public iBeaconAdvertisingPacketViewModel(iBeaconAdvertisingPacket model) { CompanyId = model.ObserveProperty(m => m.CompanyId).ToReadOnlyReactiveProperty(); Uuid = model.ObserveProperty(m => m.Uuid).ToReadOnlyReactiveProperty(); Major = model.ObserveProperty(m => m.Major).ToReadOnlyReactiveProperty(); Minor = model.ObserveProperty(m => m.Minor).ToReadOnlyReactiveProperty(); SignalPower = model.ObserveProperty(m => m.SignalPower).ToReadOnlyReactiveProperty(); TxPower = model.ObserveProperty(m => m.TxPower).ToReadOnlyReactiveProperty(); }
private iBeaconScannerService() { EstimoteManager.Instance.Initialize().ContinueWith(x => { System.Diagnostics.Debug.WriteLine($"Beacon Init Status: {x.Result}"); if (x.Result != BeaconInitStatus.Success) { return; } EstimoteManager.Instance.RegionStatusChanged += (sender, beaconArgs) => { return; }; EstimoteManager.Instance.Ranged += (sender, beacons) => { if (beacons == null) { return; } foreach (var beacon in beacons) { var packet = new iBeaconAdvertisingPacket { Uuid = beacon.Uuid, Major = beacon.Major, Minor = beacon.Minor, }; var existPacket = ScanningPackets.FirstOrDefault(item => { return(item.Uuid == packet.Uuid && item.Major == packet.Major && item.Minor == packet.Minor); }); if (existPacket == null) { ScanningPackets.Add(packet); } } }; EstimoteManager.Instance.StopAllMonitoring(); EstimoteManager.Instance.StopAllRanging(); //Sample UUID. var region = new BeaconRegion("hogeIdentifier", "c58925a9-d178-44a9-8e5e-b717e6ede88b"); EstimoteManager.Instance.StartMonitoring(region); EstimoteManager.Instance.StartRanging(region); }); }