Ejemplo n.º 1
0
        public static MSG_GET_READER_CONFIG 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 msgGetReaderConfig = new MSG_GET_READER_CONFIG();

            try
            {
                msgGetReaderConfig.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            string nodeValue1 = XmlUtil.GetNodeValue(documentElement, "AntennaID");

            msgGetReaderConfig.AntennaID = (ushort)Util.ParseValueTypeFromString(nodeValue1, "u16", "");
            string nodeValue2 = XmlUtil.GetNodeValue(documentElement, "RequestedData");

            msgGetReaderConfig.RequestedData = (ENUM_GetReaderConfigRequestedData)Enum.Parse(typeof(ENUM_GetReaderConfigRequestedData), nodeValue2);
            string nodeValue3 = XmlUtil.GetNodeValue(documentElement, "GPIPortNum");

            msgGetReaderConfig.GPIPortNum = (ushort)Util.ParseValueTypeFromString(nodeValue3, "u16", "");
            string nodeValue4 = XmlUtil.GetNodeValue(documentElement, "GPOPortNum");

            msgGetReaderConfig.GPOPortNum = (ushort)Util.ParseValueTypeFromString(nodeValue4, "u16", "");
            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)
                        {
                            msgGetReaderConfig.AddCustomParameter(customParameter);
                        }
                    }
                }
            }
            catch
            {
            }
            return(msgGetReaderConfig);
        }
Ejemplo n.º 2
0
        public static MSG_GET_READER_CAPABILITIES 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 readerCapabilities = new MSG_GET_READER_CAPABILITIES();

            try
            {
                readerCapabilities.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            string nodeValue = XmlUtil.GetNodeValue(documentElement, "RequestedData");

            readerCapabilities.RequestedData = (ENUM_GetReaderCapabilitiesRequestedData)Enum.Parse(typeof(ENUM_GetReaderCapabilitiesRequestedData), nodeValue);
            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)
                        {
                            readerCapabilities.AddCustomParameter(customParameter);
                        }
                    }
                }
            }
            catch
            {
            }
            return(readerCapabilities);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public static MSG_SET_READER_CONFIG 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_SET_READER_CONFIG msgSetReaderConfig = new MSG_SET_READER_CONFIG();

            try
            {
                msgSetReaderConfig.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            string nodeValue = XmlUtil.GetNodeValue(documentElement, "ResetToFactoryDefault");

            msgSetReaderConfig.ResetToFactoryDefault = (bool)Util.ParseValueTypeFromString(nodeValue, "u1", "");
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "ReaderEventNotificationSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.ReaderEventNotificationSpec = PARAM_ReaderEventNotificationSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AntennaProperties", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.AntennaProperties = new PARAM_AntennaProperties[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            msgSetReaderConfig.AntennaProperties[i] = PARAM_AntennaProperties.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AntennaConfiguration", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.AntennaConfiguration = new PARAM_AntennaConfiguration[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            msgSetReaderConfig.AntennaConfiguration[i] = PARAM_AntennaConfiguration.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "ROReportSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.ROReportSpec = PARAM_ROReportSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "AccessReportSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.AccessReportSpec = PARAM_AccessReportSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "KeepaliveSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.KeepaliveSpec = PARAM_KeepaliveSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "GPOWriteData", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.GPOWriteData = new PARAM_GPOWriteData[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            msgSetReaderConfig.GPOWriteData[i] = PARAM_GPOWriteData.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "GPIPortCurrentState", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.GPIPortCurrentState = new PARAM_GPIPortCurrentState[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            msgSetReaderConfig.GPIPortCurrentState[i] = PARAM_GPIPortCurrentState.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "EventsAndReports", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgSetReaderConfig.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)
                        {
                            msgSetReaderConfig.AddCustomParameter(customParameter);
                        }
                    }
                }
            }
            catch
            {
            }
            return(msgSetReaderConfig);
        }