Ejemplo n.º 1
0
        private static void AddTagSpec(string tagID, string maskBits, MSG_ADD_ACCESSSPEC msg)
        {
            //define access command

            //define air protocol spec
            msg.AccessSpec.AccessCommand = new PARAM_AccessCommand();
            msg.AccessSpec.AccessCommand.AirProtocolTagSpec = new UNION_AirProtocolTagSpec();

            PARAM_C1G2TagSpec tagSpec = new PARAM_C1G2TagSpec();

            tagSpec.C1G2TargetTag            = new PARAM_C1G2TargetTag[1];
            tagSpec.C1G2TargetTag[0]         = new PARAM_C1G2TargetTag();
            tagSpec.C1G2TargetTag[0].Match   = true; //change to "true" if you want to the following parameters take effect.
            tagSpec.C1G2TargetTag[0].MB      = new TwoBits(1);
            tagSpec.C1G2TargetTag[0].Pointer = 0x20;
            tagSpec.C1G2TargetTag[0].TagData = LLRPBitArray.FromString(tagID);
            tagSpec.C1G2TargetTag[0].TagMask = LLRPBitArray.FromBinString(maskBits);

            msg.AccessSpec.AccessCommand.AirProtocolTagSpec.Add(tagSpec);
        }
Ejemplo n.º 2
0
        public static PARAM_C1G2InventoryCommand CreateInventoryCommand(ushort pos, String mask, int truncate, int MB)
        {
            // Create the Inventory Command and RF Control parameters
            PARAM_C1G2InventoryCommand c1g2Inv = new PARAM_C1G2InventoryCommand();


            // Setup the tag filter
            c1g2Inv.C1G2Filter = new PARAM_C1G2Filter[1];

            c1g2Inv.C1G2Filter[0] = new PARAM_C1G2Filter();
            c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask = new PARAM_C1G2TagInventoryMask();
            // Filter on EPC (memory bank #1)
            c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask.MB = new TwoBits((ushort)MB);
            // Start filtering at the address 0x20 (the start of the third word).
            // The first two words of the EPC are the checksum and Protocol Control bits.
            //E20030093116008216007210
            //c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask.Pointer = (ushort)(0x20 + 4 * pos);

            //c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask.Pointer = (ushort)(0x00 + 4 * pos);
            //c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask.TagMask = LLRPBitArray.FromHexString(mask);

            c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask.Pointer = (ushort)(0x20 + pos);
            c1g2Inv.C1G2Filter[0].C1G2TagInventoryMask.TagMask = LLRPBitArray.FromBinString(mask);
            c1g2Inv.C1G2Filter[0].T        = (ENUM_C1G2TruncateAction)truncate;
            c1g2Inv.TagInventoryStateAware = false;
            c1g2Inv.C1G2Filter[0].C1G2TagInventoryStateAwareFilterAction        = new PARAM_C1G2TagInventoryStateAwareFilterAction();
            c1g2Inv.C1G2Filter[0].C1G2TagInventoryStateAwareFilterAction.Action = ENUM_C1G2StateAwareAction.DeassertSLOrB_AssertSLOrA;
            c1g2Inv.C1G2Filter[0].C1G2TagInventoryStateAwareFilterAction.Target = ENUM_C1G2StateAwareTarget.SL;



            /* c1g2Inv.C1G2Filter[1] = new PARAM_C1G2Filter();
             * c1g2Inv.C1G2Filter[1].C1G2TagInventoryMask = new PARAM_C1G2TagInventoryMask();
             * // Filter on EPC (memory bank #1)
             * c1g2Inv.C1G2Filter[1].C1G2TagInventoryMask.MB = new TwoBits(1);
             * // Start filtering at the address 0x20 (the start of the third word).
             * // The first two words of the EPC are the checksum and Protocol Control bits.
             * //E20030093116008216007210
             * c1g2Inv.C1G2Filter[1].C1G2TagInventoryMask.Pointer = (ushort)(0x20 + 4 * 0);
             * c1g2Inv.C1G2Filter[1].C1G2TagInventoryMask.TagMask = LLRPBitArray.FromHexString("D");
             * c1g2Inv.C1G2Filter[1].T = (ENUM_C1G2TruncateAction)truncate;
             * c1g2Inv.TagInventoryStateAware = true;
             * //c1g2Inv.C1G2Filter[1].C1G2TagInventoryStateAwareFilterAction = new PARAM_C1G2TagInventoryStateAwareFilterAction();
             * //c1g2Inv.C1G2Filter[1].C1G2TagInventoryStateAwareFilterAction.Action = ENUM_C1G2StateAwareAction.DeassertSLOrB_AssertSLOrA;
             * //c1g2Inv.C1G2Filter[1].C1G2TagInventoryStateAwareFilterAction.Target = ENUM_C1G2StateAwareTarget.SL;
             */
            // Set the session.
            PARAM_C1G2SingulationControl c1g2Sing = new PARAM_C1G2SingulationControl();

            c1g2Sing.Session        = new TwoBits(1);
            c1g2Sing.TagPopulation  = 64;
            c1g2Sing.TagTransitTime = 0;
            c1g2Sing.C1G2TagInventoryStateAwareSingulationAction = new PARAM_C1G2TagInventoryStateAwareSingulationAction();
            //c1g2Sing.C1G2TagInventoryStateAwareSingulationAction.I = ENUM_C1G2TagInventoryStateAwareI.State_A;
            //c1g2Sing.C1G2TagInventoryStateAwareSingulationAction.S = ENUM_C1G2TagInventoryStateAwareS.SL;

            c1g2Inv.C1G2SingulationControl = c1g2Sing;


            // Set the search mode.
            PARAM_ImpinjInventorySearchMode impISM = new PARAM_ImpinjInventorySearchMode();

            impISM.InventorySearchMode = ENUM_ImpinjInventorySearchType.Dual_Target;
            c1g2Inv.Custom.Add(impISM);
            return(c1g2Inv);
        }
Ejemplo n.º 3
0
        private bool ADD_ACCESSSPEC(string tagdata, int type)
        {
            MSG_ADD_ACCESSSPEC msg = new MSG_ADD_ACCESSSPEC();

            msg.AccessSpec = new PARAM_AccessSpec();

            msg.AccessSpec.AccessSpecID = 1001;
            msg.AccessSpec.AntennaID    = 1;
            msg.AccessSpec.ProtocolID   = ENUM_AirProtocols.EPCGlobalClass1Gen2;
            msg.AccessSpec.CurrentState = ENUM_AccessSpecState.Disabled;
            msg.AccessSpec.ROSpecID     = 123;

            //define trigger
            msg.AccessSpec.AccessSpecStopTrigger = new PARAM_AccessSpecStopTrigger();
            msg.AccessSpec.AccessSpecStopTrigger.AccessSpecStopTrigger = ENUM_AccessSpecStopTriggerType.Operation_Count;
            msg.AccessSpec.AccessSpecStopTrigger.OperationCountValue   = 100;

            //define access command

            //define air protocol spec
            msg.AccessSpec.AccessCommand = new PARAM_AccessCommand();
            msg.AccessSpec.AccessCommand.AirProtocolTagSpec = new UNION_AirProtocolTagSpec();

            PARAM_C1G2TagSpec tagSpec = new PARAM_C1G2TagSpec();

            tagSpec.C1G2TargetTag            = new PARAM_C1G2TargetTag[1];
            tagSpec.C1G2TargetTag[0]         = new PARAM_C1G2TargetTag();
            tagSpec.C1G2TargetTag[0].Match   = false; //change to "true" if you want to the following parameters take effect.
            tagSpec.C1G2TargetTag[0].MB      = new TwoBits(1);
            tagSpec.C1G2TargetTag[0].Pointer = 0x20;
            tagSpec.C1G2TargetTag[0].TagData = LLRPBitArray.FromString("1111");
            tagSpec.C1G2TargetTag[0].TagMask = LLRPBitArray.FromBinString("1111111111111111");

            msg.AccessSpec.AccessCommand.AirProtocolTagSpec.Add(tagSpec);

            //define access spec
            msg.AccessSpec.AccessCommand.AccessCommandOpSpec = new UNION_AccessCommandOpSpec();

            PARAM_C1G2Write wr = new PARAM_C1G2Write();

            wr.AccessPassword = 0;
            wr.MB             = new TwoBits(1);
            wr.OpSpecID       = 111;
            wr.WordPointer    = 2;
            //Data to be written.
            wr.WriteData = UInt16Array.FromHexString(tagdata);
            msg.AccessSpec.AccessCommand.AccessCommandOpSpec.Add(wr);

            msg.AccessSpec.AccessReportSpec = new PARAM_AccessReportSpec();
            msg.AccessSpec.AccessReportSpec.AccessReportTrigger = ENUM_AccessReportTriggerType.End_Of_AccessSpec;

            MSG_ADD_ACCESSSPEC_RESPONSE rsp = reader.ADD_ACCESSSPEC(msg, out msg_err, 12000);

            if (rsp != null)
            {
                //return rsp.ToString();
                return(true);
            }
            else if (msg_err != null)
            {
                //return msg_err.ToString();
                return(false);
            }
            else
            {
                //return "Command time out!";
                return(false);
            }
        }