mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Record originating scanner on device events
So that consumers of the events API can tell whether a sighting came from the ARP scanner or the mDNS listener. Adds a DeviceEventScanner enum (Arp / Mdns) plumbed from each scanner's call site through to a new scanner column on device_events, exposed via the existing events endpoint and OpenAPI schema. Pre-existing rows are backfilled with 'ARP' since that was the only scanner before mDNS. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
0e43194492
commit
d6cf9be412
@@ -10,6 +10,7 @@ use crate::data::mac_vendor_finder;
|
||||
use crate::data::vendor_device_type_finder;
|
||||
use crate::db;
|
||||
use crate::events;
|
||||
use crate::model::device_events::DeviceEventScanner;
|
||||
use crate::model::devices::Device;
|
||||
use crate::settings::get_settings;
|
||||
|
||||
@@ -105,7 +106,7 @@ async fn process_announcement(
|
||||
return;
|
||||
}
|
||||
// Ignoring errors: do not stop the listener if notification delivery fails
|
||||
events::trigger_existing_device(recorded, device).ok();
|
||||
events::trigger_existing_device(recorded, device, DeviceEventScanner::Mdns).ok();
|
||||
}
|
||||
None => {
|
||||
debug!("New device {mac} discovered via mDNS; inserting");
|
||||
@@ -113,7 +114,7 @@ async fn process_announcement(
|
||||
error!("Failed to insert mDNS device {mac}: {err}");
|
||||
return;
|
||||
}
|
||||
events::trigger_new_device(device).ok();
|
||||
events::trigger_new_device(device, DeviceEventScanner::Mdns).ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user