feat: working connection, conn setting, and gear ratio setting for universal shifters
This commit is contained in:
@ -24,20 +24,15 @@ mixin _$BluetoothDeviceModel {
|
||||
/// MAC address of the device
|
||||
String get address;
|
||||
|
||||
/// Signal strength indicator (RSSI)
|
||||
int? get rssi;
|
||||
|
||||
/// Type of the device
|
||||
DeviceType get type;
|
||||
|
||||
/// Whether the device is currently connected
|
||||
bool get isConnected;
|
||||
|
||||
/// Additional device information
|
||||
Map<String, dynamic>? get manufacturerData;
|
||||
|
||||
/// Service UUIDs advertised by the device
|
||||
List<String>? get serviceUuids;
|
||||
/// Identifier of the device
|
||||
@DeviceIdentJsonConverter()
|
||||
DeviceIdentifier get deviceIdent;
|
||||
|
||||
/// Create a copy of BluetoothDeviceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -58,32 +53,21 @@ mixin _$BluetoothDeviceModel {
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.address, address) || other.address == address) &&
|
||||
(identical(other.rssi, rssi) || other.rssi == rssi) &&
|
||||
(identical(other.type, type) || other.type == type) &&
|
||||
(identical(other.isConnected, isConnected) ||
|
||||
other.isConnected == isConnected) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.manufacturerData, manufacturerData) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.serviceUuids, serviceUuids));
|
||||
(identical(other.deviceIdent, deviceIdent) ||
|
||||
other.deviceIdent == deviceIdent));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
name,
|
||||
address,
|
||||
rssi,
|
||||
type,
|
||||
isConnected,
|
||||
const DeepCollectionEquality().hash(manufacturerData),
|
||||
const DeepCollectionEquality().hash(serviceUuids));
|
||||
int get hashCode => Object.hash(runtimeType, id, name, address, type,
|
||||
const DeepCollectionEquality().hash(manufacturerData), deviceIdent);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BluetoothDeviceModel(id: $id, name: $name, address: $address, rssi: $rssi, type: $type, isConnected: $isConnected, manufacturerData: $manufacturerData, serviceUuids: $serviceUuids)';
|
||||
return 'BluetoothDeviceModel(id: $id, name: $name, address: $address, type: $type, manufacturerData: $manufacturerData, deviceIdent: $deviceIdent)';
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,11 +81,9 @@ abstract mixin class $BluetoothDeviceModelCopyWith<$Res> {
|
||||
{String id,
|
||||
String? name,
|
||||
String address,
|
||||
int? rssi,
|
||||
DeviceType type,
|
||||
bool isConnected,
|
||||
Map<String, dynamic>? manufacturerData,
|
||||
List<String>? serviceUuids});
|
||||
@DeviceIdentJsonConverter() DeviceIdentifier deviceIdent});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -120,11 +102,9 @@ class _$BluetoothDeviceModelCopyWithImpl<$Res>
|
||||
Object? id = null,
|
||||
Object? name = freezed,
|
||||
Object? address = null,
|
||||
Object? rssi = freezed,
|
||||
Object? type = null,
|
||||
Object? isConnected = null,
|
||||
Object? manufacturerData = freezed,
|
||||
Object? serviceUuids = freezed,
|
||||
Object? deviceIdent = null,
|
||||
}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id
|
||||
@ -139,26 +119,18 @@ class _$BluetoothDeviceModelCopyWithImpl<$Res>
|
||||
? _self.address
|
||||
: address // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
rssi: freezed == rssi
|
||||
? _self.rssi
|
||||
: rssi // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
type: null == type
|
||||
? _self.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as DeviceType,
|
||||
isConnected: null == isConnected
|
||||
? _self.isConnected
|
||||
: isConnected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
manufacturerData: freezed == manufacturerData
|
||||
? _self.manufacturerData
|
||||
: manufacturerData // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
serviceUuids: freezed == serviceUuids
|
||||
? _self.serviceUuids
|
||||
: serviceUuids // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
deviceIdent: null == deviceIdent
|
||||
? _self.deviceIdent
|
||||
: deviceIdent // ignore: cast_nullable_to_non_nullable
|
||||
as DeviceIdentifier,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -170,13 +142,10 @@ class _BluetoothDeviceModel implements BluetoothDeviceModel {
|
||||
{required this.id,
|
||||
this.name,
|
||||
required this.address,
|
||||
this.rssi,
|
||||
this.type = DeviceType.other,
|
||||
this.isConnected = false,
|
||||
final Map<String, dynamic>? manufacturerData,
|
||||
final List<String>? serviceUuids})
|
||||
: _manufacturerData = manufacturerData,
|
||||
_serviceUuids = serviceUuids;
|
||||
@DeviceIdentJsonConverter() required this.deviceIdent})
|
||||
: _manufacturerData = manufacturerData;
|
||||
factory _BluetoothDeviceModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$BluetoothDeviceModelFromJson(json);
|
||||
|
||||
@ -192,20 +161,11 @@ class _BluetoothDeviceModel implements BluetoothDeviceModel {
|
||||
@override
|
||||
final String address;
|
||||
|
||||
/// Signal strength indicator (RSSI)
|
||||
@override
|
||||
final int? rssi;
|
||||
|
||||
/// Type of the device
|
||||
@override
|
||||
@JsonKey()
|
||||
final DeviceType type;
|
||||
|
||||
/// Whether the device is currently connected
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isConnected;
|
||||
|
||||
/// Additional device information
|
||||
final Map<String, dynamic>? _manufacturerData;
|
||||
|
||||
@ -219,18 +179,10 @@ class _BluetoothDeviceModel implements BluetoothDeviceModel {
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
/// Service UUIDs advertised by the device
|
||||
final List<String>? _serviceUuids;
|
||||
|
||||
/// Service UUIDs advertised by the device
|
||||
/// Identifier of the device
|
||||
@override
|
||||
List<String>? get serviceUuids {
|
||||
final value = _serviceUuids;
|
||||
if (value == null) return null;
|
||||
if (_serviceUuids is EqualUnmodifiableListView) return _serviceUuids;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
@DeviceIdentJsonConverter()
|
||||
final DeviceIdentifier deviceIdent;
|
||||
|
||||
/// Create a copy of BluetoothDeviceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -256,32 +208,21 @@ class _BluetoothDeviceModel implements BluetoothDeviceModel {
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.address, address) || other.address == address) &&
|
||||
(identical(other.rssi, rssi) || other.rssi == rssi) &&
|
||||
(identical(other.type, type) || other.type == type) &&
|
||||
(identical(other.isConnected, isConnected) ||
|
||||
other.isConnected == isConnected) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._manufacturerData, _manufacturerData) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._serviceUuids, _serviceUuids));
|
||||
(identical(other.deviceIdent, deviceIdent) ||
|
||||
other.deviceIdent == deviceIdent));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
name,
|
||||
address,
|
||||
rssi,
|
||||
type,
|
||||
isConnected,
|
||||
const DeepCollectionEquality().hash(_manufacturerData),
|
||||
const DeepCollectionEquality().hash(_serviceUuids));
|
||||
int get hashCode => Object.hash(runtimeType, id, name, address, type,
|
||||
const DeepCollectionEquality().hash(_manufacturerData), deviceIdent);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BluetoothDeviceModel(id: $id, name: $name, address: $address, rssi: $rssi, type: $type, isConnected: $isConnected, manufacturerData: $manufacturerData, serviceUuids: $serviceUuids)';
|
||||
return 'BluetoothDeviceModel(id: $id, name: $name, address: $address, type: $type, manufacturerData: $manufacturerData, deviceIdent: $deviceIdent)';
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,11 +238,9 @@ abstract mixin class _$BluetoothDeviceModelCopyWith<$Res>
|
||||
{String id,
|
||||
String? name,
|
||||
String address,
|
||||
int? rssi,
|
||||
DeviceType type,
|
||||
bool isConnected,
|
||||
Map<String, dynamic>? manufacturerData,
|
||||
List<String>? serviceUuids});
|
||||
@DeviceIdentJsonConverter() DeviceIdentifier deviceIdent});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -320,11 +259,9 @@ class __$BluetoothDeviceModelCopyWithImpl<$Res>
|
||||
Object? id = null,
|
||||
Object? name = freezed,
|
||||
Object? address = null,
|
||||
Object? rssi = freezed,
|
||||
Object? type = null,
|
||||
Object? isConnected = null,
|
||||
Object? manufacturerData = freezed,
|
||||
Object? serviceUuids = freezed,
|
||||
Object? deviceIdent = null,
|
||||
}) {
|
||||
return _then(_BluetoothDeviceModel(
|
||||
id: null == id
|
||||
@ -339,26 +276,18 @@ class __$BluetoothDeviceModelCopyWithImpl<$Res>
|
||||
? _self.address
|
||||
: address // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
rssi: freezed == rssi
|
||||
? _self.rssi
|
||||
: rssi // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
type: null == type
|
||||
? _self.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as DeviceType,
|
||||
isConnected: null == isConnected
|
||||
? _self.isConnected
|
||||
: isConnected // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
manufacturerData: freezed == manufacturerData
|
||||
? _self._manufacturerData
|
||||
: manufacturerData // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
serviceUuids: freezed == serviceUuids
|
||||
? _self._serviceUuids
|
||||
: serviceUuids // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>?,
|
||||
deviceIdent: null == deviceIdent
|
||||
? _self.deviceIdent
|
||||
: deviceIdent // ignore: cast_nullable_to_non_nullable
|
||||
as DeviceIdentifier,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user