public BeaconsActivity() { _iBeaconManager = IBeaconManager.GetInstanceForApplication(this); _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); meterList = new List <Meter>(); BeaconsNearbyList = new List <IBeacon>(); BeaconsNearbyFlagList = new List <bool>(); _monitoringRegion = new Region("stat", UUID, null, null); _rangingRegion = new Region("stat", UUID, null, null); }
public void StartBeacon() { _beaconManager = BeaconManager.GetInstanceForApplication(this); _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); _dictionaryOfBeaconData = new Dictionary <string, BeaconDataModel>(); //iBeacon BeaconParser beaconParser = new BeaconParser().SetBeaconLayout(AppConstants.IBEACON_FORMAT); _beaconManager.BeaconParsers.Add(beaconParser); _beaconManager.Bind(this); }
public void StartBeacon() { _beaconManager = BeaconManager.GetInstanceForApplication(this); #region Set up Beacon Simulator for TEST USE // Beacon Simulator var beaconSimulator = new BeaconSimulator(); beaconSimulator.CreateBasicSimulatedBeacons(); BeaconManager.BeaconSimulator = beaconSimulator; // Beacon Simulator #endregion Set up Beacon Simulator for TEST USE _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); _dictionaryOfBeaconData = new Dictionary <string, BeaconDataModel>(); //iBeacon BeaconParser beaconParser = new BeaconParser().SetBeaconLayout(AppConstants.IBEACON_FORMAT); _beaconManager.BeaconParsers.Add(beaconParser); _beaconManager.Bind(this); }
public AltBeaconService() { _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); _data = new List <Beacon>(); }
public AltBeaconService() { _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); _data = new List<Beacon>(); }
public AltBeaconService() { _monitorNotifier = new MonitorNotifier(); _rangeNotifier = new RangeNotifier(); }
public void listen() { beaconManager = BeaconManager.GetInstanceForApplication(Xamarin.Forms.Forms.Context.ApplicationContext); beaconManager.BeaconParsers.Add(new BeaconParser(). SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24")); beaconRegion = new Region(gimbalId, Identifier.Parse(uuid), null, null); personRegion = new Region("Person", Identifier.Parse("4BD326AA-A98C-4774-A44F-EB1061678420"), null, null); monitorNotifier = new MonitorNotifier(); rangeNotifier = new RangeNotifier(); beaconManager.SetRangeNotifier(rangeNotifier); beaconManager.SetMonitorNotifier(monitorNotifier); monitorNotifier.EnterRegionComplete += (object obj, MonitorEventArgs e) => { if (e.Region == beaconRegion) { FoundGimbal("There's a gimbal nearby!"); } else if (e.Region == personRegion) { FoundGimbal("There's a person nearby!"); } }; rangeNotifier.DidRangeBeaconsInRegionComplete += (object sender, RangeEventArgs e) => { if (e.Region == personRegion) { OnFoundPerson(new GimbalEventArgs("You found the person!", Color.Green)); } else { if (e.Beacons.Count > 0) { var beacon = e.Beacons.FirstOrDefault(); var l = beacon.Distance; if (isBetween(beacon.Distance, 0, 0.5)) { OnUpdateDisplay(new GimbalEventArgs("You found the gimbal!", Color.Green)); } else if (isBetween(beacon.Distance, 0.5, 2)) { OnUpdateDisplay(new GimbalEventArgs("You're near the gimbal!", Color.Yellow)); } else if (isBetween(beacon.Distance, 2, 7)) { OnUpdateDisplay(new GimbalEventArgs("You're near the gimbal!", Color.Yellow)); } else { OnUpdateDisplay(new GimbalEventArgs("Got no idea where the gimbal is!", Color.Gray)); } } } }; beaconManager.SetBackgroundMode(false); beaconManager.Bind((IBeaconConsumer)Xamarin.Forms.Forms.Context); }