Exemplo n.º 1
0
        public static MSG_GET_READER_CAPABILITIES_RESPONSE FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_GET_READER_CAPABILITIES_RESPONSE)null);
            }
            ArrayList arrayList = new ArrayList();
            MSG_GET_READER_CAPABILITIES_RESPONSE capabilitiesResponse = new MSG_GET_READER_CAPABILITIES_RESPONSE();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)capabilitiesResponse.msgType)
            {
                cursor -= 16;
                return((MSG_GET_READER_CAPABILITIES_RESPONSE)null);
            }
            capabilitiesResponse.msgLen     = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            capabilitiesResponse.msgID      = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            capabilitiesResponse.LLRPStatus = PARAM_LLRPStatus.FromBitArray(ref bit_array, ref cursor, length);
            capabilitiesResponse.GeneralDeviceCapabilities = PARAM_GeneralDeviceCapabilities.FromBitArray(ref bit_array, ref cursor, length);
            capabilitiesResponse.LLRPCapabilities          = PARAM_LLRPCapabilities.FromBitArray(ref bit_array, ref cursor, length);
            capabilitiesResponse.RegulatoryCapabilities    = PARAM_RegulatoryCapabilities.FromBitArray(ref bit_array, ref cursor, length);
            ushort num1 = 1;

            while (num1 != (ushort)0)
            {
                num1 = (ushort)0;
                PARAM_C1G2LLRPCapabilities llrpCapabilities1 = PARAM_C1G2LLRPCapabilities.FromBitArray(ref bit_array, ref cursor, length);
                if (llrpCapabilities1 != null)
                {
                    ++num1;
                    capabilitiesResponse.AirProtocolLLRPCapabilities.Add((IParameter)llrpCapabilities1);
                }
                PARAM_C1G2LLRPCapabilities llrpCapabilities2;
                while ((llrpCapabilities2 = PARAM_C1G2LLRPCapabilities.FromBitArray(ref bit_array, ref cursor, length)) != null)
                {
                    capabilitiesResponse.AirProtocolLLRPCapabilities.Add((IParameter)llrpCapabilities2);
                }
            }
            int  num2;
            bool flag;

            do
            {
                num2 = cursor;
                flag = false;
                ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length);
                if (customParameter != null && capabilitiesResponse.AddCustomParameter(customParameter))
                {
                    flag = true;
                }
            }while (flag);
            cursor = num2;
            return(capabilitiesResponse);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public bool AddCustomParameter(ICustom_Parameter param)
 {
     if (param is IGET_READER_CAPABILITIES_RESPONSE_Custom_Param)
     {
         this.Custom.Add(param);
         return(true);
     }
     if (param.GetType() != typeof(PARAM_Custom))
     {
         return(false);
     }
     this.Custom.Add(param);
     return(true);
 }
Exemplo n.º 4
0
 public bool AddCustomParameter(ICustom_Parameter param)
 {
     if (param is IAccessCommandOpSpec_Custom_Param)
     {
         this.Add((IParameter)param);
         return(true);
     }
     if (param.GetType() != typeof(PARAM_Custom))
     {
         return(false);
     }
     this.Add((IParameter)param);
     return(true);
 }
Exemplo n.º 5
0
 public bool AddCustomParameter(ICustom_Parameter param)
 {
     if (param is IRO_ACCESS_REPORT_Custom_Param)
     {
         this.Custom.Add(param);
         return(true);
     }
     if (param.GetType() != typeof(PARAM_Custom))
     {
         return(false);
     }
     this.Custom.Add(param);
     return(true);
 }
Exemplo n.º 6
0
 public bool AddCustomParameter(ICustom_Parameter param)
 {
     if (param is ISET_READER_CONFIG_Custom_Param)
     {
         this.Custom.Add(param);
         return(true);
     }
     if (param.GetType() != typeof(PARAM_Custom))
     {
         return(false);
     }
     this.Custom.Add(param);
     return(true);
 }
Exemplo n.º 7
0
        public static MSG_GET_READER_CAPABILITIES FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_GET_READER_CAPABILITIES)null);
            }
            ArrayList arrayList = new ArrayList();
            MSG_GET_READER_CAPABILITIES readerCapabilities = new MSG_GET_READER_CAPABILITIES();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)readerCapabilities.msgType)
            {
                cursor -= 16;
                return((MSG_GET_READER_CAPABILITIES)null);
            }
            readerCapabilities.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            readerCapabilities.msgID  = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            if (cursor > length)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int    field_len = 8;
            object obj;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(uint), field_len);
            readerCapabilities.RequestedData = (ENUM_GetReaderCapabilitiesRequestedData)(uint)obj;
            int  num;
            bool flag;

            do
            {
                num  = cursor;
                flag = false;
                ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length);
                if (customParameter != null && readerCapabilities.AddCustomParameter(customParameter))
                {
                    flag = true;
                }
            }while (flag);
            cursor = num;
            return(readerCapabilities);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 private void AddCustomParameter(ICustom_Parameter param)
 {
     Custom.Add(param);
 }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
0
 /// <summary>
 /// Overriden the add method to enforce type checking
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public int Add(ICustom_Parameter value)
 {
     list.Add(value);
     return list.Count;
 }
Exemplo n.º 14
0
        public static MSG_GET_READER_CONFIG FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_GET_READER_CONFIG)null);
            }
            ArrayList             arrayList          = new ArrayList();
            MSG_GET_READER_CONFIG msgGetReaderConfig = new MSG_GET_READER_CONFIG();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)msgGetReaderConfig.msgType)
            {
                cursor -= 16;
                return((MSG_GET_READER_CONFIG)null);
            }
            msgGetReaderConfig.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            msgGetReaderConfig.msgID  = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            if (cursor > length)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int    field_len1 = 16;
            object obj;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(ushort), field_len1);
            msgGetReaderConfig.AntennaID = (ushort)obj;
            if (cursor > length)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int field_len2 = 8;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(uint), field_len2);
            msgGetReaderConfig.RequestedData = (ENUM_GetReaderConfigRequestedData)(uint)obj;
            if (cursor > length)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int field_len3 = 16;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(ushort), field_len3);
            msgGetReaderConfig.GPIPortNum = (ushort)obj;
            if (cursor > length)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int field_len4 = 16;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(ushort), field_len4);
            msgGetReaderConfig.GPOPortNum = (ushort)obj;
            int  num;
            bool flag;

            do
            {
                num  = cursor;
                flag = false;
                ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length);
                if (customParameter != null && msgGetReaderConfig.AddCustomParameter(customParameter))
                {
                    flag = true;
                }
            }while (flag);
            cursor = num;
            return(msgGetReaderConfig);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Overriden the add method to enforce type checking
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public int Add(ICustom_Parameter value)
 {
     list.Add(value);
     return(list.Count);
 }
        public static MSG_GET_READER_CONFIG_RESPONSE FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_GET_READER_CONFIG_RESPONSE)null);
            }
            ArrayList arrayList1 = new ArrayList();
            MSG_GET_READER_CONFIG_RESPONSE readerConfigResponse = new MSG_GET_READER_CONFIG_RESPONSE();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)readerConfigResponse.msgType)
            {
                cursor -= 16;
                return((MSG_GET_READER_CONFIG_RESPONSE)null);
            }
            readerConfigResponse.msgLen         = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            readerConfigResponse.msgID          = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            readerConfigResponse.LLRPStatus     = PARAM_LLRPStatus.FromBitArray(ref bit_array, ref cursor, length);
            readerConfigResponse.Identification = PARAM_Identification.FromBitArray(ref bit_array, ref cursor, length);
            ArrayList arrayList2 = new ArrayList();
            PARAM_AntennaProperties antennaProperties;

            while ((antennaProperties = PARAM_AntennaProperties.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList2.Add((object)antennaProperties);
            }
            if (arrayList2.Count > 0)
            {
                readerConfigResponse.AntennaProperties = new PARAM_AntennaProperties[arrayList2.Count];
                for (int index = 0; index < arrayList2.Count; ++index)
                {
                    readerConfigResponse.AntennaProperties[index] = (PARAM_AntennaProperties)arrayList2[index];
                }
            }
            ArrayList arrayList3 = new ArrayList();
            PARAM_AntennaConfiguration antennaConfiguration;

            while ((antennaConfiguration = PARAM_AntennaConfiguration.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList3.Add((object)antennaConfiguration);
            }
            if (arrayList3.Count > 0)
            {
                readerConfigResponse.AntennaConfiguration = new PARAM_AntennaConfiguration[arrayList3.Count];
                for (int index = 0; index < arrayList3.Count; ++index)
                {
                    readerConfigResponse.AntennaConfiguration[index] = (PARAM_AntennaConfiguration)arrayList3[index];
                }
            }
            readerConfigResponse.ReaderEventNotificationSpec = PARAM_ReaderEventNotificationSpec.FromBitArray(ref bit_array, ref cursor, length);
            readerConfigResponse.ROReportSpec                = PARAM_ROReportSpec.FromBitArray(ref bit_array, ref cursor, length);
            readerConfigResponse.AccessReportSpec            = PARAM_AccessReportSpec.FromBitArray(ref bit_array, ref cursor, length);
            readerConfigResponse.LLRPConfigurationStateValue = PARAM_LLRPConfigurationStateValue.FromBitArray(ref bit_array, ref cursor, length);
            readerConfigResponse.KeepaliveSpec               = PARAM_KeepaliveSpec.FromBitArray(ref bit_array, ref cursor, length);
            ArrayList arrayList4 = new ArrayList();
            PARAM_GPIPortCurrentState portCurrentState;

            while ((portCurrentState = PARAM_GPIPortCurrentState.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList4.Add((object)portCurrentState);
            }
            if (arrayList4.Count > 0)
            {
                readerConfigResponse.GPIPortCurrentState = new PARAM_GPIPortCurrentState[arrayList4.Count];
                for (int index = 0; index < arrayList4.Count; ++index)
                {
                    readerConfigResponse.GPIPortCurrentState[index] = (PARAM_GPIPortCurrentState)arrayList4[index];
                }
            }
            ArrayList          arrayList5 = new ArrayList();
            PARAM_GPOWriteData paramGpoWriteData;

            while ((paramGpoWriteData = PARAM_GPOWriteData.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList5.Add((object)paramGpoWriteData);
            }
            if (arrayList5.Count > 0)
            {
                readerConfigResponse.GPOWriteData = new PARAM_GPOWriteData[arrayList5.Count];
                for (int index = 0; index < arrayList5.Count; ++index)
                {
                    readerConfigResponse.GPOWriteData[index] = (PARAM_GPOWriteData)arrayList5[index];
                }
            }
            readerConfigResponse.EventsAndReports = PARAM_EventsAndReports.FromBitArray(ref bit_array, ref cursor, length);
            int  num;
            bool flag;

            do
            {
                num  = cursor;
                flag = false;
                ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length);
                if (customParameter != null && readerConfigResponse.AddCustomParameter(customParameter))
                {
                    flag = true;
                }
            }while (flag);
            cursor = num;
            return(readerConfigResponse);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
0
        public static MSG_SET_READER_CONFIG FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_SET_READER_CONFIG)null);
            }
            ArrayList             arrayList1         = new ArrayList();
            MSG_SET_READER_CONFIG msgSetReaderConfig = new MSG_SET_READER_CONFIG();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)msgSetReaderConfig.msgType)
            {
                cursor -= 16;
                return((MSG_SET_READER_CONFIG)null);
            }
            msgSetReaderConfig.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            msgSetReaderConfig.msgID  = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            if (cursor > length)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int    field_len = 1;
            object obj;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(bool), field_len);
            msgSetReaderConfig.ResetToFactoryDefault = (bool)obj;
            cursor += 7;
            msgSetReaderConfig.ReaderEventNotificationSpec = PARAM_ReaderEventNotificationSpec.FromBitArray(ref bit_array, ref cursor, length);
            ArrayList arrayList2 = new ArrayList();
            PARAM_AntennaProperties antennaProperties;

            while ((antennaProperties = PARAM_AntennaProperties.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList2.Add((object)antennaProperties);
            }
            if (arrayList2.Count > 0)
            {
                msgSetReaderConfig.AntennaProperties = new PARAM_AntennaProperties[arrayList2.Count];
                for (int index = 0; index < arrayList2.Count; ++index)
                {
                    msgSetReaderConfig.AntennaProperties[index] = (PARAM_AntennaProperties)arrayList2[index];
                }
            }
            ArrayList arrayList3 = new ArrayList();
            PARAM_AntennaConfiguration antennaConfiguration;

            while ((antennaConfiguration = PARAM_AntennaConfiguration.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList3.Add((object)antennaConfiguration);
            }
            if (arrayList3.Count > 0)
            {
                msgSetReaderConfig.AntennaConfiguration = new PARAM_AntennaConfiguration[arrayList3.Count];
                for (int index = 0; index < arrayList3.Count; ++index)
                {
                    msgSetReaderConfig.AntennaConfiguration[index] = (PARAM_AntennaConfiguration)arrayList3[index];
                }
            }
            msgSetReaderConfig.ROReportSpec     = PARAM_ROReportSpec.FromBitArray(ref bit_array, ref cursor, length);
            msgSetReaderConfig.AccessReportSpec = PARAM_AccessReportSpec.FromBitArray(ref bit_array, ref cursor, length);
            msgSetReaderConfig.KeepaliveSpec    = PARAM_KeepaliveSpec.FromBitArray(ref bit_array, ref cursor, length);
            ArrayList          arrayList4 = new ArrayList();
            PARAM_GPOWriteData paramGpoWriteData;

            while ((paramGpoWriteData = PARAM_GPOWriteData.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList4.Add((object)paramGpoWriteData);
            }
            if (arrayList4.Count > 0)
            {
                msgSetReaderConfig.GPOWriteData = new PARAM_GPOWriteData[arrayList4.Count];
                for (int index = 0; index < arrayList4.Count; ++index)
                {
                    msgSetReaderConfig.GPOWriteData[index] = (PARAM_GPOWriteData)arrayList4[index];
                }
            }
            ArrayList arrayList5 = new ArrayList();
            PARAM_GPIPortCurrentState portCurrentState;

            while ((portCurrentState = PARAM_GPIPortCurrentState.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList5.Add((object)portCurrentState);
            }
            if (arrayList5.Count > 0)
            {
                msgSetReaderConfig.GPIPortCurrentState = new PARAM_GPIPortCurrentState[arrayList5.Count];
                for (int index = 0; index < arrayList5.Count; ++index)
                {
                    msgSetReaderConfig.GPIPortCurrentState[index] = (PARAM_GPIPortCurrentState)arrayList5[index];
                }
            }
            msgSetReaderConfig.EventsAndReports = PARAM_EventsAndReports.FromBitArray(ref bit_array, ref cursor, length);
            int  num;
            bool flag;

            do
            {
                num  = cursor;
                flag = false;
                ICustom_Parameter customParameter = CustomParamDecodeFactory.DecodeCustomParameter(ref bit_array, ref cursor, length);
                if (customParameter != null && msgSetReaderConfig.AddCustomParameter(customParameter))
                {
                    flag = true;
                }
            }while (flag);
            cursor = num;
            return(msgSetReaderConfig);
        }