ios - BLE scan window and scan Interval for Android - Stack Overflow

I'm designing a flutter application for BLE communication with a BLE device which is supposed to a

I'm designing a flutter application for BLE communication with a BLE device which is supposed to advertise at an advertising interval of 2sec (power optimisation reasons), My issue arises when I'm scanning and trying to connect to the device. The time taken to discover and connect to the device is very large on Android.

Upon reading some more (I maybe wrong and am open to ideas), I found that iOS has a burst scanning mechanism making it extremely efficient at quickly scanning for devices, however Android is limited in this aspect.

I read that I need to modify the scan_window & scan_interval to achieve what I want, however as of my knowledge I think it is not possible, or is it? Is there something else that I can do to tackle this situation?

I'm using flutter_blue_plus as my wrapper, what can I do to achieve iOS like functionality while keeping the parameters mostly same?

Following are my scan_params -

FlutterBluePlus.startScan(
  timeout: const Duration(seconds: 7),
  androidScanMode: AndroidScanMode.lowLatency,
  withNames: ['Demo Lock'],
);

Connect params -

Future<bool> connectToDevice(String bleAddress) async {
    try {
      final device = BluetoothDevice(remoteId: DeviceIdentifier(bleAddress));

      await device.connect();
      print('Connected to $bleAddress');

      await readData(device);

      return true;
    } catch (e) {
      print('Error connecting to device: $e');
      return false;
    }
  }

Android Connection Time - 3 to 12 sec

iOS Connection Time avg - 3 to 4 sec

(The BLE device has an adv interval of 2sec and is advertising from all three channels)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744284718a4566739.html

相关推荐

  • ios - BLE scan window and scan Interval for Android - Stack Overflow

    I'm designing a flutter application for BLE communication with a BLE device which is supposed to a

    7天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信