BluetoothLE (BLE) Manager
The BluetoothLE (BLE) manager is where everything begins. From here, you can request the necessary access from your user to use the hardware and scan for BLE peripherals around you
General
Start by resolving, injecting, etc your Shiny.BluetoothLE.IBleManager and as with most modules within Shiny, call RequestAccess to ensure that you your platform supports the operation, your user has given you consent to perform the operation, and that all of the necessary hardware is turned on
Scan for Peripherals
Scan for “My” Peripherals
It generally isn’t recommended you use an “open” ended scan. You also don’t want to rely on something like a device name or even “manufacturer” data to find peripherals your app was meant to work with. It is recommended you ALWAYS use a serviceUiid to scan by
Get Connected Devices
Returns all devices currently connected to your APP, not the device itself.
Returns a enumerable of peripherals (non async method)
Get Known Peripheral
Gets a peripheral by a UUID. This is only available after a scan operation assuming the peripheral was “seen”
Returns null if not found
Managed Scans
Managed scans is probably one of the most helpful things in BLE in your User Interface if you are running any sort of peripheral scan. It deals with things like:
- Maintains an observable collection that it makes thread safe and throttled changes to. Most users new to BLE won’t do these things out of the box, so let us manage it for you.
- Marshalls changes to the collection to the main thread (or another RX scheduler if necessary) allowing UI’s like Xamarin Forms a chance to rerender the contents
- Scan results don’t create fresh instances of a scanresult, they update any existing scanresult’s for previous found peripherals. They simply update the new info like RSSI and other advertisement data that can change between results.
- Devices moving out of range - if device isn’t heard in X seconds, a remove is triggered