Пример #1
0
        public static PARAM_EPC_96 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_EPC_96 paramEpc96 = new PARAM_EPC_96();
            string       nodeValue  = XmlUtil.GetNodeValue(node, "EPC");

            paramEpc96.EPC = (LLRPBitArray)Util.ParseArrayTypeFromString(nodeValue, "u96", "Hex");
            return(paramEpc96);
        }
Пример #2
0
        public static PARAM_EPC_96 FromBitArray(
            ref BitArray bit_array,
            ref int cursor,
            int length)
        {
            if (cursor >= length)
            {
                return((PARAM_EPC_96)null);
            }
            int          num1       = cursor;
            int          num2       = length;
            ArrayList    arrayList  = new ArrayList();
            PARAM_EPC_96 paramEpc96 = new PARAM_EPC_96();

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

            if (paramEpc96.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);
                paramEpc96.length = (ushort)Util.DetermineFieldLength(ref bit_array, ref cursor);
                num2              = num1 + (int)paramEpc96.length * 8;
            }
            if (val != (int)paramEpc96.TypeID)
            {
                cursor = num1;
                return((PARAM_EPC_96)null);
            }
            if (cursor > length || cursor > num2)
            {
                throw new Exception("Input data is not a complete LLRP message");
            }
            int    field_len = 96;
            object obj;

            Util.ConvertBitArrayToObj(ref bit_array, ref cursor, out obj, typeof(LLRPBitArray), field_len);
            paramEpc96.EPC = (LLRPBitArray)obj;
            return(paramEpc96);
        }