Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
37
mobile/lib/shared/models/device_state.dart
Normal file
37
mobile/lib/shared/models/device_state.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user