private void Set_Reader_Config() { 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 = 2; cmd.C1G2RFControl.Tari = 0; cmd.C1G2SingulationControl = new PARAM_C1G2SingulationControl(); cmd.C1G2SingulationControl.Session = new TwoBits(1); cmd.C1G2SingulationControl.TagPopulation = 0; cmd.C1G2SingulationControl.TagTransitTime = 1000; cmd.TagInventoryStateAware = false; PARAM_ImpinjInventorySearchMode search_mode = new PARAM_ImpinjInventorySearchMode(); search_mode.InventorySearchMode = ENUM_ImpinjInventorySearchType.Dual_Target; cmd.AddCustomParameter(search_mode); msg.AntennaConfiguration = new PARAM_AntennaConfiguration[1]; msg.AntennaConfiguration[0] = new PARAM_AntennaConfiguration(); msg.AntennaConfiguration[0].AirProtocolInventoryCommandSettings = new UNION_AirProtocolInventoryCommandSettings(); msg.AntennaConfiguration[0].AirProtocolInventoryCommandSettings.Add(cmd); msg.AntennaConfiguration[0].AntennaID = 0; msg.AntennaConfiguration[0].RFReceiver = new PARAM_RFReceiver(); msg.AntennaConfiguration[0].RFReceiver.ReceiverSensitivity = 12; msg.AntennaConfiguration[0].RFTransmitter = new PARAM_RFTransmitter(); msg.AntennaConfiguration[0].RFTransmitter.ChannelIndex = 1; msg.AntennaConfiguration[0].RFTransmitter.HopTableID = 1; msg.AntennaConfiguration[0].RFTransmitter.TransmitPower = 61; ////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; //PARAM_ImpinjFixedFrequencyList fix_list = new PARAM_ImpinjFixedFrequencyList(); //fix_list.FixedFrequencyMode = ENUM_FixedFrequencyMode.Disabled; //cmd.AddCustomParameter(fix_list); //PARAM_ImpinjPresetPowerFrequencyList power_list = new PARAM_ImpinjPresetPowerFrequencyList(); //power_list.PresetPowerMode = ENUM_PresetPowerMode.Disabled; //power_list.Reserved = 0; //cmd.AddCustomParameter(power_list); //PARAM_ImpinjLowDutyCycle lowDuty = new PARAM_ImpinjLowDutyCycle(); //lowDuty.LowDutyCycleMode = ENUM_LowDutyCycleMode.Disabled; //lowDuty.EmptyFieldTimeout = 0; //lowDuty.FieldPingInterval = 0; //cmd.AddCustomParameter(lowDuty); //msg.EventsAndReports = new PARAM_EventsAndReports(); //msg.EventsAndReports.HoldEventsAndReportsUponReconnect = false; //msg.KeepaliveSpec = new PARAM_KeepaliveSpec(); //msg.KeepaliveSpec.KeepaliveTriggerType = ENUM_KeepaliveTriggerType.Null; //msg.KeepaliveSpec.PeriodicTriggerValue = 0; //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 = true; //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 = true; //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_ROSpec; msg.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector(); msg.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector = new UNION_AirProtocolEPCMemorySelector(); PARAM_C1G2EPCMemorySelector c1g2mem = new PARAM_C1G2EPCMemorySelector(); c1g2mem.EnableCRC = true; c1g2mem.EnablePCBits = true; msg.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector.Add(c1g2mem); msg.ROReportSpec.TagReportContentSelector.EnableAccessSpecID = true; msg.ROReportSpec.TagReportContentSelector.EnableAntennaID = true; msg.ROReportSpec.TagReportContentSelector.EnableChannelIndex = true; msg.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp = true; msg.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = true; msg.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp = true; msg.ROReportSpec.TagReportContentSelector.EnablePeakRSSI = true; msg.ROReportSpec.TagReportContentSelector.EnableROSpecID = false; msg.ROReportSpec.TagReportContentSelector.EnableSpecIndex = true; msg.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = true; msg.GPIPortCurrentState = new PARAM_GPIPortCurrentState[1]; msg.GPIPortCurrentState[0] = new PARAM_GPIPortCurrentState(); msg.GPIPortCurrentState[0].Config = true; msg.GPIPortCurrentState[0].GPIPortNum = 2; msg.GPIPortCurrentState[0].State = ENUM_GPIPortState.Low; msg.GPOWriteData = new PARAM_GPOWriteData[1]; msg.GPOWriteData[0] = new PARAM_GPOWriteData(); msg.GPOWriteData[0].GPOData = true; msg.GPOWriteData[0].GPOPortNumber = 1; //PARAM_ImpinjTagDirectionReporting imp_tag_reporting = new PARAM_ImpinjTagDirectionReporting(); //imp_tag_reporting.AntennaConfiguration = ENUM_TagDirectionAntennaConfiguration.Dual_Antenna; //imp_tag_reporting.EnableTagDirection = true; //imp_tag_reporting.Reserved = 0; //msg.ROReportSpec.AddCustomParameter(imp_tag_reporting); ////PARAM_ImpinjSubRegulatoryRegion sub_region = new PARAM_ImpinjSubRegulatoryRegion(); ////sub_region.RegulatoryRegion = ENUM_ImpinjRegulatoryRegion.FCC_Part_15_247; ////msg.AddCustomParameter(sub_region); //msg.ResetToFactoryDefault = false; MSG_SET_READER_CONFIG_RESPONSE rsp = reader.SET_READER_CONFIG(msg, out msg_err, 12000); if (rsp != null) { textBox2.Text = rsp.ToString(); } else if (msg_err != null) { textBox2.Text = rsp.ToString(); } else { textBox2.Text = "Commmand time out!"; } }
private void Set_Reader_Config() { MSG_SET_READER_CONFIG msg = new MSG_SET_READER_CONFIG(); msg.AccessReportSpec = new PARAM_AccessReportSpec(); msg.AccessReportSpec.AccessReportTrigger = ENUM_AccessReportTriggerType.End_Of_AccessSpec; msg.AntennaConfiguration = new PARAM_AntennaConfiguration[1]; msg.AntennaConfiguration[0] = new PARAM_AntennaConfiguration(); msg.AntennaConfiguration[0].AirProtocolInventoryCommandSettings = new UNION_AirProtocolInventoryCommandSettings(); PARAM_C1G2InventoryCommand cmd = new PARAM_C1G2InventoryCommand(); cmd.C1G2RFControl = new PARAM_C1G2RFControl(); cmd.C1G2RFControl.ModeIndex = 2; cmd.C1G2RFControl.Tari = 0; cmd.C1G2SingulationControl = new PARAM_C1G2SingulationControl(); cmd.C1G2SingulationControl.Session = new LTKD.TwoBits(1); cmd.C1G2SingulationControl.TagPopulation = 0; cmd.C1G2SingulationControl.TagTransitTime = 1000; cmd.TagInventoryStateAware = false; msg.AntennaConfiguration[0].AirProtocolInventoryCommandSettings.Add(cmd); msg.AntennaConfiguration[0].AntennaID = 0; msg.AntennaConfiguration[0].RFReceiver = new PARAM_RFReceiver(); msg.AntennaConfiguration[0].RFReceiver.ReceiverSensitivity = 12; msg.AntennaConfiguration[0].RFTransmitter = new PARAM_RFTransmitter(); msg.AntennaConfiguration[0].RFTransmitter.ChannelIndex = 1; msg.AntennaConfiguration[0].RFTransmitter.HopTableID = 1; msg.AntennaConfiguration[0].RFTransmitter.TransmitPower = 61; //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 = 0; 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 = true; 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 = true; 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_ROSpec; msg.ROReportSpec.TagReportContentSelector = new PARAM_TagReportContentSelector(); msg.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector = new UNION_AirProtocolEPCMemorySelector(); PARAM_C1G2EPCMemorySelector c1g2mem = new PARAM_C1G2EPCMemorySelector(); c1g2mem.EnableCRC = true; c1g2mem.EnablePCBits = true; msg.ROReportSpec.TagReportContentSelector.AirProtocolEPCMemorySelector.Add(c1g2mem); msg.ROReportSpec.TagReportContentSelector.EnableAccessSpecID = true; msg.ROReportSpec.TagReportContentSelector.EnableAntennaID = true; msg.ROReportSpec.TagReportContentSelector.EnableChannelIndex = true; msg.ROReportSpec.TagReportContentSelector.EnableFirstSeenTimestamp = true; msg.ROReportSpec.TagReportContentSelector.EnableInventoryParameterSpecID = true; msg.ROReportSpec.TagReportContentSelector.EnableLastSeenTimestamp = true; msg.ROReportSpec.TagReportContentSelector.EnablePeakRSSI = true; msg.ROReportSpec.TagReportContentSelector.EnableROSpecID = false; msg.ROReportSpec.TagReportContentSelector.EnableSpecIndex = true; msg.ROReportSpec.TagReportContentSelector.EnableTagSeenCount = true; msg.ResetToFactoryDefault = false; MSG_SET_READER_CONFIG_RESPONSE rsp = reader.SET_READER_CONFIG(msg, out msg_err, 3000); if (rsp != null) { textBox2.Text = rsp.ToString(); } else if (msg_err != null) { textBox2.Text = rsp.ToString(); } else { textBox2.Text = "Commmand time out!"; } }
// 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"); } }