Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        /// <summary></summary>
        protected override void AddROSpec(uint roSpecId)
        {
            MSG_ADD_ROSPEC msg = new MSG_ADD_ROSPEC();

            // ROSpec
            PARAM_ROSpec pROSpec = new PARAM_ROSpec();

            msg.ROSpec = pROSpec;

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


            // Boundary Spec
            PARAM_ROBoundarySpec pBoundary = new PARAM_ROBoundarySpec();

            pROSpec.ROBoundarySpec = pBoundary;

            // Start Trigger
            pBoundary.ROSpecStartTrigger = new PARAM_ROSpecStartTrigger();
            //pBoundary.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Immediate;
            pBoundary.ROSpecStartTrigger.ROSpecStartTriggerType = ENUM_ROSpecStartTriggerType.Null;

            // Stop Trigger
            pBoundary.ROSpecStopTrigger = new PARAM_ROSpecStopTrigger();
            pBoundary.ROSpecStopTrigger.DurationTriggerValue  = 0;
            pBoundary.ROSpecStopTrigger.ROSpecStopTriggerType = ENUM_ROSpecStopTriggerType.Null;

            // Report Spec
            PARAM_ROReportSpec pReport = new PARAM_ROReportSpec();

            pROSpec.ROReportSpec = pReport;

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

            // Tag report content selector
            PARAM_TagReportContentSelector pTagReportContentSelector = new PARAM_TagReportContentSelector();

            pReport.TagReportContentSelector = pTagReportContentSelector;

            pTagReportContentSelector.AirProtocolEPCMemorySelector = new UNION_AirProtocolEPCMemorySelector();
            PARAM_C1G2EPCMemorySelector pEpcMemorySelector = new PARAM_C1G2EPCMemorySelector();

            pTagReportContentSelector.AirProtocolEPCMemorySelector.Add(pEpcMemorySelector);

            pEpcMemorySelector.EnableCRC    = false;
            pEpcMemorySelector.EnablePCBits = false;

            pTagReportContentSelector.EnableROSpecID  = false;
            pTagReportContentSelector.EnableSpecIndex = false;
            pTagReportContentSelector.EnableInventoryParameterSpecID = false;
            pTagReportContentSelector.EnableAntennaID          = true;
            pTagReportContentSelector.EnablePeakRSSI           = true;
            pTagReportContentSelector.EnableFirstSeenTimestamp = true;
            pTagReportContentSelector.EnableLastSeenTimestamp  = false;
            pTagReportContentSelector.EnableTagSeenCount       = false;
            pTagReportContentSelector.EnableAccessSpecID       = false;


            pROSpec.SpecParameter = new UNION_SpecParameter();

            // Impinj DI spec
            PARAM_ImpinjDISpec pDI = new PARAM_ImpinjDISpec();

            pROSpec.SpecParameter.Add(pDI);

            // Impinj Direction Sectors
            PARAM_ImpinjDirectionSectors pDirectionSectors = new PARAM_ImpinjDirectionSectors();

            pDI.ImpinjDirectionSectors         = pDirectionSectors;
            pDirectionSectors.EnabledSectorIDs = new UInt16Array();
            pDirectionSectors.EnabledSectorIDs.Add(2);
            pDirectionSectors.EnabledSectorIDs.Add(3);

            // Direction Config
            PARAM_ImpinjDirectionConfig pDirectionConfig = new PARAM_ImpinjDirectionConfig();

            pDI.ImpinjDirectionConfig = pDirectionConfig;

            pDirectionConfig.TagAgeIntervalSeconds = 0x02;
            pDirectionConfig.UpdateIntervalSeconds = 0x02;
            pDirectionConfig.FieldOfView           = ENUM_ImpinjDirectionFieldOfView.ReaderSelected;

            PARAM_ImpinjDirectionUserTagPopulationLimit pDITagPopulationLimit = new PARAM_ImpinjDirectionUserTagPopulationLimit();

            pDirectionConfig.ImpinjDirectionUserTagPopulationLimit = pDITagPopulationLimit;
            pDITagPopulationLimit.UserTagPopulationLimit           = 20; // 0x14


            // Impinj  C1G2 Direction Config
            PARAM_ImpinjC1G2DirectionConfig pC1G2DirectionConfig = new PARAM_ImpinjC1G2DirectionConfig();

            pDI.ImpinjC1G2DirectionConfig = pC1G2DirectionConfig;
            pC1G2DirectionConfig.RFMode   = ENUM_ImpinjDirectionRFMode.HighPerformance;

            // 出力電力
            PARAM_ImpinjTransmitPower pTransmitPower = new PARAM_ImpinjTransmitPower();

            pC1G2DirectionConfig.ImpinjTransmitPower = pTransmitPower;
            //pTransmitPower.TransmitPower = 81;
            pTransmitPower.TransmitPower = 21;

            PARAM_ImpinjDirectionReporting pDirectionReporting = new PARAM_ImpinjDirectionReporting();

            pDI.ImpinjDirectionReporting = pDirectionReporting;
            pDirectionReporting.DiagnosticReportLevel  = 0;
            pDirectionReporting.EnableEntryReport      = true;
            pDirectionReporting.EnableExitReport       = true;
            pDirectionReporting.EnableUpdateReport     = true;
            pDirectionReporting.EnableDiagnosticReport = false;

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

            LLRPHelper.CheckLLRPResponse(msgResp, msgErr);
        }