program_test.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package main
  2. import (
  3. "lc-smartX/lc"
  4. "testing"
  5. "time"
  6. )
  7. func TestProgram(t *testing.T) {
  8. //先用以下示例将静态节目发送至屏,P000为初始节目,P001为来车警示节目,LOGO为开机节目
  9. //单个屏设备连接不能并发发送数据,未作实现
  10. client := lc.NewScreen("支路1屏", "192.168.1.200", "5005")
  11. time.Sleep(2 * time.Second)
  12. client.SendRam(0)
  13. time.Sleep(2 * time.Second)
  14. client.SendRam(1)
  15. ////清除所有文件
  16. //time.Sleep(1*time.Second)
  17. //client.DelFile()
  18. //发送flash文件节目 静态Logo
  19. //file := lc.FlashFile{}
  20. //file.SetMsg("龙弛智慧", lc.Green)
  21. //file.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  22. //file.SetOrigin(0, true, 0)
  23. //file.SetArea(64, true, 16)
  24. //client.TextFlash([]lc.FlashFile{file}, true)
  25. //time.Sleep(1 * time.Second)
  26. //发送flash文件节目 减速慢行
  27. //file1 := lc.FlashFile{}
  28. //file1.SetMsg("减速慢行", lc.Yellow)
  29. //file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  30. //file1.SetOrigin(0, true, 0)
  31. //file1.SetArea(64, true, 16)
  32. //client.TextFlash([]lc.FlashFile{file1}, "P000",false)
  33. //time.Sleep(1 * time.Second)
  34. //发送flash文件节目 主路来车
  35. //file2 := lc.FlashFile{}
  36. //file2.SetMsg("\\T002huang|", lc.Red)
  37. //file2.SetMode(lc.DefaultRunMode, lc.Flicker)
  38. //file2.SetOrigin(0, true, 0)
  39. //file2.SetArea(16, true, 16)
  40. //file3 := lc.FlashFile{}
  41. //file3.SetMsg("主路来车", lc.Red)
  42. //file3.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  43. //file3.SetOrigin(16, true, 0)
  44. //file3.SetArea(48, true, 16)
  45. //client.TextFlash([]lc.FlashFile{file2,file3}, false)
  46. //time.Sleep(1 * time.Second)
  47. //发送位图文件-不报错,不成功
  48. //bit, err := os.ReadFile("./lc/bitmap/huang.bcm")
  49. //if err != nil {
  50. // logrus.Error("读取图库文件失败:", err)
  51. // return
  52. //}
  53. //client.Bitmap("T000", bit)
  54. //time.Sleep(1*time.Second)
  55. //发送动态区
  56. //file1 := lc.FlashFile{}
  57. //file1.SetMsg("动态", lc.Blue)
  58. //file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  59. //file1.SetOrigin(32, true, 0)
  60. //file1.SetArea(32, true, 16)
  61. //client.TextFlash(file1)
  62. //client.TextRam(file1)
  63. //time.Sleep(1*time.Second)
  64. //锁定/解锁节目
  65. //client.Lock(1, "P000")
  66. //time.Sleep(1*time.Second)
  67. //删除动态区
  68. //client.DelRamText(0)
  69. ////查询当前状态
  70. client.State()
  71. time.Sleep(time.Second * 1)
  72. client.Info()
  73. time.Sleep(time.Second * 1)
  74. }