BleConnectionParameters.fromMap constructor

BleConnectionParameters.fromMap(
  1. Map map
)

Constructs a BleConnectionParameters from the map returned by the native platform over the method channel.

The txPhy and rxPhy keys are required integers using the Android BluetoothDevice PHY constant values (1 = LE 1M, 2 = LE 2M, 3 = Coded). The remaining keys are optional and may be absent when the corresponding native callback has not yet fired.

Implementation

factory BleConnectionParameters.fromMap(Map<dynamic, dynamic> map) {
  return BleConnectionParameters(
    txPhy: BlePhy.fromIdentifier(map['txPhy'] as int),
    rxPhy: BlePhy.fromIdentifier(map['rxPhy'] as int),
    connectionIntervalMs: map['connectionIntervalMs'] != null
        ? (map['connectionIntervalMs'] as num).toDouble()
        : null,
    slaveLatency: map['slaveLatency'] as int?,
    supervisionTimeoutMs: map['supervisionTimeoutMs'] as int?,
  );
}