Files
oott/frontend/lib/model/device_event.dart
T
rzuastiandClaude Opus 4.8 4e975598f9 Add DHCP scanner to frontend status displays
Add a DHCP scanner card to the Status screen and a DHCP row to the
consolidated Status card on the Home screen, mirroring the existing
mDNS/SSDP implementations. Also label DHCP-discovered device events as
"DHCP" instead of the raw "Dhcp".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 18:45:38 -04:00

40 lines
997 B
Dart

class DeviceEvent {
final int id;
final String macAddress;
final DateTime createdOn;
final String eventType;
final String ipv4Address;
final String vendor;
final String scanner;
const DeviceEvent({
required this.id,
required this.macAddress,
required this.createdOn,
required this.eventType,
required this.ipv4Address,
required this.vendor,
required this.scanner,
});
factory DeviceEvent.fromJson(Map<String, dynamic> json) {
return DeviceEvent(
id: json['id'] as int,
macAddress: json['mac_address'] as String,
createdOn: DateTime.parse(json['created_on'] as String),
eventType: json['event_type'] as String,
ipv4Address: json['ipv4_address'] as String,
vendor: json['vendor'] as String,
scanner: json['scanner'] as String,
);
}
String get scannerLabel => switch (scanner) {
'Arp' => 'ARP',
'Mdns' => 'mDNS',
'Ssdp' => 'SSDP/UPnP',
'Dhcp' => 'DHCP',
_ => scanner,
};
}