reveal Name var for driver.info

This commit is contained in:
martha-johnston
2023-03-30 15:06:01 -04:00
committed by Eric Daniels
parent b9ce5bb861
commit 57c9ba0fc5
6 changed files with 9 additions and 0 deletions

View File

@@ -27,6 +27,7 @@
#define MAX_DEVICES 8
#define MAX_PROPERTIES 64
#define MAX_DEVICE_UID_CHARS 64
#define MAX_DEVICE_NAME_CHARS 64
typedef const char* STATUS;
static STATUS STATUS_OK = (STATUS) NULL;
@@ -65,6 +66,7 @@ typedef struct AVBindSession AVBindSession, *PAVBindSession;
typedef struct {
char uid[MAX_DEVICE_UID_CHARS + 1];
char name[MAX_DEVICE_NAME_CHARS + 1];
} AVBindDevice, *PAVBindDevice;
// AVBindDevices returns a list of AVBindDevices. The result array is pointing to a static

View File

@@ -201,6 +201,8 @@ STATUS AVBindDevices(AVBindMediaType mediaType, PAVBindDevice *ppDevices, int *p
pDevice = devices + i;
strncpy(pDevice->uid, refDevice.uniqueID.UTF8String, MAX_DEVICE_UID_CHARS);
pDevice->uid[MAX_DEVICE_UID_CHARS] = '\0';
strncpy(pDevice->name, refDevice.localizedName.UTF8String, MAX_DEVICE_NAME_CHARS);
pDevice->name[MAX_DEVICE_NAME_CHARS] = '\0';
i++;
}

View File

@@ -34,6 +34,7 @@ type Device struct {
// UID is a unique identifier for a device
UID string
cDevice C.AVBindDevice
Name string
}
func frameFormatToAVBind(f frame.Format) (C.AVBindFrameFormat, bool) {
@@ -87,6 +88,7 @@ func Devices(mediaType MediaType) ([]Device, error) {
for i := range devices {
devices[i].UID = C.GoString(&cDevices[i].uid[0])
devices[i].cDevice = cDevices[i]
devices[i].Name = C.GoString(&cDevices[i].name[0])
}
return devices, nil

View File

@@ -32,6 +32,7 @@ func Initialize() {
driver.GetManager().Register(cam, driver.Info{
Label: device.UID,
DeviceType: driver.Camera,
Name: device.Name,
})
}
}

View File

@@ -116,6 +116,7 @@ func discover(discovered map[string]struct{}, pattern string) {
Label: label + LabelSeparator + reallink,
DeviceType: driver.Camera,
Priority: priority,
Name: label,
})
}
}

View File

@@ -30,6 +30,7 @@ type Info struct {
Label string
DeviceType DeviceType
Priority Priority
Name string
}
type Adapter interface {