main.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. //单个屏设备连接不能并发发送数据,未作实现
  19. //conn, err := net.Dial("tcp", "192.168.110.200:5000")
  20. //if err != nil {
  21. // logrus.Fatalln("建立连接失败:", err)
  22. //}
  23. //client := lc.NewScreen("支路1屏", conn)
  24. //开关机
  25. //client.TurnOnOff(false)
  26. //清除所有文件
  27. //client.DelFile("")
  28. //time.Sleep(1 * time.Second)
  29. //删除指定文件
  30. //client.DelFile("P002")
  31. //time.Sleep(1*time.Second)
  32. //发送flash文件节目
  33. //file := lc.FlashFile{}
  34. //file.SetMsg("龙弛智慧", lc.Green)
  35. //file.SetMode(lc.DefaultRunMode, lc.DefaultDispMode)
  36. //file.SetOrigin(0, true, 0)
  37. //file.SetArea(64, true, 16)
  38. //client.TextFlash(file, true)
  39. //time.Sleep(1 * time.Second)
  40. //发送位图文件-不报错,不成功
  41. //file, err := os.ReadFile("./lc/bitmap/T000.bcm")
  42. //if err != nil {
  43. // logrus.Error("读取图库文件失败:", err)
  44. // return
  45. //}
  46. //client.Bitmap("T000", file)
  47. //time.Sleep(1*time.Second)
  48. //发送动态区
  49. //file1 := lc.FlashFile{}
  50. //file1.SetMsg("动态", lc.Blue)
  51. //file1.SetMode(lc.DefaultRunMode, lc.DefaultDispMode)
  52. //file1.SetOrigin(32, true, 0)
  53. //file1.SetArea(32, true, 16)
  54. //client.TextFlash(file1)
  55. //client.TextRam(file1)
  56. //time.Sleep(1*time.Second)
  57. //锁定/解锁节目
  58. //client.Lock(1, "P000")
  59. //time.Sleep(1*time.Second)
  60. //删除动态区
  61. //client.DelRamText(0)
  62. ////查询当前状态
  63. //client.State()
  64. //time.Sleep(time.Second * 1)
  65. //client.Info()
  66. //time.Sleep(time.Second * 2)
  67. }