public static MSG_CLOSE_CONNECTION_RESPONSE 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_CLOSE_CONNECTION_RESPONSE connectionResponse = new MSG_CLOSE_CONNECTION_RESPONSE();

            try
            {
                connectionResponse.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPStatus", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        connectionResponse.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            return(connectionResponse);
        }
示例#2
0
        public static MSG_GET_ACCESSSPECS_RESPONSE 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_GET_ACCESSSPECS_RESPONSE accessspecsResponse = new MSG_GET_ACCESSSPECS_RESPONSE();

            try
            {
                accessspecsResponse.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPStatus", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        accessspecsResponse.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AccessSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        accessspecsResponse.AccessSpec = new PARAM_AccessSpec[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            accessspecsResponse.AccessSpec[i] = PARAM_AccessSpec.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            return(accessspecsResponse);
        }
示例#3
0
        public static MSG_GET_READER_CAPABILITIES_RESPONSE 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_GET_READER_CAPABILITIES_RESPONSE capabilitiesResponse = new MSG_GET_READER_CAPABILITIES_RESPONSE();

            try
            {
                capabilitiesResponse.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPStatus", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        capabilitiesResponse.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "GeneralDeviceCapabilities", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        capabilitiesResponse.GeneralDeviceCapabilities = PARAM_GeneralDeviceCapabilities.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPCapabilities", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        capabilitiesResponse.LLRPCapabilities = PARAM_LLRPCapabilities.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "RegulatoryCapabilities", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        capabilitiesResponse.RegulatoryCapabilities = PARAM_RegulatoryCapabilities.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            capabilitiesResponse.AirProtocolLLRPCapabilities = new UNION_AirProtocolLLRPCapabilities();
            try
            {
                foreach (XmlNode childNode in documentElement.ChildNodes)
                {
                    switch (childNode.Name)
                    {
                    case "C1G2LLRPCapabilities":
                        capabilitiesResponse.AirProtocolLLRPCapabilities.Add((IParameter)PARAM_C1G2LLRPCapabilities.FromXmlNode(childNode));
                        continue;

                    default:
                        continue;
                    }
                }
            }
            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)
                        {
                            capabilitiesResponse.AddCustomParameter(customParameter);
                        }
                    }
                }
            }
            catch
            {
            }
            return(capabilitiesResponse);
        }
        public static MSG_GET_READER_CONFIG_RESPONSE 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_GET_READER_CONFIG_RESPONSE readerConfigResponse = new MSG_GET_READER_CONFIG_RESPONSE();

            try
            {
                readerConfigResponse.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPStatus", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "Identification", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.Identification = PARAM_Identification.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AntennaProperties", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.AntennaProperties = new PARAM_AntennaProperties[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            readerConfigResponse.AntennaProperties[i] = PARAM_AntennaProperties.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AntennaConfiguration", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.AntennaConfiguration = new PARAM_AntennaConfiguration[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            readerConfigResponse.AntennaConfiguration[i] = PARAM_AntennaConfiguration.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "ReaderEventNotificationSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.ReaderEventNotificationSpec = PARAM_ReaderEventNotificationSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "ROReportSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.ROReportSpec = PARAM_ROReportSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AccessReportSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.AccessReportSpec = PARAM_AccessReportSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPConfigurationStateValue", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.LLRPConfigurationStateValue = PARAM_LLRPConfigurationStateValue.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "KeepaliveSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.KeepaliveSpec = PARAM_KeepaliveSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "GPIPortCurrentState", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.GPIPortCurrentState = new PARAM_GPIPortCurrentState[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            readerConfigResponse.GPIPortCurrentState[i] = PARAM_GPIPortCurrentState.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "GPOWriteData", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.GPOWriteData = new PARAM_GPOWriteData[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            readerConfigResponse.GPOWriteData[i] = PARAM_GPOWriteData.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "EventsAndReports", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        readerConfigResponse.EventsAndReports = PARAM_EventsAndReports.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            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)
                        {
                            readerConfigResponse.AddCustomParameter(customParameter);
                        }
                    }
                }
            }
            catch
            {
            }
            return(readerConfigResponse);
        }