Example #1
0
        public new static MSG_GET_ROSPECS_RESPONSE FromString(string str)
        {
            string val;

            XmlDocument xdoc = new XmlDocument();
            xdoc.LoadXml(str);
            XmlNode node = (XmlNode)xdoc.DocumentElement;

            MSG_GET_ROSPECS_RESPONSE msg = new MSG_GET_ROSPECS_RESPONSE();
            try { msg.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(node, "MessageID")); }
            catch { }


            try
            {

                XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "LLRPStatus");
                if (null != xnl)
                {
                    if (xnl.Count != 0)
                        msg.LLRPStatus = PARAM_LLRPStatus.FromXmlNode(xnl[0]);
                }

            }
            catch { }

            try
            {

                XmlNodeList xnl = XmlUtil.GetXmlNodes(node, "ROSpec");
                if (null != xnl)
                {
                    if (xnl.Count != 0)
                    {
                        msg.ROSpec = new PARAM_ROSpec[xnl.Count];
                        for (int i = 0; i < xnl.Count; i++)
                            msg.ROSpec[i] = PARAM_ROSpec.FromXmlNode(xnl[i]);
                    }
                }

            }
            catch { }

            return msg;
        }
Example #2
0
        public new static MSG_GET_ROSPECS_RESPONSE FromBitArray(ref BitArray bit_array, ref int cursor, int length)
        {
            if (cursor > length) return null;

            int field_len = 0;
            object obj_val;
            ArrayList param_list = new ArrayList();

            MSG_GET_ROSPECS_RESPONSE obj = new MSG_GET_ROSPECS_RESPONSE();

            int msg_type = 0;
            cursor += 6;
            msg_type = (int)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 10);

            if (msg_type != obj.msgType)
            {
                cursor -= 16;
                return null;
            }

            obj.msgLen = (UInt32)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 32);
            obj.msgID = (UInt32)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 32);


            obj.LLRPStatus = PARAM_LLRPStatus.FromBitArray(ref bit_array, ref cursor, length);

            param_list = new ArrayList();
            PARAM_ROSpec _param_ROSpec = PARAM_ROSpec.FromBitArray(ref bit_array, ref cursor, length);
            if (_param_ROSpec != null)
            {
                param_list.Add(_param_ROSpec);
                while ((_param_ROSpec = PARAM_ROSpec.FromBitArray(ref bit_array, ref cursor, length)) != null) param_list.Add(_param_ROSpec);
                if (param_list.Count > 0)
                {
                    obj.ROSpec = new PARAM_ROSpec[param_list.Count];
                    for (int i = 0; i < param_list.Count; i++)
                        obj.ROSpec[i] = (PARAM_ROSpec)param_list[i];
                }
            }

            return obj;
        }