Hi,
I am writing a Plugin for the Managment Client and i want to list the MacAddress and SerialNumbers of all cameras.
I already know that i can query Hardware Items from the servers (VideoOS.ConfigurationApi.ClientService.QueryItems) but the info there does not contain the info i need.
How do i get the MacAddress and SerialNumber of a Camera?
Got it to work by using the ConfigurationAPI like in the ConfigAPIClient example.
The Managment Client propaply already has an ConfigurationService. Is there a way to use it so i don’t have to deal with Endpoint and Binding configuration?
The strongly typed classes / ConfigurationItems are directly implemented.
Getting a MAC address would look something like this.
HardwareDriverSettingsChildItem hardwareDriverSettingsChildItem = new Hardware(EnvironmentManager.Instance.CurrentSite.ServerId, camera.ParentItemPath).HardwareDriverSettingsFolder.HardwareDriverSettings.FirstOrDefault().HardwareDriverSettingsChildItems.FirstOrDefault();
string macKey = hardwareDriverSettingsChildItem.Properties.KeysFullName.FirstOrDefault(x => x.Contains("Mac"));
string macValue = hardwareDriverSettingsChildItem.GetProperty(macKey);
For a deeper understanding let me show this snippet of code I used to see all of a camera (hardware) hardware-driver properties.
private void HardwareProperties()
{
Item cam = new Item();
FQID cameraFQID = new FQID();
ItemPickerForm form = new ItemPickerForm();
form.KindFilter = Kind.Camera;
form.AutoAccept = true;
form.Init(Configuration.Instance.GetItems());
if (form.ShowDialog() == DialogResult.OK)
{
cameraFQID = form.SelectedItem.FQID;
}
else return;
Camera camera = new Camera(cameraFQID);
Hardware hardware = new Hardware(EnvironmentManager.Instance.CurrentSite.ServerId, camera.ParentItemPath);
label1.Text = camera.DisplayName + " Model:" + hardware.Model;
label1.Text += Environment.NewLine;
HardwareDriverSettingsChildItem hardwareDriverSettingsChildItem = hardware.HardwareDriverSettingsFolder.HardwareDriverSettings.FirstOrDefault().HardwareDriverSettingsChildItems.FirstOrDefault();
ICollection<string> propertyKeys = hardwareDriverSettingsChildItem.GetPropertyKeys();
foreach (var fullkey in propertyKeys)
{
label1.Text += fullkey + " - ";
label1.Text += hardwareDriverSettingsChildItem.GetProperty(fullkey);
label1.Text += Environment.NewLine;
}
}
If using the Configuration API the way you describe you will need to make the contact to the ConfigurationService..