예제 #1
0
        // Transfer reader's settings to the GUI
        public void ApplySettingsToGUI(ReaderManager.ReaderConfig config)
        {
            bool[] ants = config.antennaID;
            chkSettingsAnt1.Checked     = ants[0];
            chkSettingsAnt2.Checked     = ants[1];
            chkSettingsAnt3.Checked     = ants[2];
            chkSettingsAnt4.Checked     = ants[3];
            txtSettingsAttenuation.Text = config.attenuation.ToString();
            txtSettingsChannelIdx.Text  = config.channelIndex.ToString();
            txtSettingsHopTableIdx.Text = config.hopTableIndex.ToString();
            for (int idx = 0; idx < cmbSettingsMode.Items.Count; idx++)
            {
                uint id = ((ReaderManager.ReaderMode)cmbSettingsMode.Items[idx]).GetModeIdentifier();
                if (id == config.modeIndex)
                {
                    cmbSettingsMode.SelectedIndex = idx;
                }
            }

            // todo: config.modeIndex;

            //txtSettingsPeriodicTriggerValue.Text = config.periodicTriggerValue.ToString();
            txtSettingsReaderSensitivity.Text = config.readerSensitivity.ToString();
            txtSettingsTagPopulation.Text     = config.tagPopulation.ToString();
            txtSettingsTagTransitTime.Text    = config.tagTransitTime.ToString();
        }
예제 #2
0
        private MSG_ADD_ACCESSSPEC GetAccessSpecMsg(ReaderManager.ReaderConfig readerconfig)
        {
            MSG_ADD_ACCESSSPEC msg = new MSG_ADD_ACCESSSPEC();

            msg.AccessSpec = new PARAM_AccessSpec();

            msg.AccessSpec.AccessSpecID = 1001;
            msg.AccessSpec.AntennaID    = 0;     //0 :  applys to all antennae,
            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.Null;
            msg.AccessSpec.AccessSpecStopTrigger.OperationCountValue   = 3;

            return(msg);
        }
예제 #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
        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();
            }

        }
예제 #5
0
        // Sets the client's configuration
        public void Set_Reader_Config(ReaderManager.ReaderConfig readerconfig)
        {
            // find number of antennas to set
            byte   numAntennaToSet = 0;
            ushort antennaSet      = 0;

            for (int i = 0; i < readerconfig.antennaID.Length; i++)
            {
                if (readerconfig.antennaID[i])
                {
                    antennaSet = (ushort)i;
                    numAntennaToSet++;
                }
            }
            MSG_SET_READER_CONFIG msg = new MSG_SET_READER_CONFIG();

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

            PARAM_C1G2InventoryCommand cmd = new PARAM_C1G2InventoryCommand();

            cmd.C1G2RFControl = new PARAM_C1G2RFControl();
            //cmd.C1G2RFControl.ModeIndex = 1000;
            cmd.C1G2RFControl.ModeIndex               = readerconfig.modeIndex;
            cmd.C1G2RFControl.Tari                    = 0;
            cmd.C1G2SingulationControl                = new PARAM_C1G2SingulationControl();
            cmd.C1G2SingulationControl.Session        = new TwoBits(0);
            cmd.C1G2SingulationControl.TagPopulation  = readerconfig.tagPopulation;
            cmd.C1G2SingulationControl.TagTransitTime = readerconfig.tagTransitTime;
            cmd.TagInventoryStateAware                = false;

            msg.AntennaConfiguration = new PARAM_AntennaConfiguration[numAntennaToSet];
            for (ushort i = 1; i < numAntennaToSet + 1; i++)
            {
                msg.AntennaConfiguration[i - 1] = new PARAM_AntennaConfiguration();
                msg.AntennaConfiguration[i - 1].AirProtocolInventoryCommandSettings = new UNION_AirProtocolInventoryCommandSettings();
                msg.AntennaConfiguration[i - 1].AirProtocolInventoryCommandSettings.Add(cmd);

                msg.AntennaConfiguration[i - 1].AntennaID = antennaSet;

                msg.AntennaConfiguration[i - 1].RFReceiver = new PARAM_RFReceiver();
                msg.AntennaConfiguration[i - 1].RFReceiver.ReceiverSensitivity = readerconfig.readerSensitivity;

                msg.AntennaConfiguration[i - 1].RFTransmitter = new PARAM_RFTransmitter();
                msg.AntennaConfiguration[i - 1].RFTransmitter.ChannelIndex  = readerconfig.channelIndex;
                msg.AntennaConfiguration[i - 1].RFTransmitter.HopTableID    = readerconfig.hopTableIndex;
                msg.AntennaConfiguration[i - 1].RFTransmitter.TransmitPower = (ushort)(61 - (readerconfig.attenuation * 4));
            }
            //msg.AntennaProperties = new PARAM_AntennaProperties[1];
            //msg.AntennaProperties[0] = new PARAM_AntennaProperties();
            //msg.AntennaProperties[0].AntennaConnected = true;
            //msg.AntennaProperties[0].AntennaGain = 0;
            //msg.AntennaProperties[0].AntennaID = 1;

            msg.EventsAndReports = new PARAM_EventsAndReports();
            msg.EventsAndReports.HoldEventsAndReportsUponReconnect = false;

            msg.KeepaliveSpec = new PARAM_KeepaliveSpec();
            msg.KeepaliveSpec.KeepaliveTriggerType = ENUM_KeepaliveTriggerType.Null;
            msg.KeepaliveSpec.PeriodicTriggerValue = readerconfig.periodicTriggerValue;

            msg.ReaderEventNotificationSpec = new PARAM_ReaderEventNotificationSpec();
            msg.ReaderEventNotificationSpec.EventNotificationState                      = new PARAM_EventNotificationState[5];
            msg.ReaderEventNotificationSpec.EventNotificationState[0]                   = new PARAM_EventNotificationState();
            msg.ReaderEventNotificationSpec.EventNotificationState[0].EventType         = ENUM_NotificationEventType.AISpec_Event;
            msg.ReaderEventNotificationSpec.EventNotificationState[0].NotificationState = false;

            msg.ReaderEventNotificationSpec.EventNotificationState[1]                   = new PARAM_EventNotificationState();
            msg.ReaderEventNotificationSpec.EventNotificationState[1].EventType         = ENUM_NotificationEventType.Antenna_Event;
            msg.ReaderEventNotificationSpec.EventNotificationState[1].NotificationState = true;

            msg.ReaderEventNotificationSpec.EventNotificationState[2]                   = new PARAM_EventNotificationState();
            msg.ReaderEventNotificationSpec.EventNotificationState[2].EventType         = ENUM_NotificationEventType.GPI_Event;
            msg.ReaderEventNotificationSpec.EventNotificationState[2].NotificationState = false;

            msg.ReaderEventNotificationSpec.EventNotificationState[3]                   = new PARAM_EventNotificationState();
            msg.ReaderEventNotificationSpec.EventNotificationState[3].EventType         = ENUM_NotificationEventType.Reader_Exception_Event;
            msg.ReaderEventNotificationSpec.EventNotificationState[3].NotificationState = true;

            msg.ReaderEventNotificationSpec.EventNotificationState[4]                   = new PARAM_EventNotificationState();
            msg.ReaderEventNotificationSpec.EventNotificationState[4].EventType         = ENUM_NotificationEventType.RFSurvey_Event;
            msg.ReaderEventNotificationSpec.EventNotificationState[4].NotificationState = true;

            msg.ROReportSpec   = new PARAM_ROReportSpec();
            msg.ROReportSpec.N = 1;
            msg.ROReportSpec.ROReportTrigger          = ENUM_ROReportTriggerType.Upon_N_Tags_Or_End_Of_AISpec;
            msg.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector();
            msg.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector = new UNION_AirProtocolEPCMemorySelector();
            PARAM_C1G2EPCMemorySelector c1g2mem = new PARAM_C1G2EPCMemorySelector();

            c1g2mem.EnableCRC    = false;
            c1g2mem.EnablePCBits = false;
            msg.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector.Add(c1g2mem);

            msg.ROReportSpec.TagReportContentSelector.EnableAccessSpecID             = false;
            msg.ROReportSpec.TagReportContentSelector.EnableAntennaID                = true;
            msg.ROReportSpec.TagReportContentSelector.EnableChannelIndex             = false;
            msg.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp       = true;
            msg.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = false;
            msg.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp        = false;
            msg.ROReportSpec.TagReportContentSelector.EnablePeakRSSI     = true;
            msg.ROReportSpec.TagReportContentSelector.EnableROSpecID     = false;
            msg.ROReportSpec.TagReportContentSelector.EnableSpecIndex    = false;
            msg.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = true;

            msg.ResetToFactoryDefault = false;

            MSG_SET_READER_CONFIG_RESPONSE rsp = client.SET_READER_CONFIG(msg, out msg_err, 3000);

            if (rsp != null)
            {
                //textBox2.Text = rsp.ToString() + "\n";
                WriteMessage(rsp.ToString(), "setReaderConfig");
            }
            else if (msg_err != null)
            {
                WriteMessage("setReaderConfig " + rsp.ToString() + "\n");
            }
            else
            {
                WriteMessage("setReaderConfig Commmand time out!" + "\n");
            }
        }
예제 #6
0
        private void AddWriteAccessSpec(string tagID, string maskBits, string writeData, ReaderManager.ReaderConfig readerconfig)
        {
            MSG_ADD_ACCESSSPEC msg = GetAccessSpecMsg(readerconfig);

            AddTagSpec(tagID, maskBits, msg);
            AddWriteAccessCommand(msg, writeData);

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

            SendAccessSpec(msg);
        }
예제 #7
0
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////



        #region Access Spec

        public void AddReadAccessSpec(string tagID, string maskBits, ushort wordCount, ushort wordPtr, ReaderManager.ReaderConfig readerconfig)
        {
            MSG_ADD_ACCESSSPEC msg = GetAccessSpecMsg(readerconfig);

            AddTagSpec(tagID, maskBits, msg);
            AddReadAccessCommand(wordCount, wordPtr, msg);

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

            SendAccessSpec(msg);
        }
예제 #8
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");
            }
        }