feat: wire BLE scan broadcasts to dashboard WebSocket
Connect bleRegistry to the dashboard hub so ble_scan messages are broadcast every 5s to all connected dashboard clients. Add rssi, last_seen, and blob_id fields to GetCurrentDevices output to match the frontend's expected message format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
92bb8750b7
commit
b2d733227b
2 changed files with 14 additions and 5 deletions
|
|
@ -652,6 +652,11 @@ func main() {
|
|||
|
||||
dashboardHub.SetIngestionState(ingestSrv)
|
||||
|
||||
// Wire BLE state to dashboard for ble_scan broadcasts (5s interval)
|
||||
if bleRegistry != nil {
|
||||
dashboardHub.SetBLEState(bleRegistry)
|
||||
}
|
||||
|
||||
// Wire zone state to dashboard for occupancy snapshots
|
||||
if zonesMgr != nil {
|
||||
dashboardHub.SetZoneState(&zoneStateAdapter{mgr: zonesMgr})
|
||||
|
|
@ -674,9 +679,10 @@ func main() {
|
|||
}()
|
||||
}
|
||||
|
||||
// Wire ingestion → dashboard for CSI and motion broadcasts
|
||||
// Wire ingestion → dashboard for CSI, motion, and event broadcasts
|
||||
ingestSrv.SetDashboardBroadcaster(dashboardHub)
|
||||
ingestSrv.SetMotionBroadcaster(dashboardHub)
|
||||
ingestSrv.SetEventBroadcaster(dashboardHub)
|
||||
|
||||
// Phase 6: Wire BLE messages to registry and identity matcher
|
||||
ingestSrv.SetBLEHandler(func(nodeMAC string, devices []ingestion.BLEDevice) {
|
||||
|
|
|
|||
|
|
@ -1373,10 +1373,13 @@ func (r *Registry) GetCurrentDevices() []map[string]interface{} {
|
|||
result := make([]map[string]interface{}, len(devices))
|
||||
for i, d := range devices {
|
||||
result[i] = map[string]interface{}{
|
||||
"mac": d.Addr,
|
||||
"name": d.Name,
|
||||
"label": d.Label,
|
||||
"manufacturer": d.Manufacturer,
|
||||
"mac": d.Addr,
|
||||
"name": d.Name,
|
||||
"label": d.Label,
|
||||
"rssi": d.RSSIAvg,
|
||||
"last_seen": d.LastSeenAt.UnixMilli(),
|
||||
"blob_id": nil,
|
||||
"manufacturer": d.Manufacturer,
|
||||
"device_type": d.DeviceType,
|
||||
"device_name": d.DeviceName,
|
||||
"mfr_id": d.MfrID,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue