diff --git a/Sense/server/app/sense/device/credential_port.go b/Sense/server/app/sense/device/credential_port.go index 4068672..8d5e284 100644 --- a/Sense/server/app/sense/device/credential_port.go +++ b/Sense/server/app/sense/device/credential_port.go @@ -11,6 +11,11 @@ type Credential struct { Password string } +type DisplayInfo struct { + Name string + Location string +} + var activeService atomic.Pointer[Service] // ReadCredential is an internal adapter port. Credentials must never be @@ -50,6 +55,18 @@ func ReadRTSPCredential(ctx context.Context, id string) (Credential, error) { return Credential{Username: username, Password: password}, err } +func Describe(ctx context.Context, id string) (DisplayInfo, error) { + service := activeService.Load() + if service == nil { + return DisplayInfo{}, fmt.Errorf("device service is not ready") + } + item, err := service.store.Get(ctx, id) + if err != nil { + return DisplayInfo{}, err + } + return DisplayInfo{Name: item.Name, Location: item.Location}, nil +} + func MarkActive(ctx context.Context, id string) error { service := activeService.Load() if service == nil {