static void reader_OnMessageNotificationReceived(Invengo.NetAPI.Core.BaseReader reader, Invengo.NetAPI.Core.IMessageNotification msg) { if (msg.StatusCode != 0) { //显示错误信息 throw (new Exception(msg.ErrInfo)); } String msgType = msg.GetMessageType(); msgType = msgType.Substring(msgType.LastIndexOf('.') + 1); switch (msgType) { #region RXD_TagData case "RXD_TagData": { IRP1.RXD_TagData m = (IRP1.RXD_TagData)msg; if (OnRFIDDisplay != null) { OnRFIDDisplay(m); } } break; #endregion #region RXD_IOTriggerSignal_800 case "RXD_IOTriggerSignal_800": { IRP1.RXD_IOTriggerSignal_800 m = (IRP1.RXD_IOTriggerSignal_800)msg; if (m.ReceivedMessage.IsStart) { } else { } } break; #endregion } }
/// <summary> /// 接收到读写器消息触发事件 /// </summary> /// <param name="reader">读写器类</param> /// <param name="msg">消息内容</param> void reader_OnMessageNotificationReceived(Invengo.NetAPI.Core.BaseReader reader, Invengo.NetAPI.Core.IMessageNotification msg) { if (msg.StatusCode != 0) { //显示错误信息 showMsg(msg.ErrInfo); return; } String msgType = msg.GetMessageType(); msgType = msgType.Substring(msgType.LastIndexOf('.') + 1); switch (msgType) { #region RXD_TagData case "RXD_TagData": { IRP1.RXD_TagData m = (IRP1.RXD_TagData)msg; string tagType = m.ReceivedMessage.TagType; display(m); } break; #endregion #region RXD_IOTriggerSignal_800 case "RXD_IOTriggerSignal_800": { IRP1.RXD_IOTriggerSignal_800 m = (IRP1.RXD_IOTriggerSignal_800)msg; if (m.ReceivedMessage.IsStart) { changeCtrlEnable("scan"); showMsg(" I/O 触发,正在读卡..."); } else { changeCtrlEnable("conn"); showMsg(" I/O 触发,停止读卡"); } } break; #endregion } }
void reader_OnMessageNotificationReceived(Invengo.NetAPI.Core.BaseReader reader, Invengo.NetAPI.Core.IMessageNotification msg) { // String nowString = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // MessageBox.Show(nowString); //brett // String utcString = nowString; if (msg.StatusCode != 0) { showMsg(msg.ErrInfo); return; } String msgType = msg.GetMessageType(); msgType = msgType.Substring(msgType.LastIndexOf('.') + 1); switch (msgType) { #region RXD_TagData case "RXD_TagData": { IRP1.RXD_TagData m = (IRP1.RXD_TagData)msg; string rssi = m.ReceivedMessage.RSSI[0].ToString(); //RSSI SendMQTT(m); // Sends to MQTT display(m); // Local Display } break; #endregion #region RXD_IOTriggerSignal_800 case "RXD_IOTriggerSignal_800": { IRP1.RXD_IOTriggerSignal_800 m = (IRP1.RXD_IOTriggerSignal_800)msg; if (m.ReceivedMessage.IsStart) { changeCtrlEnable("scan"); // lbl_msg.Text = " Reading"; // btn_Stop.Enabled = true; // btn_ReadEPC.Enabled = false; } else { changeCtrlEnable("conn"); //lbl_msg.Text = " stop"; //btn_Stop.Enabled = false; //btn_ReadEPC.Enabled = true; } } break; #endregion } }