Problem while defining events for hardware devices

Hello,

I am trying to define events for the metadata devices in the XProtect driver. I have multiple devices, each handling an input but all should be able to raise an event if a sign is received.

First I have added the same device event for the metadata devices:

protected override ICollection<DeviceDefinitionBase> BuildDevices()
{
    var devices = new List<DeviceDefinitionBase>();
    int deviceAmount = 5;
 
    for (int i = 0; i < deviceAmount; i++)
    {
        devices.Add(new MetadataDeviceDefinition()
        {
            DisplayName = "Channel " + $"{i:D3}",
            DeviceId = Constants.MetadataDeviceIDs[i].ToString(),
            Streams = BuildMetadataStreams(i),
            Settings = new Dictionary<string, string>()
            {
                { Constants.TopicNameSetting, "Topic name" },
                { Constants.UIDNameSetting, i.ToString() }
            },
            DeviceEvents = new List<EventDefinition>
            {
                new EventDefinition()
                {
                    DisplayName = "Human Detected Event",
                    ReferenceId = Constants.HumanDetectedEventId
                }
            }
        });
    }
    return devices;
}

I have configured the event to the metadata devices on the Event tab, added the device to a camera as related metadata, then created a few rules to trigger a user-defined event when any of my events is raised on the configured camera. Then the user-defined events raised an alarm.

The problem is that in the Smart Client alarm was received from only one camera, regardless of having multiple metadata devices: on the Alarm Manager only one camera was listed, although the other devices also received input signals (and raised an event)

Update: Sorry, this is not an issue. There was a filter defined in the Smart Client Alarm Manager for only one kind of alarm. However the below question is still valid.

So I have tried to distinguish the events related to the metadata devices by adding separate GUIDs to the event definitions, modifying the code as below :

protected override ICollection<DeviceDefinitionBase> BuildDevices()
{
    var devices = new List<DeviceDefinitionBase>();
    int deviceAmount = 5;
 
    for (int i = 0; i < deviceAmount; i++)
    {
        devices.Add(new MetadataDeviceDefinition()
        {
            DisplayName = "Channel " + $"{i:D3}",
            DeviceId = Constants.MetadataDeviceIDs[i].ToString(),
            Streams = BuildMetadataStreams(i),
            Settings = new Dictionary<string, string>()
            {
                { Constants.TopicNameSetting, "Topic name" },
                { Constants.UIDNameSetting, i.ToString() }
            },
            DeviceEvents = new List<EventDefinition>
            {
                new EventDefinition()
                {
                    DisplayName = "Human Detected Event, " + "Channel " + $"{i:D3}",
                    ReferenceId = Constants.HumanDetectedEventIds[i],
                    NameReferenceId = Constants.HumanDetectedEventIds[i]
                }
            }
        });
    }
    return devices;
}

However I have found that only one event was visible on the system: Human Detected Event, Channel004.

Events named Channel000 - Channel003 were completely missing - either on the event tab, or in the event list of the rules management.

Do you happen to know if this is a bug? Also what is the recommended method for raising device events: one event type (one GUID) added for all of the devices, or separate events for each devices?

I am using XProtect Corporate, 2020R1, version 20.1b

Best Regards,

Andras

I guess you have verified that you do not incidentally reuse an ID?

In order to be able to get an understanding I think we will need your BuildMetadataStreams() method also.

Yes, the MetadataDeviceIDs and the HumanDetectedEventIds are all different.

Please see below the BuildMetadataStreams() method.

private static ICollection<StreamDefinition> BuildMetadataStreams()
{
    ICollection<StreamDefinition> streams = new List<StreamDefinition>();
    streams.Add(new StreamDefinition()
        {
            DisplayName = "U-metadata stream",
            ReferenceId = Constants.HeadDetectionStreamReferenceId.ToString(),
            MetadataTypes = new List<MetadataTypeDefinition>()
            {
                new MetadataTypeDefinition()
                {
                    DisplayName = "Bounding boxes",
                    DisplayNameId = Constants.HeadDetectionStreamReferenceId,
                    MetadataType = Constants.HeadDetectionMetadataType,
                    ValidTime = TimeSpan.FromSeconds(1),
                    Settings = new Dictionary<string, string>()
                    {  }
                }
            }
        });
        return streams; 
    }

An additional question, you mention you changed the events definitions by adding separate GUIDs for each in your driver. Did you remove and re-add the hardware after changing the driver?

Yes, I did.

Milestone will investigate..

I am sorry for the long wait you have experienced. Please await the findings of the investigation into this. Please let us know if the issue is solved or no longer relevant for you.

Once again sorry for the long waiting time. After investigating this we have found that it is due to the design of the internal device handling and it cannot easily be changed (it is the same for the existing device pack drivers).

So unfortunately the system and thus the framework can only handle the same set of events for all devices of the same type. The documentation has been updated to state this for the 2020 R2 release.

We sincerely apologize for the inconvenience this has caused you.