How can I implement to control a PTZ camera with Milestone SDK in C# MVVM ReactiveUI?

297 views Asked by At

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();
    }
0

There are 0 answers