Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Start()
- {
- Application.runInBackground = true;
- _scannedItems = new Dictionary<string, BleDeviceInfo>();
- BluetoothLEHardwareInterface.Initialize(true, false, () =>
- {
- },
- (error) =>
- {
- BluetoothLEHardwareInterface.Log("Error: " + error);
- if (error.Contains("Bluetooth LE Not Enabled"))
- BluetoothLEHardwareInterface.BluetoothEnable(true);
- });
- Debug.Log("CheckForBluetooth()");
- InvokeRepeating("CheckForBluetooth", 1f, 1f);
- }
- void CheckForBluetooth()
- {
- Debug.Log("BluetoothLEHardwareInterface.StopScan()");
- BluetoothLEHardwareInterface.StopScan();
- Debug.Log("ScanForPeripheralsWithServices.ScanForPeripheralsWithServices()");
- BluetoothLEHardwareInterface.ScanForPeripheralsWithServices(null, null, (address, name, rssi, bytes) =>
- {
- BluetoothLEHardwareInterface.Log("item found !");
- BluetoothLEHardwareInterface.Log("item scanned: " + address);
- BluetoothLEHardwareInterface.Log("item rssi: " + rssi);
- }, false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement