public virtual void StopMonitoring(BeaconRegion region) {
			this.monitoringRegions.Remove(region);
            this.StopMonitoringNative(region);
            this.UpdateMonitoringList();
		}
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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--;
//					}
//			}
        }
Exemplo n.º 4
0
		public void StopRanging(BeaconRegion region) {}
Exemplo n.º 5
0
		protected override void StopMonitoringNative(BeaconRegion region) {
			var native = this.ToNative(region);
            this.beaconManager.StopMonitoring(native);
        }
Exemplo n.º 6
0
 protected override void StopRangingNative(BeaconRegion region)
 {
 }
Exemplo n.º 7
0
		public void StartRanging(BeaconRegion region) {}
Exemplo n.º 8
0
 public void StopMonitoring(BeaconRegion region)
 {
 }
Exemplo n.º 9
0
 public void StopRanging(BeaconRegion region)
 {
 }
Exemplo n.º 10
0
 public BeaconRegionStatusChangedEventArgs(BeaconRegion region, bool entering)
 {
     this.Region     = region;
     this.IsEntering = entering;
 }
Exemplo n.º 11
0
 public void StartRanging(BeaconRegion region)
 {
 }
Exemplo n.º 12
0
        protected override void StopRangingNative(BeaconRegion region)
        {
            var native = this.ToNative(region);

            this.beaconManager.StopRangingBeacons(native);
        }
Exemplo n.º 13
0
        protected override void StopMonitoringNative(BeaconRegion region)
        {
            var native = this.ToNative(region);

            this.beaconManager.StopMonitoring(native);
        }
Exemplo n.º 14
0
        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();
		}
Exemplo n.º 16
0
 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;
        }
Exemplo n.º 18
0
 protected override void StopRangingNative(BeaconRegion region) {}
Exemplo n.º 19
0
 protected override void StopMonitoringNative(BeaconRegion region)
 {
 }
Exemplo n.º 20
0
 protected override void StopMonitoringNative(BeaconRegion region) {}
Exemplo n.º 21
0
		public void StopMonitoring(BeaconRegion region) {}
 protected virtual void OnRegionStatusChanged(BeaconRegion region, bool entering) {
     this.RegionStatusChanged?.Invoke(this, new BeaconRegionStatusChangedEventArgs(region, entering));
 }
Exemplo n.º 23
0
 public async Task<IEnumerable<IBeacon>> FetchNearbyBeacons(BeaconRegion region, TimeSpan? time) {
     return new List<IBeacon>(0);
 }
 protected abstract void StopMonitoringNative(BeaconRegion region);
Exemplo n.º 25
0
 protected override void StopRangingNative(BeaconRegion region) {
     var native = this.ToNative(region);
     this.beaconManager.StopRangingBeacons(native);
 }
 protected abstract void StopRangingNative(BeaconRegion region);
 public BeaconRegionStatusChangedEventArgs(BeaconRegion region, bool entering)
 {
     this.Region = region;
     this.IsEntering = entering;
 }
Exemplo n.º 28
0
        protected override void StartMonitoringNative(BeaconRegion region) {
            Log.Debug(DEBUG_TAG, "StartMonitoringNative");
			var native = this.ToNative(region);
			this.beaconManager.StartMonitoring(native);
        }