コード例 #1
0
        // Transfer reader's settings to the GUI
        public void ApplySettingsToGUI(ReaderManager.InventoryConfig config)
        {
            // this sets the cmb box to show the new set values
            cmbSettingsROStartTrigger.SelectedItem = config.startTrigger;
            cmbSettingsROStopTrigger.SelectedItem  = config.stopTrigger;
            cmbSettingsReportTrigger.SelectedItem  = config.reportTrigger;
            cmbSettingsAIStopTrigger.SelectedItem  = config.AITriggerType;

            txtNumReports.Text          = config.reportN.ToString();
            txtSettingsNumAttempts.Text = config.numAttempts.ToString();
            txtSettingsNumTags.Text     = config.numTags.ToString();
            txtSettingsDuration.Text    = config.duration.ToString();
            txtSettingsAITimeout.Text   = config.AITimeout.ToString();
        }
コード例 #2
0
        private void settings_Load_1(object sender, EventArgs e)
        {
            // set position of form
            base.Location = new Point(800, 250);

            if (reader.IsConnected())
            {
                // reader is our handle to the physical reader.
                readerConfigStruct = reader.getReaderConfig();
                invConfigStruct    = reader.getInventoryConfig();
                PopulateReaderModeOptions();
                PopulateInvCmbBox();
                ApplySettingsToGUI(reader.getInventoryConfig());
                ApplySettingsToGUI(reader.getReaderConfig());
            }
            else
            {
                Error.message("Reader must be connected");
                this.Close();
            }
        }
コード例 #3
0
        private void settings_Load_1(object sender, EventArgs e)
        {
            // set position of form
            base.Location = new Point(800, 250);

            if (reader.IsConnected())
            {
                // reader is our handle to the physical reader.
                readerConfigStruct = reader.getReaderConfig();
                invConfigStruct = reader.getInventoryConfig();
                PopulateReaderModeOptions();
                PopulateInvCmbBox();
                ApplySettingsToGUI(reader.getInventoryConfig());
                ApplySettingsToGUI(reader.getReaderConfig());
            }
            else
            {
                Error.message("Reader must be connected");
                this.Close();
            }

        }
コード例 #4
0
ファイル: RFIDReader.cs プロジェクト: yangyongjx/Blink
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////



        #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");
            }
        }