From 607b802f3ad74438056884516728a707ad445c37 Mon Sep 17 00:00:00 2001 From: taylorbell Date: Tue, 7 Jan 2025 07:49:05 -0600 Subject: [PATCH] chore: rename connectionState to bondState in BondStateUpdate --- .../lib/src/ble/ble_device_bond_monitor.dart | 2 +- .../lib/src/converter/protobuf_converter.dart | 2 +- .../lib/src/reactive_ble_mobile_platform.dart | 2 +- .../test/reactive_ble_platform_test.dart | 4 +-- .../lib/src/model/bond_state_update.dart | 4 +-- .../lib/src/model/bond_state_update.g.dart | 28 +++++++++---------- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/example/lib/src/ble/ble_device_bond_monitor.dart b/example/lib/src/ble/ble_device_bond_monitor.dart index ab305f3f..a79b2a1b 100644 --- a/example/lib/src/ble/ble_device_bond_monitor.dart +++ b/example/lib/src/ble/ble_device_bond_monitor.dart @@ -19,7 +19,7 @@ class BleDeviceBondMonitor implements ReactiveState { void startMonitoringDevice(String deviceId) { _bondStateSubscription ??= _ble.bondUpdateStream .where((update) => update.deviceId == deviceId) - .map((update) => update.connectionState) + .map((update) => update.bondState) .listen(_bondStateController.add); } diff --git a/packages/reactive_ble_mobile/lib/src/converter/protobuf_converter.dart b/packages/reactive_ble_mobile/lib/src/converter/protobuf_converter.dart index 2ab7b605..6f3fa828 100644 --- a/packages/reactive_ble_mobile/lib/src/converter/protobuf_converter.dart +++ b/packages/reactive_ble_mobile/lib/src/converter/protobuf_converter.dart @@ -84,7 +84,7 @@ class ProtobufConverterImpl implements ProtobufConverter { final message = pb.BondInfo.fromBuffer(data); return BondStateUpdate( deviceId: message.id, - connectionState: selectFrom( + bondState: selectFrom( DeviceBondState.values, index: message.bondState, fallback: (_) => DeviceBondState.unknown, diff --git a/packages/reactive_ble_mobile/lib/src/reactive_ble_mobile_platform.dart b/packages/reactive_ble_mobile/lib/src/reactive_ble_mobile_platform.dart index 9cb2dcf1..02246116 100644 --- a/packages/reactive_ble_mobile/lib/src/reactive_ble_mobile_platform.dart +++ b/packages/reactive_ble_mobile/lib/src/reactive_ble_mobile_platform.dart @@ -51,7 +51,7 @@ class ReactiveBleMobilePlatform extends ReactiveBlePlatform { _bondUpdateRawStream.map(_protobufConverter.bondUpdateFrom).map( (update) { _logger?.log( - 'Received $BondStateUpdate(deviceId: ${update.deviceId}, connectionState: ${update.connectionState})', + 'Received $BondStateUpdate(deviceId: ${update.deviceId}, connectionState: ${update.bondState})', ); return update; }, diff --git a/packages/reactive_ble_mobile/test/reactive_ble_platform_test.dart b/packages/reactive_ble_mobile/test/reactive_ble_platform_test.dart index fc4002b0..42b4b1b7 100644 --- a/packages/reactive_ble_mobile/test/reactive_ble_platform_test.dart +++ b/packages/reactive_ble_mobile/test/reactive_ble_platform_test.dart @@ -628,12 +628,12 @@ void main() { group('bond status', () { const status1 = BondStateUpdate( deviceId: '123', - connectionState: DeviceBondState.unknown, + bondState: DeviceBondState.unknown, ); const status2 = BondStateUpdate( deviceId: '123', - connectionState: DeviceBondState.bonding, + bondState: DeviceBondState.bonding, ); Stream? _bondUpdateStream; diff --git a/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.dart b/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.dart index a533e465..cf434422 100644 --- a/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.dart +++ b/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.dart @@ -9,11 +9,11 @@ part 'bond_state_update.g.dart'; @FunctionalData() class BondStateUpdate extends $BondStateUpdate { final String deviceId; - final DeviceBondState connectionState; + final DeviceBondState bondState; const BondStateUpdate({ required this.deviceId, - required this.connectionState, + required this.bondState, }); } diff --git a/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.g.dart b/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.g.dart index cfa2b1b2..bd1a32d8 100644 --- a/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.g.dart +++ b/packages/reactive_ble_platform_interface/lib/src/model/bond_state_update.g.dart @@ -10,33 +10,33 @@ abstract class $BondStateUpdate { const $BondStateUpdate(); String get deviceId; - DeviceBondState get connectionState; + DeviceBondState get bondState; BondStateUpdate copyWith({ String? deviceId, - DeviceBondState? connectionState, + DeviceBondState? bondState, }) => BondStateUpdate( deviceId: deviceId ?? this.deviceId, - connectionState: connectionState ?? this.connectionState, + bondState: bondState ?? this.bondState, ); BondStateUpdate copyUsing( void Function(BondStateUpdate$Change change) mutator) { final change = BondStateUpdate$Change._( this.deviceId, - this.connectionState, + this.bondState, ); mutator(change); return BondStateUpdate( deviceId: change.deviceId, - connectionState: change.connectionState, + bondState: change.bondState, ); } @override String toString() => - "BondStateUpdate(deviceId: $deviceId, connectionState: $connectionState)"; + "BondStateUpdate(deviceId: $deviceId, bondState: $bondState)"; @override // ignore: avoid_equals_and_hash_code_on_mutable_classes @@ -44,14 +44,14 @@ abstract class $BondStateUpdate { other is BondStateUpdate && other.runtimeType == runtimeType && deviceId == other.deviceId && - connectionState == other.connectionState; + bondState == other.bondState; @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode { var result = 17; result = 37 * result + deviceId.hashCode; - result = 37 * result + connectionState.hashCode; + result = 37 * result + bondState.hashCode; return result; } } @@ -59,11 +59,11 @@ abstract class $BondStateUpdate { class BondStateUpdate$Change { BondStateUpdate$Change._( this.deviceId, - this.connectionState, + this.bondState, ); String deviceId; - DeviceBondState connectionState; + DeviceBondState bondState; } // ignore: avoid_classes_with_only_static_members @@ -74,9 +74,9 @@ class BondStateUpdate$ { deviceIdContainer.copyWith(deviceId: deviceId), ); - static final connectionState = Lens( - (connectionStateContainer) => connectionStateContainer.connectionState, - (connectionStateContainer, connectionState) => - connectionStateContainer.copyWith(connectionState: connectionState), + static final bondState = Lens( + (bondStateContainer) => bondStateContainer.bondState, + (bondStateContainer, bondState) => + bondStateContainer.copyWith(bondState: bondState), ); }