forked from truongsinh/flutter_bluetooth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bluetooth_service.dart
31 lines (27 loc) · 1023 Bytes
/
bluetooth_service.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2017, Paul DeMarco.
// All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of bluetooth;
class BluetoothService {
final Uuid uuid;
final DeviceIdentifier deviceId;
final bool isPrimary;
final List<BluetoothCharacteristic> characteristics;
final List<BluetoothService> includedServices;
BluetoothService(
{@required this.uuid,
@required this.deviceId,
@required this.isPrimary,
@required this.characteristics,
@required this.includedServices});
BluetoothService.fromProto(protos.BluetoothService p)
: uuid = Uuid.fromString(p.uuid),
deviceId = new DeviceIdentifier(p.remoteId),
isPrimary = p.isPrimary,
characteristics = p.characteristics
.map((c) => new BluetoothCharacteristic.fromProto(c))
.toList(),
includedServices = p.includedServices
.map((s) => new BluetoothService.fromProto(s))
.toList();
}