예제 #1
0
        public static void Add_RoSpec(LLRPClient reader)
        {
            MSG_ERROR_MESSAGE errorMessage;
            var msg = new MSG_ADD_ROSPEC {
                ROSpec = new PARAM_ROSpec()
            };

            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            msg.ROSpec.ROSpecID     = 123;

            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Immediate;
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;

            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            var aiSpec = new PARAM_AISpec {
                AntennaIDs = new UInt16Array()
            };

            aiSpec.AntennaIDs = new UInt16Array();
            aiSpec.AntennaIDs.Add(0);
            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;

            aiSpec.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;
            msg.ROSpec.SpecParameter.Add(aiSpec);

            msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            msg.ROSpec.ROReportSpec.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;
            msg.ROSpec.ROReportSpec.N = 1;
            msg.ROSpec.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();

            var response = reader.ADD_ROSPEC(msg, out errorMessage, 2000);

            if (response != null)
            {
                Console.WriteLine(response.ToString());
            }
            else if (errorMessage != null)
            {
                Console.WriteLine(errorMessage.ToString());
            }
            else
            {
                Console.WriteLine("Timeout Error");
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            LLRPClient reader;

            if (args.Length != 1)
            {
                usage();
                return;
            }
            string readerName = args[0];


            Console.WriteLine(
                "Impinj C# LTK.NET RFID Application DocSample1 reader - " +
                readerName + "\n");

            #region Initializing
            {
                Console.WriteLine("Initializing\n");

                //Create an instance of LLRP reader client.
                reader = new LLRPClient();

                //Impinj Best Practice! Always Install the Impinj extensions
                Impinj_Installer.Install();
            }
            #endregion

            #region EventHandlers
            {
                Console.WriteLine("Adding Event Handlers\n");
                // don't need two kinds of reader events, just use encaped here to demonstrate
                //reader.OnReaderEventNotification += new delegateReaderEventNotification(reader_OnReaderEventNotification);
                reader.OnEncapedReaderEventNotification += new delegateEncapReaderEventNotification(reader_OnEncapedReaderEventNotification);
                reader.OnRoAccessReportReceived         += new delegateRoAccessReport(reader_OnRoAccessReportReceived);
            }
            #endregion

            #region Connecting
            {
                Console.WriteLine("Connecting To Reader\n");

                ENUM_ConnectionAttemptStatusType status;

                //Open the reader connection.  Timeout after 5 seconds
                bool ret = reader.Open(readerName, 5000, out status);

                //Ensure that the open succeeded and that the reader
                // returned the correct connection status result

                if (!ret || status != ENUM_ConnectionAttemptStatusType.Success)
                {
                    Console.WriteLine("Failed to Connect to Reader \n");
                    return;
                }
            }
            #endregion

            #region EnableExtensions
            {
                Console.WriteLine("Enabling Impinj Extensions\n");

                MSG_IMPINJ_ENABLE_EXTENSIONS imp_msg =
                    new MSG_IMPINJ_ENABLE_EXTENSIONS();
                MSG_ERROR_MESSAGE msg_err;

                imp_msg.MSG_ID = 1; // not this doesn't need to bet set as the library will default

                //Send the custom message and wait for 8 seconds
                MSG_CUSTOM_MESSAGE cust_rsp = reader.CUSTOM_MESSAGE(imp_msg, out msg_err, 8000);
                MSG_IMPINJ_ENABLE_EXTENSIONS_RESPONSE msg_rsp =
                    cust_rsp as MSG_IMPINJ_ENABLE_EXTENSIONS_RESPONSE;

                if (msg_rsp != null)
                {
                    if (msg_rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(msg_rsp.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("Enable Extensions Command Timed out\n");
                    reader.Close();
                    return;
                }
            }
            #endregion

            #region FactoryDefault
            {
                Console.WriteLine("Factory Default the Reader\n");

                // factory default the reader
                MSG_SET_READER_CONFIG msg_cfg = new MSG_SET_READER_CONFIG();
                MSG_ERROR_MESSAGE     msg_err;

                msg_cfg.ResetToFactoryDefault = true;
                msg_cfg.MSG_ID = 2; //this doesn't need to bet set as the library will default

                //if SET_READER_CONFIG affects antennas it could take several seconds to return
                MSG_SET_READER_CONFIG_RESPONSE rsp_cfg = reader.SET_READER_CONFIG(msg_cfg, out msg_err, 12000);

                if (rsp_cfg != null)
                {
                    if (rsp_cfg.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(rsp_cfg.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("SET_READER_CONFIG Command Timed out\n");
                    reader.Close();
                    return;
                }
            }
            #endregion

            #region ADDRoSpecWithObjects
            {
                Console.WriteLine("Adding RoSpec\n");

                // set up the basic parameters in the ROSpec. Use all the defaults from the reader
                MSG_ADD_ROSPEC    msg = new MSG_ADD_ROSPEC();
                MSG_ERROR_MESSAGE msg_err;
                msg.ROSpec = new PARAM_ROSpec();
                msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
                msg.ROSpec.Priority     = 0x00;
                msg.ROSpec.ROSpecID     = 1111;

                // setup the start and stop triggers in the Boundary Spec
                msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
                msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
                msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;

                msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
                msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;
                msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue  = 0; // ignored by reader

                // Add a single Antenna Inventory to the ROSpec
                msg.ROSpec.SpecParameter = new UNION_SpecParameter();
                PARAM_AISpec aiSpec = new PARAM_AISpec();

                aiSpec.AntennaIDs = new UInt16Array();
                aiSpec.AntennaIDs.Add(0);       // all antennas
                aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
                aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;

                // use all the defaults from the reader.  Just specify the minimum required
                aiSpec.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
                aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
                aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
                aiSpec.InventoryParameterSpec[0].ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;

                msg.ROSpec.SpecParameter.Add(aiSpec);

                MSG_ADD_ROSPEC_RESPONSE rsp = reader.ADD_ROSPEC(msg, out msg_err, 12000);
                if (rsp != null)
                {
                    if (rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(rsp.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("ADD_ROSPEC Command Timed out\n");
                    reader.Close();
                    return;
                }
            }
            #endregion

            #region EnableRoSpec
            {
                Console.WriteLine("Enabling RoSpec\n");
                MSG_ENABLE_ROSPEC msg = new MSG_ENABLE_ROSPEC();
                MSG_ERROR_MESSAGE msg_err;
                msg.ROSpecID = 1111; // this better match the ROSpec we created above
                MSG_ENABLE_ROSPEC_RESPONSE rsp = reader.ENABLE_ROSPEC(msg, out msg_err, 12000);
                if (rsp != null)
                {
                    if (rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(rsp.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("ENABLE_ROSPEC Command Timed out\n");
                    reader.Close();
                    return;
                }
            }
            #endregion

            #region StartRoSpec
            {
                Console.WriteLine("Starting RoSpec\n");
                MSG_START_ROSPEC  msg = new MSG_START_ROSPEC();
                MSG_ERROR_MESSAGE msg_err;
                msg.ROSpecID = 1111; // this better match the RoSpec we created above
                MSG_START_ROSPEC_RESPONSE rsp = reader.START_ROSPEC(msg, out msg_err, 12000);
                if (rsp != null)
                {
                    if (rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(rsp.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("START_ROSPEC Command Timed out\n");
                    reader.Close();
                    return;
                }
            }
            #endregion

            // wait around to collect some data
            Thread.Sleep(10000);

            #region StopRoSpec
            {
                Console.WriteLine("Stopping RoSpec\n");
                MSG_STOP_ROSPEC   msg = new MSG_STOP_ROSPEC();
                MSG_ERROR_MESSAGE msg_err;
                msg.ROSpecID = 1111; // this better match the RoSpec we created above
                MSG_STOP_ROSPEC_RESPONSE rsp = reader.STOP_ROSPEC(msg, out msg_err, 12000);
                if (rsp != null)
                {
                    if (rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(rsp.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("STOP_ROSPEC Command Timed out\n");
                    reader.Close();
                    return;
                }
            }
            #endregion

            #region Clean Up Reader Configuration
            {
                Console.WriteLine("Factory Default the Reader\n");

                // factory default the reader
                MSG_SET_READER_CONFIG msg_cfg = new MSG_SET_READER_CONFIG();
                MSG_ERROR_MESSAGE     msg_err;

                msg_cfg.ResetToFactoryDefault = true;
                msg_cfg.MSG_ID = 2; // not this doesn't need to bet set as the library will default

                // Note that if SET_READER_CONFIG affects antennas it could take several seconds to return
                MSG_SET_READER_CONFIG_RESPONSE rsp_cfg = reader.SET_READER_CONFIG(msg_cfg, out msg_err, 12000);

                if (rsp_cfg != null)
                {
                    if (rsp_cfg.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                    {
                        Console.WriteLine(rsp_cfg.LLRPStatus.StatusCode.ToString());
                        reader.Close();
                        return;
                    }
                }
                else if (msg_err != null)
                {
                    Console.WriteLine(msg_err.ToString());
                    reader.Close();
                    return;
                }
                else
                {
                    Console.WriteLine("SET_READER_CONFIG Command Timed out\n");
                    reader.Close();
                    return;
                }
            }

            #endregion

            Console.WriteLine("  Received " + reportCount + " Reports.");
            Console.WriteLine("  Received " + eventCount + " Events.");
            Console.WriteLine("Closing\n");
            // clean up the reader
            reader.Close();
            reader.OnReaderEventNotification -= new delegateReaderEventNotification(reader_OnReaderEventNotification);
            reader.OnRoAccessReportReceived  -= new delegateRoAccessReport(reader_OnRoAccessReportReceived);
        }
예제 #3
0
        static void Add_RoSpec()
        {
            MSG_ERROR_MESSAGE msg_err;
            MSG_ADD_ROSPEC    msg = new MSG_ADD_ROSPEC();

            // Reader Operation Spec (ROSpec)
            msg.ROSpec = new PARAM_ROSpec();
            // ROSpec должен быть по умолчанию не доступен
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            // The ROSpec ID может получить числовой ID
            msg.ROSpec.ROSpecID = 123;
            // ROBoundarySpec
            // Specifies the start and stop triggers for the ROSpec
            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            // Immediate start trigger
            // The reader will start reading tags as soon as the ROSpec
            // is enabled
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger =
                new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger
            .ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Immediate;

            // No stop trigger. Keep reading tags until the ROSpec is disabled.
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger =
                new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType =
                ENUM_ROSpecStopTriggerType.Null;

            // Antenna Inventory Spec (AISpec)
            // Specifies which antennas and protocol to use
            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            aiSpec.AntennaIDs = new UInt16Array();
            // Enable all antennas
            aiSpec.AntennaIDs.Add(0);
            // No AISpec stop trigger. It stops when the ROSpec stops.
            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType =
                ENUM_AISpecStopTriggerType.Null;
            aiSpec.InventoryParameterSpec =
                new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] =
                new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID =
                ENUM_AirProtocols.EPCGlobalClass1Gen2;
            msg.ROSpec.SpecParameter.Add(aiSpec);

            // Report Spec
            msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            // Send a report for every tag read
            msg.ROSpec.ROReportSpec.ROReportTrigger =
                ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;
            msg.ROSpec.ROReportSpec.N = 1;
            msg.ROSpec.ROReportSpec.TagReportContentSelector =
                new PARAM_TagReportContentSelector();

            MSG_ADD_ROSPEC_RESPONSE rsp =
                readerR.ADD_ROSPEC(msg, out msg_err, 2000);
        }
예제 #4
0
        public void ADDRoSpec()
        {
            Console.WriteLine("Adding RoSpec\n");

            // set up the basic parameters in the ROSpec. Use all the defaults from the reader
            MSG_ADD_ROSPEC    msg = new MSG_ADD_ROSPEC();
            MSG_ERROR_MESSAGE msg_err;

            msg.ROSpec = new PARAM_ROSpec();
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            msg.ROSpec.Priority     = 0x00;
            msg.ROSpec.ROSpecID     = 1111;

            // setup the start and stop triggers in the Boundary Spec
            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;

            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue  = 0; // ignored by reader

            // Add a single Antenna Inventory to the ROSpec
            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            aiSpec.AntennaIDs = new UInt16Array();
            aiSpec.AntennaIDs.Add(1);
            aiSpec.AntennaIDs.Add(2);
            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;

            // use all the defaults from the reader.  Just specify the minimum required
            aiSpec.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID                            = ENUM_AirProtocols.EPCGlobalClass1Gen2;
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration                  = new PARAM_AntennaConfiguration[1];
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0]               = new PARAM_AntennaConfiguration();
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].AntennaID     = 0;
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].RFTransmitter = new PARAM_RFTransmitter();
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].RFTransmitter.ChannelIndex  = 1;
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].RFTransmitter.TransmitPower = 91;
            // Add the inventory command to the AI spec.
            PARAM_C1G2InventoryCommand c1g2Inv = CreateInventoryCommand();

            aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].AirProtocolInventoryCommandSettings.Add(c1g2Inv);
            msg.ROSpec.SpecParameter.Add(aiSpec);

            MSG_ADD_ROSPEC_RESPONSE rsp = reader.ADD_ROSPEC(msg, out msg_err, 12000);

            if (rsp != null)
            {
                if (rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                {
                    Console.WriteLine(rsp.LLRPStatus.StatusCode.ToString());
                    reader.Close();
                    return;
                }
            }
            else if (msg_err != null)
            {
                Console.WriteLine(msg_err.ToString());
                reader.Close();
                return;
            }
            else
            {
                Console.WriteLine("ADD_ROSPEC Command Timed out\n");
                reader.Close();
                return;
            }
        }
예제 #5
0
        private bool Add_RoSpec()
        {
            MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();

            msg.ROSpec = new PARAM_ROSpec();
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            msg.ROSpec.Priority     = 0x00;
            msg.ROSpec.ROSpecID     = 123;

            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;


            //msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue = new PARAM_GPITriggerValue();
            //msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue.GPIPortNum = 1;
            //msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue.Timeout = 10;
            //msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue.GPIEvent = true;



            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Duration;
            //msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue = new PARAM_GPITriggerValue();
            //msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue.GPIEvent = false;
            //msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue.GPIPortNum = 1;
            //msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue.Timeout = 2000;
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue = 2000;

            msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            msg.ROSpec.ROReportSpec.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_AISpec;
            msg.ROSpec.ROReportSpec.N = 1;


            msg.ROSpec.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAccessSpecID             = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAntennaID                = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableChannelIndex             = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp       = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp        = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnablePeakRSSI     = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableROSpecID     = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableSpecIndex    = false;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = false;


            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            aiSpec.AntennaIDs = new UInt16Array();
            aiSpec.AntennaIDs.Add(0);
            //aiSpec.AntennaIDs.Add(2);
            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;
            //aiSpec.AISpecStopTrigger.DurationTrigger = 4000;
            //aiSpec.AISpecStopTrigger.GPITriggerValue = new PARAM_GPITriggerValue();
            //aiSpec.AISpecStopTrigger.GPITriggerValue.GPIEvent = false;
            //aiSpec.AISpecStopTrigger.GPITriggerValue.GPIPortNum = 1;
            //aiSpec.AISpecStopTrigger.GPITriggerValue.Timeout = 0;


            aiSpec.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;

            msg.ROSpec.SpecParameter.Add(aiSpec);

            //PARAM_ImpinjLoopSpec testloopspec = new PARAM_ImpinjLoopSpec();
            //testloopspec.LoopCount = 0;
            //msg.ROSpec.SpecParameter.AddCustomParameter(testloopspec);

            MSG_ADD_ROSPEC_RESPONSE rsp = reader.ADD_ROSPEC(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);
            }
        }
예제 #6
0
        private void Add_RoSpec(uint id)
        {
            MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();
            msg.ROSpec = new PARAM_ROSpec();
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            msg.ROSpec.Priority = 0x00;
            msg.ROSpec.ROSpecID = id;

            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Immediate;

            //>//>/If you want to use GPI as start trigger

            //>msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue = new PARAM_GPITriggerValue();
            //>msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue.GPIPortNum = 1;
            //>msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.GPITriggerValue.GPIEvent = true;

            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;

            //                msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue = 10000;        //>ten second
            if (isNumeric("1000", System.Globalization.NumberStyles.Integer))
            {
                msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue = Convert.ToUInt16("1000");        //>ten second
            }
            else
            {
                //MessageBox.Show("Read Duration must be a numeric integer");
                return;
            }

            //--> change this value

            //>//>/If you want to use GPI as stop trigger

            //>msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.GPI_With_Timeout;
            //>msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue = new PARAM_GPITriggerValue();
            //>msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue.GPIEvent = false;
            //>msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue.GPIPortNum = 1;
            //>msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.GPITriggerValue.Timeout = 2000;

            //>//>/Enable the following code will replace the parameters set by Set_Reader_Config

            //>msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            //>msg.ROSpec.ROReportSpec.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;
            //>msg.ROSpec.ROReportSpec.N = 1; //>0 for reporting ro_access_report at once
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAccessSpecID = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAntennaID = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableChannelIndex = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnablePeakRSSI = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableROSpecID = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableSpecIndex = false;
            //>msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = false;

            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            aiSpec.AntennaIDs = new UInt16Array();

            aiSpec.AntennaIDs.Add(0);
            //aiSpec.AntennaIDs.Add(2);

            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;

            //>//>/GPI triggered AISpec
            //>aiSpec.AISpecStopTrigger.GPITriggerValue = new PARAM_GPITriggerValue();
            //>aiSpec.AISpecStopTrigger.GPITriggerValue.GPIEvent = false;
            //>aiSpec.AISpecStopTrigger.GPITriggerValue.GPIPortNum = 1;
            //>aiSpec.AISpecStopTrigger.GPITriggerValue.Timeout = 0;
            aiSpec.InventoryParameterSpec = new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;
            //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            //>>>>added this to prevent the out of index error when using antennas other than 1
            aiSpec.InventoryParameterSpec[0].AntennaConfiguration = new PARAM_AntennaConfiguration[aiSpec.AntennaIDs.Count];
            for (int x = 0; x < aiSpec.AntennaIDs.Count; x++)
            {
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x] = new PARAM_AntennaConfiguration();
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].AntennaID = aiSpec.AntennaIDs[x];
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFReceiver = new PARAM_RFReceiver();
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter = new PARAM_RFTransmitter();
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFReceiver.ReceiverSensitivity = (ushort)(1); ;
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter.ChannelIndex = 1;
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter.HopTableID = 1;
                aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter.TransmitPower = (ushort)(81); ;
                //aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].AirProtocolInventoryCommandSettings[0] = new PARAM_C1G2InventoryCommand();
                //aiSpec.InventoryParameterSpec[0].AntennaConfiguration[0].AirProtocolInventoryCommandSettings[0];
                //aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFReceiver = new PARAM_RFReceiver();

                //aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter = new PARAM_RFTransmitter();
                //aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter.ChannelIndex = 1;
                //aiSpec.InventoryParameterSpec[0].AntennaConfiguration[x].RFTransmitter.HopTableID = 1;

            }
            //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            msg.ROSpec.SpecParameter.Add(aiSpec);

            MSG_ADD_ROSPEC_RESPONSE rsp = reader.ADD_ROSPEC(msg, out msg_err, 2121);
        }
예제 #7
0
        private void Add_RoSpec()
        {
            MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();

            msg.ROSpec = new PARAM_ROSpec();
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            msg.ROSpec.Priority     = 0x00;
            msg.ROSpec.ROSpecID     = 123;


            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;

            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Duration;
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue  = 1000;

            msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            msg.ROSpec.ROReportSpec.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;
            msg.ROSpec.ROReportSpec.N = 0;


            msg.ROSpec.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAccessSpecID             = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAntennaID                = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableChannelIndex             = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp       = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp        = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnablePeakRSSI     = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableROSpecID     = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableSpecIndex    = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = true;

            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            aiSpec.AntennaIDs = new LTKD.UInt16Array();
            aiSpec.AntennaIDs.Add(0);       //0 :  applys to all antennae,
            //aiSpec.AntennaIDs.Add(1);
            //aiSpec.AntennaIDs.Add(2);     ...

            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Duration;
            aiSpec.AISpecStopTrigger.DurationTrigger       = 1000;

            aiSpec.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;

            msg.ROSpec.SpecParameter.Add(aiSpec);

            MSG_ADD_ROSPEC_RESPONSE rsp = reader.ADD_ROSPEC(msg, out msg_err, 3000);

            if (rsp != null)
            {
                textBox2.Text = rsp.ToString();
            }
            else if (msg_err != null)
            {
                textBox2.Text = msg_err.ToString();
            }
            else
            {
                textBox2.Text = "Command time out!";
            }
        }
예제 #8
0
        static void Add_RoSpec()
        {
            MSG_ERROR_MESSAGE msg_err;
            MSG_ADD_ROSPEC    msg = new MSG_ADD_ROSPEC();

            // Reader Operation Spec (ROSpec)
            msg.ROSpec = new PARAM_ROSpec();
            // ROSpec must be disabled by default
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled;
            // The ROSpec ID can be set to any number
            // You must use the same ID when enabling this ROSpec
            msg.ROSpec.ROSpecID = 123;

            // ROBoundarySpec
            // Specifies the start and stop triggers for the ROSpec
            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            // Immediate start trigger
            // The reader will start reading tags as soon as the ROSpec
            // is enabled
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger =
                new PARAM_ROSpecStartTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger
            .ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Immediate;

            // No stop trigger. Keep reading tags until the ROSpec is disabled.
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger =
                new PARAM_ROSpecStopTrigger();
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType =
                ENUM_ROSpecStopTriggerType.Null;

            // Antenna Inventory Spec (AISpec)
            // Specifies which antennas and protocol to use
            msg.ROSpec.SpecParameter = new UNION_SpecParameter();
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            aiSpec.AntennaIDs = new UInt16Array();
            // Enable all antennas
            aiSpec.AntennaIDs.Add(0);
            // No AISpec stop trigger. It stops when the ROSpec stops.
            aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
            aiSpec.AISpecStopTrigger.AISpecStopTriggerType =
                ENUM_AISpecStopTriggerType.Null;
            aiSpec.InventoryParameterSpec =
                new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] =
                new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID =
                ENUM_AirProtocols.EPCGlobalClass1Gen2;
            msg.ROSpec.SpecParameter.Add(aiSpec);

            // Report Spec
            msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            // Send a report for every tag read
            msg.ROSpec.ROReportSpec.ROReportTrigger =
                ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;
            msg.ROSpec.ROReportSpec.N = 1;
            msg.ROSpec.ROReportSpec.TagReportContentSelector =
                new PARAM_TagReportContentSelector();

            MSG_ADD_ROSPEC_RESPONSE rsp =
                reader.ADD_ROSPEC(msg, out msg_err, 2000);

            if (rsp != null)
            {
                // Success
                Console.WriteLine(rsp.ToString());
            }
            else if (msg_err != null)
            {
                // Error
                Console.WriteLine(msg_err.ToString());
            }
            else
            {
                // Timeout
                Console.WriteLine("Timeout Error.");
            }
        }
예제 #9
0
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////



        #region RO Spec
        /// <summary>
        /// Communicates the information of a ROSpec to the Reader.
        /// </summary>
        public void Add_RoSpec(ReaderManager.InventoryConfig inventoryconfig, ReaderManager.ReaderConfig readerconfig)
        {
            // Create a new message to be sent to the client
            MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();

            msg.ROSpec = new PARAM_ROSpec();
            msg.ROSpec.CurrentState = ENUM_ROSpecState.Disabled; // Reader's current state: Disable
            msg.ROSpec.Priority     = 0x00;                      // specifies the priority of the rospect
            msg.ROSpec.ROSpecID     = 123;

            //==============================
            // Start condition
            msg.ROSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            // Null – No start trigger. The only way to start the ROSpec is with a START_ROSPEC from the Client.
            // 1 Immediate
            // 2 Periodic
            // 3 GPI
            // Note: This ROSpect starts immediatelly
            msg.ROSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = inventoryconfig.startTrigger;


            // Stop condition
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            // 0 Null – Stop when all AISpecs are done, or when preempted, or with a STOP_ROSPEC from the Client.
            // 1 Duration
            // 2 GPI with a timeout value
            // DurationTriggerValue: Duration in milliseconds

            // Trigger 1
            msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = inventoryconfig.stopTrigger;

            //msg.ROSpec.ROBoundarySpec.ROSpecStopTrigger.DurationTriggerValue = 1000;


            // ROReportSpec triger
            // 0 None
            // 1 (Upon N TagReportData Parameters or End of AISpec) Or (End of RFSurveySpec) - N=0 is unlimited.
            // 2 Upon N TagReportData Parameters or End of ROSpec N=0 is unlimited.

            // N: Unsigned Short Integer. This is the number of TagReportData Parameters used in ROReportTrigger = 1 and 2.
            // If N = 0, there is no limit on the number of TagReportData Parameters.
            // This field SHALL be ignored when ROReportTrigger = 0.
            msg.ROSpec.ROReportSpec = new PARAM_ROReportSpec();
            msg.ROSpec.ROReportSpec.ROReportTrigger = inventoryconfig.reportTrigger;
            msg.ROSpec.ROReportSpec.N = inventoryconfig.reportN;


            // Report 2
            //msg.ROSpec.ROReportSpec.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;
            //msg.ROSpec.ROReportSpec.N = 0;

            msg.ROSpec.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAccessSpecID             = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableAntennaID                = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableChannelIndex             = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp       = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp        = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnablePeakRSSI     = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableROSpecID     = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableSpecIndex    = true;
            msg.ROSpec.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = true;

            msg.ROSpec.SpecParameter = new UNION_SpecParameter();

            // Antena inventory operation
            PARAM_AISpec aiSpec = new PARAM_AISpec();

            // 12345

            aiSpec.AntennaIDs = new UInt16Array();
            //aiSpec.AntennaIDs.Add(0);       //0 :  applys to all antennae,
            for (ushort i = 1; i < readerconfig.antennaID.Length + 1; i++)
            {
                if (readerconfig.antennaID[i - 1])
                {
                    aiSpec.AntennaIDs.Add(i);
                }
            }
            // Stop trigger parameter
            // 0 Null – Stop when ROSpec is done.
            // 1 Duration
            // 2 GPI with a timeout value
            // 3 Tag observation

            //if (inventorymode)
            //{
            // TriggerType: Integer
            // Possible Values: Value Modulation
            // ------ ------------
            // 0 Upon seeing N tag observations, or timeout
            // 1 Upon seeing no more new tag observations for t ms,or timeout
            // 2 N attempts to see all tags in the FOV, or timeout

            if (inventoryconfig.AITriggerType == ENUM_AISpecStopTriggerType.Tag_Observation)
            {
                // Antena inventory operation
                aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
                aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Tag_Observation;
                aiSpec.AISpecStopTrigger.TagObservationTrigger = new PARAM_TagObservationTrigger();

                if (inventoryconfig.numAttempts == 0)
                {
                    // Trigger type 1: works
                    aiSpec.AISpecStopTrigger.TagObservationTrigger.TriggerType  = ENUM_TagObservationTriggerType.Upon_Seeing_N_Tags_Or_Timeout;
                    aiSpec.AISpecStopTrigger.TagObservationTrigger.NumberOfTags = inventoryconfig.numTags;
                    aiSpec.AISpecStopTrigger.TagObservationTrigger.Timeout      = inventoryconfig.AITimeout;  // There is no time out
                }
                else
                {
                    // Trigger type 2
                    aiSpec.AISpecStopTrigger.TagObservationTrigger.TriggerType      = ENUM_TagObservationTriggerType.N_Attempts_To_See_All_Tags_In_FOV_Or_Timeout;
                    aiSpec.AISpecStopTrigger.TagObservationTrigger.NumberOfAttempts = inventoryconfig.numAttempts;
                    aiSpec.AISpecStopTrigger.TagObservationTrigger.Timeout          = inventoryconfig.AITimeout; // There is no time out
                }
            }
            else if (inventoryconfig.AITriggerType == ENUM_AISpecStopTriggerType.Duration)
            {
                // Antena inventory operation
                aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
                aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Duration;
                aiSpec.AISpecStopTrigger.DurationTrigger       = inventoryconfig.duration;
            }

            else if (inventoryconfig.AITriggerType == ENUM_AISpecStopTriggerType.GPI_With_Timeout)
            {
                aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
                aiSpec.AISpecStopTrigger.AISpecStopTriggerType   = ENUM_AISpecStopTriggerType.GPI_With_Timeout;
                aiSpec.AISpecStopTrigger.GPITriggerValue.Timeout = inventoryconfig.AITimeout;
            }

            //}


            // Operational parameters for an inventory using a single air protocol.
            aiSpec.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
            aiSpec.InventoryParameterSpec[0] = new PARAM_InventoryParameterSpec();
            aiSpec.InventoryParameterSpec[0].InventoryParameterSpecID = 1234;
            aiSpec.InventoryParameterSpec[0].ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;

            msg.ROSpec.SpecParameter.Add(aiSpec);   // Add operational parameters to Add_ROSpec msg

            // Send message to client and get the response

            MSG_ADD_ROSPEC_RESPONSE rsp = client.ADD_ROSPEC(msg, out msg_err, 3000);


            if (rsp != null)
            {
                //textBox2.Text = rsp.ToString() + "\n";
                WriteMessage(rsp.ToString(), "Add_RoSpec");
                WriteMessage("Add_RoSpec \n");
            }
            else if (msg_err != null)
            {
                WriteMessage("Add_RoSpec " + msg_err.ToString() + "\n");
            }
            else
            {
                WriteMessage("Add_RoSpec Command time out!" + "\n");
            }
        }
예제 #10
0
        private void BuildRoSpec(ReadPlan rp, int timeOut, List<PARAM_ROSpec> roSpecList, bool isStandaloneOp)
        {
            string response = string.Empty;
            if (rp is MultiReadPlan)
            {
                MultiReadPlan mrp = (MultiReadPlan)rp;
                numPlans = mrp.Plans.Length;
                foreach (ReadPlan r in mrp.Plans)
                {
                    // Ideally, totalWeight=0 would allow reader to
                    // dynamically adjust timing based on tags observed.
                    // For now, just divide equally.
                    int subtimeout =
                        (mrp.TotalWeight != 0) ? (int)timeOut * r.Weight / mrp.TotalWeight
                        : timeOut / mrp.Plans.Length;
                    totalWeight = (uint)mrp.TotalWeight;
                    subtimeout = Math.Min(subtimeout, UInt16.MaxValue);
                    BuildRoSpec(r, subtimeout, roSpecList,false);
                }
            }
            else if (rp is SimpleReadPlan)
            {
                //MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();
                // Create a Reader Operation Spec (ROSpec).
                PARAM_ROSpec roSpec = new PARAM_ROSpec();
                roSpec.CurrentState = ENUM_ROSpecState.Disabled;
                roSpec.Priority = 0;
                roSpec.ROSpecID = ++roSpecId;
                //Add rospec id and protocol in the hashtable. So that it can be used to populate the tagdata's protocol member with the read tag protocol.
                roSpecProtcolTable.Add(roSpec.ROSpecID,((SimpleReadPlan)rp).Protocol);
                // Set up the ROBoundarySpec
                // This defines the start and stop triggers.
                roSpec.ROBoundarySpec = new PARAM_ROBoundarySpec();
                // Set the start trigger to null.
                // This means the ROSpec will start as soon as it is enabled.
                roSpec.ROBoundarySpec.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
                uint asyncOnTime = Convert.ToUInt16(ParamGet("/reader/read/asyncOnTime"));
                if (continuousReading && numPlans > 1)
                {                    
                    roSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Periodic;
                    PARAM_PeriodicTriggerValue pValue = new PARAM_PeriodicTriggerValue();
                    pValue.Offset = 0;
                    pValue.Period = asyncOnTime;                    
                    roSpec.ROBoundarySpec.ROSpecStartTrigger.PeriodicTriggerValue = pValue;
                }
                else
                {
                    roSpec.ROBoundarySpec.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;
                }

                // Set the stop trigger is null. This means the ROSpec
                // will keep running until an STOP_ROSPEC message is sent.
                roSpec.ROBoundarySpec.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
                roSpec.ROBoundarySpec.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;

                roSpec.SpecParameter = new UNION_SpecParameter();
                PARAM_AISpec aiSpec = new PARAM_AISpec();
                // Select which antenna ports we want to use based on the read plan settings
                aiSpec.AntennaIDs = new LTKD.UInt16Array();
                SimpleReadPlan srp = (SimpleReadPlan)rp;
                //Check for fast search enable                
                isFastSearch = srp.UseFastSearch;
                //Validate protocol
                ValidateProtocol(srp.Protocol);
                int[] antennas = srp.Antennas;
                if (null == antennas)
                {
                    aiSpec.AntennaIDs.Add(0);               //0 :  applys to all antennae, 
                }
                else
                {
                    foreach (int antenna in antennas)
                        aiSpec.AntennaIDs.Add((ushort)antenna);
                }
                //Specify AI spec trigger type
                aiSpec.AISpecStopTrigger = new PARAM_AISpecStopTrigger();
                //Specify Report spec
                roSpec.ROReportSpec = new PARAM_ROReportSpec();
                if (continuousReading)
                {
                    // ASYNC Mode - Set the AI stop trigger to null. AI spec will run until the ROSpec stops.
                    if(numPlans  > 1)
                    {
                         // ASYNC Mode - Set the AI stop trigger to Duration - AsyncOnTime. AI spec will run until the Disable ROSpec is sent.
                        aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Duration;
                        aiSpec.AISpecStopTrigger.DurationTrigger = (uint)timeOut;
                    }
                    else
                    {
                        aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;
                        aiSpec.AISpecStopTrigger.DurationTrigger = 0;
                    }
                    // Receive a report every time a tag is read.
                    roSpec.ROReportSpec.N = 1;
                }
                else
                {
                    // SYNC Mode - Set the AI stop trigger to inputted duration. AI spec will run for particular duration
                    aiSpec.AISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Duration;
                    aiSpec.AISpecStopTrigger.DurationTrigger = (uint)timeOut;
                    roSpec.ROReportSpec.N = 0;                    
                }
                PARAM_InventoryParameterSpec inventoryParam = new PARAM_InventoryParameterSpec();
                List<PARAM_InventoryParameterSpec> invParamList = new List<PARAM_InventoryParameterSpec>();
                inventoryParam.InventoryParameterSpecID = 1;
                TagFilter tagFilter = srp.Filter;
                //Filter
                if(tagFilter != null)
                {
                    List<PARAM_AntennaConfiguration> antennaConfigList = new List<PARAM_AntennaConfiguration>();
                    PARAM_AntennaConfiguration antConfig = new PARAM_AntennaConfiguration();
                    antConfig.AntennaID = 0;
                    if (TagProtocol.GEN2.Equals(srp.Protocol))
                    {
                    List<PARAM_C1G2Filter> filterList = new List<PARAM_C1G2Filter>();
                    PARAM_C1G2Filter filter = new PARAM_C1G2Filter();
                    PARAM_C1G2TagInventoryMask mask;
                    filter.T = ENUM_C1G2TruncateAction.Do_Not_Truncate;

                    PARAM_C1G2InventoryCommand inventoryCommand = new PARAM_C1G2InventoryCommand();
                    inventoryCommand.TagInventoryStateAware = false;

                    PARAM_C1G2TagInventoryStateUnawareFilterAction unAwareAction = new PARAM_C1G2TagInventoryStateUnawareFilterAction();
                    unAwareAction.Action = ENUM_C1G2StateUnawareAction.Select_Unselect;            

                    if (tagFilter is Gen2.Select)
                    {
                        Gen2.Select selectFilter = (Gen2.Select)tagFilter;
                        mask = new PARAM_C1G2TagInventoryMask();

                        // Memory Bank
                        mask.MB = new LTKD.TwoBits((ushort)selectFilter.Bank);
                        mask.TagMask = LTKD.LLRPBitArray.FromHexString(ByteFormat.ToHex(selectFilter.Mask).Split('x')[1].ToString());
                        mask.Pointer = (ushort)selectFilter.BitPointer;
                        filter.C1G2TagInventoryMask = mask;

                        if (selectFilter.Invert)
                        {
                            unAwareAction.Action = ENUM_C1G2StateUnawareAction.Unselect_Select;
                        }
                        filter.C1G2TagInventoryStateUnawareFilterAction = unAwareAction;                                        
                    }
                    else if (tagFilter is TagData)
                    {
                        TagData tagDataFilter = (TagData)tagFilter;
                        mask = new PARAM_C1G2TagInventoryMask();

                        // EPC Memory Bank 
                        mask.MB = new LTKD.TwoBits((ushort)Gen2.Bank.EPC);
                        mask.TagMask = LTKD.LLRPBitArray.FromHexString(tagDataFilter.EpcString);
                        //For epc bit pointer is 32
                        mask.Pointer = 32;

                        filter.C1G2TagInventoryMask = mask;
                        filter.C1G2TagInventoryStateUnawareFilterAction = unAwareAction;                    
                    }
                    else
                    {
                        throw new Exception("Unsupported operation");
                    }
                    filterList.Add(filter);
                    inventoryCommand.C1G2Filter = filterList.ToArray();
                    antConfig.AirProtocolInventoryCommandSettings.Add(inventoryCommand);
                    antennaConfigList.Add(antConfig);
                    inventoryParam.AntennaConfiguration = antennaConfigList.ToArray();
                    }
                    else if (TagProtocol.ISO180006B.Equals(srp.Protocol))
                    {
                        if (tagFilter is Iso180006b.Select)
                        {
                            PARAM_ThingMagicISO180006BTagPattern tagPattern = new PARAM_ThingMagicISO180006BTagPattern();
                            //Filter type
                            tagPattern.FilterType = ENUM_ThingMagicISO180006BFilterType.ISO180006BSelect;
                            //Invert
                            tagPattern.Invert = ((Iso180006b.Select)tagFilter).Invert;
                            //Address
                            tagPattern.Address = Convert.ToByte(((Iso180006b.Select)tagFilter).Address.ToString("X"));
                            //Mask
                            tagPattern.Mask = ((Iso180006b.Select)tagFilter).Mask;
                            //SelectOp
                            tagPattern.SelectOp = new Org.LLRP.LTK.LLRPV1.DataType.TwoBits(Convert.ToUInt16(((Iso180006b.Select)tagFilter).Op));
                            //TagData
                            tagPattern.TagData = LTKD.ByteArray.FromHexString(ByteFormat.ToHex(((Iso180006b.Select)tagFilter).Data).Split('x')[1]);
                            PARAM_ThingMagicISO180006BInventoryCommand iso18k6bInventoryCmd = new PARAM_ThingMagicISO180006BInventoryCommand();
                            iso18k6bInventoryCmd.ThingMagicISO180006BTagPattern = tagPattern;
                            antConfig.AirProtocolInventoryCommandSettings.Add(iso18k6bInventoryCmd);
                            antennaConfigList.Add(antConfig);
                            inventoryParam.AntennaConfiguration = antennaConfigList.ToArray();
                        }
                        else if(tagFilter is TagData)
                        {
                            PARAM_ThingMagicISO180006BTagPattern tagPattern = new PARAM_ThingMagicISO180006BTagPattern();
                            //Filter type
                            tagPattern.FilterType = ENUM_ThingMagicISO180006BFilterType.ISO180006BTagData;
                            //Invert
                            tagPattern.Invert = false;
                            //Address
                            tagPattern.Address = 0;
                            //Mask
                            tagPattern.Mask = 0xff;
                            //SelectOp
                            tagPattern.SelectOp = new Org.LLRP.LTK.LLRPV1.DataType.TwoBits(Convert.ToUInt16(((Iso180006b.SelectOp.EQUALS))));
                            //TagData
                            tagPattern.TagData = LTKD.ByteArray.FromHexString(((TagData)tagFilter).EpcString);
                            PARAM_ThingMagicISO180006BInventoryCommand iso18k6bInventoryCmd = new PARAM_ThingMagicISO180006BInventoryCommand();
                            iso18k6bInventoryCmd.ThingMagicISO180006BTagPattern = tagPattern;
                            antConfig.AirProtocolInventoryCommandSettings.Add(iso18k6bInventoryCmd);
                            antennaConfigList.Add(antConfig);
                            inventoryParam.AntennaConfiguration = antennaConfigList.ToArray();
                        }
                        else
                        {
                            throw new Exception("Unsupported operation");
                        }
                    }
                }
                if (isFastSearch)
                {
                    List<PARAM_AntennaConfiguration> antennaConfigList = new List<PARAM_AntennaConfiguration>();
                    PARAM_AntennaConfiguration antConfig = new PARAM_AntennaConfiguration();                    
                    PARAM_ThingMagicFastSearchMode fastSearch = new PARAM_ThingMagicFastSearchMode();
                    fastSearch.ThingMagicFastSearch = ENUM_ThingMagicFastSearchValue.Enabled;
                    PARAM_C1G2InventoryCommand inventoryCommandFastSearch = new PARAM_C1G2InventoryCommand();
                    inventoryCommandFastSearch.AddCustomParameter(fastSearch);
                    antConfig.AirProtocolInventoryCommandSettings.Add(inventoryCommandFastSearch);
                    antennaConfigList.Add(antConfig);
                    inventoryParam.AntennaConfiguration = antennaConfigList.ToArray();
                }

                //Emebeded tagops
                TagOp tagOperation = srp.Op;
                PARAM_AccessCommand accessCommand = new PARAM_AccessCommand();
                PARAM_AccessSpec accessSpec = new PARAM_AccessSpec();
                if (null != tagOperation)
                {
                    
                    accessSpec.AccessSpecID = ++AccessSpecID;
                    accessSpec.AccessCommand = accessCommand;
                    accessSpec.ROSpecID = roSpecId;

                    PARAM_AccessSpecStopTrigger trigger = new PARAM_AccessSpecStopTrigger();
                    if (!isStandaloneOp)//Embedded operation
                    {
                        if (tagOperation is Gen2.NxpGen2TagOp.EasAlarm)
                        {
                            throw new FeatureNotSupportedException("Gen2.NxpGen2TagOp.EasAlarm command can be standalone tag operation ");
                        }
                        if (tagOperation is Gen2.NXP.G2X.ResetReadProtect)
                        {
                            throw new FeatureNotSupportedException("NXP Reset Read protect command can be embedded only if the chip-type is G2il");
                        }
                        accessSpec.AntennaID = 0;
                        trigger.AccessSpecStopTrigger = ENUM_AccessSpecStopTriggerType.Null;
                        trigger.OperationCountValue = 0;
                    }
                    else
                    { //standalone operation
                        if (tagOperation is Gen2.Alien.Higgs2.PartialLoadImage)
                        {
                            if (null != tagFilter)
                            {
                                throw new ReaderException("Filter is not supported on this operation.");
                            }
                        }
                        accessSpec.AntennaID = Convert.ToUInt16(ParamGet("/reader/tagop/antenna"));
                        trigger.AccessSpecStopTrigger = ENUM_AccessSpecStopTriggerType.Operation_Count;
                        trigger.OperationCountValue = 1;
                    }

                    accessCommand.AccessCommandOpSpec.Add(BuildOpSpec(srp));
                    accessSpec.ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;
                    accessSpec.CurrentState = ENUM_AccessSpecState.Disabled;
                    accessSpec.AccessSpecStopTrigger = trigger;
                    
                    // Add a list of target tags to the tag spec.

                    PARAM_C1G2TagSpec tagSpec = new PARAM_C1G2TagSpec();
                    PARAM_C1G2TargetTag targetTag = new PARAM_C1G2TargetTag();
                    targetTag.MB = new LTKD.TwoBits(0);
                    targetTag.Match = false;
                    targetTag.Pointer = 0;
                    targetTag.TagData = LTKD.LLRPBitArray.FromBinString("0");
                    targetTag.TagMask = LTKD.LLRPBitArray.FromBinString("0");

                    List<PARAM_C1G2TargetTag> targetTagList = new List<PARAM_C1G2TargetTag>();
                    targetTagList.Add(targetTag);
                    tagSpec.C1G2TargetTag = targetTagList.ToArray();
                    

                     //Add the tag spec to the access command.
                    accessCommand.AirProtocolTagSpec.Add(tagSpec);
                    AddAccessSpec(accessSpec);
                    EnableAccessSpec(accessSpec.AccessSpecID);
                }
                
                // Reading Gen2 Tags, specify in InventorySpec
                if (TagProtocol.GEN2 == srp.Protocol)
                {
                    inventoryParam.ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;
                }
                else if (TagProtocol.ISO180006B == srp.Protocol)
                {
                    inventoryParam.ProtocolID = ENUM_AirProtocols.Unspecified;
                    PARAM_ThingMagicCustomAirProtocols airProtocol = new PARAM_ThingMagicCustomAirProtocols();
                    airProtocol.customProtocolId = ENUM_ThingMagicCustomAirProtocolList.Iso180006b;
                    inventoryParam.Custom.Add(airProtocol);
                }
                else
                {
                    throw new FeatureNotSupportedException("Only GEN2 and ISO18K6B protocol is supported as of now");
                }
                invParamList.Add(inventoryParam);
                aiSpec.InventoryParameterSpec = invParamList.ToArray();
                // Specify what type of tag reports we want to receive and when we want to receive them.
                roSpec.ROReportSpec.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;

                roSpec.SpecParameter.Add(aiSpec);
                // Selecting which fields we want in the report.
                roSpec.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();
                roSpec.ROReportSpec.TagReportContentSelector.EnableAccessSpecID = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableAntennaID = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableChannelIndex = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnablePeakRSSI = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableROSpecID = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableSpecIndex = true;
                roSpec.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = true;                

                // By default both PC and CRC bits are set, so sent from tmmpd
                PARAM_C1G2EPCMemorySelector gen2MemSelector = new PARAM_C1G2EPCMemorySelector();
                gen2MemSelector.EnableCRC = true;
                gen2MemSelector.EnablePCBits = true;
                roSpec.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector.Add(gen2MemSelector);
                // Since Spruce release firmware doesn't support phase, don't add PARAM_ThingMagicTagReportContentSelector 
                // custom paramter in ROReportSpec
                string[] ver = softwareVersion.Split('.');
                if (((Convert.ToInt32(ver[0]) == 4) && 
                    (Convert.ToInt32(ver[1]) >= 17)) ||
                    (Convert.ToInt32(ver[0]) > 4))
                {
                        PARAM_ThingMagicTagReportContentSelector tagReportContentSelector = new PARAM_ThingMagicTagReportContentSelector();
                        tagReportContentSelector.PhaseMode = ENUM_ThingMagicPhaseMode.Enabled;
                        roSpec.ROReportSpec.AddCustomParameter(tagReportContentSelector);                
                }
                roSpecList.Add(roSpec);
            }
        }
예제 #11
0
        /// <summary>ROSpec 追加</summary>
        protected virtual void AddROSpec(uint roSpecId, bool isEnabledImpinjExtensions = false)
        {
            MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();

            PARAM_ROSpec pROSpec = new PARAM_ROSpec();

            msg.ROSpec = pROSpec;

            pROSpec.ROSpecID     = roSpecId;
            pROSpec.Priority     = 0;
            pROSpec.CurrentState = ENUM_ROSpecState.Disabled;

            //
            PARAM_ROBoundarySpec pBoundary = new PARAM_ROBoundarySpec();

            pROSpec.ROBoundarySpec = pBoundary;

            // 開始トリガ
            pBoundary.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            pBoundary.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;
            // 停止トリガ
            pBoundary.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            pBoundary.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;
            pBoundary.ROSpecStopTrigger.DurationTriggerValue  = 0;

            // レポートスペック
            PARAM_ROReportSpec pReport = new PARAM_ROReportSpec();

            pROSpec.ROReportSpec    = pReport;
            pReport.N               = 1;
            pReport.ROReportTrigger = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_ROSpec;


            PARAM_TagReportContentSelector pContentSelector = new PARAM_TagReportContentSelector();

            pReport.TagReportContentSelector          = pContentSelector;
            pContentSelector.EnableAntennaID          = true;
            pContentSelector.EnablePeakRSSI           = true;
            pContentSelector.EnableROSpecID           = true;
            pContentSelector.EnableFirstSeenTimestamp = true;


            if (isEnabledImpinjExtensions)
            {
                var pImpinjContentSelector = new PARAM_ImpinjTagReportContentSelector();
                pReport.Custom.Add(pImpinjContentSelector);

                pImpinjContentSelector.ImpinjEnablePeakRSSI = new PARAM_ImpinjEnablePeakRSSI()
                {
                    PeakRSSIMode = ENUM_ImpinjPeakRSSIMode.Enabled
                };
                pImpinjContentSelector.ImpinjEnableRFPhaseAngle = new PARAM_ImpinjEnableRFPhaseAngle()
                {
                    RFPhaseAngleMode = ENUM_ImpinjRFPhaseAngleMode.Enabled
                };
            }

            pROSpec.SpecParameter = new UNION_SpecParameter();


            // AISpec
            PARAM_AISpec pAI = new PARAM_AISpec();

            pROSpec.SpecParameter.Add(pAI);
            pAI.AntennaIDs = new UInt16Array();
            pAI.AntennaIDs.Add(0);

            // AISpec Stop Trigger
            PARAM_AISpecStopTrigger pAISpecStopTrigger = new PARAM_AISpecStopTrigger();

            pAI.AISpecStopTrigger = pAISpecStopTrigger;
            pAISpecStopTrigger.AISpecStopTriggerType = ENUM_AISpecStopTriggerType.Null;

            PARAM_InventoryParameterSpec pInventory = new PARAM_InventoryParameterSpec();

            pAI.InventoryParameterSpec    = new PARAM_InventoryParameterSpec[1];
            pAI.InventoryParameterSpec[0] = pInventory;

            pInventory.InventoryParameterSpecID = 4567;
            pInventory.ProtocolID = ENUM_AirProtocols.EPCGlobalClass1Gen2;

            if (this.Settings != null)
            {
                pAI.AntennaIDs = new UInt16Array();
                foreach (var ant in this.Settings.Antennas.Where(ant => ant.IsEnabled))
                {
                    pAI.AntennaIDs.Add(ant.Id);
                }

                pInventory.AntennaConfiguration =
                    new PARAM_AntennaConfiguration[this.Settings.Antennas.Count];

                for (ushort aid = 0; aid < this.Settings.Antennas.Count; ++aid)
                {
                    PARAM_AntennaConfiguration pAntenna = new PARAM_AntennaConfiguration();
                    pInventory.AntennaConfiguration[aid] = pAntenna;

                    var antenna = this.Settings.Antennas[aid];
                    pAntenna.AntennaID     = antenna.Id;
                    pAntenna.RFTransmitter = new PARAM_RFTransmitter();
                    pAntenna.RFTransmitter.ChannelIndex  = 1;
                    pAntenna.RFTransmitter.HopTableID    = 0;
                    pAntenna.RFTransmitter.TransmitPower = antenna.Tx.Id;

                    pAntenna.RFReceiver = new PARAM_RFReceiver();
                    pAntenna.RFReceiver.ReceiverSensitivity = antenna.Rx.Id;


                    pAntenna.AirProtocolInventoryCommandSettings = new UNION_AirProtocolInventoryCommandSettings();
                    var pInventoryCommand = new PARAM_C1G2InventoryCommand();
                    pAntenna.AirProtocolInventoryCommandSettings.Add(pInventoryCommand);

                    pInventoryCommand.TagInventoryStateAware  = false;
                    pInventoryCommand.C1G2RFControl           = new PARAM_C1G2RFControl();
                    pInventoryCommand.C1G2RFControl.ModeIndex = 1000;
                    pInventoryCommand.C1G2RFControl.Tari      = 0;

                    pInventoryCommand.C1G2SingulationControl                = new PARAM_C1G2SingulationControl();
                    pInventoryCommand.C1G2SingulationControl.Session        = new TwoBits(false, false);
                    pInventoryCommand.C1G2SingulationControl.TagPopulation  = 32;
                    pInventoryCommand.C1G2SingulationControl.TagTransitTime = 0;
                }
            }

            MSG_ERROR_MESSAGE?      msgErr  = null;
            MSG_ADD_ROSPEC_RESPONSE?msgResp = this.BaseClient?.ADD_ROSPEC(
                msg:      msg,
                msg_err:  out msgErr,
                time_out: 3000);

            this.CheckLLRPError(msgResp, msgErr);
        }