rts-sim-testing-service/third_party/example/rssp/main.go

47 lines
1.1 KiB
Go
Raw Normal View History

2023-11-14 10:31:06 +08:00
package main
import (
2023-11-14 17:57:54 +08:00
"fmt"
"time"
2023-11-14 10:31:06 +08:00
"joylink.club/bj-rtsts-server/config"
2023-11-14 17:57:54 +08:00
"joylink.club/bj-rtsts-server/third_party/example/rssp/ci"
2023-11-14 10:31:06 +08:00
"joylink.club/bj-rtsts-server/third_party/message"
)
2023-11-14 17:57:54 +08:00
func main() {
// message.InitRsspCrcTable()
2023-11-14 17:57:54 +08:00
ci.InitCiServerCodePoints()
2023-11-14 10:31:06 +08:00
//
2023-11-14 17:57:54 +08:00
cfg := &config.RsspAxleConfig{}
cfg.City = "北京"
cfg.LineId = "12"
cfg.CentralizedStation = "酒仙桥"
cfg.RsspCfg.SrcAddr = 0x01
cfg.RsspCfg.DstAddr = 0x02
cfg.RsspCfg.DataVer1 = 0x0011
cfg.RsspCfg.DataVer2 = 0x0012
cfg.RsspCfg.SID1 = 0x10000000
cfg.RsspCfg.SID2 = 0x00000001
cfg.RsspCfg.SINIT1 = 0x01
cfg.RsspCfg.SINIT2 = 0x02
cfg.RsspCfg.SendingPeriod = 500
cfg.RsspCfg.SsrRsspTimeout = 3
cfg.RsspCfg.Mtv = 3
cfg.RsspCfg.DeviceA = true
cfg.RsspCfg.PicType = message.PIC_MASTER
cfg.RsspCfg.RemoteIp = "192.168.3.5"
cfg.RsspCfg.RemoteUdpPort = 6666
cfg.RsspCfg.LocalUdpPort = 7777
2023-11-14 10:31:06 +08:00
//
2023-11-14 17:57:54 +08:00
ciServer := ci.NewRsspCiServer(cfg)
ciServer.Start()
fmt.Println("==>>ci server ...")
for {
time.Sleep(2 * time.Second)
ciServer.SendSectionReset("北京_12_酒仙桥_9G", true, false)
}
2023-11-14 10:31:06 +08:00
//
2023-11-14 17:57:54 +08:00
time.Sleep(3600 * time.Second)
2023-11-14 10:31:06 +08:00
}