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

            this.beaconManager.StopRangingBeacons(native);
        }
コード例 #13
0
        protected override void StopMonitoringNative(BeaconRegion region)
        {
            var native = this.ToNative(region);

            this.beaconManager.StopMonitoring(native);
        }
コード例 #14
0
        protected virtual Region ToNative(BeaconRegion region) {
			return new Region(
				region.Identifier,
				region.Uuid,
				this.ToInteger(region.Major),
				this.ToInteger(region.Minor)
			);
        }
コード例 #15
0
		public virtual void StopRanging(BeaconRegion region) {
			this.rangingRegions.Remove(region);
            this.StopRangingNative(region);
            this.UpdateRangingList();
		}
コード例 #16
0
 public async Task <IEnumerable <IBeacon> > FetchNearbyBeacons(BeaconRegion region, TimeSpan?time)
 {
     return(new List <IBeacon>(0));
 }
コード例 #17
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;
        }
コード例 #18
0
 protected override void StopRangingNative(BeaconRegion region) {}
コード例 #19
0
 protected override void StopMonitoringNative(BeaconRegion region)
 {
 }
コード例 #20
0
 protected override void StopMonitoringNative(BeaconRegion region) {}
コード例 #21
0
		public void StopMonitoring(BeaconRegion region) {}
コード例 #22
0
 protected virtual void OnRegionStatusChanged(BeaconRegion region, bool entering) {
     this.RegionStatusChanged?.Invoke(this, new BeaconRegionStatusChangedEventArgs(region, entering));
 }
コード例 #23
0
 public async Task<IEnumerable<IBeacon>> FetchNearbyBeacons(BeaconRegion region, TimeSpan? time) {
     return new List<IBeacon>(0);
 }
コード例 #24
0
 protected abstract void StopMonitoringNative(BeaconRegion region);
コード例 #25
0
 protected override void StopRangingNative(BeaconRegion region) {
     var native = this.ToNative(region);
     this.beaconManager.StopRangingBeacons(native);
 }
コード例 #26
0
 protected abstract void StopRangingNative(BeaconRegion region);
コード例 #27
0
 public BeaconRegionStatusChangedEventArgs(BeaconRegion region, bool entering)
 {
     this.Region = region;
     this.IsEntering = entering;
 }
コード例 #28
0
        protected override void StartMonitoringNative(BeaconRegion region) {
            Log.Debug(DEBUG_TAG, "StartMonitoringNative");
			var native = this.ToNative(region);
			this.beaconManager.StartMonitoring(native);
        }