12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package lc
- import (
- "fmt"
- "lc-smartX/bx"
- "lc-smartX/util/mqtt"
- "net"
- )
- // Screener 屏接口
- type Screener interface {
- Display(int)
- }
- type Screen struct {
- Name string
- Addr string
- conn net.Conn
- liveState bool
- StateInfo *bx.StateInfo //状态信息
- Params *bx.Params //屏参
- }
- func NewScreen(name string, ip, port string) *Screen {
- s := &Screen{
- Name: name,
- Addr: fmt.Sprintf("%s:%s", ip, port),
- StateInfo: &bx.StateInfo{},
- Params: &bx.Params{},
- }
- s.Reconnect()
- return s
- }
- func (s *Screen) Display(id int) {
- msg := "来车new-55"
- if id == 0 {
- msg = "路口new-54"
- }
- GetMQTTMgr().Publish("000000/cltled/LED20230408/down/switch", []byte(msg), mqtt.AtMostOnce, ToCloud)
- }
- // Correct 校正时间
- func (s *Screen) Correct() {
- }
- // Reconnect 重连
- func (s *Screen) Reconnect() {
- }
|