Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
class DeviceStateModel {
|
|
const DeviceStateModel({
|
|
this.deviceRole = 'camera',
|
|
this.batteryLevel,
|
|
this.networkType,
|
|
this.signalStrength,
|
|
this.currentBitrate,
|
|
this.targetBitrate,
|
|
this.fps,
|
|
this.status,
|
|
});
|
|
|
|
final String deviceRole;
|
|
final int? batteryLevel;
|
|
final String? networkType;
|
|
final int? signalStrength;
|
|
final int? currentBitrate;
|
|
final int? targetBitrate;
|
|
final int? fps;
|
|
final String? status;
|
|
|
|
factory DeviceStateModel.fromJson(Map<String, dynamic> json) {
|
|
return DeviceStateModel(
|
|
deviceRole: json['device_role'] as String? ?? 'camera',
|
|
batteryLevel: json['battery'] as int? ?? json['battery_level'] as int?,
|
|
networkType: json['network'] as String? ?? json['network_type'] as String?,
|
|
signalStrength: json['signal_strength'] as int?,
|
|
currentBitrate: json['bitrate'] as int? ?? json['current_bitrate'] as int?,
|
|
targetBitrate: json['target_bitrate'] as int?,
|
|
fps: json['fps'] as int?,
|
|
status: json['status'] as String?,
|
|
);
|
|
}
|
|
|
|
double get bitrateMbps =>
|
|
currentBitrate != null ? currentBitrate! / 1_000_000 : 0;
|
|
}
|