Is there any way to adjust the BLE advertisement scanning interval on Windows 10 when using Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcher
Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcher
for Windows Universal App try to change StartScanner as following:
public static void StartScanner(int scanType, ushort scanInterval, ushort scanWindow) { Action action = (object obj) => { BLUETOOTH_FIND_RADIO_PARAM param = new BLUETOOTH_FIND_RADIO_PARAM(); param.Initialize(); IntPtr handle; BluetoothFindFirstRadio(ref param, out handle); uint outsize; LE_SCAN_REQUEST req = new LE_SCAN_REQUEST { scanType = scanType, scanInterval = scanInterval, scanWindow = scanWindow }; DeviceIoControl(handle, 0x41118c, ref req, 8, IntPtr.Zero, 0, out outsize, IntPtr.Zero); }; Task task = new Task(action,"nothing"); task.Start(); }