示例#1
0
        public static PARAM_InventoryParameterSpecID FromXmlNode(
            XmlNode node)
        {
            ArrayList           arrayList        = new ArrayList();
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(node.OwnerDocument.NameTable);

            namespaceManager.AddNamespace("", "http://www.llrp.org/ltk/schema/core/encoding/xml/1.0");
            namespaceManager.AddNamespace("llrp", "http://www.llrp.org/ltk/schema/core/encoding/xml/1.0");
            PARAM_InventoryParameterSpecID inventoryParameterSpecId = new PARAM_InventoryParameterSpecID();
            string nodeValue = XmlUtil.GetNodeValue(node, "InventoryParameterSpecID");

            inventoryParameterSpecId.InventoryParameterSpecID = (ushort)Util.ParseValueTypeFromString(nodeValue, "u16", "");
            return(inventoryParameterSpecId);
        }
示例#2
0
        public static PARAM_InventoryParameterSpecID FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor >= length)
            {
                return((PARAM_InventoryParameterSpecID)null);
            }
            int       num1      = cursor;
            int       num2      = length;
            ArrayList arrayList = new ArrayList();
            PARAM_InventoryParameterSpecID inventoryParameterSpecId = new PARAM_InventoryParameterSpecID();

            inventoryParameterSpecId.tvCoding = bit_array[cursor];
            int val;

            if (inventoryParameterSpecId.tvCoding)
            {
                ++cursor;
                val = (int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 7);
            }
            else
            {
                cursor += 6;
                val     = (int)(ulong)Util.CalculateVal(ref bit_array, ref cursor, 10);
                inventoryParameterSpecId.length = (ushort)Util.DetermineFieldLength(ref bit_array, ref cursor);
                num2 = num1 + (int)inventoryParameterSpecId.length * 8;
            }
            if (val != (int)inventoryParameterSpecId.TypeID)
            {
                cursor = num1;
                return((PARAM_InventoryParameterSpecID)null);
            }
            if (cursor > length || cursor > num2)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int    field_len = 16;
            object obj;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(ushort), field_len);
            inventoryParameterSpecId.InventoryParameterSpecID = (ushort)obj;
            return(inventoryParameterSpecId);
        }