public void StartInventory() { if (!IsConnected()) { gui.AppendToDebugTextBox("Can't start inventory: Reader not connected."); return; } // Initialize the reader configuration to obtain another mobility pattern vector // Clean current reader configuration reader.CleanSubscriptionClient(); currentMode = GuiModes.Idle; // Initialize the reader bool connect = reader.connectTo(reader_address); currentMode = GuiModes.Ready; readerModes = reader.Get_Reader_Capability(); SetDefaultReaderConfig(); SetDefaultInventoryConfig(); reader.Initialize(); stopInventory = false; ProbeMobilityPatterns(); }
public void StopInventory() { if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } }
public void ProbeMobilityPatterns() { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } // Mobility probe mode for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } channel_counter = 0; /* * // Initialize the reader configuration to obtain another mobility pattern vector * // Clean current reader configuration * reader.CleanSubscriptionClient(); * currentMode = GuiModes.Idle; * * // Initialize the reader * bool connect = reader.connectTo("10.0.0.200"); * currentMode = GuiModes.Ready; * readerModes = reader.Get_Reader_Capability(); * SetDefaultReaderConfig(); * SetDefaultInventoryConfig(); * reader.Initialize();*/ inventoryconfig.duration = 30; readerconfig.modeIndex = 1000; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); // Start the first round of mobility detection if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(RecordMobilityPatterns); probe_channel_timer.Interval = 1500; probe_channel_timer.Enabled = true; } }
public void SlowMovingTag(Object sender, ElapsedEventArgs e) { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } if (channel_index == last_channel_index) { if (channel_counter != 0) { tagInfo.rssi[channel_index - 1] = tagInfo.rssi[channel_index - 1] / channel_counter; } } // Record the second round of tag mobility detection for (int ii = 0; ii < 50; ii++) { mobility_pattern[0, ii] = tagInfo.rssi[ii]; } for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } channel_counter = 0; inventoryconfig.duration = 100; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(SlowMovingTag_MobilityCheck); probe_channel_timer.Interval = 5000; probe_channel_timer.Enabled = true; } return; }
public void StopInventory() { if (IsInventoryRunning()) { stopInventory = true; reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; if (probe_channel_timer != null) { probe_channel_timer.Close(); } } }
public void StartInventory() { if (!IsConnected()) { gui.AppendToDebugTextBox("Can't start inventory: Reader not connected."); return; } //reader.DELETE_ACCESSSPEC(); // clear out any old read commands reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); }
public void RateAdaptation_FastMovingTag(Object sender, ElapsedEventArgs e) { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } readerconfig.modeIndex = RateSelection(); // Start transmission for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } //channel_counter = 0; inventoryconfig.duration = 100; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(FastMovingTag_MobilityCheck); probe_channel_timer.Interval = 5000; probe_channel_timer.Enabled = true; } return; }
/// <summary> /// disconnect to Reader /// </summary> public void Disconnect() { // check if doing inventory if (IsInventoryRunning()) { StopInventory(); } // check if doing read if (IsReadRunning()) { StopRead(); } if (IsConnected()) { reader.CleanSubscriptionClient(); } currentMode = GuiModes.Idle; }
public void RecordMobilityPatterns(Object sender, ElapsedEventArgs e) { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } if (mobility_probe_round == 0) { if (channel_index == last_channel_index) { if (channel_counter != 0) { tagInfo.rssi[channel_index - 1] = tagInfo.rssi[channel_index - 1] / channel_counter; } } // Record the first round of tag mobility detection for (int ii = 0; ii < 50; ii++) { mobility_pattern[0, ii] = tagInfo.rssi[ii]; } mobility_probe_round = mobility_probe_round + 1; ProbeMobilityPatterns(); } else { if (channel_index == last_channel_index) { if (channel_counter!=0) { tagInfo.rssi[channel_index - 1] = tagInfo.rssi[channel_index - 1] / channel_counter; } } // Record the second round of tag mobility detection for (int ii = 0; ii < 50; ii++) { mobility_pattern[1, ii] = tagInfo.rssi[ii]; } Thread.Sleep(10); // Check tag mobility pattern Boolean tag_mobility = CheckTagMobility(); // Finish mobility detection and switch to rate adaptation // Probe channel first for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } channel_counter = 0; inventoryconfig.duration = 20; readerconfig.modeIndex = 1000; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); if (tag_mobility==false) { // For static tag if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(RateAdaptation_SlowMovingTag); probe_channel_timer.Interval = 1000; probe_channel_timer.Enabled = true; } } else { // For mobile tag if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(RateAdaptation_FastMovingTag); probe_channel_timer.Interval = 1000; probe_channel_timer.Enabled = true; } } } return; }
public void RateAdaptation_SlowMovingTag(Object sender, ElapsedEventArgs e) { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } readerconfig.modeIndex = RateSelection(); for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } channel_counter = 0; inventoryconfig.duration = 100; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(SlowMovingTag); probe_channel_timer.Interval = 5000; probe_channel_timer.Enabled = true; } return; }
public void ProbeMobilityPatterns() { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } // Mobility probe mode for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } channel_counter = 0; /* // Initialize the reader configuration to obtain another mobility pattern vector // Clean current reader configuration reader.CleanSubscriptionClient(); currentMode = GuiModes.Idle; // Initialize the reader bool connect = reader.connectTo("10.0.0.200"); currentMode = GuiModes.Ready; readerModes = reader.Get_Reader_Capability(); SetDefaultReaderConfig(); SetDefaultInventoryConfig(); reader.Initialize();*/ inventoryconfig.duration = 30; readerconfig.modeIndex = 1000; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); // Start the first round of mobility detection if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(RecordMobilityPatterns); probe_channel_timer.Interval = 1500; probe_channel_timer.Enabled = true; } }
/// <summary> /// disconnect to Reader /// </summary> public void Disconnect() { // check if doing inventory if (IsInventoryRunning()) { StopInventory(); } // check if doing read if (IsReadRunning()) { StopRead(); } if(IsConnected()) { reader.CleanSubscriptionClient(); } currentMode = GuiModes.Idle; }
/// <summary> /// Connect to Reader /// </summary> public void Connect(string ipAddress) { reader_address = ipAddress; // check for dumb errors. if (IsConnected()) throw new Exception("Already connected"); if (ipAddress.Length == 0) throw new Exception("Bad IP"); IPAddress address = null; // look for url-based addresses if (ipAddress.ToLower().Contains("speedway")) { IPAddress[] addresses; addresses = Dns.GetHostEntry(ipAddress).AddressList; if (addresses.Length >= 1) address = addresses[0]; else throw new Exception("Hostname not found."); } else { if (!System.Net.IPAddress.TryParse(ipAddress, out address)) throw new Exception("Bad IP Address"); address = System.Net.IPAddress.Parse(ipAddress); } if (address != null) { bool connect = reader.connectTo(ipAddress); if (connect) { currentMode = GuiModes.Ready; readerModes = reader.Get_Reader_Capability(); SetDefaultReaderConfig(); SetDefaultInventoryConfig(); //WriteMessage(status.ToString()); reader.Initialize(); } else { throw new Exception("Bad IP or Reader in use."); } } else { // MessageBox.Show("Need IP address to connect to client", "LLRP Test", MessageBoxButtons.OK, MessageBoxIcon.Error); // txtIPAddress.Focus(); throw new Exception("Need IP address to connect to client"); } }
// FastMovingTag_MobilityCheck use history record to figure out the mobility patterns of fast moving tag. public void FastMovingTag_MobilityCheck(Object sender, ElapsedEventArgs e) { // Stop reader inventory if (IsInventoryRunning()) { reader.Stop_RoSpec(); reader.Delete_RoSpec(); currentMode = GuiModes.Ready; } if (probe_channel_timer != null) { probe_channel_timer.Close(); } if (channel_index == last_channel_index) { if (channel_counter != 0) { tagInfo.rssi[channel_index - 1] = tagInfo.rssi[channel_index - 1] / channel_counter; } } // Record the second round of tag mobility detection for (int ii = 0; ii < 50; ii++) { mobility_pattern[1, ii] = tagInfo.rssi[ii]; } Thread.Sleep(10); Boolean tag_mobility = CheckTagMobility(); if (tag_mobility == false) { // Rate adaptation and switch to mobile data transfer mode. for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } //channel_counter = 0; inventoryconfig.duration = 20; readerconfig.modeIndex = 1000; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); // For mobile tag if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(RateAdaptation_SlowMovingTag); probe_channel_timer.Interval = 1000; probe_channel_timer.Enabled = true; } } else { // Probe channel first for (int ii = 0; ii < 50; ii++) { tagInfo.rssi[ii] = 0; } //channel_counter = 0; inventoryconfig.duration = 20; readerconfig.modeIndex = 1000; reader.Set_Reader_Config(readerconfig); // Sets the client configuration currentMode = GuiModes.UserInventory; // Add a ROSpec reader.Add_RoSpec(inventoryconfig, readerconfig); reader.Enable_RoSpec(); if (stopInventory == false) { probe_channel_timer = new System.Timers.Timer(); probe_channel_timer.Elapsed += new System.Timers.ElapsedEventHandler(RateAdaptation_FastMovingTag); probe_channel_timer.Interval = 1000; probe_channel_timer.Enabled = true; } } }
public void SetMode(GuiModes newMode, string txtIPAddress) { // Set current mode = new Mode, // this will be changed if there is an error. GuiModes oldMode = currentMode; if(newMode == GuiModes.AttenuatorTest) throw new Exception("Can't set mode to AttenuatorTest!"); // Switch performs the action switch (newMode) { case GuiModes.Idle: if (IsConnected()) { Disconnect(); } break; case GuiModes.Ready: // If we were disconnected, connect. if (oldMode == GuiModes.Idle) { if (!IsConnected()) { // CONNECT! Connect(txtIPAddress); // if connect fails, an exception will be thrown // if success, currentMode will be set after this switch statement } } else if (oldMode == GuiModes.Ready) { stopInventory = true; } // If we were running, stop various modes: else if (oldMode == GuiModes.UserInventory) { if (IsConnected()) { StopInventory(); } } break; case GuiModes.UserInventory: if (!IsConnected()) { currentMode = GuiModes.Idle; } else if (oldMode == GuiModes.Ready) { StartInventory(); } break; default: throw new Exception("Can't set mode to unknown state!"); //break; } // if no exceptions have interrupted us, we successfully got to the new mode: currentMode = newMode; }
public void SetMode(GuiModes newMode, string txtIPAddress) { // Set current mode = new Mode, // this will be changed if there is an error. GuiModes oldMode = currentMode; if (newMode == GuiModes.AttenuatorTest) { throw new Exception("Can't set mode to AttenuatorTest!"); } // Switch performs the action switch (newMode) { case GuiModes.Idle: if (IsConnected()) { Disconnect(); } break; case GuiModes.Ready: // If we were disconnected, connect. if (oldMode == GuiModes.Idle) { if (!IsConnected()) { // CONNECT! Connect(txtIPAddress); // if connect fails, an exception will be thrown // if success, currentMode will be set after this switch statement } } else if (oldMode == GuiModes.Ready) { stopInventory = true; } // If we were running, stop various modes: else if (oldMode == GuiModes.UserInventory) { if (IsConnected()) { StopInventory(); } } break; case GuiModes.UserInventory: if (!IsConnected()) { currentMode = GuiModes.Idle; } else if (oldMode == GuiModes.Ready) { StartInventory(); } break; default: throw new Exception("Can't set mode to unknown state!"); //break; } // if no exceptions have interrupted us, we successfully got to the new mode: currentMode = newMode; }
/// <summary> /// Connect to Reader /// </summary> public void Connect(string ipAddress) { reader_address = ipAddress; // check for dumb errors. if (IsConnected()) { throw new Exception("Already connected"); } if (ipAddress.Length == 0) { throw new Exception("Bad IP"); } IPAddress address = null; // look for url-based addresses if (ipAddress.ToLower().Contains("speedway")) { IPAddress[] addresses; addresses = Dns.GetHostEntry(ipAddress).AddressList; if (addresses.Length >= 1) { address = addresses[0]; } else { throw new Exception("Hostname not found."); } } else { if (!System.Net.IPAddress.TryParse(ipAddress, out address)) { throw new Exception("Bad IP Address"); } address = System.Net.IPAddress.Parse(ipAddress); } if (address != null) { bool connect = reader.connectTo(ipAddress); if (connect) { currentMode = GuiModes.Ready; readerModes = reader.Get_Reader_Capability(); SetDefaultReaderConfig(); SetDefaultInventoryConfig(); //WriteMessage(status.ToString()); reader.Initialize(); } else { throw new Exception("Bad IP or Reader in use."); } } else { // MessageBox.Show("Need IP address to connect to client", "LLRP Test", MessageBoxButtons.OK, MessageBoxIcon.Error); // txtIPAddress.Focus(); throw new Exception("Need IP address to connect to client"); } }