Skip to content

Commit

Permalink
Add toString for all classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldemarco committed Apr 1, 2020
1 parent 1403ecb commit cc65e15
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/src/bluetooth_characteristic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ class BluetoothCharacteristic {
return (c.isNotifying == notify);
});
}

@override
String toString() {
return 'BluetoothCharacteristic{uuid: $uuid, deviceId: $deviceId, serviceUuid: $serviceUuid, secondaryServiceUuid: $secondaryServiceUuid, properties: $properties, descriptors: $descriptors, value: ${_value?.value}';
}
}

enum CharacteristicWriteType { withResponse, withoutResponse }
Expand Down Expand Up @@ -212,4 +217,9 @@ class CharacteristicProperties {
extendedProperties = p.extendedProperties,
notifyEncryptionRequired = p.notifyEncryptionRequired,
indicateEncryptionRequired = p.indicateEncryptionRequired;

@override
String toString() {
return 'CharacteristicProperties{broadcast: $broadcast, read: $read, writeWithoutResponse: $writeWithoutResponse, write: $write, notify: $notify, indicate: $indicate, authenticatedSignedWrites: $authenticatedSignedWrites, extendedProperties: $extendedProperties, notifyEncryptionRequired: $notifyEncryptionRequired, indicateEncryptionRequired: $indicateEncryptionRequired}';
}
}
5 changes: 5 additions & 0 deletions lib/src/bluetooth_descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ class BluetoothDescriptor {
.then((_) => _value.add(value))
.then((_) => null);
}

@override
String toString() {
return 'BluetoothDescriptor{uuid: $uuid, deviceId: $deviceId, serviceUuid: $serviceUuid, characteristicUuid: $characteristicUuid, value: ${_value?.value}}';
}
}
5 changes: 5 additions & 0 deletions lib/src/bluetooth_device.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ class BluetoothDevice {

@override
int get hashCode => id.hashCode;

@override
String toString() {
return 'BluetoothDevice{id: $id, name: $name, type: $type, isDiscoveringServices: ${_isDiscoveringServices?.value}, _services: ${_services?.value}';
}
}

enum BluetoothDeviceType { unknown, classic, le, dual }
Expand Down
5 changes: 5 additions & 0 deletions lib/src/bluetooth_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ class BluetoothService {
includedServices = p.includedServices
.map((s) => new BluetoothService.fromProto(s))
.toList();

@override
String toString() {
return 'BluetoothService{uuid: $uuid, deviceId: $deviceId, isPrimary: $isPrimary, characteristics: $characteristics, includedServices: $includedServices}';
}
}
10 changes: 10 additions & 0 deletions lib/src/flutter_blue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ class ScanResult {

@override
int get hashCode => device.hashCode;

@override
String toString() {
return 'ScanResult{device: $device, advertisementData: $advertisementData, rssi: $rssi}';
}
}

class AdvertisementData {
Expand All @@ -263,4 +268,9 @@ class AdvertisementData {
manufacturerData = p.manufacturerData,
serviceData = p.serviceData,
serviceUuids = p.serviceUuids;

@override
String toString() {
return 'AdvertisementData{localName: $localName, txPowerLevel: $txPowerLevel, connectable: $connectable, manufacturerData: $manufacturerData, serviceData: $serviceData, serviceUuids: $serviceUuids}';
}
}

0 comments on commit cc65e15

Please sign in to comment.