Pixels Plugin for Unity
Enable communications with Pixels dice using Bluetooth Low Energy.
|
Implements scanning of Bluetooth Low Energy (BLE) peripherals. It stores and notifies of discovered peripherals with ScannedPeripheral objects. More...
#include <Scanner.h>
Public Member Functions | |
Scanner (std::function< void(std::shared_ptr< ScannedPeripheral >)> peripheralDiscovered, std::vector< winrt::guid > services=std::vector< winrt::guid >{}) | |
Initializes a new instance of Scanner and immediately starts scanning for BLE peripherals. | |
void | copyDiscoveredPeripherals (std::vector< std::shared_ptr< ScannedPeripheral > > &outDiscoveredPeripherals) |
Copy the discovered peripherals to the given std::vector. | |
~Scanner () | |
Stops the scan and destroys the Scanner instance. | |
Implements scanning of Bluetooth Low Energy (BLE) peripherals. It stores and notifies of discovered peripherals with ScannedPeripheral objects.
The Scanner class internally stores a WinRT's BluetoothLEAdvertisementWatcher
object.
Systemic::BluetoothLE::Scanner::Scanner | ( | std::function< void(std::shared_ptr< ScannedPeripheral >)> | peripheralDiscovered, |
std::vector< winrt::guid > | services = std::vector<winrt::guid>{} |
||
) |
Initializes a new instance of Scanner and immediately starts scanning for BLE peripherals.
peripheralDiscovered | Called for each received advertisement packet. When receiving a scan response, the advertisement data is combined with the data from the last DiscoveredPeripheral instance created for the same peripheral before being passed to this callback. |
services | List of service UUIDs. Peripherals advertising at least one of the services will be reported. Notify for all peripherals if the list is empty. |
void Systemic::BluetoothLE::Scanner::copyDiscoveredPeripherals | ( | std::vector< std::shared_ptr< ScannedPeripheral > > & | outDiscoveredPeripherals | ) |
Copy the discovered peripherals to the given std::vector.
Peripherals are copied in no particular order, which may vary from one call to another.
outDiscoveredPeripherals | A std::vector to which the discovered peripherals are copied (appended). |