|
@@ -62,6 +62,18 @@ func (s *Device) Process() {
|
|
|
logger.Logger.Errorf("Process[case '61'] SN not found \n")
|
|
|
break
|
|
|
}
|
|
|
+
|
|
|
+ err = Dev.UpdateScreensStatus(screens.ScreensCode, request.DeviceStatus{
|
|
|
+ Status: 1,
|
|
|
+ PlayStatus: 1,
|
|
|
+ DisplayStatus: 1,
|
|
|
+ SourceStatus: 1,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ logger.Logger.Error("[Handle] UpdateScreensStatus err", zap.Error(err))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
s.info = screens
|
|
|
devices[s.info.Sn] = *s
|
|
|
s.conn.Write(buffer.Bytes())
|
|
@@ -98,17 +110,13 @@ func (s *Device) Handle() {
|
|
|
case <-t2.C:
|
|
|
state := request.DeviceStatus{
|
|
|
Status: 1,
|
|
|
- PlayStatus: 1,
|
|
|
- DisplayStatus: 1,
|
|
|
- SourceStatus: 1,
|
|
|
+ PlayStatus: s.info.PlayStatus,
|
|
|
+ DisplayStatus: s.info.DisplayStatus,
|
|
|
+ SourceStatus: s.info.SourceStatus,
|
|
|
}
|
|
|
if time.Now().Add(-2*time.Minute).After(s.lastTime) || s.lastTime.IsZero() {
|
|
|
//离线
|
|
|
state.Status = 0
|
|
|
- state.PlayStatus = 0
|
|
|
- state.DisplayStatus = 0
|
|
|
- state.SourceStatus = 0
|
|
|
-
|
|
|
err := Dev.UpdateScreensStatus(s.info.ScreensCode, state)
|
|
|
if err != nil {
|
|
|
logger.Logger.Error("[Handle] UpdateScreensStatus err", zap.Error(err))
|