예제 #1
0
        public static MSG_ADD_ROSPEC 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_ADD_ROSPEC msgAddRospec = new MSG_ADD_ROSPEC();

            try
            {
                msgAddRospec.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "ROSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        msgAddRospec.ROSpec = PARAM_ROSpec.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            return(msgAddRospec);
        }
예제 #2
0
        public static MSG_GET_ROSPECS_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_ROSPECS_RESPONSE getRospecsResponse = new MSG_GET_ROSPECS_RESPONSE();

            try
            {
                getRospecsResponse.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(documentElement, "MessageID"));
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "LLRPStatus", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        getRospecsResponse.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xmlNodes[0]);
                    }
                }
            }
            catch
            {
            }
            try
            {
                XmlNodeList xmlNodes = XmlUtil.GetXmlNodes(documentElement, "ROSpec", nsmgr);
                if (xmlNodes != null)
                {
                    if (xmlNodes.Count != 0)
                    {
                        getRospecsResponse.ROSpec = new PARAM_ROSpec[xmlNodes.Count];
                        for (int i = 0; i < xmlNodes.Count; ++i)
                        {
                            getRospecsResponse.ROSpec[i] = PARAM_ROSpec.FromXmlNode(xmlNodes[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            return(getRospecsResponse);
        }
예제 #3
0
        public static MSG_GET_ROSPECS_RESPONSE FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_GET_ROSPECS_RESPONSE)null);
            }
            ArrayList arrayList1 = new ArrayList();
            MSG_GET_ROSPECS_RESPONSE getRospecsResponse = new MSG_GET_ROSPECS_RESPONSE();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)getRospecsResponse.msgType)
            {
                cursor -= 16;
                return((MSG_GET_ROSPECS_RESPONSE)null);
            }
            getRospecsResponse.msgLen     = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            getRospecsResponse.msgID      = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            getRospecsResponse.LLRPStatus = PARAM_LLRPStatus.FromBitArray(ref bit_array, ref cursor, length);
            ArrayList    arrayList2 = new ArrayList();
            PARAM_ROSpec paramRoSpec;

            while ((paramRoSpec = PARAM_ROSpec.FromBitArray(ref bit_array, ref cursor, length)) != null)
            {
                arrayList2.Add((object)paramRoSpec);
            }
            if (arrayList2.Count > 0)
            {
                getRospecsResponse.ROSpec = new PARAM_ROSpec[arrayList2.Count];
                for (int index = 0; index < arrayList2.Count; ++index)
                {
                    getRospecsResponse.ROSpec[index] = (PARAM_ROSpec)arrayList2[index];
                }
            }
            return(getRospecsResponse);
        }
예제 #4
0
        public static MSG_ADD_ROSPEC FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor > length)
            {
                return((MSG_ADD_ROSPEC)null);
            }
            ArrayList      arrayList    = new ArrayList();
            MSG_ADD_ROSPEC msgAddRospec = new MSG_ADD_ROSPEC();

            cursor += 6;
            if ((int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10) != (int)msgAddRospec.msgType)
            {
                cursor -= 16;
                return((MSG_ADD_ROSPEC)null);
            }
            msgAddRospec.msgLen = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            msgAddRospec.msgID  = (uint)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 32);
            msgAddRospec.ROSpec = PARAM_ROSpec.FromBitArray(ref bit_array, ref cursor, length);
            return(msgAddRospec);
        }