public App(IBluetoothPacketProvider provider, string userPath) { InitializeComponent(); XF.Material.Forms.Material.Init(this, "Material.Configuration"); XF.Material.Forms.Material.PlatformConfiguration.ChangeStatusBarColor(Color.White); BLEAdapter = new BLE(provider); UserPath = userPath; MainPage = new LoadingPage(); }
public BLE(IBluetoothPacketProvider provider) { if (provider != null) { manager = new BeaconManager(provider); manager.BeaconAdded += (s, b) => BeaconAdded.Invoke(s, b); provider.AdvertisementPacketReceived += (s, e) => AdvertisementPacketReceived.Invoke(s, e); } }
/// <summary> /// Create new Beacon Manager based on the provider that is going to update the manager with /// new received Bluetooth Packets. /// </summary> /// <param name="provider">Package provider that emits events whenever Bluetooth advertisement packets /// have been received.</param> /// <param name="invokeAction">Optional invoke action, e.g., to run the code to handle the received /// event in a different thread.</param> public BeaconManager(IBluetoothPacketProvider provider, Action <Action> invokeAction = null) { _provider = provider; _provider.AdvertisementPacketReceived += OnAdvertisementPacketReceived; _invokeAction = invokeAction; }