This commit is contained in:
2026-10-11 14:59:51 +07:00
parent e3576db693
commit 5da08f6916
17 changed files with 1235 additions and 258 deletions
+27
View File
@@ -1,6 +1,7 @@
package app
import (
"evening_detective_server/internal/modules/cudy"
"evening_detective_server/internal/services/device_presence_service"
proto "evening_detective_server/proto"
@@ -51,3 +52,29 @@ func mapVenueDevices(devices []device_presence_service.Device) []*proto.VenueDev
}
return result
}
func mapWiFi(snapshot cudy.Snapshot, stale bool) *proto.VenueWiFi {
result := &proto.VenueWiFi{
Enabled: snapshot.Enabled,
Stale: stale,
HasError: snapshot.HasError,
Clients: make([]*proto.WiFiClient, 0, len(snapshot.Clients)),
}
if !snapshot.CollectedAt.IsZero() {
result.CollectedAt = timestamppb.New(snapshot.CollectedAt)
}
for _, client := range snapshot.Clients {
var signal *int32
if client.Signal != nil {
value := int32(*client.Signal)
signal = &value
}
result.Clients = append(result.Clients, &proto.WiFiClient{
IP: client.IP,
MAC: client.MAC,
Band: client.Band,
Signal: signal,
})
}
return result
}