BmBluetoothCharacteristic.fromMap constructor

BmBluetoothCharacteristic.fromMap(
  1. Map json
)

Implementation

factory BmBluetoothCharacteristic.fromMap(Map<dynamic, dynamic> json) {
  // convert descriptors
  List<BmBluetoothDescriptor> descs = [];
  for (var v in json['descriptors']) {
    descs.add(BmBluetoothDescriptor.fromMap(v));
  }

  return BmBluetoothCharacteristic(
    remoteId: DeviceIdentifier(json['remote_id']),
    serviceUuid: Guid(json['service_uuid']),
    secondaryServiceUuid: json['secondary_service_uuid'] != null ? Guid(json['secondary_service_uuid']) : null,
    characteristicUuid: Guid(json['characteristic_uuid']),
    descriptors: descs,
    properties: BmCharacteristicProperties.fromMap(json['properties']),
  );
}