道岔添加强制操作
添加应答器编解码器部分代码
This commit is contained in:
parent
71f8163cab
commit
340d1371d2
@ -29,7 +29,7 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
|||||||
authed.POST("/check/data", checkSimMapData)
|
authed.POST("/check/data", checkSimMapData)
|
||||||
authed.POST("/train/add", addTrain)
|
authed.POST("/train/add", addTrain)
|
||||||
authed.POST("/train/remove", removeTrain)
|
authed.POST("/train/remove", removeTrain)
|
||||||
authed.POST("/switch/operation", switchOperation)
|
authed.POST("/switch/operation", turnoutOperation)
|
||||||
authed.POST("/relay/operation", relayOperation)
|
authed.POST("/relay/operation", relayOperation)
|
||||||
authed.POST("/signal/operation", signalOperation)
|
authed.POST("/signal/operation", signalOperation)
|
||||||
authed.POST("/axleSection/operation", axleSectionOperation)
|
authed.POST("/axleSection/operation", axleSectionOperation)
|
||||||
@ -248,7 +248,7 @@ func removeTrain(c *gin.Context) {
|
|||||||
// @Success 200 {object} string
|
// @Success 200 {object} string
|
||||||
// @Failure 500 {object} dto.ErrorDto
|
// @Failure 500 {object} dto.ErrorDto
|
||||||
// @Router /api/v1/simulation/switch/operation [post]
|
// @Router /api/v1/simulation/switch/operation [post]
|
||||||
func switchOperation(c *gin.Context) {
|
func turnoutOperation(c *gin.Context) {
|
||||||
req := &request_proto.TurnoutOperationReq{}
|
req := &request_proto.TurnoutOperationReq{}
|
||||||
if err := c.ShouldBind(&req); err != nil {
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
panic(sys_error.New("道岔操作失败,请求参数异常", err))
|
panic(sys_error.New("道岔操作失败,请求参数异常", err))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: request.proto
|
// source: request.proto
|
||||||
|
|
||||||
@ -24,40 +24,49 @@ const (
|
|||||||
type Turnout_Operation int32
|
type Turnout_Operation int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Turnout_Undefined Turnout_Operation = 0 // 未定义
|
Turnout_Undefined Turnout_Operation = 0 // 未定义
|
||||||
Turnout_DC Turnout_Operation = 1 // 定操
|
Turnout_DC Turnout_Operation = 1 // 定操
|
||||||
Turnout_CancelDC Turnout_Operation = 2 // 取消定操
|
Turnout_CancelDC Turnout_Operation = 2 // 取消定操
|
||||||
Turnout_FC Turnout_Operation = 3 // 反操
|
Turnout_FC Turnout_Operation = 3 // 反操
|
||||||
Turnout_CancelFC Turnout_Operation = 4 // 取消反操
|
Turnout_CancelFC Turnout_Operation = 4 // 取消反操
|
||||||
Turnout_SetSB Turnout_Operation = 5 // 设置失表故障
|
Turnout_SetSB Turnout_Operation = 5 // 设置失表故障
|
||||||
Turnout_CancelSB Turnout_Operation = 6 // 取消失表故障
|
Turnout_CancelSB Turnout_Operation = 6 // 取消失表故障
|
||||||
Turnout_SetJC Turnout_Operation = 7 // 设置挤岔故障
|
Turnout_SetJC Turnout_Operation = 7 // 设置挤岔故障
|
||||||
Turnout_CancelJC Turnout_Operation = 8 // 取消挤岔故障
|
Turnout_CancelJC Turnout_Operation = 8 // 取消挤岔故障
|
||||||
|
Turnout_ForceDw Turnout_Operation = 9 // 强制定位
|
||||||
|
Turnout_ForceFw Turnout_Operation = 10 // 强制反位
|
||||||
|
Turnout_CancelForce Turnout_Operation = 11 // 取消强制
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for Turnout_Operation.
|
// Enum value maps for Turnout_Operation.
|
||||||
var (
|
var (
|
||||||
Turnout_Operation_name = map[int32]string{
|
Turnout_Operation_name = map[int32]string{
|
||||||
0: "Undefined",
|
0: "Undefined",
|
||||||
1: "DC",
|
1: "DC",
|
||||||
2: "CancelDC",
|
2: "CancelDC",
|
||||||
3: "FC",
|
3: "FC",
|
||||||
4: "CancelFC",
|
4: "CancelFC",
|
||||||
5: "SetSB",
|
5: "SetSB",
|
||||||
6: "CancelSB",
|
6: "CancelSB",
|
||||||
7: "SetJC",
|
7: "SetJC",
|
||||||
8: "CancelJC",
|
8: "CancelJC",
|
||||||
|
9: "ForceDw",
|
||||||
|
10: "ForceFw",
|
||||||
|
11: "CancelForce",
|
||||||
}
|
}
|
||||||
Turnout_Operation_value = map[string]int32{
|
Turnout_Operation_value = map[string]int32{
|
||||||
"Undefined": 0,
|
"Undefined": 0,
|
||||||
"DC": 1,
|
"DC": 1,
|
||||||
"CancelDC": 2,
|
"CancelDC": 2,
|
||||||
"FC": 3,
|
"FC": 3,
|
||||||
"CancelFC": 4,
|
"CancelFC": 4,
|
||||||
"SetSB": 5,
|
"SetSB": 5,
|
||||||
"CancelSB": 6,
|
"CancelSB": 6,
|
||||||
"SetJC": 7,
|
"SetJC": 7,
|
||||||
"CancelJC": 8,
|
"CancelJC": 8,
|
||||||
|
"ForceDw": 9,
|
||||||
|
"ForceFw": 10,
|
||||||
|
"CancelForce": 11,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -165,14 +174,12 @@ func (Signal_Operation) EnumDescriptor() ([]byte, []int) {
|
|||||||
return file_request_proto_rawDescGZIP(), []int{2, 0}
|
return file_request_proto_rawDescGZIP(), []int{2, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计轴区段操作
|
// 计轴操作
|
||||||
type Section_AxleOperation int32
|
type Section_AxleOperation int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Section_Drst Section_AxleOperation = 0 //设置计轴直接复位
|
Section_Drst Section_AxleOperation = 0 //设置计轴直接复位
|
||||||
Section_Pdrst Section_AxleOperation = 1 //设置计轴预复位
|
Section_Pdrst Section_AxleOperation = 1 //设置计轴预复位
|
||||||
Section_TrainIn Section_AxleOperation = 2 //设置计轴区段内有车轴
|
|
||||||
Section_TrainOut Section_AxleOperation = 3 //设置计轴区段内没有车轴
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for Section_AxleOperation.
|
// Enum value maps for Section_AxleOperation.
|
||||||
@ -180,14 +187,10 @@ var (
|
|||||||
Section_AxleOperation_name = map[int32]string{
|
Section_AxleOperation_name = map[int32]string{
|
||||||
0: "Drst",
|
0: "Drst",
|
||||||
1: "Pdrst",
|
1: "Pdrst",
|
||||||
2: "TrainIn",
|
|
||||||
3: "TrainOut",
|
|
||||||
}
|
}
|
||||||
Section_AxleOperation_value = map[string]int32{
|
Section_AxleOperation_value = map[string]int32{
|
||||||
"Drst": 0,
|
"Drst": 0,
|
||||||
"Pdrst": 1,
|
"Pdrst": 1,
|
||||||
"TrainIn": 2,
|
|
||||||
"TrainOut": 3,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -218,6 +221,53 @@ func (Section_AxleOperation) EnumDescriptor() ([]byte, []int) {
|
|||||||
return file_request_proto_rawDescGZIP(), []int{3, 0}
|
return file_request_proto_rawDescGZIP(), []int{3, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 区段操作
|
||||||
|
type Section_SectionOperation int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
Section_SetFaultOcc Section_SectionOperation = 0 //设置故障占用
|
||||||
|
Section_CancelFaultOcc Section_SectionOperation = 1 //取消故障占用
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for Section_SectionOperation.
|
||||||
|
var (
|
||||||
|
Section_SectionOperation_name = map[int32]string{
|
||||||
|
0: "SetFaultOcc",
|
||||||
|
1: "CancelFaultOcc",
|
||||||
|
}
|
||||||
|
Section_SectionOperation_value = map[string]int32{
|
||||||
|
"SetFaultOcc": 0,
|
||||||
|
"CancelFaultOcc": 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x Section_SectionOperation) Enum() *Section_SectionOperation {
|
||||||
|
p := new(Section_SectionOperation)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Section_SectionOperation) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Section_SectionOperation) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_request_proto_enumTypes[3].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Section_SectionOperation) Type() protoreflect.EnumType {
|
||||||
|
return &file_request_proto_enumTypes[3]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Section_SectionOperation) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Section_SectionOperation.Descriptor instead.
|
||||||
|
func (Section_SectionOperation) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_request_proto_rawDescGZIP(), []int{3, 1}
|
||||||
|
}
|
||||||
|
|
||||||
// 道岔
|
// 道岔
|
||||||
type Turnout struct {
|
type Turnout struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@ -411,48 +461,53 @@ var File_request_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_request_proto_rawDesc = []byte{
|
var file_request_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
0x0a, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||||
0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x07, 0x54, 0x75, 0x72,
|
0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xaf, 0x01, 0x0a, 0x07, 0x54, 0x75, 0x72,
|
||||||
0x6e, 0x6f, 0x75, 0x74, 0x22, 0x78, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
0x6e, 0x6f, 0x75, 0x74, 0x22, 0xa3, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
|
||||||
0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00,
|
0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10,
|
||||||
0x12, 0x06, 0x0a, 0x02, 0x44, 0x43, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63,
|
0x00, 0x12, 0x06, 0x0a, 0x02, 0x44, 0x43, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e,
|
||||||
0x65, 0x6c, 0x44, 0x43, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46, 0x43, 0x10, 0x03, 0x12, 0x0c,
|
0x63, 0x65, 0x6c, 0x44, 0x43, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46, 0x43, 0x10, 0x03, 0x12,
|
||||||
0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x43, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05,
|
0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x43, 0x10, 0x04, 0x12, 0x09, 0x0a,
|
||||||
0x53, 0x65, 0x74, 0x53, 0x42, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65,
|
0x05, 0x53, 0x65, 0x74, 0x53, 0x42, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63,
|
||||||
0x6c, 0x53, 0x42, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x4a, 0x43, 0x10, 0x07,
|
0x65, 0x6c, 0x53, 0x42, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x65, 0x74, 0x4a, 0x43, 0x10,
|
||||||
0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4a, 0x43, 0x10, 0x08, 0x22, 0xa5,
|
0x07, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4a, 0x43, 0x10, 0x08, 0x12,
|
||||||
0x01, 0x0a, 0x13, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
0x0b, 0x0a, 0x07, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x77, 0x10, 0x09, 0x12, 0x0b, 0x0a, 0x07,
|
||||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
|
0x46, 0x6f, 0x72, 0x63, 0x65, 0x46, 0x77, 0x10, 0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x61, 0x6e,
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69,
|
0x63, 0x65, 0x6c, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x10, 0x0b, 0x22, 0xa5, 0x01, 0x0a, 0x13, 0x54,
|
||||||
0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61,
|
0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||||
0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64,
|
0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
|
||||||
0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09,
|
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18,
|
||||||
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
|
||||||
0x1a, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75,
|
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||||
0x74, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65,
|
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72,
|
||||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61,
|
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x72, 0x65,
|
||||||
0x6c, 0x22, 0xea, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x4f, 0x70,
|
||||||
0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0b,
|
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
|
||||||
0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c,
|
0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x22, 0xea, 0x01,
|
||||||
0x69, 0x67, 0x68, 0x74, 0x48, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x02, 0x12, 0x11,
|
0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55,
|
||||||
0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10,
|
0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x69,
|
||||||
0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x46, 0x61, 0x75, 0x6c, 0x74,
|
0x73, 0x70, 0x6c, 0x61, 0x79, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74,
|
||||||
0x44, 0x73, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41, 0x46, 0x61,
|
0x48, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69,
|
||||||
0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74,
|
0x67, 0x68, 0x74, 0x55, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x03, 0x12, 0x11, 0x0a,
|
||||||
0x42, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69,
|
0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x73, 0x10, 0x04,
|
||||||
0x67, 0x68, 0x74, 0x48, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x07, 0x12, 0x12,
|
0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44,
|
||||||
0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x55, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73,
|
0x73, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x42, 0x46, 0x61, 0x75,
|
||||||
0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x43, 0x61, 0x6e, 0x63,
|
0x6c, 0x74, 0x44, 0x73, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x48,
|
||||||
0x65, 0x6c, 0x44, 0x73, 0x10, 0x09, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41,
|
0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x07, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69,
|
||||||
0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0a, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69,
|
0x67, 0x68, 0x74, 0x55, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x08, 0x12, 0x12,
|
||||||
0x67, 0x68, 0x74, 0x42, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0b, 0x22, 0x4a,
|
0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73,
|
||||||
0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x0d, 0x41, 0x78, 0x6c,
|
0x10, 0x09, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x41, 0x43, 0x61, 0x6e, 0x63,
|
||||||
0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x72,
|
0x65, 0x6c, 0x44, 0x73, 0x10, 0x0a, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x42,
|
||||||
0x73, 0x74, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x64, 0x72, 0x73, 0x74, 0x10, 0x01, 0x12,
|
0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x73, 0x10, 0x0b, 0x22, 0x68, 0x0a, 0x07, 0x53, 0x65,
|
||||||
0x0b, 0x0a, 0x07, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08,
|
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x24, 0x0a, 0x0d, 0x41, 0x78, 0x6c, 0x65, 0x4f, 0x70, 0x65,
|
||||||
0x54, 0x72, 0x61, 0x69, 0x6e, 0x4f, 0x75, 0x74, 0x10, 0x03, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f,
|
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x72, 0x73, 0x74, 0x10, 0x00,
|
||||||
0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74,
|
0x12, 0x09, 0x0a, 0x05, 0x50, 0x64, 0x72, 0x73, 0x74, 0x10, 0x01, 0x22, 0x37, 0x0a, 0x10, 0x53,
|
||||||
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||||
|
0x0f, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x63, 0x63, 0x10, 0x00,
|
||||||
|
0x12, 0x12, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4f,
|
||||||
|
0x63, 0x63, 0x10, 0x01, 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 (
|
var (
|
||||||
@ -467,16 +522,17 @@ func file_request_proto_rawDescGZIP() []byte {
|
|||||||
return file_request_proto_rawDescData
|
return file_request_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
|
||||||
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||||
var file_request_proto_goTypes = []interface{}{
|
var file_request_proto_goTypes = []interface{}{
|
||||||
(Turnout_Operation)(0), // 0: request.Turnout.Operation
|
(Turnout_Operation)(0), // 0: request.Turnout.Operation
|
||||||
(Signal_Operation)(0), // 1: request.Signal.Operation
|
(Signal_Operation)(0), // 1: request.Signal.Operation
|
||||||
(Section_AxleOperation)(0), // 2: request.Section.AxleOperation
|
(Section_AxleOperation)(0), // 2: request.Section.AxleOperation
|
||||||
(*Turnout)(nil), // 3: request.Turnout
|
(Section_SectionOperation)(0), // 3: request.Section.SectionOperation
|
||||||
(*TurnoutOperationReq)(nil), // 4: request.TurnoutOperationReq
|
(*Turnout)(nil), // 4: request.Turnout
|
||||||
(*Signal)(nil), // 5: request.Signal
|
(*TurnoutOperationReq)(nil), // 5: request.TurnoutOperationReq
|
||||||
(*Section)(nil), // 6: request.Section
|
(*Signal)(nil), // 6: request.Signal
|
||||||
|
(*Section)(nil), // 7: request.Section
|
||||||
}
|
}
|
||||||
var file_request_proto_depIdxs = []int32{
|
var file_request_proto_depIdxs = []int32{
|
||||||
0, // 0: request.TurnoutOperationReq.operation:type_name -> request.Turnout.Operation
|
0, // 0: request.TurnoutOperationReq.operation:type_name -> request.Turnout.Operation
|
||||||
@ -547,7 +603,7 @@ func file_request_proto_init() {
|
|||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_request_proto_rawDesc,
|
RawDescriptor: file_request_proto_rawDesc,
|
||||||
NumEnums: 3,
|
NumEnums: 4,
|
||||||
NumMessages: 4,
|
NumMessages: 4,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
|
29
third_party/balise/codec.go
vendored
Normal file
29
third_party/balise/codec.go
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package balise
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// 应答器数据编解码器
|
||||||
|
type Codec interface {
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
Bytes1023 = 128
|
||||||
|
Bytes341 = 43
|
||||||
|
)
|
||||||
|
|
||||||
|
// 解码应答器数据,1023/341位解码
|
||||||
|
// bys - 128/43字节数据
|
||||||
|
// return - 830/210位数据
|
||||||
|
func Decode(bys []byte) ([]int, error) {
|
||||||
|
size := len(bys)
|
||||||
|
|
||||||
|
if size == Bytes1023 {
|
||||||
|
// 1023应答器解码
|
||||||
|
return nil, nil
|
||||||
|
} else if size == Bytes341 {
|
||||||
|
// 341应答器解码
|
||||||
|
return nil, nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("不支持的应答器类型")
|
||||||
|
}
|
||||||
|
}
|
173
third_party/balise/conv.go
vendored
Normal file
173
third_party/balise/conv.go
vendored
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
package balise
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ConvWords = []uint16{
|
||||||
|
0o0101, 0o0102, 0o0103, 0o0104, 0o0105, 0o0106, 0o0107, 0o0110, 0o0111, 0o0112,
|
||||||
|
0o0113, 0o0114, 0o0115, 0o0116, 0o0117, 0o0120, 0o0121, 0o0122, 0o0123, 0o0124,
|
||||||
|
0o0125, 0o0126, 0o0127, 0o0130, 0o0131, 0o0132, 0o0133, 0o0134, 0o0135, 0o0141,
|
||||||
|
0o0142, 0o0143, 0o0144, 0o0145, 0o0146, 0o0147, 0o0150, 0o0151, 0o0152, 0o0153,
|
||||||
|
0o0154, 0o0155, 0o0156, 0o0157, 0o0160, 0o0161, 0o0162, 0o0163, 0o0164, 0o0165,
|
||||||
|
0o0166, 0o0167, 0o0170, 0o0171, 0o0172, 0o0173, 0o0174, 0o0175, 0o0176, 0o0201,
|
||||||
|
0o0206, 0o0211, 0o0214, 0o0216, 0o0217, 0o0220, 0o0222, 0o0223, 0o0224, 0o0225,
|
||||||
|
0o0226, 0o0231, 0o0233, 0o0244, 0o0245, 0o0246, 0o0253, 0o0257, 0o0260, 0o0261,
|
||||||
|
0o0272, 0o0273, 0o0274, 0o0275, 0o0276, 0o0301, 0o0303, 0o0315, 0o0317, 0o0320,
|
||||||
|
0o0321, 0o0332, 0o0334, 0o0341, 0o0342, 0o0343, 0o0344, 0o0346, 0o0352, 0o0353,
|
||||||
|
0o0357, 0o0360, 0o0374, 0o0376, 0o0401, 0o0403, 0o0404, 0o0405, 0o0406, 0o0407,
|
||||||
|
0o0410, 0o0411, 0o0412, 0o0413, 0o0416, 0o0417, 0o0420, 0o0424, 0o0425, 0o0426,
|
||||||
|
0o0427, 0o0432, 0o0433, 0o0442, 0o0443, 0o0445, 0o0456, 0o0457, 0o0460, 0o0461,
|
||||||
|
0o0464, 0o0465, 0o0470, 0o0471, 0o0472, 0o0474, 0o0475, 0o0476, 0o0501, 0o0502,
|
||||||
|
0o0503, 0o0504, 0o0505, 0o0506, 0o0507, 0o0516, 0o0517, 0o0520, 0o0521, 0o0522,
|
||||||
|
0o0523, 0o0524, 0o0525, 0o0530, 0o0531, 0o0532, 0o0533, 0o0534, 0o0535, 0o0544,
|
||||||
|
0o0545, 0o0546, 0o0547, 0o0550, 0o0551, 0o0552, 0o0553, 0o0554, 0o0555, 0o0556,
|
||||||
|
0o0557, 0o0560, 0o0561, 0o0562, 0o0563, 0o0571, 0o0573, 0o0576, 0o0601, 0o0602,
|
||||||
|
0o0604, 0o0605, 0o0610, 0o0611, 0o0612, 0o0613, 0o0614, 0o0615, 0o0616, 0o0617,
|
||||||
|
0o0620, 0o0621, 0o0622, 0o0623, 0o0624, 0o0625, 0o0626, 0o0627, 0o0630, 0o0634,
|
||||||
|
0o0635, 0o0644, 0o0645, 0o0646, 0o0647, 0o0650, 0o0651, 0o0652, 0o0653, 0o0654,
|
||||||
|
0o0655, 0o0656, 0o0657, 0o0660, 0o0661, 0o0662, 0o0663, 0o0666, 0o0667, 0o0672,
|
||||||
|
0o0674, 0o0675, 0o0676, 0o0701, 0o0712, 0o0713, 0o0716, 0o0717, 0o0720, 0o0721,
|
||||||
|
0o0722, 0o0723, 0o0730, 0o0731, 0o0732, 0o0733, 0o0734, 0o0735, 0o0742, 0o0743,
|
||||||
|
0o0744, 0o0745, 0o0746, 0o0747, 0o0750, 0o0751, 0o0752, 0o0753, 0o0754, 0o0755,
|
||||||
|
0o0756, 0o0757, 0o0760, 0o0761, 0o0764, 0o0765, 0o0766, 0o0767, 0o0772, 0o0773,
|
||||||
|
0o0776, 0o1001, 0o1004, 0o1005, 0o1016, 0o1017, 0o1020, 0o1021, 0o1022, 0o1023,
|
||||||
|
0o1024, 0o1025, 0o1030, 0o1031, 0o1032, 0o1033, 0o1034, 0o1035, 0o1043, 0o1044,
|
||||||
|
0o1045, 0o1046, 0o1047, 0o1054, 0o1057, 0o1060, 0o1061, 0o1062, 0o1075, 0o1076,
|
||||||
|
0o1101, 0o1102, 0o1103, 0o1110, 0o1114, 0o1115, 0o1116, 0o1117, 0o1120, 0o1121,
|
||||||
|
0o1122, 0o1123, 0o1124, 0o1125, 0o1126, 0o1127, 0o1130, 0o1131, 0o1132, 0o1133,
|
||||||
|
0o1142, 0o1143, 0o1144, 0o1145, 0o1146, 0o1147, 0o1151, 0o1152, 0o1153, 0o1154,
|
||||||
|
0o1155, 0o1156, 0o1157, 0o1160, 0o1164, 0o1166, 0o1167, 0o1176, 0o1201, 0o1214,
|
||||||
|
0o1217, 0o1220, 0o1221, 0o1222, 0o1223, 0o1224, 0o1225, 0o1226, 0o1227, 0o1230,
|
||||||
|
0o1231, 0o1232, 0o1233, 0o1243, 0o1244, 0o1245, 0o1253, 0o1254, 0o1255, 0o1256,
|
||||||
|
0o1257, 0o1260, 0o1261, 0o1272, 0o1273, 0o1274, 0o1275, 0o1276, 0o1301, 0o1302,
|
||||||
|
0o1303, 0o1305, 0o1306, 0o1307, 0o1317, 0o1320, 0o1321, 0o1332, 0o1334, 0o1335,
|
||||||
|
0o1342, 0o1343, 0o1344, 0o1345, 0o1350, 0o1351, 0o1352, 0o1353, 0o1355, 0o1356,
|
||||||
|
0o1357, 0o1360, 0o1361, 0o1364, 0o1365, 0o1370, 0o1371, 0o1372, 0o1373, 0o1374,
|
||||||
|
0o1376, 0o1401, 0o1403, 0o1406, 0o1407, 0o1414, 0o1415, 0o1416, 0o1417, 0o1420,
|
||||||
|
0o1424, 0o1425, 0o1431, 0o1433, 0o1434, 0o1435, 0o1443, 0o1445, 0o1456, 0o1457,
|
||||||
|
0o1460, 0o1462, 0o1474, 0o1475, 0o1476, 0o1501, 0o1502, 0o1503, 0o1504, 0o1505,
|
||||||
|
0o1516, 0o1517, 0o1520, 0o1524, 0o1532, 0o1533, 0o1544, 0o1546, 0o1550, 0o1551,
|
||||||
|
0o1552, 0o1553, 0o1554, 0o1557, 0o1560, 0o1561, 0o1562, 0o1563, 0o1566, 0o1567,
|
||||||
|
0o1576, 0o1601, 0o1603, 0o1604, 0o1605, 0o1606, 0o1607, 0o1610, 0o1611, 0o1612,
|
||||||
|
0o1613, 0o1614, 0o1615, 0o1616, 0o1617, 0o1620, 0o1621, 0o1622, 0o1623, 0o1624,
|
||||||
|
0o1625, 0o1626, 0o1630, 0o1631, 0o1632, 0o1633, 0o1635, 0o1643, 0o1644, 0o1645,
|
||||||
|
0o1650, 0o1651, 0o1652, 0o1653, 0o1654, 0o1655, 0o1656, 0o1657, 0o1660, 0o1661,
|
||||||
|
0o1672, 0o1674, 0o1675, 0o1676, 0o1701, 0o1720, 0o1744, 0o1745, 0o1746, 0o1747,
|
||||||
|
0o1750, 0o1751, 0o1752, 0o1753, 0o1754, 0o1755, 0o1756, 0o1757, 0o1760, 0o1761,
|
||||||
|
0o1762, 0o1763, 0o1764, 0o1765, 0o1766, 0o1767, 0o1770, 0o1771, 0o1772, 0o1773,
|
||||||
|
0o1774, 0o1775, 0o2002, 0o2003, 0o2004, 0o2005, 0o2006, 0o2007, 0o2010, 0o2011,
|
||||||
|
0o2012, 0o2013, 0o2014, 0o2015, 0o2016, 0o2017, 0o2020, 0o2021, 0o2022, 0o2023,
|
||||||
|
0o2024, 0o2025, 0o2026, 0o2027, 0o2030, 0o2031, 0o2032, 0o2033, 0o2057, 0o2076,
|
||||||
|
0o2101, 0o2102, 0o2103, 0o2105, 0o2116, 0o2117, 0o2120, 0o2121, 0o2122, 0o2123,
|
||||||
|
0o2124, 0o2125, 0o2126, 0o2127, 0o2132, 0o2133, 0o2134, 0o2142, 0o2144, 0o2145,
|
||||||
|
0o2146, 0o2147, 0o2151, 0o2152, 0o2153, 0o2154, 0o2155, 0o2156, 0o2157, 0o2160,
|
||||||
|
0o2161, 0o2162, 0o2163, 0o2164, 0o2165, 0o2166, 0o2167, 0o2170, 0o2171, 0o2172,
|
||||||
|
0o2173, 0o2174, 0o2176, 0o2201, 0o2210, 0o2211, 0o2214, 0o2215, 0o2216, 0o2217,
|
||||||
|
0o2220, 0o2223, 0o2224, 0o2225, 0o2226, 0o2227, 0o2231, 0o2233, 0o2244, 0o2245,
|
||||||
|
0o2253, 0o2257, 0o2260, 0o2261, 0o2272, 0o2273, 0o2274, 0o2275, 0o2276, 0o2301,
|
||||||
|
0o2302, 0o2303, 0o2315, 0o2317, 0o2320, 0o2321, 0o2332, 0o2334, 0o2342, 0o2343,
|
||||||
|
0o2344, 0o2346, 0o2352, 0o2353, 0o2357, 0o2360, 0o2361, 0o2362, 0o2363, 0o2370,
|
||||||
|
0o2371, 0o2374, 0o2376, 0o2401, 0o2403, 0o2404, 0o2405, 0o2406, 0o2407, 0o2412,
|
||||||
|
0o2413, 0o2416, 0o2417, 0o2420, 0o2421, 0o2422, 0o2424, 0o2425, 0o2426, 0o2427,
|
||||||
|
0o2432, 0o2433, 0o2434, 0o2435, 0o2442, 0o2443, 0o2445, 0o2456, 0o2457, 0o2460,
|
||||||
|
0o2470, 0o2471, 0o2472, 0o2474, 0o2475, 0o2476, 0o2501, 0o2502, 0o2503, 0o2504,
|
||||||
|
0o2505, 0o2516, 0o2517, 0o2520, 0o2521, 0o2522, 0o2523, 0o2524, 0o2532, 0o2533,
|
||||||
|
0o2534, 0o2544, 0o2545, 0o2546, 0o2547, 0o2550, 0o2551, 0o2552, 0o2553, 0o2554,
|
||||||
|
0o2555, 0o2556, 0o2557, 0o2560, 0o2563, 0o2576, 0o2601, 0o2610, 0o2611, 0o2613,
|
||||||
|
0o2617, 0o2620, 0o2621, 0o2622, 0o2623, 0o2624, 0o2625, 0o2626, 0o2630, 0o2631,
|
||||||
|
0o2632, 0o2633, 0o2634, 0o2635, 0o2644, 0o2645, 0o2646, 0o2647, 0o2650, 0o2651,
|
||||||
|
0o2652, 0o2653, 0o2654, 0o2655, 0o2656, 0o2657, 0o2660, 0o2661, 0o2662, 0o2663,
|
||||||
|
0o2667, 0o2674, 0o2675, 0o2676, 0o2701, 0o2702, 0o2715, 0o2716, 0o2717, 0o2720,
|
||||||
|
0o2723, 0o2730, 0o2731, 0o2732, 0o2733, 0o2734, 0o2742, 0o2743, 0o2744, 0o2745,
|
||||||
|
0o2746, 0o2747, 0o2752, 0o2753, 0o2754, 0o2755, 0o2756, 0o2757, 0o2760, 0o2761,
|
||||||
|
0o2772, 0o2773, 0o2776, 0o3001, 0o3004, 0o3005, 0o3010, 0o3011, 0o3012, 0o3013,
|
||||||
|
0o3016, 0o3017, 0o3020, 0o3021, 0o3022, 0o3023, 0o3024, 0o3025, 0o3026, 0o3027,
|
||||||
|
0o3030, 0o3031, 0o3032, 0o3033, 0o3034, 0o3035, 0o3042, 0o3043, 0o3044, 0o3045,
|
||||||
|
0o3046, 0o3047, 0o3054, 0o3055, 0o3056, 0o3057, 0o3060, 0o3061, 0o3064, 0o3065,
|
||||||
|
0o3076, 0o3101, 0o3102, 0o3103, 0o3105, 0o3110, 0o3111, 0o3114, 0o3115, 0o3116,
|
||||||
|
0o3117, 0o3120, 0o3121, 0o3122, 0o3123, 0o3124, 0o3125, 0o3126, 0o3127, 0o3130,
|
||||||
|
0o3131, 0o3132, 0o3133, 0o3142, 0o3143, 0o3147, 0o3150, 0o3151, 0o3152, 0o3153,
|
||||||
|
0o3154, 0o3155, 0o3156, 0o3157, 0o3160, 0o3161, 0o3162, 0o3163, 0o3164, 0o3165,
|
||||||
|
0o3166, 0o3167, 0o3172, 0o3173, 0o3175, 0o3176, 0o3201, 0o3204, 0o3206, 0o3214,
|
||||||
|
0o3215, 0o3216, 0o3217, 0o3220, 0o3221, 0o3222, 0o3223, 0o3224, 0o3225, 0o3226,
|
||||||
|
0o3227, 0o3230, 0o3231, 0o3232, 0o3233, 0o3242, 0o3243, 0o3244, 0o3245, 0o3246,
|
||||||
|
0o3247, 0o3252, 0o3253, 0o3254, 0o3255, 0o3256, 0o3257, 0o3260, 0o3261, 0o3270,
|
||||||
|
0o3271, 0o3272, 0o3273, 0o3274, 0o3275, 0o3276, 0o3301, 0o3302, 0o3303, 0o3305,
|
||||||
|
0o3306, 0o3307, 0o3312, 0o3313, 0o3316, 0o3317, 0o3320, 0o3321, 0o3332, 0o3334,
|
||||||
|
0o3335, 0o3344, 0o3345, 0o3350, 0o3351, 0o3352, 0o3353, 0o3357, 0o3360, 0o3361,
|
||||||
|
0o3364, 0o3365, 0o3366, 0o3367, 0o3370, 0o3371, 0o3372, 0o3373, 0o3374, 0o3376,
|
||||||
|
0o3401, 0o3403, 0o3417, 0o3420, 0o3424, 0o3425, 0o3431, 0o3433, 0o3434, 0o3435,
|
||||||
|
0o3436, 0o3443, 0o3445, 0o3456, 0o3457, 0o3460, 0o3462, 0o3474, 0o3476, 0o3501,
|
||||||
|
0o3502, 0o3503, 0o3504, 0o3505, 0o3516, 0o3517, 0o3520, 0o3524, 0o3531, 0o3532,
|
||||||
|
0o3533, 0o3544, 0o3546, 0o3551, 0o3552, 0o3553, 0o3554, 0o3555, 0o3557, 0o3560,
|
||||||
|
0o3561, 0o3563, 0o3566, 0o3571, 0o3576, 0o3601, 0o3602, 0o3603, 0o3604, 0o3605,
|
||||||
|
0o3606, 0o3607, 0o3610, 0o3611, 0o3612, 0o3613, 0o3614, 0o3615, 0o3616, 0o3617,
|
||||||
|
0o3620, 0o3621, 0o3622, 0o3623, 0o3624, 0o3625, 0o3626, 0o3627, 0o3630, 0o3631,
|
||||||
|
0o3632, 0o3633, 0o3634, 0o3635, 0o3636, 0o3642, 0o3643, 0o3644, 0o3645, 0o3646,
|
||||||
|
0o3647, 0o3650, 0o3651, 0o3652, 0o3653, 0o3654, 0o3655, 0o3656, 0o3657, 0o3660,
|
||||||
|
0o3661, 0o3662, 0o3663, 0o3664, 0o3665, 0o3666, 0o3667, 0o3670, 0o3671, 0o3672,
|
||||||
|
0o3673, 0o3674, 0o3675, 0o3676,
|
||||||
|
}
|
||||||
|
|
||||||
|
var convWordMap = make(map[uint16]int, 1024)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
for i, v := range ConvWords {
|
||||||
|
convWordMap[v] = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bit数组转换为数字,左边为最高有效位
|
||||||
|
// v - 0/1数组,数组的每个值都只能是0或1
|
||||||
|
func ToVal(v []int) uint16 {
|
||||||
|
if len(v) > 15 {
|
||||||
|
panic(fmt.Errorf("不支持15位以上"))
|
||||||
|
}
|
||||||
|
val := uint16(0)
|
||||||
|
l := len(v)
|
||||||
|
for i := 0; i < l; i++ {
|
||||||
|
if v[i] == 1 {
|
||||||
|
val += (1 << (l - i - 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数字转换为bit数组,左边为最高有效位
|
||||||
|
func ToBits(val int, count int) []int {
|
||||||
|
bs := make([]int, count)
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
tmp := 1 << (count - 1 - i)
|
||||||
|
if (val & (tmp)) == (tmp) {
|
||||||
|
bs[i] = 1
|
||||||
|
} else {
|
||||||
|
bs[i] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bs
|
||||||
|
}
|
||||||
|
|
||||||
|
// 11位字转换回10位字
|
||||||
|
func From11(b11 []int) ([]int, error) {
|
||||||
|
v11 := ToVal(b11)
|
||||||
|
v10, ok := convWordMap[uint16(v11)]
|
||||||
|
if ok {
|
||||||
|
return ToBits(v10, 10), nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("错误的11位字")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 10位字转换为11位字
|
||||||
|
func To11(b10 []int) []int {
|
||||||
|
if len(b10) != 10 {
|
||||||
|
panic(fmt.Errorf("应答器编码10位字转换为11位字参数异常: 位数不是10, len=%d", len(b10)))
|
||||||
|
}
|
||||||
|
v10 := ToVal(b10)
|
||||||
|
if v10 > 1023 {
|
||||||
|
panic(fmt.Errorf("应答器编码10位字转换为11位字参数异常: 10位字转为整数不能大于1023, v10=%d", v10))
|
||||||
|
}
|
||||||
|
v11 := ConvWords[v10]
|
||||||
|
return ToBits(int(v11), 11)
|
||||||
|
}
|
44
third_party/balise/conv_test.go
vendored
Normal file
44
third_party/balise/conv_test.go
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package balise_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"joylink.club/bj-rtsts-server/third_party/balise"
|
||||||
|
)
|
||||||
|
|
||||||
|
var by830 = []int{
|
||||||
|
0x90, 0x02, 0x7F, 0xC7, 0x8C, 0x0A, 0xC5, 0x40, 0x7B, 0x20, 0x00, 0x21, 0x68, 0x05, 0x9A, 0x04, 0x09, 0x61, 0x0B, 0x0A,
|
||||||
|
0xF0, 0x05, 0x0B, 0xB9, 0x05, 0x0E, 0xD8, 0x03, 0x1E, 0xDD, 0x09, 0x09, 0xC4, 0x09, 0x0D, 0x4E, 0xFF, 0x1B, 0x00, 0xAC,
|
||||||
|
0x80, 0x00, 0x64, 0x00, 0x5A, 0x9A, 0x7F, 0x00, 0xB0, 0x0D, 0x68, 0x04, 0x0C, 0xB2, 0x00, 0x00, 0xC2, 0x00, 0x75, 0xC0,
|
||||||
|
0x30, 0x74, 0x86, 0x10, 0x74, 0xA0, 0x30, 0x78, 0x66, 0x10, 0x78, 0x60, 0x30, 0x75, 0x26, 0x10, 0x75, 0x20, 0x30, 0x79,
|
||||||
|
0x86, 0x10, 0x79, 0x80, 0x30, 0x7A, 0x06, 0x10, 0x7A, 0x00, 0x30, 0x7C, 0x46, 0x10, 0x7C, 0x60, 0x30, 0x7C, 0xA6, 0x10,
|
||||||
|
0x82, 0x9F, 0xFF, 0xFF,
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConvList(t *testing.T) {
|
||||||
|
// 数量
|
||||||
|
assert.Equal(t, 1024, len(balise.ConvWords))
|
||||||
|
// 后面的数比前面大
|
||||||
|
for i := 0; i < 1023; i++ {
|
||||||
|
assert.Less(t, balise.ConvWords[i], balise.ConvWords[i+1])
|
||||||
|
}
|
||||||
|
// 前512项和
|
||||||
|
sum_q := 0
|
||||||
|
for i := 0; i < 512; i++ {
|
||||||
|
sum_q += int(balise.ConvWords[i])
|
||||||
|
}
|
||||||
|
assert.Equal(t, 267528, sum_q)
|
||||||
|
// 后512项和
|
||||||
|
sum_b := 0
|
||||||
|
for i := 512; i < 1024; i++ {
|
||||||
|
sum_b += int(balise.ConvWords[i])
|
||||||
|
}
|
||||||
|
// 总1024项和
|
||||||
|
assert.Equal(t, 1048064, sum_q+sum_b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTo11(t *testing.T) {
|
||||||
|
b10 := []int{0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
|
||||||
|
balise.To11(b10)
|
||||||
|
}
|
23
third_party/example/main.go
vendored
23
third_party/example/main.go
vendored
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"time"
|
|
||||||
|
|
||||||
"joylink.club/bj-rtsts-server/third_party/udp"
|
"joylink.club/bj-rtsts-server/third_party/balise"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestMsg struct {
|
type TestMsg struct {
|
||||||
@ -29,7 +29,7 @@ func handleUdpMsg(b []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
udp.NewServer("127.0.0.1:6666", handleUdpMsg).Listen()
|
// udp.NewServer("127.0.0.1:6666", handleUdpMsg).Listen()
|
||||||
|
|
||||||
// client := udp.NewClient("127.0.0.1:7777")
|
// client := udp.NewClient("127.0.0.1:7777")
|
||||||
// for i := 0; i < 1000; i++ {
|
// for i := 0; i < 1000; i++ {
|
||||||
@ -39,5 +39,20 @@ func main() {
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
time.Sleep(time.Second * 60)
|
// time.Sleep(time.Second * 60)
|
||||||
|
// for i, v := range balise.ConvWords {
|
||||||
|
// fmt.Printf("0%o,", v)
|
||||||
|
// if i%10 == 9 {
|
||||||
|
// fmt.Println()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
v10 := balise.ToVal([]int{
|
||||||
|
1, 1, 1,
|
||||||
|
1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1})
|
||||||
|
fmt.Println(v10)
|
||||||
|
bs := balise.ToBits(1982, 11)
|
||||||
|
fmt.Println(bs)
|
||||||
|
// fmt.Printf("%o\n", balise.ConvWords[511])
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: ibpGraphics.proto
|
// source: ibpGraphics.proto
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: picture.proto
|
// source: picture.proto
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: pslGraphics.proto
|
// source: pslGraphics.proto
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: relayCabinetLayoutGraphics.proto
|
// source: relayCabinetLayoutGraphics.proto
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: stationLayoutGraphics.proto
|
// source: stationLayoutGraphics.proto
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.1
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.1
|
// protoc v4.23.1
|
||||||
// source: device_state.proto
|
// source: device_state.proto
|
||||||
|
|
||||||
|
@ -34,6 +34,12 @@ func HandleTurnoutOperation(simulation *VerifySimulation, req *request_proto.Tur
|
|||||||
fi.SetTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
fi.SetTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
||||||
case request_proto.Turnout_CancelJC:
|
case request_proto.Turnout_CancelJC:
|
||||||
fi.CancelTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
fi.CancelTurnoutFault(simulation.World, uid, component_proto.Turnout_JC)
|
||||||
|
case request_proto.Turnout_ForceDw:
|
||||||
|
fi.ForceTurnoutDw(simulation.World, uid)
|
||||||
|
case request_proto.Turnout_ForceFw:
|
||||||
|
fi.ForceTurnoutFw(simulation.World, uid)
|
||||||
|
case request_proto.Turnout_CancelForce:
|
||||||
|
fi.CancelTurnoutForce(simulation.World, uid)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
panic(fmt.Sprintf("未知的道岔操作:%s", req.Operation))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user