reconnect method

  1. @override
Future<IBleDevice> reconnect()
override

Tries to reconnect the device.

Implementation

@override
Future<IBleDevice> reconnect() async {
  await Future.delayed(const Duration(seconds: 2))
      .then((value) => _bleDeviceConnectionStateChangeListener
          ?.onDeviceConnectionStateChanged(
              device: this, newGattState: BleConnectionState.connecting))
      .then((value) => Future.delayed(const Duration(seconds: 1)).then(
          (value) => _bleDeviceConnectionStateChangeListener
              ?.onDeviceConnectionStateChanged(
                  device: this, newGattState: BleConnectionState.connected)));
  return this;
}