修改IBP盘构建逻辑、操作接口、状态收集逻辑;修改PSL构建bug
This commit is contained in:
parent
420b18fccd
commit
0c6e9a37d8
|
@ -475,7 +475,7 @@ func ibpBtnOperation(c *gin.Context) {
|
|||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
err := memory.ChangeIBPButtonState(simulation, req.MapId, req.StationId, req.ButtonId, req.Down)
|
||||
err := memory.ChangeIBPButtonState(simulation, req.MapId, req.IbpId, req.ButtonId, req.Down)
|
||||
if err != nil {
|
||||
panic(sys_error.New(fmt.Sprintf("IBP按钮操作失败,%s", err.Error()), err))
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ func ibpKeyOperation(c *gin.Context) {
|
|||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
err := memory.ChangeIBPKeyState(simulation, req.MapId, req.StationId, req.KeyId, req.Gear)
|
||||
err := memory.ChangeIBPKeyState(simulation, req.MapId, req.IbpId, req.KeyId, req.Gear)
|
||||
if err != nil {
|
||||
panic(sys_error.New(fmt.Sprintf("IBP开关操作失败,%s", err.Error()), err))
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ func pslBtnOperation(c *gin.Context) {
|
|||
}
|
||||
simulation := checkDeviceDataAndReturn(req.SimulationId)
|
||||
slog.Info("传入状态参数", req)
|
||||
memory.ChangePSLButtonState(simulation, req.MapId, req.GateBoxId, req.ButtonCode, req.Down)
|
||||
memory.ChangePSLButtonState(simulation, req.MapId, req.PslId, req.ButtonCode, req.Down)
|
||||
c.JSON(http.StatusOK, "ok")
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 63774c3fa82b3831a06d7b2b68675677d6fd5e1e
|
||||
Subproject commit 55e58e0d1858d122d13f3d7b9e699011026b97e8
|
File diff suppressed because it is too large
Load Diff
|
@ -192,7 +192,7 @@ type EsbButtonOperationReqDto struct {
|
|||
type IBPButtonOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
StationId uint32 `form:"stationId" json:"stationId" binding:"required"`
|
||||
IbpId uint32 `form:"ibpId" json:"ibpId" binding:"required"`
|
||||
ButtonId uint32 `form:"buttonId" json:"buttonId" binding:"required"`
|
||||
Down bool `form:"down" json:"down"`
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ type IBPButtonOperationReqDto struct {
|
|||
type PslOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
GateBoxId uint32 `form:"gateBoxId" json:"gateBoxId"`
|
||||
PslId uint32 `form:"pslId" json:"pslId"`
|
||||
ButtonCode string `form:"buttonCode" json:"buttonCode" binding:"required"`
|
||||
Down bool `form:"down" json:"down"`
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ type PslOperationReqDto struct {
|
|||
type KeyOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
StationId uint32 `form:"stationId" json:"stationId" binding:"required"`
|
||||
IbpId uint32 `form:"ibpId" json:"ibpId" binding:"required"`
|
||||
KeyId uint32 `form:"keyId" json:"keyId"`
|
||||
Gear int32 `form:"gear" json:"gear"`
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package message_server
|
|||
import (
|
||||
"fmt"
|
||||
"joylink.club/bj-rtsts-server/dto/data_proto"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
"time"
|
||||
|
||||
"joylink.club/bj-rtsts-server/dto/state_proto"
|
||||
|
@ -18,39 +19,34 @@ import (
|
|||
func NewIBPMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
|
||||
mapData := memory.QueryGiData[*data_proto.RtssGraphicStorage](mapId)
|
||||
return ms_api.NewScheduleTask(fmt.Sprintf("地图[%d]综合后备盘IBP", mapId), func() error {
|
||||
for _, station := range mapData.Stations {
|
||||
sid := memory.GetMapElementId(station.Common)
|
||||
stationIbpState, err := collectStationIbpState(mapId, vs.World, station)
|
||||
for _, ibpBox := range mapData.IbpBoxs {
|
||||
ibpState, err := collectIbpState(mapId, vs.World, ibpBox)
|
||||
if err != nil {
|
||||
return err
|
||||
return sys_error.New("IBP状态发送异常", err)
|
||||
}
|
||||
mqtt.GetMsgClient().PubIBPState(vs.SimulationId, mapId, sid, stationIbpState)
|
||||
mqtt.GetMsgClient().PubIBPState(vs.SimulationId, mapId, ibpBox.Common.Id, ibpState)
|
||||
}
|
||||
return nil
|
||||
}, 200*time.Millisecond)
|
||||
}
|
||||
|
||||
func collectStationIbpState(mapId int32, world ecs.World, station *data_proto.Station) (*state_proto.PushedDevicesStatus, error) {
|
||||
if station.RefIbpMapCode == "" {
|
||||
return nil, nil
|
||||
}
|
||||
sid := memory.GetMapElementId(station.Common)
|
||||
stationUid := memory.QueryUidByMidAndComId(mapId, sid, &data_proto.Station{})
|
||||
ibpMapId, ibpStorage := memory.QueryGiDataByName[*data_proto.IBPGraphicStorage](station.RefIbpMapCode)
|
||||
func collectIbpState(mapId int32, world ecs.World, ibpBox *data_proto.IbpBox) (*state_proto.PushedDevicesStatus, error) {
|
||||
ibpBoxUid := memory.QueryUidByMidAndComId(mapId, ibpBox.Common.Id, &data_proto.IbpBox{})
|
||||
ibpMapId, ibpStorage := memory.QueryGiDataByName[*data_proto.IBPGraphicStorage](ibpBox.RefIbpMapCode)
|
||||
ibpUidsMap := memory.QueryUidStructure[*memory.IBPUidStructure](ibpMapId)
|
||||
buttonStates, err := collectIBPButtonState(world, stationUid, ibpUidsMap, ibpStorage.IbpButtons)
|
||||
buttonStates, err := collectIBPButtonState(world, ibpBoxUid, ibpUidsMap, ibpStorage.IbpButtons)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
alarmStates, err := collectIBPAlarmState(world, stationUid, ibpUidsMap, ibpStorage.IbpAlarms)
|
||||
alarmStates, err := collectIBPAlarmState(world, ibpBoxUid, ibpUidsMap, ibpStorage.IbpAlarms)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lightStates, err := collectIBPLightState(world, stationUid, ibpUidsMap, ibpStorage.IbpLights)
|
||||
lightStates, err := collectIBPLightState(world, ibpBoxUid, ibpUidsMap, ibpStorage.IbpLights)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
keyStates, err := collectIBPKeyState(world, stationUid, ibpUidsMap, ibpStorage.IbpKeys)
|
||||
keyStates, err := collectIBPKeyState(world, ibpBoxUid, ibpUidsMap, ibpStorage.IbpKeys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -66,11 +62,11 @@ func collectStationIbpState(mapId int32, world ecs.World, station *data_proto.St
|
|||
}
|
||||
|
||||
// 收集IBP按钮状态
|
||||
func collectIBPButtonState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpButtons []*data_proto.IBPButton) ([]*state_proto.ButtonState, error) {
|
||||
func collectIBPButtonState(world ecs.World, ibpBoxUid string, uidsMap *memory.IBPUidStructure, ibpButtons []*data_proto.IBPButton) ([]*state_proto.ButtonState, error) {
|
||||
var states []*state_proto.ButtonState
|
||||
for _, data := range ibpButtons { // 按钮
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpButtonIds[did].Uid
|
||||
uid := ibpBoxUid + "_" + uidsMap.IbpButtonIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(world, uid)
|
||||
if !ok {
|
||||
continue
|
||||
|
@ -97,11 +93,11 @@ func getIBPButtonState(id uint32, entry *ecs.Entry) *state_proto.ButtonState {
|
|||
}
|
||||
|
||||
// 收集报警器状态
|
||||
func collectIBPAlarmState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpAlarms []*data_proto.IbpAlarm) ([]*state_proto.AlarmState, error) {
|
||||
func collectIBPAlarmState(world ecs.World, ibpBoxUid string, uidsMap *memory.IBPUidStructure, ibpAlarms []*data_proto.IbpAlarm) ([]*state_proto.AlarmState, error) {
|
||||
var states []*state_proto.AlarmState
|
||||
for _, data := range ibpAlarms { // 报警器
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpAlarmIds[did].Uid
|
||||
uid := ibpBoxUid + "_" + uidsMap.IbpAlarmIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(world, uid)
|
||||
if !ok {
|
||||
continue
|
||||
|
@ -114,11 +110,11 @@ func collectIBPAlarmState(world ecs.World, stationUid string, uidsMap *memory.IB
|
|||
}
|
||||
|
||||
// 收集灯状态信息
|
||||
func collectIBPLightState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpLights []*data_proto.IbpLight) ([]*state_proto.LightState, error) {
|
||||
func collectIBPLightState(world ecs.World, ibpBoxUid string, uidsMap *memory.IBPUidStructure, ibpLights []*data_proto.IbpLight) ([]*state_proto.LightState, error) {
|
||||
var states []*state_proto.LightState
|
||||
for _, data := range ibpLights { // 指示灯
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpLightIds[did].Uid
|
||||
uid := ibpBoxUid + "_" + uidsMap.IbpLightIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(world, uid)
|
||||
if !ok {
|
||||
continue
|
||||
|
@ -131,11 +127,11 @@ func collectIBPLightState(world ecs.World, stationUid string, uidsMap *memory.IB
|
|||
}
|
||||
|
||||
// 收集钥匙状态
|
||||
func collectIBPKeyState(world ecs.World, stationUid string, uidsMap *memory.IBPUidStructure, ibpKeys []*data_proto.IbpKey) ([]*state_proto.KeyState, error) {
|
||||
func collectIBPKeyState(world ecs.World, ibpBoxUid string, uidsMap *memory.IBPUidStructure, ibpKeys []*data_proto.IbpKey) ([]*state_proto.KeyState, error) {
|
||||
var states []*state_proto.KeyState
|
||||
for _, data := range ibpKeys { // 钥匙
|
||||
did := memory.GetMapElementId(data.Common)
|
||||
uid := stationUid + "_" + uidsMap.IbpKeyIds[did].Uid
|
||||
uid := ibpBoxUid + "_" + uidsMap.IbpKeyIds[did].Uid
|
||||
entry, ok := entity.GetEntityByUid(world, uid)
|
||||
if !ok {
|
||||
continue
|
||||
|
|
|
@ -100,8 +100,8 @@ func (c *MqttClient) PubTpapiServiceState(simulationId string, msg *state_proto.
|
|||
}
|
||||
|
||||
// 发送IBP状态数据
|
||||
func (client *MqttClient) PubIBPState(simulationId string, mapId int32, stationId uint32, msg *state_proto.PushedDevicesStatus) error {
|
||||
return client.pub(GetIbpTopic(simulationId, mapId, stationId), msg)
|
||||
func (client *MqttClient) PubIBPState(simulationId string, mapId int32, ibpId uint32, msg *state_proto.PushedDevicesStatus) error {
|
||||
return client.pub(GetIbpTopic(simulationId, mapId, ibpId), msg)
|
||||
}
|
||||
|
||||
// 发送PSL状态数据
|
||||
|
|
|
@ -13,8 +13,8 @@ const (
|
|||
tpapiServiceTopic = topicPrefix + "tpis" // 第三方API服务状态topic
|
||||
sfpTopic = topicPrefix + "sfp/%d" // 平面布置图设备状态topic 地图ID
|
||||
rccTopic = topicPrefix + "rcc/%d" // 继电器柜继电器状态topic 地图ID
|
||||
pslTopic = topicPrefix + "psl/%d/%d" // psl状态topic 地图ID/门控箱ID
|
||||
ibpTopic = topicPrefix + "ibp/%d/%d" // ibp盘状态topic 地图ID/车站ID
|
||||
pslTopic = topicPrefix + "psl/%d/%d" // psl状态topic 地图ID/PSL盘ID
|
||||
ibpTopic = topicPrefix + "ibp/%d/%d" // ibp盘状态topic 地图ID/IBP盘ID
|
||||
)
|
||||
|
||||
var topicMap = map[string]string{
|
||||
|
@ -76,6 +76,6 @@ func GetPslTopic(simulationId string, mapId int32, boxId uint32) string {
|
|||
}
|
||||
|
||||
// IBP设备状态消息topic
|
||||
func GetIbpTopic(simulationId string, mapId int32, stationId uint32) string {
|
||||
return fmt.Sprintf(ibpTopic, simulationId, mapId, stationId)
|
||||
func GetIbpTopic(simulationId string, mapId int32, ibpId uint32) string {
|
||||
return fmt.Sprintf(ibpTopic, simulationId, mapId, ibpId)
|
||||
}
|
||||
|
|
|
@ -2,58 +2,81 @@ package memory
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"joylink.club/bj-rtsts-server/sys_error"
|
||||
|
||||
"joylink.club/bj-rtsts-server/dto/data_proto"
|
||||
"joylink.club/rtsssimulation/fi"
|
||||
)
|
||||
|
||||
// 操作IBP按钮
|
||||
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId uint32, pressDown bool) error {
|
||||
uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId)
|
||||
if err != nil {
|
||||
return err
|
||||
func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, ibpId, btnId uint32, pressDown bool) error {
|
||||
storage := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
|
||||
var ibp *data_proto.IbpBox
|
||||
for _, box := range storage.IbpBoxs {
|
||||
if box.Common.Id == ibpId {
|
||||
ibp = box
|
||||
}
|
||||
}
|
||||
if uidMap.IbpButtonIds[btnId] == nil {
|
||||
return fmt.Errorf("车站【%d】按钮【%d】UID不存在", stationId, btnId)
|
||||
if ibp == nil {
|
||||
return sys_error.New(fmt.Sprintf("没有找到[id:%d]IBP元素", ibpId))
|
||||
}
|
||||
stationUid := QueryUidByMidAndComId(mapId, stationId, &data_proto.Station{})
|
||||
ibpMapId, _ := QueryGiDataByName[*data_proto.IBPGraphicStorage](ibp.RefIbpMapCode)
|
||||
ibpUidMap := QueryUidStructure[*IBPUidStructure](ibpMapId)
|
||||
if ibpUidMap == nil {
|
||||
return fmt.Errorf("没有找到IBP对应的数据")
|
||||
}
|
||||
if ibpUidMap.IbpButtonIds[btnId] == nil {
|
||||
return fmt.Errorf("ibp【%d】按钮【%d】UID不存在", ibpId, btnId)
|
||||
}
|
||||
ibpUid := QueryUidByMidAndComId(mapId, ibp.Common.Id, &data_proto.IbpBox{})
|
||||
if pressDown {
|
||||
return fi.PressDownButton(sim.World, stationUid+"_"+uidMap.IbpButtonIds[btnId].Uid)
|
||||
return fi.PressDownButton(sim.World, ibpUid+"_"+ibpUidMap.IbpButtonIds[btnId].Uid)
|
||||
} else {
|
||||
return fi.PressUpButton(sim.World, stationUid+"_"+uidMap.IbpButtonIds[btnId].Uid)
|
||||
return fi.PressUpButton(sim.World, ibpUid+"_"+ibpUidMap.IbpButtonIds[btnId].Uid)
|
||||
}
|
||||
}
|
||||
|
||||
// 操作IBP按钮
|
||||
func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, stationId, keyId uint32, gear int32) error {
|
||||
uidMap, err := getIbpUidByMapIdAndStationId(mapId, stationId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if uidMap.IbpKeyIds[keyId] == nil {
|
||||
return fmt.Errorf("车站【%d】钥匙【%d】UID不存在", stationId, keyId)
|
||||
}
|
||||
stationUid := QueryUidByMidAndComId(mapId, stationId, &data_proto.Station{})
|
||||
return fi.SwitchKeyGear(sim.World, stationUid+"_"+uidMap.IbpKeyIds[keyId].Uid, gear)
|
||||
}
|
||||
|
||||
// 根据平面布置图ID、列车ID获取IbpUid信息
|
||||
func getIbpUidByMapIdAndStationId(mapId int32, stationId uint32) (*IBPUidStructure, error) {
|
||||
giData := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
|
||||
var station *data_proto.Station
|
||||
for _, s := range giData.Stations {
|
||||
if GetMapElementId(s.Common) == stationId {
|
||||
station = s
|
||||
break
|
||||
func ChangeIBPKeyState(sim *VerifySimulation, mapId int32, ibpId, keyId uint32, gear int32) error {
|
||||
storage := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
|
||||
var ibpBox *data_proto.IbpBox
|
||||
for _, box := range storage.IbpBoxs {
|
||||
if box.Common.Id == ibpId {
|
||||
ibpBox = box
|
||||
}
|
||||
}
|
||||
if station == nil {
|
||||
return nil, fmt.Errorf("地图【%d】车站【%d】不存在", mapId, stationId)
|
||||
if ibpBox == nil {
|
||||
return sys_error.New(fmt.Sprintf("没有找到[id:%d]IBP元素", ibpId))
|
||||
}
|
||||
|
||||
if station.RefIbpMapCode == "" {
|
||||
return nil, fmt.Errorf("车站【%s】未关联IBP地图", station.StationName)
|
||||
ibpMapId, _ := QueryGiDataByName[*data_proto.IBPGraphicStorage](ibpBox.RefIbpMapCode)
|
||||
ibpUidMap := QueryUidStructure[*IBPUidStructure](ibpMapId)
|
||||
if ibpUidMap == nil {
|
||||
return fmt.Errorf("没有找到IBP对应的数据")
|
||||
}
|
||||
ibpMapId, _ := QueryGiDataByName[*data_proto.IBPGraphicStorage](station.RefIbpMapCode)
|
||||
return QueryUidStructure[*IBPUidStructure](ibpMapId), nil
|
||||
if ibpUidMap.IbpKeyIds[keyId] == nil {
|
||||
return fmt.Errorf("车站【%d】钥匙【%d】UID不存在", ibpId, keyId)
|
||||
}
|
||||
ibpUid := QueryUidByMidAndComId(mapId, ibpBox.Common.Id, &data_proto.IbpBox{})
|
||||
return fi.SwitchKeyGear(sim.World, ibpUid+"_"+ibpUidMap.IbpKeyIds[keyId].Uid, gear)
|
||||
}
|
||||
|
||||
//// 根据平面布置图ID、列车ID获取IbpUid信息
|
||||
//func getIbpUidByMapIdAndIbpId(mapId int32, ibpId uint32) (*IBPUidStructure, error) {
|
||||
// giData := QueryGiData[*data_proto.RtssGraphicStorage](mapId)
|
||||
// var station *data_proto.Station
|
||||
// for _, s := range giData.Stations {
|
||||
// if GetMapElementId(s.Common) == ibpId {
|
||||
// station = s
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// if station == nil {
|
||||
// return nil, fmt.Errorf("地图【%d】车站【%d】不存在", mapId, ibpId)
|
||||
// }
|
||||
//
|
||||
// if station.RefIbpMapCode == "" {
|
||||
// return nil, fmt.Errorf("车站【%s】未关联IBP地图", station.StationName)
|
||||
// }
|
||||
// ibpMapId, _ := QueryGiDataByName[*data_proto.IBPGraphicStorage](station.RefIbpMapCode)
|
||||
// return QueryUidStructure[*IBPUidStructure](ibpMapId), nil
|
||||
//}
|
||||
|
|
|
@ -615,6 +615,10 @@ func getUidMapByType(uidData any, m interface{}) map[uint32]*elementIdStructure
|
|||
return (uidData.(*StationUidStructure)).SpksSwitchIds
|
||||
case *data_proto.ScreenDoor:
|
||||
return (uidData.(*StationUidStructure)).PsdIds
|
||||
case *data_proto.PslBox:
|
||||
return (uidData.(*StationUidStructure)).PslIds
|
||||
case *data_proto.IbpBox:
|
||||
return (uidData.(*StationUidStructure)).IbpIds
|
||||
default:
|
||||
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
|
||||
}
|
||||
|
|
|
@ -1284,20 +1284,21 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic
|
|||
mkx.QkqrplaId = repoButton.Id
|
||||
case "MPL":
|
||||
mkx.MplaId = repoButton.Id
|
||||
case "JXTCPL":
|
||||
case "JXTCPLA":
|
||||
mkx.JxtcplaId = repoButton.Id
|
||||
}
|
||||
}
|
||||
}
|
||||
//IBP
|
||||
for _, data := range storage.IbpBoxs {
|
||||
boxUidInfo := uidsMap.IbpIds[data.Common.Id]
|
||||
station := repoStationMap[data.RefStationId]
|
||||
handlerIBPDeviceToStation(station, repo, data.RefIbpMapCode)
|
||||
handlerIBPDeviceToStation(station, boxUidInfo.Uid, repo, data.RefIbpMapCode)
|
||||
}
|
||||
}
|
||||
|
||||
// 将IBP的设备关联到车站中
|
||||
func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, ibpMapCode string) {
|
||||
func handlerIBPDeviceToStation(station *proto.Station, ibpBoxUid string, repo *proto.Repository, ibpMapCode string) {
|
||||
mapId, storage := QueryGiDataByName[*data_proto.IBPGraphicStorage](ibpMapCode)
|
||||
if storage == nil {
|
||||
return
|
||||
|
@ -1307,7 +1308,7 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
|
|||
for _, data := range storage.IbpButtons { // 处理按钮
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Button{
|
||||
Id: station.Id + "_" + uidMap.IbpButtonIds[id].Uid,
|
||||
Id: ibpBoxUid + "_" + uidMap.IbpButtonIds[id].Uid,
|
||||
Code: data.Code,
|
||||
ButtonType: proto.Button_NO_Reset_Press,
|
||||
HasLight: data.HasLight,
|
||||
|
@ -1324,7 +1325,7 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
|
|||
for _, data := range storage.IbpKeys { // 钥匙
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Key{
|
||||
Id: station.Id + "_" + uidMap.IbpKeyIds[id].Uid,
|
||||
Id: ibpBoxUid + "_" + uidMap.IbpKeyIds[id].Uid,
|
||||
Code: data.Code,
|
||||
Gear: 2,
|
||||
}
|
||||
|
@ -1337,7 +1338,7 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
|
|||
for _, data := range storage.IbpAlarms { // 报警器
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Alarm{
|
||||
Id: station.Id + "_" + uidMap.IbpAlarmIds[id].Uid,
|
||||
Id: ibpBoxUid + "_" + uidMap.IbpAlarmIds[id].Uid,
|
||||
Code: data.Code,
|
||||
}
|
||||
deviceMap[id] = &proto.ElectronicComponent{
|
||||
|
@ -1349,7 +1350,7 @@ func handlerIBPDeviceToStation(station *proto.Station, repo *proto.Repository, i
|
|||
for _, data := range storage.IbpLights { // 指示灯,
|
||||
id := GetMapElementId(data.Common)
|
||||
b := &proto.Light{
|
||||
Id: station.Id + "_" + uidMap.IbpLightIds[id].Uid,
|
||||
Id: ibpBoxUid + "_" + uidMap.IbpLightIds[id].Uid,
|
||||
Code: data.Code,
|
||||
}
|
||||
deviceMap[id] = &proto.ElectronicComponent{
|
||||
|
|
Loading…
Reference in New Issue