private void OnServiceREQCmd(object sender, CService.CCmdArgs e) { lock (cmdLock) { ShowServiceLog("【REQ COMMAND】:" + DateTime.Now.ToString("HH:mm:ss.") + DateTime.Now.Millisecond.ToString("D3") + "\r\n", Color.Black); ShowServiceLog("【Topic】:", Color.Black); ShowServiceLog(e.topic + "\r\n", Color.Blue); ShowServiceLog("【Message】:", Color.Black); ShowServiceLog(e.message + "\r\n", Color.Green); ShowServiceStatus("接收到设备编号【" + e.data.Data[0].ID + "】应答指令", false); } }
private void OnServiceRPTCmd(object sender, CService.CCmdArgs e) { lock (cmdLock) { ShowServiceLog("【RPT COMMAND】:" + DateTime.Now.ToString("HH:mm:ss.") + DateTime.Now.Millisecond.ToString("D3") + "\r\n", Color.Black); ShowServiceLog("【Topic】:", Color.Black); ShowServiceLog(e.topic + "\r\n", Color.Blue); ShowServiceLog("【Message】:", Color.Black); ShowServiceLog(e.message + "\r\n", Color.Green); ShowServiceStatus("接收到设备编号【" + e.data.Data[0].ID + "】请求指令", false); List <CDevList> devList = new List <CDevList>(); for (int i = 0; i < e.data.Data.Count; i++) { devList.Add(new CDevList() { idNo = e.data.Data[i].ID, Name = e.data.Data[i].Name } ); } string er = string.Empty; string cmdInfo = txtCmdInfo.Text; ECmdType cmdType = ECmdType.报状态; string cmdName = cmdType.ToString(); if (!_service.Publish_Device(EMessageType.广播指令, cmdType, cmdName, cmdInfo, devList, out er)) { ShowServiceStatus(er, true); return; } } }