예제 #1
0
 /// <summary>
 /// 更改是否自身播放音乐状态反转
 /// </summary>
 /// <param name="msg">user:wali_Server type:other
 /// msg:wali_C40BCB80050A;8;8215;88888888;1$/r$</param>
 public static void UpdatePlayState(string msg)
 {
     if (msg.IndexOf(";") > 0)
     {
         string userid   = msg.Split(';')[0];
         string deviceid = msg.Split(';')[3];
         //
         using (HsfDBContext hsfDBContext = new HsfDBContext())
         {
             var soundhostEntity = hsfDBContext.sound_host.Where(t => t.userid == userid && t.deviceid == deviceid).FirstOrDefault();
             if (soundhostEntity.playstate == 1 || soundhostEntity.playstate == null)
             {
                 soundhostEntity.playstate = 0;
             }
             else
             {
                 soundhostEntity.playstate = 1;
             }
             hsfDBContext.SaveChanges();
         }
         SoundPassiveRequest _SoundPassiveRequest = new SoundPassiveRequest()
         {
             sessionId = Guid.NewGuid().ToString(),
             deviceId  = deviceid,
             actionId  = "8215",
             blwakeup  = "0"
         };
         DoRequestEvent(_SoundPassiveRequest);
     }
 }
예제 #2
0
        /// <summary>
        /// 向音响发送指令
        /// </summary>
        /// <param name="req"></param>
        public static void DoRequestEvent(SoundPassiveRequest _SoundPassiveRequest)
        {
            if (_SmartHomeNlpRequestMsg == null)
            {
                return;
            }

            Task.Run(() =>
            {
                _SmartHomeNlpRequestMsg(_SoundPassiveRequest);
            });
        }
예제 #3
0
 /// <summary>
 /// 音响升级
 /// </summary>
 /// <param name="msg">user:wali_Server type:other
 /// msg:wali_C40BCB80050A;8;8216;88888888;1$/r$</param>
 public static void SoundUpgrade(string msg)
 {
     if (msg.IndexOf(";") > 0)
     {
         string userid   = msg.Split(';')[0];
         string deviceid = msg.Split(';')[3];
         SoundPassiveRequest _SoundPassiveRequest = new SoundPassiveRequest()
         {
             sessionId = Guid.NewGuid().ToString(),
             deviceId  = deviceid,
             actionId  = "8216",
             blwakeup  = "0"
         };
         DoRequestEvent(_SoundPassiveRequest);
     }
 }