This example program is located in your CVB installation under %CVB%Tutorial/Image Manager/Cvb++/CppConnectionState
.
main.cpp:
#include <iostream>
#include <stdio.h>
#include <iostream>
#include <cvb/device_factory.hpp>
int main()
{
try
{
if (infoList.empty())
{
std::cout << "no device discovered"<<std::endl;
return(0);
}
auto cookie = device->RegisterConnectionStateChangedEvent([]() {
std::cout << "device was disconnected" << std::endl;
});
char endKey;
std::cout << "you can disconnect the device and get a confirmation message or ending the program by pressing a key."<<std::endl;
std::cin >> endKey;
}
catch (const std::exception& error)
{
std::cout << error.what() << std::endl;
}
return(0);
}
static std::vector< DiscoveryInformation > Discover()
static std::shared_ptr< T > Open(const String &provider, AcquisitionStack acquisitionStack=AcquisitionStack::PreferVin)