0

I'm creating a plugin where I can select the camera and have left right buttons (currently the left button is logging it was moved), the buttons are working but the camera does not move.

Here is my code snippet:

    private void InitializeCommands()
    {
        this.MoveCamera = ReactiveCommand.Create<BtnCommands, Unit>(b => 
            {
                if (b == BtnCommands.Left)
                {
                    // here comes the API stuff to actually turn it
                    VideoOS.Platform.Messaging.Message msg = new VideoOS.Platform.Messaging.Message(MessageId.Control.PTZMoveCommand, VideoOS.Platform.Messaging.PTZMoveCommandData.Left);
                    EnvironmentManager.Instance.SendMessage(msg, this.SelectedCamera.FQID);
                }
                
                else if (b == BtnCommands.Right)
                {
                    // here comes the API stuff to actually turn it
                }
                return Unit.Default;
            });
        this.WhenAnyValue(x => x.SelectedCamera).Log(this, "Test").Subscribe();
        this.WhenAnyValue(b => b.MoveCamera).Log(this, "Moved?").Subscribe();
    }
Szimu B.
  • 11
  • 2
  • The issue may be related to either the Milestone SDK, or to ReactiveUI, so a couple of questions here. Did you ensure that the `SendMessage` method is called? How are you binding the `MoveCamera` command to a button? Also, we generally extract such logic to an abstraction like `interface IApiService`, so we can easily mock that API interaction and just debug the UI. – Artyom Sep 29 '20 at 20:57
  • SendMessage should work as in the documentation a sample program is provided which is exactly the same. However, that one is not based on ReactiveUI. The MoveCamera is working as I log it when it is being clicked and I do its logic based on the SelectedCamera, which I can select one camera from a combobox and it is working. So, MoveCamera seems fine too. – Szimu B. Sep 30 '20 at 14:38

0 Answers0