MessageId.Control.StopRecordingCommand on specific camera stops all recording all cameras

hi,

I created a mip plugin for XProtectSmartClient, I want to start and stop recording my cameras based on internal commands

when I send MessageId.Control.StartRecordingCommand on specific camera, it works fine but when I send MessageId.Control.StopRecordingCommand on the same specific camera it stops recording all cameras.

I use version version 2023 R1

I suspect you have a mistake in specifying the destination for the StopRecordingCommand, have seen it before, which adds to my suspicion. Please double check..

(Snippet from Video Viewer sample.)

        private void ButtonStopRecording1_Click(object sender, RoutedEventArgs e)
        {
            if (_selectItem1 != null)
                EnvironmentManager.Instance.PostMessage(
                    new VideoOS.Platform.Messaging.Message(MessageId.Control.StopRecordingCommand), _selectItem1.FQID);
        }

What I have seen is the “target” moved into the message instead of being the second parameter on the PostMessage..

hi, this is the method that handles start and stop recording

private void HandleCamerasRecording(string command, List<string> camerasToHandle)
{
    var cameras = Utils.EnumerateItemsByKind(Kind.Camera);
    foreach (var camera in cameras)
    {
        if (camera != null)
        {
            if (camerasToHandle == null || camerasToHandle.Count == 0)
            {
                EnvironmentManager.Instance.SendMessage(
                    new Message(command), camera.FQID);
                Logger.Instance.Info($"{command} camera with name {camera.Name} - NOT from cameras list");
            }
            else
            {
                if (camerasToHandle.Contains(camera.Name))
                {
                    EnvironmentManager.Instance.SendMessage(
                        new Message(command), camera.FQID);
                    Logger.Instance.Info($"{command} camera with name {camera.Name} - camera IS IN camera list");
                }
            }
        }
    }
}

where command can be - MessageId.Control.StartRecordingCommand OR MessageId.Control.StopRecordingCommand

and still the start works on specific camera but stop command is stopping all cameras

hi, any answer?!

Can you check what is in the log file? If the camerasToHandle is empty - you will stop all cameras.

I debug the plugin and the camera to camerasToHandle is not empty, it goes the else, send the specific name and it stops all the cameras

But the else statement is executed for all cameras - how many entries do you get in the ‘Logger. …’ statement?

yeh, but in the camerasToHandle I send only one camera, because this is what I want to stop

I have not tested it, but have you tried the ‘new Message(command, camera.FQID), camera.FQID)’ variant?

you mean like this:

EnvironmentManager.Instance.SendMessage(
    new Message(command, camera.FQID), camera.FQID);
Logger.Instance.Info($"{command} camera with name {camera.Name} - NOT from cameras list");

look on the difference on line 2

Yes, so the Message class has the FQID in the ‘Related’ property.

tried it, unfortunately still the same behavior

We cannot reproduce:

Testing with:

EnvironmentManager.Instance.PostMessage(
	new VideoOS.Platform.Messaging.Message(MessageId.Control.StartRecordingCommand), 
	_item.FQID
	);
 
EnvironmentManager.Instance.PostMessage(
	new VideoOS.Platform.Messaging.Message(MessageId.Control.StopRecordingCommand),
	_item.FQID
	);

Please double-check the syntax.

Your variable ‘command’, what is it?

Perhaps you could do a quick test with my test code.