How to get access to the camera associated with the VPS metadata device?

Hello,

We are using the metadata received from VPS to launch a rule already defined in the management client “make sort of recordings on the camera associated to”.

Since we are using multiple cameras, how can we programmatically know which camera (IP address) is associated with the VPS metadata in order to link them together?

we are not sure if this configuration is correctly set.

Thanks.

Hi.

In essence, I’ve found “Related” property of ClientSettingsFolder for the metadata. Then I filtered out cameras that have common parent hardware with the metadata in question.

I’ve used this sample code to retreive address property of original camera hardware:

var address = “”;

var metadataGuid = new Guid(“5c4c76d8-9ddf-40af-8bdb-ed1986e271e0”);

var metadataItem = _configApiClient.GetItem($“Metadata[{metadataGuid}]”);

metadataItem.Children = _configApiClient.GetChildItems(metadataItem.Path);

var hardwarePath = _configApiClient.GetItem(metadataItem.ParentPath).ParentPath;

var clientProfiles =

           \_configApiClient.GetItem($"Metadata\[{metadataGuid}\]/ClientSettingsFolder");

clientProfiles.Children = _configApiClient.GetChildItems(clientProfiles.Path);

string related = “”;

foreach (var clientProfilesChild in clientProfiles.Children){

foreach (var property in clientProfilesChild.Properties){

if (property.Key == “Related”){

related = property.Value;}

} }

var cameras = related.Split(‘,’);

var originalHardware = “”;

foreach (var camera in cameras){

var cameraItem = _configApiClient.GetItem(camera);

var cameraItemParent = _configApiClient.GetItem(cameraItem.ParentPath);

if (cameraItemParent.ParentPath != hardwarePath){

// this is the same as metadata

originalHardware = cameraItemParent.ParentPath;

}

}

var hardware = _configApiClient.GetItem(originalHardware);

foreach (var hardwareProperty in hardware.Properties){

if (hardwareProperty.Key == “Address”){

address = hardwareProperty.Value;

}

}

Hi, thank you for your answer.

I tried a similar approach, using the “Related” property of each camera to find the VPS metadata device linked to the camera and it works.

Regarding your solution, I would like to ask you about the variable _configApiClient.

How did you declare it ?

Thanks**.**

I used the ConfigAPIClient sample.

_configApiClient = new ConfigApiClient();

  \_configApiClient.ServerAddress = \_serverAddress;

  \_configApiClient.Serverport = \_serverPort;

_configApiClient.ServerType = _corporate

               ? ConfigApiClient.ServerTypeEnum.Corporate

               : ConfigApiClient.ServerTypeEnum.Arcus;

_configApiClient.Initialize();

Thank you so much for your help.