main.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package main
  2. import (
  3. "lc-smartX/lc"
  4. "lc-smartX/util/gopool"
  5. "time"
  6. )
  7. func main() {
  8. gopool.SetCap(64)
  9. gopool.Go(lc.StartEventServer)
  10. //等事件服务先启动
  11. time.Sleep(1 * time.Second)
  12. is := &lc.IntersectionServer{
  13. Main: time.NewTicker(5 * time.Second), //主路状态回滚
  14. Sub: time.NewTicker(5 * time.Second), //支路状态回滚
  15. ReTicker: time.NewTicker(19 * time.Second), //重连
  16. }
  17. lc.StartSmartXServer(is)
  18. //先用以下示例将静态节目发送至屏,P000为初始节目,P001为来车警示节目,LOGO为开机节目
  19. //单个屏设备连接不能并发发送数据,未作实现
  20. //conn, err := net.Dial("tcp", "192.168.110.200:5000")
  21. //if err != nil {
  22. // logrus.Fatalln("建立连接失败:", err)
  23. //}
  24. //client := lc.NewScreen("支路1屏", conn)
  25. //开关机
  26. //client.TurnOnOff(false)
  27. //清除所有文件
  28. //client.DelFile("")
  29. //time.Sleep(1 * time.Second)
  30. //删除指定文件
  31. //client.DelFile("P002")
  32. //time.Sleep(1*time.Second)
  33. //发送flash文件节目
  34. //file := lc.FlashFile{}
  35. //file.SetMsg("龙弛智慧", lc.Green)
  36. //file.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  37. //file.SetOrigin(0, true, 0)
  38. //file.SetArea(64, true, 16)
  39. //client.TextFlash(file, true)
  40. //time.Sleep(1 * time.Second)
  41. //发送位图文件-不报错,不成功
  42. //file, err := os.ReadFile("./lc/bitmap/T000.bcm")
  43. //if err != nil {
  44. // logrus.Error("读取图库文件失败:", err)
  45. // return
  46. //}
  47. //client.Bitmap("T000", file)
  48. //time.Sleep(1*time.Second)
  49. //发送动态区
  50. //file1 := lc.FlashFile{}
  51. //file1.SetMsg("动态", lc.Blue)
  52. //file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  53. //file1.SetOrigin(32, true, 0)
  54. //file1.SetArea(32, true, 16)
  55. //client.TextFlash(file1)
  56. //client.TextRam(file1)
  57. //time.Sleep(1*time.Second)
  58. //锁定/解锁节目
  59. //client.Lock(1, "P000")
  60. //time.Sleep(1*time.Second)
  61. //删除动态区
  62. //client.DelRamText(0)
  63. ////查询当前状态
  64. //client.State()
  65. //time.Sleep(time.Second * 1)
  66. //client.Info()
  67. //time.Sleep(time.Second * 2)
  68. }