setAdvertisementAndConnectiontInterval method

Future<bool> setAdvertisementAndConnectiontInterval (int advMinInterval int advMaxInterval int connMinInterval int connMaxInterval)

Requests a change of the advertisement and connection intervals on the connected device.

Condition for advertisement interval:

  • the minimum interval should be greater than or equal to 100
  • the maximum interval should be less than or equal to 2000
  • the maximum interval should be greater than or equal to the minimum interval.

Condition for connection interval:

  • the minimum interval should be greater than or equal to 20
  • the maximum interval should be less than or equal to 2000
  • the difference between the maximum and minimum intervals should be greater than or equal to 20.

Returns true if the request was successfully made, false otherwise

Implementation

static Future<bool> setAdvertisementAndConnectiontInterval(
    int advMinInterval, int advMaxInterval, int connMinInterval, int connMaxInterval) async {
  assert(advMinInterval != null && advMaxInterval != null && connMinInterval != null && connMaxInterval != null,
      'Non-null advertisement and connection intervals must be specified.');
  if (!connected) throw ESenseException('Not connected to any eSense device.');
  return await _eSenseManagerMethodChannel.invokeMethod('setAdvertisementAndConnectiontInterval', <String, dynamic>{
    'advMinInterval': advMinInterval,
    'advMaxInterval': advMaxInterval,
    'connMinInterval': connMinInterval,
    'connMaxInterval': connMaxInterval,
  });
}