When using the DemoDriver sample, if you try to add a setting to the Output called “TriggerTime” the following exception will be thrown in “HardwareDriver” recording server log.
To reproduce, take the Demo Driver sample and add this field in “BuildFields” method of configuration manager:
f.Add(new NumberSetupField()
{
Key = "TriggerTime",
DisplayName = "TriggerTimes",
DisplayNameReferenceId = Guid.Empty,
MinValue = 0,
MaxValue = 100,
IsReadOnly = false,
ReferenceId = Guid.Parse("30dac874-c8c4-443a-b876-bda9e37679f4"),
DefaultValue = 25,
});
and this setting in “BuildDevices” method:
devices.Add(new OutputDeviceDefinition()
{
DisplayName = "Output 1",
DeviceId = Constants.Output1.ToString(),
SupportSetState = true,
SupportTrigger = true,
DeviceType = DeviceType.Output,
Settings = new Dictionary<string, string>()
{
{"TriggerTime", "5" }
}
});
Issue is resolved by nemaning the key from “TriggerTime” to something else like “OutputTriggerTime”.
Exception:
2023-11-06 15:31:07.042+01:00 [ 96] ERROR - 00000000-0000-0000-0000-000000000000 http://127.0.0.1:22222/ MIPDriverFrameworkHardwareDriver.SetupNewDriver(), ex=System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item)
at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item)
at VideoOS.Common.Integration.Definition.CapabilitiesCollection..ctor(MainDefinition mainDefinition, capabilitiesType capabilities)
at VideoOS.Common.Integration.Definition.DeviceDefinition.get_Capabilities()
at VideoOS.IO.Drivers.HardwareDriverBase.SetupDevices(IEnumerable`1 deviceSetupInfoCollection)
at VideoOS.IO.Drivers.MIPDriverFrameworkHardwareDriver.SetupNewDriver(String activationDefinitionXml, Uri uri, String userName, String password, String driverProxyName, String customDriverData, String initialDriverSettings)