Пример #1
0
 private void sendBeacons()
 {
     sendingBeacons = true;
     while (sendingBeacons)
     {
         if (MINSLEEP != 0 || MAXSLEEP != 0)
         {
             Thread.Sleep(rnd.Next(MINSLEEP, MAXSLEEP));
         }
         Beacon generatedRSSI = new Beacon(getRandomRSSIByDistance(), DateTime.Now);
         avgRSSI = GetAverageRSSI(generatedRSSI);
         sendBeacon(this, generatedRSSI.RSSI);
     }
 }
 private int GetAverageRSSI(Beacon LastRSSI)
 {
     DateTime now = DateTime.Now;
     lastBeacons.RemoveAll(beacon => (now - beacon.Timestamp).TotalSeconds > DIFFERENCE);
     lastBeacons.Add(LastRSSI);
     return GetAverageRSSI();
 }
 private void sendBeacons()
 {
     sendingBeacons = true;
     while (sendingBeacons)
     {
         if (MINSLEEP != 0 || MAXSLEEP != 0) Thread.Sleep(rnd.Next(MINSLEEP, MAXSLEEP));
         Beacon generatedRSSI = new Beacon(getRandomRSSIByDistance(), DateTime.Now);
         avgRSSI = GetAverageRSSI(generatedRSSI);
         sendBeacon(this, generatedRSSI.RSSI);
     }
 }