// // Starts Vimba // Gets all connected cameras // And prints out information about the camera name, model name, serial number, ID and the corresponding interface ID // void ListCameras::Print() { VimbaSystem& sys = VimbaSystem::GetInstance(); // Get a reference to the VimbaSystem singleton std::cout<<"Vimba Version V"<<sys<<"\n"; // Print out version of Vimba VmbErrorType err = sys.Startup(); // Initialize the Vimba API CameraPtrVector cameras; // A vector of std::shared_ptr<AVT::VmbAPI::Camera> objects std::stringstream strError; if( VmbErrorSuccess == err ) { err = sys.GetCameras( cameras ); // Fetch all cameras known to Vimba if( VmbErrorSuccess == err ) { std::cout << "Cameras found: " << cameras.size() <<"\n\n"; // Query all static details of all known cameras and print them out. // We don't have to open the cameras for that. std::for_each( cameras.begin(), cameras.end(), PrintCameraInfo ); } else { std::cout << "Could not list cameras. Error code: " << err << "("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "\n"; } sys.Shutdown(); // Close Vimba } else { std::cout << "Could not start system. Error code: " << err <<"("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "\n"; } }
// // Queries and lists all known camera // void CAsynchronousGrabDlg::UpdateCameraListBox() { // Get all cameras currently connected to Vimba CameraPtrVector cameras = m_ApiController.GetCameraList(); // Simply forget about all cameras known so far m_ListBoxCameras.ResetContent(); m_cameras.clear(); // And query the camera details again for( CameraPtrVector::const_iterator iter = cameras.begin(); cameras.end() != iter; ++iter ) { std::string strCameraName; std::string strCameraID; if( VmbErrorSuccess != (*iter)->GetName( strCameraName ) ) { strCameraName = "[NoName]"; } // If for any reason we cannot get the ID of a camera we skip it if( VmbErrorSuccess == (*iter)->GetID( strCameraID ) ) { std::string strInfo = strCameraName + " " + strCameraID; m_ListBoxCameras.AddString( CString( strInfo.c_str() ) ); m_cameras.push_back( strCameraID ); } else { Log( _TEXT("Could not get camera ID") ); } } // Select first cam if none is selected if ( -1 == m_ListBoxCameras.GetCurSel() && 0 < m_cameras.size() ) { m_ListBoxCameras.SetCurSel( 0 ); } m_ButtonStartStop.EnableWindow( 0 < m_cameras.size() || m_bIsStreaming ); }