Example #1
0
        /// <summary>
        /// 接收信号处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MDispatch_SmartMessage(object sender, EventArgs e)
        {
            IoTEventArg arg = (IoTEventArg)e;

            if (arg.Data.cmd == null)
            {
                return;
            }
            mDispatch.DoWork(arg.Data);
        }
Example #2
0
        /// <summary>
        /// 接收信息的回调函数
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="len"></param>
        void ReceiveMsgCallback(byte[] msg, int len)
        {
            string      strJson = Encoding.UTF8.GetString(msg, 0, msg.Length);
            IoTEventArg arg     = new IoTEventArg();

            arg.Data = JsonConvert.DeserializeObject <IoTModel>(strJson);
            EventHandler handler = SmartMessage;

            handler?.Invoke(this, arg);
        }