package main import ( "lc-smartX/lc" "lc-smartX/util/gopool" "time" ) func main() { gopool.SetCap(64) gopool.Go(lc.StartEventServer) //等事件服务先启动 time.Sleep(1 * time.Second) is := &lc.IntersectionServer{ Main: time.NewTicker(5 * time.Second), //主路状态回滚 Sub: time.NewTicker(5 * time.Second), //支路状态回滚 ReTicker: time.NewTicker(19 * time.Second), //重连 } lc.StartSmartXServer(is) //先用以下示例将静态节目发送至屏,P000为初始节目,P001为来车警示节目,LOGO为开机节目 //单个屏设备连接不能并发发送数据,未作实现 //conn, err := net.Dial("tcp", "192.168.110.200:5000") //if err != nil { // logrus.Fatalln("建立连接失败:", err) //} //client := lc.NewScreen("支路1屏", conn) //开关机 //client.TurnOnOff(false) //清除所有文件 //client.DelFile("") //time.Sleep(1 * time.Second) //删除指定文件 //client.DelFile("P002") //time.Sleep(1*time.Second) //发送flash文件节目 //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(file, true) //time.Sleep(1 * time.Second) //发送位图文件-不报错,不成功 //file, err := os.ReadFile("./lc/bitmap/T000.bcm") //if err != nil { // logrus.Error("读取图库文件失败:", err) // return //} //client.Bitmap("T000", file) //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 * 2) }