private void Instance_Ranged(object sender, IEnumerable <IBeacon> e) { try { Beacons.Clear(); foreach (var beacon in e) { var imageCellBeacon = new ImageCellBeacon { Text = beacon.Proximity.ToString(), Detail = $"{beacon.Major}.{beacon.Minor}", DetailColor = beacon.Uuid == EstimoteConfig.EstimoteUuidVirtual ? "Blue" : "Purple", ImageSource = beacon.Uuid == EstimoteConfig.EstimoteUuidVirtual ? "EstimoteBlue.png" : "EstimotePurple.png", }; Beacons.Add(imageCellBeacon); } _beaconsFound = DateTime.Now; DisplayCurrentStatus(); if (!_timerStarted) { Device.StartTimer(TimeSpan.FromSeconds(5), TimerElapsed); _timerStarted = true; } Debug.WriteLine("Beacons : " + Beacons.Count); } catch (Exception exception) { LogStatus = exception.Message; } }
public void CreateBeacon(AdvertisementBeaconPageNewBeaconViewModel parameters) { short?preferredTxPower = null; if (parameters.PreferredTxPower != "") { preferredTxPower = Convert.ToInt16(parameters.PreferredTxPower); } var beacon = new ObservableBluetoothLEBeacon( GattConvert.ToIBufferFromHexString(parameters.Payload).ToArray(), parameters.UseExtendedFormat, parameters.IsAnonymous, parameters.IncludeTxPower, preferredTxPower); Beacons.Add(beacon); // Reset the parameters after creation. parameters.Reset(); }