public virtual void StopMonitoring(BeaconRegion region) { this.monitoringRegions.Remove(region); this.StopMonitoringNative(region); this.UpdateMonitoringList(); }
protected virtual Estimote.BeaconRegion ToNative(BeaconRegion region) { var uuid = new NSUuid(region.Uuid); Estimote.BeaconRegion native = null; if (region.Major > 0 && region.Minor > 0) native = new Estimote.BeaconRegion(uuid, region.Major.Value, region.Minor.Value, region.Identifier); else if (region.Major > 0) native = new Estimote.BeaconRegion(uuid, region.Major.Value, region.Identifier); else native = new Estimote.BeaconRegion(uuid, region.Identifier); native.NotifyEntryStateOnDisplay = true; native.NotifyOnEntry = true; native.NotifyOnExit = true; return native; }
protected override void StopRangingNative(BeaconRegion region) { var native = this.ToNative(region); this.beaconManager.StopRanging(native); lock (this.beaconsInRange) this.beaconsInRange.Clear(); // TODO: could clear this smart. Instead of the mess below, clear it all and let re-ranging pick it all back up // var count = this.beaconsInRange.Count; // for (var i = 0; i < count; i++) { // var remove = false; // // var b = this.beaconsInRange[i]; // if (b.Uuid.Equals(region.Uuid, StringComparison.InvariantCultureIgnoreCase)) { // if (region.Major > 0) { // if (region.Major == b.Major) { // if (region.Minor > 0) // remove = (region.Minor == b.Minor); // else // remove = true; // } // } // else { // remove = true; // } // } // if (remove) { // this.beaconsInRange.RemoveAt(i); // i--; // count--; // } // } }
public void StopRanging(BeaconRegion region) {}
protected override void StopMonitoringNative(BeaconRegion region) { var native = this.ToNative(region); this.beaconManager.StopMonitoring(native); }
protected override void StopRangingNative(BeaconRegion region) { }
public void StartRanging(BeaconRegion region) {}
public void StopMonitoring(BeaconRegion region) { }
public void StopRanging(BeaconRegion region) { }
public BeaconRegionStatusChangedEventArgs(BeaconRegion region, bool entering) { this.Region = region; this.IsEntering = entering; }
public void StartRanging(BeaconRegion region) { }
protected override void StopRangingNative(BeaconRegion region) { var native = this.ToNative(region); this.beaconManager.StopRangingBeacons(native); }
protected virtual Region ToNative(BeaconRegion region) { return new Region( region.Identifier, region.Uuid, this.ToInteger(region.Major), this.ToInteger(region.Minor) ); }
public virtual void StopRanging(BeaconRegion region) { this.rangingRegions.Remove(region); this.StopRangingNative(region); this.UpdateRangingList(); }
public async Task <IEnumerable <IBeacon> > FetchNearbyBeacons(BeaconRegion region, TimeSpan?time) { return(new List <IBeacon>(0)); }
public virtual async Task<IEnumerable<IBeacon>> FetchNearbyBeacons(BeaconRegion region, TimeSpan? waitTime) { var beaconList = new Dictionary<string, IBeacon>(); var handler = new EventHandler<IEnumerable<IBeacon>>((sender, beacons) => { var list = beacons.Where(x => x.Uuid.Equals(region.Uuid)); if (region.Major > 0) list = list.Where(x => x.Major == region.Major.Value); if (region.Minor > 0) list = list.Where(x => x.Minor == region.Minor.Value); foreach (var beacon in list) { var key = $"{beacon.Uuid}-{beacon.Major}-{beacon.Minor}"; beaconList[key] = beacon; } }); var wasRanging = true; if (!this.RangingRegions.Contains(region)) { this.StartRanging(region); wasRanging = false; } this.Ranged += handler; await Task.Delay(waitTime ?? TimeSpan.FromSeconds(3)); this.Ranged -= handler; if (!wasRanging) this.StopRanging(region); return beaconList.Values; }
protected override void StopRangingNative(BeaconRegion region) {}
protected override void StopMonitoringNative(BeaconRegion region) { }
protected override void StopMonitoringNative(BeaconRegion region) {}
public void StopMonitoring(BeaconRegion region) {}
protected virtual void OnRegionStatusChanged(BeaconRegion region, bool entering) { this.RegionStatusChanged?.Invoke(this, new BeaconRegionStatusChangedEventArgs(region, entering)); }
public async Task<IEnumerable<IBeacon>> FetchNearbyBeacons(BeaconRegion region, TimeSpan? time) { return new List<IBeacon>(0); }
protected abstract void StopMonitoringNative(BeaconRegion region);
protected abstract void StopRangingNative(BeaconRegion region);
protected override void StartMonitoringNative(BeaconRegion region) { Log.Debug(DEBUG_TAG, "StartMonitoringNative"); var native = this.ToNative(region); this.beaconManager.StartMonitoring(native); }