Beispiel #1
0
 public static void PowerOFF(ComPort port)
 {
     port.SendCommand(Constants.ANTPower.SendID, Constants.ANTPower.Power.OFF);
     byte[] Back = port.ReadPacket();
     if (!(Back[0] == Constants.ANTPower.RecieveID && Back[2] == Constants.Error.NoError))
         throw new Exception("Error Turning OFF the Antenna!");
 }
Beispiel #2
0
 private static Tag NextTagInventory(ComPort port)
 {
     //port.SendCommand(Constants.InventoryRSSI.SendID, Constants.InventoryRSSI.Type.Start);
       byte[] Back = port.ReadPacket();
       if (!(Back[0] == Constants.InventoryRSSI.RecieveID))
             throw new Exception("Error Getting next tag");
       return new Tag(Back);
 }
Beispiel #3
0
        public static List<Tag> StartTagInventory(ComPort port)
        {
            List<Tag> Tags = new List<Tag>();
              int TagCount;
              port.SendCommand(Constants.InventoryRSSI.SendID, Constants.InventoryRSSI.Type.Start);
              byte[] Back = port.ReadPacket();
              if (!(Back[0] == Constants.InventoryRSSI.RecieveID))
                    throw new Exception("Error Starting RSSI Inventory!");
              Tags.Add(new Tag(Back));
              TagCount = (int)Back[2] -1; //Minus one because we have already read the first tag
              int i = 0;
              while (i < TagCount)
              {
                  Tags.Add(NextTagInventory(port));
                  i++;
              }

              return Tags;
        }
Beispiel #4
0
        internal void Initalize(int Distance_Start, int Distance_End, int Distance_interval, LookupTable.Axis ID, ComPort Reader)
        {
            List<Tag> Tags;

            //Start Distance of the configuration
            int Distance = Distance_Start;
            MessageBox.Show("Information",string.Format("Please put tag at {0}cm then press enter", Distance), MessageBoxButtons.OK);

            while (Distance < Distance_End)
            {

                List<Tag> ListRead = new List<Tag>();
                while (ListRead.Count < Configutation_num_reads)
                {
                    //Seach for tags with RSSI
                    Tags = Inventory.StartTagInventory(Reader);

                    //if more then 1 tag found and does not contain SHIT
                    //Then we read the tag and increment Read
                    if (Tags.Count > 0)
                        if (!Tags[0].ID.Contains("SHIT"))
                        {
                            ListRead.Add(Tags[0]);
                            Debug.WriteLine("I:{0}, Q:{1}", Tags[0].I, Tags[0].Q);
                        }
                    //Sleep thread to get accurate measurements each time
                    //Has to be adjusted so we do not overflow the reader
                    // Console.WriteLine("Attempt:{0}",iter);
                    //System.Threading.Thread.Sleep(SleepTimer);
                }
                Data.Add_Tags(Distance, ListRead,ID);
                Distance += Distance_interval;
                MessageBox.Show("Information",string.Format("Please put tag at {0}cm then press enter", Distance), MessageBoxButtons.OK);

            }
        }