BmBluetoothService.fromMap constructor
BmBluetoothService.fromMap(
- Map json
Implementation
factory BmBluetoothService.fromMap(Map<dynamic, dynamic> json) {
// convert characteristics
List<BmBluetoothCharacteristic> chrs = [];
for (var v in json['characteristics']) {
chrs.add(BmBluetoothCharacteristic.fromMap(v));
}
// convert services
List<BmBluetoothService> svcs = [];
for (var v in json['included_services']) {
svcs.add(BmBluetoothService.fromMap(v));
}
return BmBluetoothService(
serviceUuid: Guid(json['service_uuid']),
remoteId: DeviceIdentifier(json['remote_id']),
isPrimary: json['is_primary'] != 0,
characteristics: chrs,
includedServices: svcs,
);
}