program_test.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. ////清除所有文件
  13. //client.DelFile("P002")
  14. //client.DelFile("P001")
  15. //time.Sleep(1*time.Second)
  16. //发送flash文件节目 静态Logo
  17. //file := lc.FlashFile{}
  18. //file.SetMsg("龙弛智慧", lc.Green)
  19. //file.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  20. //file.SetOrigin(0, true, 0)
  21. //file.SetArea(64, true, 16)
  22. //client.TextFlash([]lc.FlashFile{file}, true)
  23. //time.Sleep(1 * time.Second)
  24. //发送flash文件节目 减速慢行
  25. file1 := lc.FlashFile{}
  26. file1.SetMsg("减速慢行", lc.Yellow)
  27. file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  28. file1.SetOrigin(0, true, 0)
  29. file1.SetArea(64, true, 16)
  30. client.TextFlash([]lc.FlashFile{file1}, false)
  31. time.Sleep(1 * time.Second)
  32. //发送flash文件节目 主路来车
  33. //file2 := lc.FlashFile{}
  34. //file2.SetMsg("\\T002huang|", lc.Red)
  35. //file2.SetMode(lc.DefaultRunMode, lc.Flicker)
  36. //file2.SetOrigin(0, true, 0)
  37. //file2.SetArea(16, true, 16)
  38. //file3 := lc.FlashFile{}
  39. //file3.SetMsg("主路来车", lc.Red)
  40. //file3.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  41. //file3.SetOrigin(16, true, 0)
  42. //file3.SetArea(48, true, 16)
  43. //client.TextFlash([]lc.FlashFile{file2,file3}, false)
  44. //time.Sleep(1 * time.Second)
  45. //发送位图文件-不报错,不成功
  46. //bit, err := os.ReadFile("./lc/bitmap/huang.bcm")
  47. //if err != nil {
  48. // logrus.Error("读取图库文件失败:", err)
  49. // return
  50. //}
  51. //client.Bitmap("T000", bit)
  52. //time.Sleep(1*time.Second)
  53. //发送动态区
  54. //file1 := lc.FlashFile{}
  55. //file1.SetMsg("动态", lc.Blue)
  56. //file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
  57. //file1.SetOrigin(32, true, 0)
  58. //file1.SetArea(32, true, 16)
  59. //client.TextFlash(file1)
  60. //client.TextRam(file1)
  61. //time.Sleep(1*time.Second)
  62. //锁定/解锁节目
  63. //client.Lock(1, "P000")
  64. //time.Sleep(1*time.Second)
  65. //删除动态区
  66. //client.DelRamText(0)
  67. ////查询当前状态
  68. client.State()
  69. time.Sleep(time.Second * 1)
  70. client.Info()
  71. time.Sleep(time.Second * 1)
  72. }