This commit is contained in:
walker 2023-11-03 17:27:43 +08:00
commit 82dc5a6dcb
13 changed files with 866 additions and 311 deletions

@ -1 +1 @@
Subproject commit 92c5696b7eb3b47b387f48e094f5c8644ddb7da8
Subproject commit 280219a91abaa9c58fd9979ad7340fe5d85caad1

View File

@ -236,43 +236,55 @@ func (Section_Operation) EnumDescriptor() ([]byte, []int) {
type Psd_Operation int32
const (
Psd_Undefined Psd_Operation = 0
Psd_Km4 Psd_Operation = 1 //四编组开门
Psd_CancelKm4 Psd_Operation = 2 //取消四编组开门
Psd_Km8 Psd_Operation = 3 //八编组开门
Psd_CancelKm8 Psd_Operation = 4 //取消八编组开门
Psd_Gm Psd_Operation = 5 //关门
Psd_CancelGm Psd_Operation = 6 //取消关门
Psd_ForceKm4 Psd_Operation = 7 //强制四编组开门
Psd_ForceKm8 Psd_Operation = 8 //强制八编组开门
Psd_ForceGm Psd_Operation = 9 //强制关门
Psd_Undefined Psd_Operation = 0
Psd_Km4 Psd_Operation = 1 //四编组开门
Psd_CancelKm4 Psd_Operation = 2 //取消四编组开门
Psd_Km8 Psd_Operation = 3 //八编组开门
Psd_CancelKm8 Psd_Operation = 4 //取消八编组开门
Psd_Gm Psd_Operation = 5 //关门
Psd_CancelGm Psd_Operation = 6 //取消关门
Psd_ForceKm4 Psd_Operation = 7 //强制四编组开门
Psd_ForceKm8 Psd_Operation = 8 //强制八编组开门
Psd_ForceGm Psd_Operation = 9 //强制关门
Psd_AsdCannotOpen Psd_Operation = 10 //滑动门无法开门
Psd_CancelAsdCannotOpen Psd_Operation = 11 //取消滑动门无法开门
Psd_AsdCannotClose Psd_Operation = 12 //滑动门无法关闭
Psd_CancelAsdCannotClose Psd_Operation = 13 //取消滑动门无法关闭
)
// Enum value maps for Psd_Operation.
var (
Psd_Operation_name = map[int32]string{
0: "Undefined",
1: "Km4",
2: "CancelKm4",
3: "Km8",
4: "CancelKm8",
5: "Gm",
6: "CancelGm",
7: "ForceKm4",
8: "ForceKm8",
9: "ForceGm",
0: "Undefined",
1: "Km4",
2: "CancelKm4",
3: "Km8",
4: "CancelKm8",
5: "Gm",
6: "CancelGm",
7: "ForceKm4",
8: "ForceKm8",
9: "ForceGm",
10: "AsdCannotOpen",
11: "CancelAsdCannotOpen",
12: "AsdCannotClose",
13: "CancelAsdCannotClose",
}
Psd_Operation_value = map[string]int32{
"Undefined": 0,
"Km4": 1,
"CancelKm4": 2,
"Km8": 3,
"CancelKm8": 4,
"Gm": 5,
"CancelGm": 6,
"ForceKm4": 7,
"ForceKm8": 8,
"ForceGm": 9,
"Undefined": 0,
"Km4": 1,
"CancelKm4": 2,
"Km8": 3,
"CancelKm8": 4,
"Gm": 5,
"CancelGm": 6,
"ForceKm4": 7,
"ForceKm8": 8,
"ForceGm": 9,
"AsdCannotOpen": 10,
"CancelAsdCannotOpen": 11,
"AsdCannotClose": 12,
"CancelAsdCannotClose": 13,
}
)
@ -541,6 +553,7 @@ type PsdOperationReq struct {
MapId int32 `protobuf:"varint,2,opt,name=mapId,proto3" json:"mapId,omitempty"` // 图id
DeviceId string `protobuf:"bytes,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` // 设备id
Operation Psd_Operation `protobuf:"varint,4,opt,name=operation,proto3,enum=request.Psd_Operation" json:"operation,omitempty"` // 操作
AsdCodes []int32 `protobuf:"varint,5,rep,packed,name=asdCodes,proto3" json:"asdCodes,omitempty"` //无法关闭/无法开启故障涉及的滑动门的编号
}
func (x *PsdOperationReq) Reset() {
@ -603,6 +616,13 @@ func (x *PsdOperationReq) GetOperation() Psd_Operation {
return Psd_Undefined
}
func (x *PsdOperationReq) GetAsdCodes() []int32 {
if x != nil {
return x.AsdCodes
}
return nil
}
var File_request_proto protoreflect.FileDescriptor
var file_request_proto_rawDesc = []byte{
@ -652,7 +672,7 @@ var file_request_proto_rawDesc = []byte{
0x0b, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x64, 0x72, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0f,
0x0a, 0x0b, 0x53, 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63, 0x63, 0x10, 0x04, 0x12,
0x12, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63,
0x63, 0x10, 0x05, 0x22, 0x91, 0x01, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0x89, 0x01, 0x0a, 0x09,
0x63, 0x10, 0x05, 0x22, 0xeb, 0x01, 0x0a, 0x03, 0x50, 0x73, 0x64, 0x22, 0xe3, 0x01, 0x0a, 0x09,
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64,
0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4b, 0x6d, 0x34, 0x10,
0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4b, 0x6d, 0x34, 0x10, 0x02,
@ -661,19 +681,26 @@ var file_request_proto_rawDesc = []byte{
0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x47, 0x6d, 0x10, 0x06, 0x12, 0x0c,
0x0a, 0x08, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x4b, 0x6d, 0x34, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08,
0x46, 0x6f, 0x72, 0x63, 0x65, 0x4b, 0x6d, 0x38, 0x10, 0x08, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x6f,
0x72, 0x63, 0x65, 0x47, 0x6d, 0x10, 0x09, 0x22, 0x9d, 0x01, 0x0a, 0x0f, 0x50, 0x73, 0x64, 0x4f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73,
0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12,
0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49,
0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50,
0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70,
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f,
0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x63, 0x65, 0x47, 0x6d, 0x10, 0x09, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x73, 0x64, 0x43, 0x61,
0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x0a, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61,
0x6e, 0x63, 0x65, 0x6c, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x4f, 0x70, 0x65,
0x6e, 0x10, 0x0b, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74,
0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x0c, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x61, 0x6e, 0x63, 0x65,
0x6c, 0x41, 0x73, 0x64, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10,
0x0d, 0x22, 0xb9, 0x01, 0x0a, 0x0f, 0x50, 0x73, 0x64, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d,
0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70,
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12,
0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16,
0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x73, 0x64, 0x2e, 0x4f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20,
0x03, 0x28, 0x05, 0x52, 0x08, 0x61, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x15, 0x5a,
0x13, 0x2e, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -2,6 +2,7 @@ package message_server
import (
"fmt"
"strconv"
"time"
"google.golang.org/protobuf/proto"
@ -65,6 +66,10 @@ func (ms *SfpMs) OnTick() ([]*ms_api.TopicMsg, error) {
if err != nil {
return nil, err
}
spksStates, err := ms.collectSpksStates()
if err != nil {
return nil, err
}
ststes := &state.PushedDevicesStatus{
All: true,
AllStatus: &state.AllDevicesStatus{
@ -74,6 +79,7 @@ func (ms *SfpMs) OnTick() ([]*ms_api.TopicMsg, error) {
ButtonState: buttonStates,
PsdState: psdStates,
SectionState: sectionStates,
SpksState: spksStates,
},
}
b, err := proto.Marshal(ststes)
@ -97,16 +103,21 @@ func (ms *SfpMs) collectPsdStates() ([]*state.PsdState, error) {
uid := uidStructure.PsdIds[door.Common.Id].Uid
psdEntry, ok := entity.GetEntityByUid(world, uid)
if ok {
var openSubDoor []int32
for i, asd := range component.AsdListType.Get(psdEntry).List {
if !component.AsdMotorStateType.Get(asd).MG {
openSubDoor = append(openSubDoor, int32(i+1))
list := component.AsdListType.Get(psdEntry).List
asdStates := make([]*state.AsdState, len(list), len(list))
for i, asdEntry := range list {
asdState := component.AsdStateType.Get(asdEntry)
asdStates[i] = &state.AsdState{
Code: strconv.Itoa(i + 1),
Kmdw: asdState.Kmdw,
Gmdw: asdState.Gmdw,
Mgj: asdState.Mgj,
}
}
psdStateArr = append(psdStateArr, &state.PsdState{
Id: door.Common.Id,
Close: component.PsdStateType.Get(psdEntry).Close,
OpenAsdCodes: openSubDoor,
Id: door.Common.Id,
AsdStates: asdStates,
Mgj: component.PsdStateType.Get(psdEntry).Close,
})
}
}
@ -295,3 +306,72 @@ func (ms *SfpMs) collectTurnoutStates() ([]*state.SwitchState, error) {
}
return switchArr, nil
}
// 人员防护开关状态
func (ms *SfpMs) collectSpksStates() ([]*state.SpksState, error) {
uidsMap := memory.QueryUidStructure[*memory.StationUidStructure](ms.mapId)
var states []*state.SpksState
for _, stationUid := range uidsMap.StationIds {
entry, ok := entity.GetEntityByUid(ms.vs.World, stationUid.Uid)
if !ok {
return nil, fmt.Errorf("车站实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), stationUid.Uid)
}
if entry.HasComponent(component.SpkElectronicType) {
spkElectronic := component.SpkElectronicType.Get(entry)
// 下行
xplj := getRelayXqVal(spkElectronic.SPKSXPLAJ)
xplb := getIbpBtnVal(spkElectronic.SPKSXPLA_BTN)
states = append(states, createSpksState(spkElectronic.SPKSX1J_KEY, spkElectronic.SPKSX1J, spkElectronic.SPKSX1D, xplb, xplj, ms.vs))
states = append(states, createSpksState(spkElectronic.SPKSX3J_KEY, spkElectronic.SPKSX3J, spkElectronic.SPKSX3D, xplb, xplj, ms.vs))
// 上行
splj := getRelayXqVal(spkElectronic.SPKSSPLAJ)
splb := getIbpBtnVal(spkElectronic.SPKSSPLA_BTN)
states = append(states, createSpksState(spkElectronic.SPKSS2J_KEY, spkElectronic.SPKSS2J, spkElectronic.SPKSS2D, splb, splj, ms.vs))
states = append(states, createSpksState(spkElectronic.SPKSS4J_KEY, spkElectronic.SPKSS4J, spkElectronic.SPKSS4D, splb, splj, ms.vs))
}
}
return states, nil
}
// 创建实体
func createSpksState(k, j, d *ecs.Entry, pl, pj bool, s *memory.VerifySimulation) *state.SpksState {
uid := getEntryId(k)
return &state.SpksState{
Id: s.GetComIdByUid(uid),
Open: getIbpKeyVal(k),
Xh: getRelayXqVal(j),
Light: getLightTdVal(d),
Pl: pl,
Pljxh: pj,
}
}
// 获取实体ID
func getEntryId(entry *ecs.Entry) string {
id := component.UidType.Get(entry)
return id.Id
}
// 获取按钮状态
func getIbpBtnVal(entry *ecs.Entry) bool {
btn := component.BitStateType.Get(entry)
return btn.Val
}
// 获取按钮状态
func getIbpKeyVal(entry *ecs.Entry) bool {
btn := component.GearStateType.Get(entry)
return btn.Val == 1
}
// 获取继电器吸起状态
func getRelayXqVal(entry *ecs.Entry) bool {
relay := component.BitStateType.Get(entry)
return relay.Val
}
// 设置信号灯通电
func getLightTdVal(entry *ecs.Entry) bool {
light := component.BitStateType.Get(entry)
return light.Val
}

@ -1 +1 @@
Subproject commit d77c37055ba841091f417b1c36fd8d3f6beb15c5
Subproject commit d080a2a1fc3224f1a9c1696d57dad95635523956

View File

@ -1,23 +1,23 @@
package axle_device
// AxleDeviceConfig CI系统与计轴设备的安全通信协议配置参数
// RsspConfig CI系统与计轴设备的安全通信协议配置参数
// 计轴设备(管理一个集中站的所有计轴器)配置
type AxleDeviceConfig struct {
SrcAddr uint16 //16位源地址
DstAddr uint16 //16位目的地址
DataVer1 uint32 //通道1数据版本
DataVer2 uint32 //通道2数据版本
SID1 uint32 //通道1源标识
SID2 uint32 //通道2源标识
SINIT1 uint32 //通道1序列初始
SINIT2 uint32 //通道2序列初始
SendingPeriod uint32 //接收方每个安全通信会话对应的发送周期值,单位ms
SSRTimeout uint32 //等待SSR回应的定时器超时值,单位ms
Mtv uint32 //每个安全通信会话可容忍的最大时序偏差
Udl uint32 //每个安全通信会话RSD应用数据长度发送和接收的配置值支持固定长度和可变长度;0-可变长度大于0即固定长度
type RsspConfig struct {
SrcAddr uint16 //16位源地址,本地地址
DstAddr uint16 //16位目的地址,远程地址
DataVer1 uint32 //通道1数据版本
DataVer2 uint32 //通道2数据版本
SID1 uint32 //通道1源标识
SID2 uint32 //通道2源标识
SINIT1 uint32 //通道1序列初始
SINIT2 uint32 //通道2序列初始
SendingPeriod uint32 //接收方每个安全通信会话对应的发送周期值,单位ms
SsrRsspTimeout uint32 //等待SSR回应的定时器超时值,为RsspTimer时间,1=SendingPeriod
Mtv uint32 //每个安全通信会话可容忍的最大时序偏差,即当前接收的RSD的序列号与上一次RSD的序列号最大允许差值
Udl uint32 //每个安全通信会话RSD应用数据长度发送和接收的配置值支持固定长度和可变长度;0-可变长度大于0即固定长度
}
// CheckAddress 检测目标源地址目的地址是否在配置中
func (c *AxleDeviceConfig) CheckAddress(srcAddr uint16, dstAddr uint16) bool {
func (c *RsspConfig) CheckAddress(srcAddr uint16, dstAddr uint16) bool {
return true
}

View File

@ -1,41 +1,256 @@
package axle_device
import "joylink.club/bj-rtsts-server/third_party/message"
import (
"joylink.club/bj-rtsts-server/third_party/message"
"log/slog"
)
// 实现rssp通信流程
type RsspServer struct {
// RsspChannel 实现rssp通信
type RsspChannel struct {
//rssp安全通信配置
config *RsspConfig
//rssp时钟
rsspTimer *RsspTimer
//批次编号,发送序列号
sn *message.RsspSn
//安全通道1时间戳
ch1Ts *message.RsspLFSR
//安全通道2时间戳
ch2Ts *message.RsspLFSR
//协议交互类别
picType message.PicType
//true-A机false-B机
deviceA bool
//最近一次接收到的报文的安全通道1时间戳
rcvCh1Ts uint32
//最近一次接收到的报文的安全通道2时间戳
rcvCh2Ts uint32
//最近一次接收到的报文的序列号
rcvSn uint32
//时序校验请求发送记录
sendSseRecord *SseFireRecord
}
// HandleRsspMsg 处理接收到的rssp报文
func (s *RsspServer) HandleRsspMsg(pack []byte, config *AxleDeviceConfig) {
// RsspTimer rssp时钟每一个tick周期为config.SendingPeriod
type RsspTimer struct {
t uint64
}
func (s *RsspTimer) tick() {
s.t++
}
func (s *RsspTimer) now() uint64 {
return s.t
}
// SseFireRecord 发送时序校验请求的记录
type SseFireRecord struct {
send *message.RsspSse //已经发送的时序校验请求
rsspTime uint64 //发送时序校验请求时的rssp时间
}
func (s *SseFireRecord) record(send *message.RsspSse, rsspTime uint64) {
s.send = send
s.rsspTime = rsspTime
}
func (s *SseFireRecord) clear() {
s.send = nil
s.rsspTime = 0
}
func (s *SseFireRecord) hasRecord() bool {
return s.send != nil
}
// 处理接收到的rssp报文
func (s *RsspChannel) handleRsspMsg(pack []byte) {
//报文头校验
head := &message.RsspHead{}
if !head.Parse(pack) { //解析报文头失败
slog.Debug("丢弃接收的RSSP报文解析报文头失败")
return
}
if !message.RsspHeadMcCheck(head) { //报文类别检测未通过
slog.Debug("丢弃接收的RSSP报文报文类别检测未通过")
return
}
if !message.RsspHeadPicCheck(head) { //协议交互类别检测未通过
slog.Debug("丢弃接收的RSSP报文协议交互类别检测未通过")
return
}
if !config.CheckAddress(head.Sa, head.Da) { //校验报文头中源地址和目的地址是否包含在已配置列表中
if !s.config.CheckAddress(head.Sa, head.Da) { //校验报文头中源地址和目的地址是否包含在已配置列表中
slog.Debug("丢弃接收的RSSP报文报文头中源地址或目的地址不在在已配置列表中")
return
}
//报文尾校验
if !message.RsspPackCrc16Check(pack) { //整个报文crc16校验未通过
slog.Debug("丢弃接收的RSSP报文报文尾CRC16校验未通过")
return
}
//解析得到RSD、SSE或SRE
rssp := message.ParseRsspPack(head, pack)
if rssp == nil { //解析具体rssp包失败
slog.Debug("丢弃接收的RSSP报文解析具体类别包失败")
return
}
//处理接收到的具体类别RSSP包
switch rssp.Type() {
case message.RSD_A:
fallthrough
case message.RSD_B:
s.handleRsspRsd(rssp.(*message.RsspRsd))
case message.SSE:
s.handleRsspSse(rssp.(*message.RsspSse))
case message.SSR:
s.handleRsspSsr(rssp.(*message.RsspSsr))
}
}
// 处理接收到的实时安全数据
func (s *RsspChannel) handleRsspRsd(rsd *message.RsspRsd) {
if rsd.Pic != message.PIC_MASTER {
slog.Debug("丢弃接收的RSSP-RSD报文来自备系")
return
}
//序列号校验
//接收的序列号小于最近一次有效序列号则触发SSE时序校验
if rsd.Sn < s.rcvSn {
slog.Debug("丢弃接收的RSSP-RSD报文当前接收RSD的序列号小于最近一次接收的RSD的序列号触发SSE")
s.fireSse(rsd)
return
}
dSn := rsd.Sn - s.rcvSn
if dSn > s.config.Mtv {
slog.Debug("丢弃接收的RSSP-RSD报文当前接收RSD的序列号与最近一次接收的RSD的序列号差值过大触发SSE")
s.fireSse(rsd)
return
}
//SVC校验
c1Crc32 := message.RsspC1Crc32(rsd.Sad)
c1SidTs := c1Crc32 ^ rsd.Svc1 ^ message.SCW_C1
//
c2Crc32 := message.RsspC2Crc32(rsd.Sad)
c2SidTs := c2Crc32 ^ rsd.Svc2 ^ message.SCW_C2
//todo ... SVC校验待完善
_ = c1SidTs
_ = c2SidTs
//校验通过
//记录本次接收RSD的序列号和安全校验通道时间戳
s.rcvSn = rsd.Sn
s.rcvCh1Ts = c1SidTs ^ s.config.SID1
s.rcvCh2Ts = c2SidTs ^ s.config.SID2
//通知应用层接收应用数据
s.rcvUserData(rsd.Sad)
}
// 从安全通道成功接收到应用层数据
func (s *RsspChannel) rcvUserData(userData []byte) {
}
// 触发时序校正请求
func (s *RsspChannel) fireSse(rsd *message.RsspRsd) {
s.sendSse()
}
// 接收到时序校正请求
func (s *RsspChannel) handleRsspSse(rsd *message.RsspSse) {
}
// 接收到时序校正应答
func (s *RsspChannel) handleRsspSsr(ssr *message.RsspSsr) {
//SSR校验
if !s.sendSseRecord.hasRecord() {
slog.Debug("丢弃接收的RSSP-SSR报文未发起过SSE时序校正请求")
return
}
if s.rsspTimer.t-s.sendSseRecord.rsspTime > uint64(s.config.SsrRsspTimeout) {
slog.Debug("丢弃接收的RSSP-SSR报文等待SSE响应超时")
return
}
if ssr.SeSn != s.sendSseRecord.send.Sn {
slog.Debug("丢弃接收的RSSP-SSR报文SSR与SSE不对应")
return
}
//恢复时序
//todo
}
// 将序列号和时间戳更新到下一个值
func (s *RsspChannel) freshSnTs() {
s.sn.GetAndAdd()
s.ch1Ts.GetAndMove()
s.ch2Ts.GetAndMove()
}
// 发送时序校正应答
func (s *RsspChannel) sendSsr(sse *message.RsspSse) {
ssr := &message.RsspSsr{}
//
ssr.Pic = message.PIC_MASTER
ssr.Mc = message.SSR
ssr.Sa = s.config.SrcAddr
ssr.Da = s.config.DstAddr
ssr.SrSn = s.sn.Get() //当前序列号
ssr.SeSn = sse.Sn
ssr.Tic1 = sse.SeqEnq1 ^ s.config.SID1 ^ s.ch1Ts.Get() ^ s.config.DataVer1
ssr.Tic2 = sse.SeqEnq2 ^ s.config.SID2 ^ s.ch2Ts.Get() ^ s.config.DataVer2
ssr.Dvn = 0x01 //预留固定值
//
rsspPack := ssr.Encode()
s.sendPack(rsspPack)
}
// 发送时序校正请求
func (s *RsspChannel) sendSse() {
sse := &message.RsspSse{}
//
sse.Pic = message.PIC_MASTER
sse.Mc = message.SSE
sse.Sa = s.config.SrcAddr
sse.Da = s.config.DstAddr
//时序校正请求,把最近一次接收到的报文中的序列号时间戳发送给发送方
sse.Sn = s.rcvSn
sse.SeqEnq1 = s.createSeqNeq(s.config.SID1, s.rcvCh1Ts)
sse.SeqEnq2 = s.createSeqNeq(s.config.SID2, s.rcvCh2Ts)
//
rsspPack := sse.Encode()
s.sendPack(rsspPack)
}
// 发送用户数据即通过rssp安全通道发送应用层数据通过rssp的RSD报文发送
func (s *RsspChannel) sendUserData(userData []byte) {
rsd := &message.RsspRsd{}
rsd.Pic = s.picType
if s.deviceA {
rsd.Mc = message.RSD_A
} else {
rsd.Mc = message.RSD_B
}
rsd.Sa = s.config.SrcAddr
rsd.Da = s.config.DstAddr
//
rsd.Sn = s.sn.Get()
rsd.Sdl = uint16(len(userData) + 8)
//安全校验通道SVC_1
crc_c1 := message.RsspC1Crc32(userData)
rsd.Svc1 = s.createSvcCode(crc_c1, s.config.SID1, s.ch1Ts.Get(), message.SCW_C1)
//安全校验通道SVC_2
crc_c2 := message.RsspC2Crc32(userData)
rsd.Svc1 = s.createSvcCode(crc_c2, s.config.SID2, s.ch2Ts.Get(), message.SCW_C2)
rsd.Sad = userData
//
rsspPack := rsd.Encode()
s.sendPack(rsspPack)
}
func (s *RsspChannel) createSvcCode(crc32 uint32, sid uint32, ts uint32, scw uint32) uint32 {
return crc32 ^ sid ^ ts ^ scw
}
func (s *RsspChannel) createSeqNeq(sid uint32, ts uint32) uint32 {
return sid ^ ts
}
// 通过网络发送数据
func (s *RsspChannel) sendPack(rsspPack []byte) {
}

View File

@ -86,15 +86,6 @@ type RsspRsd struct {
Crc16 uint16
}
const (
CRC32_G_C1 = (uint64(0x01) << 32) | uint64(0x100d4e63) //crc32生成多项式
CRC32_G_C2 = (uint64(0x01) << 32) | uint64(0x8ce56011) //crc32生成多项式
SCW_C1 = uint32(0xae390b5a) //SCW常
SCW_C2 = uint32(0xc103589c) //SCW常
SJC_C1 = uint32(0x0fc22f87) //时间戳生成多项式
SJC_C2 = uint32(0xc3e887e1) //时间戳生成多项式
)
func (r *RsspRsd) Encode() []byte {
data := make([]byte, 0, 6+14+len(r.Sad)+2)
//报文头

View File

@ -16,6 +16,10 @@ const ( //时间戳生成多项式
RsspTsC1 uint32 = 0x0fc22f87
RsspTsC2 uint32 = 0xc3e887e1
)
const (
SCW_C1 = uint32(0xae390b5a) //SCW常
SCW_C2 = uint32(0xc103589c) //SCW常
)
// InitRsspCrcTable 初始化RSSP协议中需要的CRC表
func InitRsspCrcTable() {
@ -198,31 +202,50 @@ func Crc(data []byte,
return (register1 ^ final_xor_value) & significant_mask
}
////////////////////////////////////////////////////////
//////////////////////////LFSR//////////////////////////////
// 线性反馈移位寄存器
type RsspLFSR struct {
polynomial uint32 //生成多项式
width int //寄存器宽度
register uint32 //寄存器
initValue uint32 //初始值
rightShift bool //true-右移false-左移
}
func NewRsspLFSR(polynomial uint32, width int, init_value uint32) *RsspLFSR {
func NewRsspLFSR(polynomial uint32, width int, init_value uint32, rightShift bool) *RsspLFSR {
var wd_msb_mask uint32 = 1 << (width - 1)
var wd_mask uint32 = 0xffffffff >> (32 - width)
init_value &= wd_mask
polynomial &= wd_mask
polynomial = (polynomial >> 1) | wd_msb_mask
//
return &RsspLFSR{polynomial: polynomial, width: width, register: init_value}
return &RsspLFSR{polynomial: polynomial, width: width, register: init_value, initValue: init_value, rightShift: rightShift}
}
func (r *RsspLFSR) move() {
r.move0(r.rightShift)
}
func (r *RsspLFSR) MoveRight() *RsspLFSR {
r.move0(true)
return r
}
func (r *RsspLFSR) MoveLeft() *RsspLFSR {
r.move0(false)
return r
}
func (r *RsspLFSR) move0(rightShift bool) {
var significant_mask uint32 = 0xffffffff >> (32 - r.width)
//
r.register &= significant_mask
cb := r.register & r.polynomial & significant_mask
out := bitXor(cb, r.width)
r.register >>= 1
r.register = r.register | (out << (r.width - 1))
if rightShift {
r.register >>= 1
r.register = r.register | (out << (r.width - 1))
} else {
r.register <<= 1
r.register = r.register | out
}
r.register &= significant_mask
}
@ -231,6 +254,12 @@ func (r *RsspLFSR) GetAndMove() uint32 {
r.move()
return rt
}
func (r *RsspLFSR) Get() uint32 {
return r.register
}
func (r *RsspLFSR) Reset() {
r.register = r.initValue
}
// return 0 或 1
func bitXor(data uint32, width int) uint32 {
@ -241,3 +270,27 @@ func bitXor(data uint32, width int) uint32 {
}
return v & lsb_mask
}
// ///////////////////////////////////////////////////////
const RsspSnMax = uint32(4294967295)
type RsspSn struct {
sn uint32 //顺序序列号最大值4294967295
initValue uint32
}
func NewRsspSn(initValue uint32) *RsspSn {
return &RsspSn{sn: initValue, initValue: initValue}
}
func (s *RsspSn) GetAndAdd() uint32 {
if s.sn < RsspSnMax {
s.sn++
return s.sn
} else {
s.sn = s.initValue
return s.sn
}
}
func (s *RsspSn) Get() uint32 {
return s.sn
}

View File

@ -198,7 +198,7 @@ func (x SimulationStatus_SimulationState) Number() protoreflect.EnumNumber {
// Deprecated: Use SimulationStatus_SimulationState.Descriptor instead.
func (SimulationStatus_SimulationState) EnumDescriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{19, 0}
return file_device_state_proto_rawDescGZIP(), []int{21, 0}
}
// 相邻端点定义的link的状态
@ -1643,9 +1643,9 @@ type PsdState struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
OpenAsdCodes []int32 `protobuf:"varint,2,rep,packed,name=openAsdCodes,proto3" json:"openAsdCodes,omitempty"` //开启的滑动门的编号
Close bool `protobuf:"varint,3,opt,name=close,proto3" json:"close,omitempty"` //屏蔽门整体的关闭(继电器)状态
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //屏蔽门的id
AsdStates []*AsdState `protobuf:"bytes,2,rep,name=asdStates,proto3" json:"asdStates,omitempty"` //滑动门状态
Mgj bool `protobuf:"varint,3,opt,name=mgj,proto3" json:"mgj,omitempty"` //屏蔽门整体的关闭(继电器)状态
}
func (x *PsdState) Reset() {
@ -1687,16 +1687,88 @@ func (x *PsdState) GetId() string {
return ""
}
func (x *PsdState) GetOpenAsdCodes() []int32 {
func (x *PsdState) GetAsdStates() []*AsdState {
if x != nil {
return x.OpenAsdCodes
return x.AsdStates
}
return nil
}
func (x *PsdState) GetClose() bool {
func (x *PsdState) GetMgj() bool {
if x != nil {
return x.Close
return x.Mgj
}
return false
}
// 滑动门状态
type AsdState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` //滑动门的编号
Kmdw bool `protobuf:"varint,2,opt,name=kmdw,proto3" json:"kmdw,omitempty"` //开门到位(实际位置)
Gmdw bool `protobuf:"varint,3,opt,name=gmdw,proto3" json:"gmdw,omitempty"` //关门到位(实际位置)
Mgj bool `protobuf:"varint,4,opt,name=mgj,proto3" json:"mgj,omitempty"` //门关继电器
}
func (x *AsdState) Reset() {
*x = AsdState{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AsdState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AsdState) ProtoMessage() {}
func (x *AsdState) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AsdState.ProtoReflect.Descriptor instead.
func (*AsdState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{15}
}
func (x *AsdState) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *AsdState) GetKmdw() bool {
if x != nil {
return x.Kmdw
}
return false
}
func (x *AsdState) GetGmdw() bool {
if x != nil {
return x.Gmdw
}
return false
}
func (x *AsdState) GetMgj() bool {
if x != nil {
return x.Mgj
}
return false
}
@ -1714,7 +1786,7 @@ type KeyState struct {
func (x *KeyState) Reset() {
*x = KeyState{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[15]
mi := &file_device_state_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1727,7 +1799,7 @@ func (x *KeyState) String() string {
func (*KeyState) ProtoMessage() {}
func (x *KeyState) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[15]
mi := &file_device_state_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1740,7 +1812,7 @@ func (x *KeyState) ProtoReflect() protoreflect.Message {
// Deprecated: Use KeyState.ProtoReflect.Descriptor instead.
func (*KeyState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{15}
return file_device_state_proto_rawDescGZIP(), []int{16}
}
func (x *KeyState) GetId() string {
@ -1757,6 +1829,94 @@ func (x *KeyState) GetGear() int32 {
return 0
}
// 站场图SPKS状态
type SpksState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Open bool `protobuf:"varint,2,opt,name=open,proto3" json:"open,omitempty"` // 钥匙是否开启状态
Xh bool `protobuf:"varint,3,opt,name=xh,proto3" json:"xh,omitempty"` // 继电器状态
Light bool `protobuf:"varint,4,opt,name=light,proto3" json:"light,omitempty"` // 启用灯状态
Pl bool `protobuf:"varint,5,opt,name=pl,proto3" json:"pl,omitempty"` // 旁路按钮状态
Pljxh bool `protobuf:"varint,6,opt,name=pljxh,proto3" json:"pljxh,omitempty"` // 旁路按钮继电器状态
}
func (x *SpksState) Reset() {
*x = SpksState{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SpksState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpksState) ProtoMessage() {}
func (x *SpksState) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SpksState.ProtoReflect.Descriptor instead.
func (*SpksState) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{17}
}
func (x *SpksState) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *SpksState) GetOpen() bool {
if x != nil {
return x.Open
}
return false
}
func (x *SpksState) GetXh() bool {
if x != nil {
return x.Xh
}
return false
}
func (x *SpksState) GetLight() bool {
if x != nil {
return x.Light
}
return false
}
func (x *SpksState) GetPl() bool {
if x != nil {
return x.Pl
}
return false
}
func (x *SpksState) GetPljxh() bool {
if x != nil {
return x.Pljxh
}
return false
}
// 仿真运行时状态变化量,当前时刻与上一时刻比较得到
type VariationStatus struct {
state protoimpl.MessageState
@ -1778,7 +1938,7 @@ type VariationStatus struct {
func (x *VariationStatus) Reset() {
*x = VariationStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[16]
mi := &file_device_state_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1791,7 +1951,7 @@ func (x *VariationStatus) String() string {
func (*VariationStatus) ProtoMessage() {}
func (x *VariationStatus) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[16]
mi := &file_device_state_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1804,7 +1964,7 @@ func (x *VariationStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use VariationStatus.ProtoReflect.Descriptor instead.
func (*VariationStatus) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{16}
return file_device_state_proto_rawDescGZIP(), []int{18}
}
func (x *VariationStatus) GetUpdatedTrain() []*TrainState {
@ -1868,12 +2028,14 @@ type AllDevicesStatus struct {
PsdState []*PsdState `protobuf:"bytes,9,rep,name=psdState,proto3" json:"psdState,omitempty"`
// 钥匙状态
KeyState []*KeyState `protobuf:"bytes,10,rep,name=KeyState,proto3" json:"KeyState,omitempty"`
// 站场图SPKS状态
SpksState []*SpksState `protobuf:"bytes,11,rep,name=spksState,proto3" json:"spksState,omitempty"`
}
func (x *AllDevicesStatus) Reset() {
*x = AllDevicesStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[17]
mi := &file_device_state_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1886,7 +2048,7 @@ func (x *AllDevicesStatus) String() string {
func (*AllDevicesStatus) ProtoMessage() {}
func (x *AllDevicesStatus) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[17]
mi := &file_device_state_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1899,7 +2061,7 @@ func (x *AllDevicesStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use AllDevicesStatus.ProtoReflect.Descriptor instead.
func (*AllDevicesStatus) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{17}
return file_device_state_proto_rawDescGZIP(), []int{19}
}
func (x *AllDevicesStatus) GetTrainState() []*TrainState {
@ -1972,6 +2134,13 @@ func (x *AllDevicesStatus) GetKeyState() []*KeyState {
return nil
}
func (x *AllDevicesStatus) GetSpksState() []*SpksState {
if x != nil {
return x.SpksState
}
return nil
}
// 服务器端向前端推送的设备状态信息
type PushedDevicesStatus struct {
state protoimpl.MessageState
@ -1990,7 +2159,7 @@ type PushedDevicesStatus struct {
func (x *PushedDevicesStatus) Reset() {
*x = PushedDevicesStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[18]
mi := &file_device_state_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -2003,7 +2172,7 @@ func (x *PushedDevicesStatus) String() string {
func (*PushedDevicesStatus) ProtoMessage() {}
func (x *PushedDevicesStatus) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[18]
mi := &file_device_state_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -2016,7 +2185,7 @@ func (x *PushedDevicesStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use PushedDevicesStatus.ProtoReflect.Descriptor instead.
func (*PushedDevicesStatus) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{18}
return file_device_state_proto_rawDescGZIP(), []int{20}
}
func (x *PushedDevicesStatus) GetAll() bool {
@ -2054,7 +2223,7 @@ type SimulationStatus struct {
func (x *SimulationStatus) Reset() {
*x = SimulationStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_device_state_proto_msgTypes[19]
mi := &file_device_state_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -2067,7 +2236,7 @@ func (x *SimulationStatus) String() string {
func (*SimulationStatus) ProtoMessage() {}
func (x *SimulationStatus) ProtoReflect() protoreflect.Message {
mi := &file_device_state_proto_msgTypes[19]
mi := &file_device_state_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -2080,7 +2249,7 @@ func (x *SimulationStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use SimulationStatus.ProtoReflect.Descriptor instead.
func (*SimulationStatus) Descriptor() ([]byte, []int) {
return file_device_state_proto_rawDescGZIP(), []int{19}
return file_device_state_proto_rawDescGZIP(), []int{21}
}
func (x *SimulationStatus) GetSimulationId() string {
@ -2317,99 +2486,116 @@ var file_device_state_proto_rawDesc = []byte{
0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x34, 0x0a, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x54, 0x0a,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x5b, 0x0a,
0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x70, 0x65,
0x6e, 0x41, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52,
0x0c, 0x6f, 0x70, 0x65, 0x6e, 0x41, 0x73, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a,
0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c,
0x6f, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67,
0x65, 0x61, 0x72, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26,
0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64,
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54,
0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74,
0x65, 0x52, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
0x12, 0x3b, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a,
0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x05, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c,
0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52,
0x65, 0x70, 0x6c, 0x79, 0x22, 0x93, 0x04, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61,
0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b,
0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65,
0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x73,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72,
0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34,
0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53,
0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62,
0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c,
0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74,
0x65, 0x52, 0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a,
0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53,
0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x2b, 0x0a, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a,
0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50,
0x75, 0x73, 0x68, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x03, 0x61, 0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x61, 0x6c,
0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69,
0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x05, 0x73, 0x74,
0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x0f, 0x53,
0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x09,
0x0a, 0x05, 0x50, 0x41, 0x55, 0x53, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41,
0x52, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12,
0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x03, 0x2a, 0x37, 0x0a, 0x0b,
0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41,
0x6e, 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x41, 0x78, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x09,
0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x68, 0x79,
0x73, 0x69, 0x63, 0x10, 0x03, 0x42, 0x4c, 0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f,
0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73,
0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x10,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x5a, 0x11, 0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74,
0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2d, 0x0a, 0x09, 0x61, 0x73, 0x64,
0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73,
0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x61,
0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6d, 0x67, 0x6a, 0x22, 0x58, 0x0a, 0x08, 0x41, 0x73,
0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x6d,
0x64, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6b, 0x6d, 0x64, 0x77, 0x12, 0x12,
0x0a, 0x04, 0x67, 0x6d, 0x64, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x67, 0x6d,
0x64, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x67, 0x6a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
0x03, 0x6d, 0x67, 0x6a, 0x22, 0x2e, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x67, 0x65, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x67, 0x65, 0x61, 0x72, 0x22, 0x7b, 0x0a, 0x09, 0x53, 0x70, 0x6b, 0x73, 0x53, 0x74, 0x61, 0x74,
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x78, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28,
0x08, 0x52, 0x02, 0x78, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x70,
0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x70, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70,
0x6c, 0x6a, 0x78, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x70, 0x6c, 0x6a, 0x78,
0x68, 0x22, 0x9e, 0x02, 0x0a, 0x0f, 0x56, 0x61, 0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0e,
0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02,
0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x54, 0x72, 0x61,
0x69, 0x6e, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53,
0x77, 0x69, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x3b,
0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53,
0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x70,
0x6c, 0x79, 0x22, 0xc3, 0x04, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69, 0x6e,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a,
0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x73, 0x77,
0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74,
0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x37, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x73, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x72, 0x65, 0x70,
0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b,
0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c,
0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x62, 0x75, 0x74,
0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x41, 0x6c, 0x61, 0x72,
0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73,
0x74, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
0x0a, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x4c,
0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x0a, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b,
0x0a, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74,
0x65, 0x52, 0x08, 0x70, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x4b,
0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08,
0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x73, 0x70, 0x6b, 0x73,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x53, 0x70, 0x6b, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x73,
0x70, 0x6b, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50, 0x75, 0x73,
0x68, 0x65, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x61,
0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x61,
0x72, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x76,
0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
0xd8, 0x01, 0x0a, 0x10, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e,
0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x2e, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x0f, 0x53, 0x69, 0x6d,
0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x09, 0x0a, 0x05,
0x50, 0x41, 0x55, 0x53, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54,
0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12, 0x0b, 0x0a,
0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x03, 0x2a, 0x37, 0x0a, 0x0b, 0x53, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x79,
0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x41, 0x78, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05,
0x4c, 0x6f, 0x67, 0x69, 0x63, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x68, 0x79, 0x73, 0x69,
0x63, 0x10, 0x03, 0x42, 0x4c, 0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c,
0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76,
0x65, 0x72, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x10, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x11,
0x2e, 0x2f, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74,
0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -2425,7 +2611,7 @@ func file_device_state_proto_rawDescGZIP() []byte {
}
var file_device_state_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_device_state_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
var file_device_state_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_device_state_proto_goTypes = []interface{}{
(SectionType)(0), // 0: state.SectionType
(Signal_Aspect)(0), // 1: state.Signal.Aspect
@ -2445,38 +2631,42 @@ var file_device_state_proto_goTypes = []interface{}{
(*AlarmState)(nil), // 15: state.AlarmState
(*LightState)(nil), // 16: state.LightState
(*PsdState)(nil), // 17: state.PsdState
(*KeyState)(nil), // 18: state.KeyState
(*VariationStatus)(nil), // 19: state.VariationStatus
(*AllDevicesStatus)(nil), // 20: state.AllDevicesStatus
(*PushedDevicesStatus)(nil), // 21: state.PushedDevicesStatus
(*SimulationStatus)(nil), // 22: state.SimulationStatus
(*AsdState)(nil), // 18: state.AsdState
(*KeyState)(nil), // 19: state.KeyState
(*SpksState)(nil), // 20: state.SpksState
(*VariationStatus)(nil), // 21: state.VariationStatus
(*AllDevicesStatus)(nil), // 22: state.AllDevicesStatus
(*PushedDevicesStatus)(nil), // 23: state.PushedDevicesStatus
(*SimulationStatus)(nil), // 24: state.SimulationStatus
}
var file_device_state_proto_depIdxs = []int32{
1, // 0: state.SignalState.aspect:type_name -> state.Signal.Aspect
11, // 1: state.TrainState.dynamicState:type_name -> state.TrainDynamicState
12, // 2: state.TrainState.vobcState:type_name -> state.TrainVobcState
10, // 3: state.VariationStatus.updatedTrain:type_name -> state.TrainState
5, // 4: state.VariationStatus.updatedSwitch:type_name -> state.SwitchState
4, // 5: state.VariationStatus.updatedSection:type_name -> state.SectionState
13, // 6: state.VariationStatus.updatedReply:type_name -> state.ReplyState
10, // 7: state.AllDevicesStatus.trainState:type_name -> state.TrainState
5, // 8: state.AllDevicesStatus.switchState:type_name -> state.SwitchState
4, // 9: state.AllDevicesStatus.sectionState:type_name -> state.SectionState
13, // 10: state.AllDevicesStatus.replyState:type_name -> state.ReplyState
6, // 11: state.AllDevicesStatus.signalState:type_name -> state.SignalState
14, // 12: state.AllDevicesStatus.buttonState:type_name -> state.ButtonState
15, // 13: state.AllDevicesStatus.AlarmState:type_name -> state.AlarmState
16, // 14: state.AllDevicesStatus.LightState:type_name -> state.LightState
17, // 15: state.AllDevicesStatus.psdState:type_name -> state.PsdState
18, // 16: state.AllDevicesStatus.KeyState:type_name -> state.KeyState
19, // 17: state.PushedDevicesStatus.varStatus:type_name -> state.VariationStatus
20, // 18: state.PushedDevicesStatus.allStatus:type_name -> state.AllDevicesStatus
2, // 19: state.SimulationStatus.state:type_name -> state.SimulationStatus.SimulationState
20, // [20:20] is the sub-list for method output_type
20, // [20:20] is the sub-list for method input_type
20, // [20:20] is the sub-list for extension type_name
20, // [20:20] is the sub-list for extension extendee
0, // [0:20] is the sub-list for field type_name
18, // 3: state.PsdState.asdStates:type_name -> state.AsdState
10, // 4: state.VariationStatus.updatedTrain:type_name -> state.TrainState
5, // 5: state.VariationStatus.updatedSwitch:type_name -> state.SwitchState
4, // 6: state.VariationStatus.updatedSection:type_name -> state.SectionState
13, // 7: state.VariationStatus.updatedReply:type_name -> state.ReplyState
10, // 8: state.AllDevicesStatus.trainState:type_name -> state.TrainState
5, // 9: state.AllDevicesStatus.switchState:type_name -> state.SwitchState
4, // 10: state.AllDevicesStatus.sectionState:type_name -> state.SectionState
13, // 11: state.AllDevicesStatus.replyState:type_name -> state.ReplyState
6, // 12: state.AllDevicesStatus.signalState:type_name -> state.SignalState
14, // 13: state.AllDevicesStatus.buttonState:type_name -> state.ButtonState
15, // 14: state.AllDevicesStatus.AlarmState:type_name -> state.AlarmState
16, // 15: state.AllDevicesStatus.LightState:type_name -> state.LightState
17, // 16: state.AllDevicesStatus.psdState:type_name -> state.PsdState
19, // 17: state.AllDevicesStatus.KeyState:type_name -> state.KeyState
20, // 18: state.AllDevicesStatus.spksState:type_name -> state.SpksState
21, // 19: state.PushedDevicesStatus.varStatus:type_name -> state.VariationStatus
22, // 20: state.PushedDevicesStatus.allStatus:type_name -> state.AllDevicesStatus
2, // 21: state.SimulationStatus.state:type_name -> state.SimulationStatus.SimulationState
22, // [22:22] is the sub-list for method output_type
22, // [22:22] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name
22, // [22:22] is the sub-list for extension extendee
0, // [0:22] is the sub-list for field type_name
}
func init() { file_device_state_proto_init() }
@ -2666,7 +2856,7 @@ func file_device_state_proto_init() {
}
}
file_device_state_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*KeyState); i {
switch v := v.(*AsdState); i {
case 0:
return &v.state
case 1:
@ -2678,7 +2868,7 @@ func file_device_state_proto_init() {
}
}
file_device_state_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VariationStatus); i {
switch v := v.(*KeyState); i {
case 0:
return &v.state
case 1:
@ -2690,7 +2880,7 @@ func file_device_state_proto_init() {
}
}
file_device_state_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllDevicesStatus); i {
switch v := v.(*SpksState); i {
case 0:
return &v.state
case 1:
@ -2702,7 +2892,7 @@ func file_device_state_proto_init() {
}
}
file_device_state_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushedDevicesStatus); i {
switch v := v.(*VariationStatus); i {
case 0:
return &v.state
case 1:
@ -2714,6 +2904,30 @@ func file_device_state_proto_init() {
}
}
file_device_state_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllDevicesStatus); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_device_state_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushedDevicesStatus); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_device_state_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SimulationStatus); i {
case 0:
return &v.state
@ -2732,7 +2946,7 @@ func file_device_state_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_device_state_proto_rawDesc,
NumEnums: 3,
NumMessages: 20,
NumMessages: 22,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -32,6 +32,7 @@ type StationUidStructure struct {
PlatformIds map[string]*elementIdStructure
PsdIds map[string]*elementIdStructure
GateBoxIds map[string]*elementIdStructure
SpksSwitchIds map[string]*elementIdStructure
}
type RelayUidStructure struct {
@ -79,6 +80,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
PlatformIds: make(map[string]*elementIdStructure, len(data.Platforms)),
PsdIds: make(map[string]*elementIdStructure, len(data.ScreenDoors)),
GateBoxIds: make(map[string]*elementIdStructure, len(data.GateBoxs)),
SpksSwitchIds: make(map[string]*elementIdStructure, len(data.SpksSwitchs)),
}
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
// 初始化计轴信息
@ -197,6 +199,25 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
Uid: GenerateElementUid(city, lineId, []string{stationId}, box.Code),
}
}
// SPKS人员防护
for _, spk := range data.SpksSwitchs {
if spk.RefStand == "" {
continue
}
platform := platformMap[spk.RefStand]
if platform == nil {
continue
}
station := gus.StationIds[platform.RefStationId]
if station == nil {
continue
}
gus.SpksSwitchIds[spk.Common.Id] = &elementIdStructure{
CommonId: spk.Common.Id,
Code: spk.Code,
Uid: station.Uid + "_key_" + spk.Code,
}
}
return gus
}
@ -287,6 +308,7 @@ func buildRepositoryAllUidsMap(mapIds []int32, repo *repository.Repository) map[
saveToAllUidMap(u.SlopeIds)
saveToAllUidMap(u.CurvatureIds)
saveToAllUidMap(u.ButtonIds)
saveToAllUidMap(u.SpksSwitchIds)
continue
}
}
@ -327,6 +349,8 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
return (uidData.(*StationUidStructure)).ButtonIds
case *graphicData.Station:
return (uidData.(*StationUidStructure)).StationIds
case *graphicData.SpksSwitch:
return (uidData.(*StationUidStructure)).SpksSwitchIds
case *graphicData.ScreenDoor:
return (uidData.(*StationUidStructure)).PsdIds
default:

View File

@ -86,38 +86,3 @@ func RemoveTrainState(vs *VerifySimulation, id string) {
panic(fmt.Sprintf("列车【%s】不存在", id))
}
}
/*
// 列车占用状态
func GetDeviceOccByTrainState(vs *VerifySimulation, ts *state.TrainState) {
if ts.DevicePort == "" { // 区段
if ts.PointTo { // 如果是运行方向是从A -> B
if ts.HeadOffset >= ts.TrainLength { // 如果车头偏移量大于车身长度,只占用当前区段
fmt.Println(ts.HeadDeviceUId)
} else { // 如果不够,向后找占用设备
s1 := vs.Repo.FindPhysicalSection(ts.HeadDeviceUId)
l := int64(math.Abs(float64(s1.BLinkPosition().Offset() - s1.ALinkPosition().Offset())))
// 剩余长度
sl := ts.TrainLength - l
// 寻找下一段设备
ar := s1.ARelation()
if condition {
}
if ar.Device().Type() == rtproto.DeviceType_DeviceType_PhysicalSection { // 区段
}
}
} else {
}
} else { // 道岔
}
// 车头所在位置、列车长度
// 运行方向
// 占用设备类型、设备长度
// 占用设备ID、设备偏移
}
*/

View File

@ -3,15 +3,11 @@ package memory
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/fi"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
)
// 处理道岔操作
@ -46,31 +42,3 @@ func HandleTurnoutOperation(simulation *VerifySimulation, req *request_proto.Tur
}
return err
}
// 获取全部的道岔状态,动力学使用
func GetAllTurnoutState(sim *VerifySimulation) []*state.SwitchState {
var switchArr []*state.SwitchState
turnoutList := sim.Repo.TurnoutList()
for _, o := range turnoutList {
s := handlerTurnoutState(sim.World, o.Id())
if s == nil {
continue
}
s.Id = sim.GetComIdByUid(o.Id())
switchArr = append(switchArr, s)
}
return switchArr
}
func handlerTurnoutState(w ecs.World, uid string) *state.SwitchState {
entry, ok := entity.GetEntityByUid(w, uid)
if !ok {
fmt.Printf("id=%s的道岔不存在", uid)
return nil
}
if !entry.HasComponent(component.TurnoutPositionType) {
return nil
}
pos := component.TurnoutPositionType.Get(entry)
return &state.SwitchState{Normal: pos.Db, Reverse: pos.Fb, Dw: pos.Dw, Fw: pos.Fw}
}

View File

@ -20,6 +20,8 @@ import (
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/fi"
"joylink.club/rtsssimulation/repository"
"joylink.club/rtsssimulation/repository/model/proto"
@ -148,23 +150,39 @@ func (s *VerifySimulation) GetComIdByUid(uid string) string {
// 采集动力学道岔状态
func (s *VerifySimulation) CollectDynamicsTurnoutInfo() []*message.DynamicsTurnoutInfo {
stateSlice := GetAllTurnoutState(s)
var turnoutStates []*message.DynamicsTurnoutInfo
for _, sta := range stateSlice {
code64, err := strconv.ParseUint(sta.Id, 10, 16)
for _, o := range s.Repo.TurnoutList() {
sta := s.uidMap[o.Id()]
if sta == nil {
continue
}
code64, err := strconv.ParseUint(sta.CommonId, 10, 16)
if err != nil {
slog.Error("id转uint16报错", err)
}
info := message.DynamicsTurnoutInfo{
Code: uint16(code64),
NPosition: sta.Dw,
RPosition: sta.Fw,
s := handlerDynamicsTurnoutState(s.World, o.Id())
if s == nil {
continue
}
turnoutStates = append(turnoutStates, &info)
s.Code = uint16(code64)
turnoutStates = append(turnoutStates, s)
}
return turnoutStates
}
func handlerDynamicsTurnoutState(w ecs.World, uid string) *message.DynamicsTurnoutInfo {
entry, ok := entity.GetEntityByUid(w, uid)
if !ok {
fmt.Printf("id=%s的道岔不存在", uid)
return nil
}
if !entry.HasComponent(component.TurnoutPositionType) {
return nil
}
pos := component.TurnoutPositionType.Get(entry)
return &message.DynamicsTurnoutInfo{NPosition: pos.Dw, RPosition: pos.Fw}
}
// 处理动力学列车速度消息
func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainInfo) {
sta, ok := s.Memory.Status.TrainStateMap.Load(strconv.Itoa(int(info.Number)))