package main

import (
	"github.com/sirupsen/logrus"
	"lc/common/util"
	"lc/edge/led_screen/clt_client"
)

var pool *util.Pool
var IDGen util.IdWorker

var appName = "led_screen"
var appVersion = "1.3.0"

func main() {
	util.InitLogrus("release")
	if err := loadAppConfig(); err != nil {
		logrus.Errorf("加载app.json失败:%s", err.Error())
		return
	}

	IDGen.InitIdWorker(1000, 1)
	//加载httpclient和vsn
	clt_client.GetClient()
	GetMQTTMgr()
	if err := GetLedMgr().initAll(); err != nil {
		logrus.Errorf("调用initAllLcDevice失败:%s", err.Error())
		return
	}
	pool = util.NewPool(5)
	pool.Add(GetMQTTMgr().MQTTMessageHandle, 1)
	pool.Add(GetMQTTMgr().MQTTConnectMgr, 2)
	pool.Run()
	pool.Wait()
}
