48 lines
1.2 KiB
Dart
48 lines
1.2 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'bluetooth_device_model.freezed.dart';
|
|
part 'bluetooth_device_model.g.dart';
|
|
|
|
/// Enum representing the type of Bluetooth device
|
|
enum DeviceType {
|
|
/// Universal Shifters device
|
|
universalShifters,
|
|
|
|
/// Other unspecified device types
|
|
other,
|
|
}
|
|
|
|
/// Model representing a Bluetooth device
|
|
@freezed
|
|
abstract class BluetoothDeviceModel with _$BluetoothDeviceModel {
|
|
const factory BluetoothDeviceModel({
|
|
/// Unique identifier for the device
|
|
required String id,
|
|
|
|
/// Name of the device as advertised
|
|
String? name,
|
|
|
|
/// MAC address of the device
|
|
required String address,
|
|
|
|
/// Signal strength indicator (RSSI)
|
|
int? rssi,
|
|
|
|
/// Type of the device
|
|
@Default(DeviceType.other) DeviceType type,
|
|
|
|
/// Whether the device is currently connected
|
|
@Default(false) bool isConnected,
|
|
|
|
/// Additional device information
|
|
Map<String, dynamic>? manufacturerData,
|
|
|
|
/// Service UUIDs advertised by the device
|
|
List<String>? serviceUuids,
|
|
}) = _BluetoothDeviceModel;
|
|
|
|
/// Create a BluetoothDeviceModel from JSON
|
|
factory BluetoothDeviceModel.fromJson(Map<String, dynamic> json) =>
|
|
_$BluetoothDeviceModelFromJson(json);
|
|
}
|