private void ProcessFrame(short ver, short msg_type, int msg_id, byte[] data) { int cursor = 0; switch (msg_type) { case 61: try { BitArray bitArray = Util.ConvertByteArrayToBitArray(data); int count = bitArray.Count; this.notificationQueue.Enqueue((object)MSG_RO_ACCESS_REPORT.FromBitArray(ref bitArray, ref cursor, count)); break; } catch { break; } case 62: try { BitArray bitArray = Util.ConvertByteArrayToBitArray(data); int count = bitArray.Count; this.notificationQueue.Enqueue((object)MSG_KEEPALIVE.FromBitArray(ref bitArray, ref cursor, count)); break; } catch { break; } case 63: try { BitArray bitArray = Util.ConvertByteArrayToBitArray(data); int count = bitArray.Count; MSG_READER_EVENT_NOTIFICATION eventNotification = MSG_READER_EVENT_NOTIFICATION.FromBitArray(ref bitArray, ref cursor, count); if (this.conn_evt != null && eventNotification.ReaderEventNotificationData.ConnectionAttemptEvent != null) { this.conn_status_type = eventNotification.ReaderEventNotificationData.ConnectionAttemptEvent.Status; this.conn_evt.Set(); break; } this.notificationQueue.Enqueue((object)eventNotification); break; } catch { break; } } }
protected void TriggerRoAccessReport(MSG_RO_ACCESS_REPORT msg) { if (this.OnRoAccessReportReceived != null) { this.OnRoAccessReportReceived(msg); } if (this.OnEncapedRoAccessReportReceived == null) { return; } this.OnEncapedRoAccessReportReceived(new ENCAPED_RO_ACCESS_REPORT() { reader = this.reader_name, report = msg }); }
public void OnRoAccessReport(Org.LLRP.LTK.LLRPV1.MSG_RO_ACCESS_REPORT message) { if (message.TagReportData == null) { return; } foreach (var tagReportData in message.TagReportData) { if (tagReportData.EPCParameter.Count > 0) { this.action(new TagEvent { Epc = Utils.GetEpcBytes(tagReportData.EPCParameter[0]), PeakRSSI = tagReportData.PeakRSSI.PeakRSSI, }); } } }
public static MSG_RO_ACCESS_REPORT FromString(string str) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(str); XmlNode documentElement = (XmlNode)xmlDocument.DocumentElement; XmlNamespaceManager nsmgr = new XmlNamespaceManager(documentElement.OwnerDocument.NameTable); nsmgr.AddNamespace("", "http://www.llrp.org/ltk/schema/core/encoding/xml/1.0"); nsmgr.AddNamespace("llrp", "http://www.llrp.org/ltk/schema/core/encoding/xml/1.0"); MSG_RO_ACCESS_REPORT msgRoAccessReport = new MSG_RO_ACCESS_REPORT(); try { msgRoAccessReport.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID")); } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "TagReportData", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { msgRoAccessReport.TagReportData = new PARAM_TagReportData[xmlNodes.Count]; for (int i = 0; i < xmlNodes.Count; ++i) { msgRoAccessReport.TagReportData[i] = PARAM_TagReportData.FromXmlNode(xmlNodes[i]); } } } } catch { } try { XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "RFSurveyReportData", nsmgr); if (xmlNodes != null) { if (xmlNodes.Count != 0) { msgRoAccessReport.RFSurveyReportData = new PARAM_RFSurveyReportData[xmlNodes.Count]; for (int i = 0; i < xmlNodes.Count; ++i) { msgRoAccessReport.RFSurveyReportData[i] = PARAM_RFSurveyReportData.FromXmlNode(xmlNodes[i]); } } } } catch { } try { ArrayList nodeCustomChildren = XmlUtil.GetXmlNodeCustomChildren(documentElement, nsmgr); if (nodeCustomChildren != null) { for (int index = 0; index < nodeCustomChildren.Count; ++index) { ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeXmlNodeToCustomParameter((XmlNode)nodeCustomChildren[index]); if (customParameter != null) { msgRoAccessReport.AddCustomParameter(customParameter); } } } } catch { } return(msgRoAccessReport); }
public static MSG_RO_ACCESS_REPORT FromBitArray( ref BitArray bit_array, ref int cursor, int length) { if (cursor > length) { return((MSG_RO_ACCESS_REPORT)null); } ArrayList arrayList1 = new ArrayList(); MSG_RO_ACCESS_REPORT msgRoAccessReport = new MSG_RO_ACCESS_REPORT(); cursor += 6; if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)msgRoAccessReport.msgType) { cursor -= 16; return((MSG_RO_ACCESS_REPORT)null); } msgRoAccessReport.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); msgRoAccessReport.msgID = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32); ArrayList arrayList2 = new ArrayList(); PARAM_TagReportData paramTagReportData; while ((paramTagReportData = PARAM_TagReportData.FromBitArray(ref bit_array, ref cursor, length)) != null) { arrayList2.Add((object)paramTagReportData); } if (arrayList2.Count > 0) { msgRoAccessReport.TagReportData = new PARAM_TagReportData[arrayList2.Count]; for (int index = 0; index < arrayList2.Count; ++index) { msgRoAccessReport.TagReportData[index] = (PARAM_TagReportData)arrayList2[index]; } } ArrayList arrayList3 = new ArrayList(); PARAM_RFSurveyReportData surveyReportData; while ((surveyReportData = PARAM_RFSurveyReportData.FromBitArray(ref bit_array, ref cursor, length)) != null) { arrayList3.Add((object)surveyReportData); } if (arrayList3.Count > 0) { msgRoAccessReport.RFSurveyReportData = new PARAM_RFSurveyReportData[arrayList3.Count]; for (int index = 0; index < arrayList3.Count; ++index) { msgRoAccessReport.RFSurveyReportData[index] = (PARAM_RFSurveyReportData)arrayList3[index]; } } int num; bool flag; do { num = cursor; flag = false; ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length); if (customParameter != null && msgRoAccessReport.AddCustomParameter(customParameter)) { flag = true; } }while (flag); cursor = num; return(msgRoAccessReport); }
/// <summary> /// Decode Binary LLRP packet to LLRP message object /// </summary> /// <param name="packet">Binary LLRP packet to be decoded</param> /// <param name="msg">LLRP message. output</param> public static void Decode(ref byte [] packet, out Message msg) { LLRP_Envelope env; Decode_Envelope(packet, out env); BitArray ba = Util.ConvertByteArrayToBitArray(packet); int cursor = 0; switch (env.msg_type) { case ENUM_LLRP_MSG_TYPE.CUSTOM_MESSAGE: msg = MSG_CUSTOM_MESSAGE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES: msg = MSG_GET_READER_CAPABILITIES.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES_RESPONSE: msg = MSG_GET_READER_CAPABILITIES_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ADD_ROSPEC: msg = MSG_ADD_ROSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ADD_ROSPEC_RESPONSE: msg = MSG_ADD_ROSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC: msg = MSG_DELETE_ROSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC_RESPONSE: msg = MSG_DELETE_ROSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.START_ROSPEC: msg = MSG_START_ROSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.START_ROSPEC_RESPONSE: msg = MSG_START_ROSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.STOP_ROSPEC: msg = MSG_STOP_ROSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.STOP_ROSPEC_RESPONSE: msg = MSG_STOP_ROSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC: msg = MSG_ENABLE_ROSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC_RESPONSE: msg = MSG_ENABLE_ROSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC: msg = MSG_DISABLE_ROSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC_RESPONSE: msg = MSG_DISABLE_ROSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_ROSPECS: msg = MSG_GET_ROSPECS.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_ROSPECS_RESPONSE: msg = MSG_GET_ROSPECS_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC: msg = MSG_ADD_ACCESSSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC_RESPONSE: msg = MSG_ADD_ACCESSSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC: msg = MSG_DELETE_ACCESSSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC_RESPONSE: msg = MSG_DELETE_ACCESSSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC: msg = MSG_ENABLE_ACCESSSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC_RESPONSE: msg = MSG_ENABLE_ACCESSSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC: msg = MSG_DISABLE_ACCESSSPEC.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC_RESPONSE: msg = MSG_DISABLE_ACCESSSPEC_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS: msg = MSG_GET_ACCESSSPECS.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS_RESPONSE: msg = MSG_GET_ACCESSSPECS_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG: msg = MSG_GET_READER_CONFIG.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG_RESPONSE: msg = MSG_GET_READER_CONFIG_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG: msg = MSG_SET_READER_CONFIG.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG_RESPONSE: msg = MSG_SET_READER_CONFIG_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION: msg = MSG_CLOSE_CONNECTION.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION_RESPONSE: msg = MSG_CLOSE_CONNECTION_RESPONSE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.GET_REPORT: msg = MSG_GET_REPORT.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.RO_ACCESS_REPORT: msg = MSG_RO_ACCESS_REPORT.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.KEEPALIVE: msg = MSG_KEEPALIVE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.KEEPALIVE_ACK: msg = MSG_KEEPALIVE_ACK.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.READER_EVENT_NOTIFICATION: msg = MSG_READER_EVENT_NOTIFICATION.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ENABLE_EVENTS_AND_REPORTS: msg = MSG_ENABLE_EVENTS_AND_REPORTS.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; case ENUM_LLRP_MSG_TYPE.ERROR_MESSAGE: msg = MSG_ERROR_MESSAGE.FromBitArray(ref ba, ref cursor, (int)(env.msg_len * 8)); return; default: throw new MalformedPacket("Unrecognized message " + env.msg_type); } }
/// <summary> /// Parse XML string to LLRP message /// </summary> /// <param name="xmlstr">XML string to be parsed.</param> /// <param name="msg">LLRP message. output</param> /// <param name="type">LLRP message type. output</param> public static void ParseXMLToLLRPMessage(string xmlstr, out Message msg, out ENUM_LLRP_MSG_TYPE type) { XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(xmlstr); XmlNode node = (XmlNode)xdoc.DocumentElement; switch (node.Name) { case "CUSTOM_MESSAGE": msg = (Message)MSG_CUSTOM_MESSAGE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.CUSTOM_MESSAGE; return; case "GET_READER_CAPABILITIES": msg = (Message)MSG_GET_READER_CAPABILITIES.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES; return; case "GET_READER_CAPABILITIES_RESPONSE": msg = (Message)MSG_GET_READER_CAPABILITIES_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES_RESPONSE; return; case "ADD_ROSPEC": msg = (Message)MSG_ADD_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ROSPEC; return; case "ADD_ROSPEC_RESPONSE": msg = (Message)MSG_ADD_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ROSPEC_RESPONSE; return; case "DELETE_ROSPEC": msg = (Message)MSG_DELETE_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC; return; case "DELETE_ROSPEC_RESPONSE": msg = (Message)MSG_DELETE_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC_RESPONSE; return; case "START_ROSPEC": msg = (Message)MSG_START_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.START_ROSPEC; return; case "START_ROSPEC_RESPONSE": msg = (Message)MSG_START_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.START_ROSPEC_RESPONSE; return; case "STOP_ROSPEC": msg = (Message)MSG_STOP_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.STOP_ROSPEC; return; case "STOP_ROSPEC_RESPONSE": msg = (Message)MSG_STOP_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.STOP_ROSPEC_RESPONSE; return; case "ENABLE_ROSPEC": msg = (Message)MSG_ENABLE_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC; return; case "ENABLE_ROSPEC_RESPONSE": msg = (Message)MSG_ENABLE_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC_RESPONSE; return; case "DISABLE_ROSPEC": msg = (Message)MSG_DISABLE_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC; return; case "DISABLE_ROSPEC_RESPONSE": msg = (Message)MSG_DISABLE_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC_RESPONSE; return; case "GET_ROSPECS": msg = (Message)MSG_GET_ROSPECS.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ROSPECS; return; case "GET_ROSPECS_RESPONSE": msg = (Message)MSG_GET_ROSPECS_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ROSPECS_RESPONSE; return; case "ADD_ACCESSSPEC": msg = (Message)MSG_ADD_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC; return; case "ADD_ACCESSSPEC_RESPONSE": msg = (Message)MSG_ADD_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC_RESPONSE; return; case "DELETE_ACCESSSPEC": msg = (Message)MSG_DELETE_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC; return; case "DELETE_ACCESSSPEC_RESPONSE": msg = (Message)MSG_DELETE_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC_RESPONSE; return; case "ENABLE_ACCESSSPEC": msg = (Message)MSG_ENABLE_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC; return; case "ENABLE_ACCESSSPEC_RESPONSE": msg = (Message)MSG_ENABLE_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC_RESPONSE; return; case "DISABLE_ACCESSSPEC": msg = (Message)MSG_DISABLE_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC; return; case "DISABLE_ACCESSSPEC_RESPONSE": msg = (Message)MSG_DISABLE_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC_RESPONSE; return; case "GET_ACCESSSPECS": msg = (Message)MSG_GET_ACCESSSPECS.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS; return; case "GET_ACCESSSPECS_RESPONSE": msg = (Message)MSG_GET_ACCESSSPECS_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS_RESPONSE; return; case "GET_READER_CONFIG": msg = (Message)MSG_GET_READER_CONFIG.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG; return; case "GET_READER_CONFIG_RESPONSE": msg = (Message)MSG_GET_READER_CONFIG_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG_RESPONSE; return; case "SET_READER_CONFIG": msg = (Message)MSG_SET_READER_CONFIG.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG; return; case "SET_READER_CONFIG_RESPONSE": msg = (Message)MSG_SET_READER_CONFIG_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG_RESPONSE; return; case "CLOSE_CONNECTION": msg = (Message)MSG_CLOSE_CONNECTION.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION; return; case "CLOSE_CONNECTION_RESPONSE": msg = (Message)MSG_CLOSE_CONNECTION_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION_RESPONSE; return; case "GET_REPORT": msg = (Message)MSG_GET_REPORT.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_REPORT; return; case "RO_ACCESS_REPORT": msg = (Message)MSG_RO_ACCESS_REPORT.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.RO_ACCESS_REPORT; return; case "KEEPALIVE": msg = (Message)MSG_KEEPALIVE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.KEEPALIVE; return; case "KEEPALIVE_ACK": msg = (Message)MSG_KEEPALIVE_ACK.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.KEEPALIVE_ACK; return; case "READER_EVENT_NOTIFICATION": msg = (Message)MSG_READER_EVENT_NOTIFICATION.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.READER_EVENT_NOTIFICATION; return; case "ENABLE_EVENTS_AND_REPORTS": msg = (Message)MSG_ENABLE_EVENTS_AND_REPORTS.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_EVENTS_AND_REPORTS; return; case "ERROR_MESSAGE": msg = (Message)MSG_ERROR_MESSAGE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ERROR_MESSAGE; return; default: msg = null; type = 0; return; } }
public static void ParseXMLToLLRPMessage( string xmlstr, out Message msg, out ENUM_LLRP_MSG_TYPE type) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xmlstr); XmlNode documentElement = (XmlNode)xmlDocument.DocumentElement; switch (documentElement.Name) { case "CUSTOM_MESSAGE": msg = (Message)MSG_CUSTOM_MESSAGE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.CUSTOM_MESSAGE; break; case "GET_READER_CAPABILITIES": msg = (Message)MSG_GET_READER_CAPABILITIES.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES; break; case "GET_READER_CAPABILITIES_RESPONSE": msg = (Message)MSG_GET_READER_CAPABILITIES_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES_RESPONSE; break; case "ADD_ROSPEC": msg = (Message)MSG_ADD_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ROSPEC; break; case "ADD_ROSPEC_RESPONSE": msg = (Message)MSG_ADD_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ROSPEC_RESPONSE; break; case "DELETE_ROSPEC": msg = (Message)MSG_DELETE_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC; break; case "DELETE_ROSPEC_RESPONSE": msg = (Message)MSG_DELETE_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC_RESPONSE; break; case "START_ROSPEC": msg = (Message)MSG_START_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.START_ROSPEC; break; case "START_ROSPEC_RESPONSE": msg = (Message)MSG_START_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.START_ROSPEC_RESPONSE; break; case "STOP_ROSPEC": msg = (Message)MSG_STOP_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.STOP_ROSPEC; break; case "STOP_ROSPEC_RESPONSE": msg = (Message)MSG_STOP_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.STOP_ROSPEC_RESPONSE; break; case "ENABLE_ROSPEC": msg = (Message)MSG_ENABLE_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC; break; case "ENABLE_ROSPEC_RESPONSE": msg = (Message)MSG_ENABLE_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC_RESPONSE; break; case "DISABLE_ROSPEC": msg = (Message)MSG_DISABLE_ROSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC; break; case "DISABLE_ROSPEC_RESPONSE": msg = (Message)MSG_DISABLE_ROSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC_RESPONSE; break; case "GET_ROSPECS": msg = (Message)MSG_GET_ROSPECS.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ROSPECS; break; case "GET_ROSPECS_RESPONSE": msg = (Message)MSG_GET_ROSPECS_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ROSPECS_RESPONSE; break; case "ADD_ACCESSSPEC": msg = (Message)MSG_ADD_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC; break; case "ADD_ACCESSSPEC_RESPONSE": msg = (Message)MSG_ADD_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC_RESPONSE; break; case "DELETE_ACCESSSPEC": msg = (Message)MSG_DELETE_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC; break; case "DELETE_ACCESSSPEC_RESPONSE": msg = (Message)MSG_DELETE_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC_RESPONSE; break; case "ENABLE_ACCESSSPEC": msg = (Message)MSG_ENABLE_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC; break; case "ENABLE_ACCESSSPEC_RESPONSE": msg = (Message)MSG_ENABLE_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC_RESPONSE; break; case "DISABLE_ACCESSSPEC": msg = (Message)MSG_DISABLE_ACCESSSPEC.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC; break; case "DISABLE_ACCESSSPEC_RESPONSE": msg = (Message)MSG_DISABLE_ACCESSSPEC_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC_RESPONSE; break; case "GET_ACCESSSPECS": msg = (Message)MSG_GET_ACCESSSPECS.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS; break; case "GET_ACCESSSPECS_RESPONSE": msg = (Message)MSG_GET_ACCESSSPECS_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS_RESPONSE; break; case "GET_READER_CONFIG": msg = (Message)MSG_GET_READER_CONFIG.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG; break; case "GET_READER_CONFIG_RESPONSE": msg = (Message)MSG_GET_READER_CONFIG_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG_RESPONSE; break; case "SET_READER_CONFIG": msg = (Message)MSG_SET_READER_CONFIG.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG; break; case "SET_READER_CONFIG_RESPONSE": msg = (Message)MSG_SET_READER_CONFIG_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG_RESPONSE; break; case "CLOSE_CONNECTION": msg = (Message)MSG_CLOSE_CONNECTION.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION; break; case "CLOSE_CONNECTION_RESPONSE": msg = (Message)MSG_CLOSE_CONNECTION_RESPONSE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION_RESPONSE; break; case "GET_REPORT": msg = (Message)MSG_GET_REPORT.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.GET_REPORT; break; case "RO_ACCESS_REPORT": msg = (Message)MSG_RO_ACCESS_REPORT.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.RO_ACCESS_REPORT; break; case "KEEPALIVE": msg = (Message)MSG_KEEPALIVE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.KEEPALIVE; break; case "KEEPALIVE_ACK": msg = (Message)MSG_KEEPALIVE_ACK.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.KEEPALIVE_ACK; break; case "READER_EVENT_NOTIFICATION": msg = (Message)MSG_READER_EVENT_NOTIFICATION.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.READER_EVENT_NOTIFICATION; break; case "ENABLE_EVENTS_AND_REPORTS": msg = (Message)MSG_ENABLE_EVENTS_AND_REPORTS.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ENABLE_EVENTS_AND_REPORTS; break; case "ERROR_MESSAGE": msg = (Message)MSG_ERROR_MESSAGE.FromString(xmlstr); type = ENUM_LLRP_MSG_TYPE.ERROR_MESSAGE; break; default: type = (ENUM_LLRP_MSG_TYPE)0; msg = (Message)CustomMsgDecodeFactory.DecodeXmlNodeToCustomMessage(documentElement, xmlstr); if (msg == null) { break; } type = ENUM_LLRP_MSG_TYPE.CUSTOM_MESSAGE; break; } }