public void Setup()
        {
            _channel = new Channel("localhost:39946", ChannelCredentials.Insecure);
            _client  = new VimbaCamera.VimbaCameraClient(_channel);

            ThrowIfError(
                _client.VimbaInstanceControl(new VimbaInstanceControlRequest()
            {
                Command = ConnectionCommands.Connect
            }));
            ThrowIfError(_client.RequestCameraConnection(new CameraConnectionRequest()
            {
                Command  = ConnectionCommands.Connect,
                CameraID = TestClass.CameraId
            }));

            ThrowIfError(_client.RequestReset(new ResetRequest()));

            Task.Delay(1000).Wait();

            ThrowIfError(_client.RequestCameraConnection(new CameraConnectionRequest()
            {
                Command  = ConnectionCommands.Connect,
                CameraID = TestClass.CameraId
            }));
        }
 public void Teardown()
 {
     ThrowIfError(_client.RequestCameraConnection(new CameraConnectionRequest()
     {
         Command = ConnectionCommands.Disconnect
     }));
     ThrowIfError(
         _client.VimbaInstanceControl(
             new VimbaInstanceControlRequest()
     {
         Command = ConnectionCommands.Disconnect
     }));
 }
Exemple #3
0
        public void TestConnectToCamera()
        {
            StartVimbaAndShutDown(() =>
            {
                var response = _client.RequestCameraConnection(
                    new CameraConnectionRequest()
                {
                    CameraID = CameraId, Command = ConnectionCommands.Connect
                });

                Assert.IsNull(response.Error);
                Assert.IsTrue(response.IsConnected);

                response = _client.RequestCameraConnection(
                    new CameraConnectionRequest()
                {
                    CameraID = CameraId, Command = ConnectionCommands.Disconnect
                });
                Assert.IsNull(response.Error);
                Assert.IsFalse(response.IsConnected);
            });
        }