123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- package main
- import (
- "lc-smartX/lc"
- "testing"
- "time"
- )
- func TestProgram(t *testing.T) {
- //先用以下示例将静态节目发送至屏,P000为初始节目,P001为来车警示节目,LOGO为开机节目
- //单个屏设备连接不能并发发送数据,未作实现
- client := lc.NewScreen("支路1屏", "192.168.1.200", "5005")
- time.Sleep(2 * time.Second)
- ////清除所有文件
- //client.DelFile("P002")
- //client.DelFile("P001")
- //time.Sleep(1*time.Second)
- //发送flash文件节目 静态Logo
- //file := lc.FlashFile{}
- //file.SetMsg("龙弛智慧", lc.Green)
- //file.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
- //file.SetOrigin(0, true, 0)
- //file.SetArea(64, true, 16)
- //client.TextFlash([]lc.FlashFile{file}, true)
- //time.Sleep(1 * time.Second)
- //发送flash文件节目 减速慢行
- file1 := lc.FlashFile{}
- file1.SetMsg("减速慢行", lc.Yellow)
- file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
- file1.SetOrigin(0, true, 0)
- file1.SetArea(64, true, 16)
- client.TextFlash([]lc.FlashFile{file1}, false)
- time.Sleep(1 * time.Second)
- //发送flash文件节目 主路来车
- //file2 := lc.FlashFile{}
- //file2.SetMsg("\\T002huang|", lc.Red)
- //file2.SetMode(lc.DefaultRunMode, lc.Flicker)
- //file2.SetOrigin(0, true, 0)
- //file2.SetArea(16, true, 16)
- //file3 := lc.FlashFile{}
- //file3.SetMsg("主路来车", lc.Red)
- //file3.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
- //file3.SetOrigin(16, true, 0)
- //file3.SetArea(48, true, 16)
- //client.TextFlash([]lc.FlashFile{file2,file3}, false)
- //time.Sleep(1 * time.Second)
- //发送位图文件-不报错,不成功
- //bit, err := os.ReadFile("./lc/bitmap/huang.bcm")
- //if err != nil {
- // logrus.Error("读取图库文件失败:", err)
- // return
- //}
- //client.Bitmap("T000", bit)
- //time.Sleep(1*time.Second)
- //发送动态区
- //file1 := lc.FlashFile{}
- //file1.SetMsg("动态", lc.Blue)
- //file1.SetMode(lc.DefaultRunMode, lc.DefaultDisplayMode)
- //file1.SetOrigin(32, true, 0)
- //file1.SetArea(32, true, 16)
- //client.TextFlash(file1)
- //client.TextRam(file1)
- //time.Sleep(1*time.Second)
- //锁定/解锁节目
- //client.Lock(1, "P000")
- //time.Sleep(1*time.Second)
- //删除动态区
- //client.DelRamText(0)
- ////查询当前状态
- client.State()
- time.Sleep(time.Second * 1)
- client.Info()
- time.Sleep(time.Second * 1)
- }
|