generated from VLADIMIR/template
up
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user