static const char * arv_get_info (unsigned int index, const char *get_info (ArvInterface *, guint)) { unsigned int offset = 0; unsigned int i; const char *info; g_mutex_lock (&arv_system_mutex); for (i = 0; i < G_N_ELEMENTS (interfaces); i++) { ArvInterface *interface; unsigned int n_devices; if (interfaces[i].is_available) { interface = interfaces[i].get_interface_instance (); n_devices = arv_interface_get_n_devices (interface); if (index - offset < n_devices) { info = get_info (interface, index - offset); g_mutex_unlock (&arv_system_mutex); return info; } offset += n_devices; } } g_mutex_unlock (&arv_system_mutex); return NULL; }
bool CameraGigeAravis::listCameras(){ ArvInterface *interface; //arv_update_device_list(); int ni = arv_get_n_interfaces (); cout << endl << "------------ GIGE CAMERAS WITH ARAVIS ----------" << endl << endl; for (int j = 0; j< ni; j++){ interface = arv_gv_interface_get_instance(); arv_interface_update_device_list(interface); //int nb = arv_get_n_devices(); int nb = arv_interface_get_n_devices(interface); for(int i = 0; i < nb; i++){ cout << "-> [" << i << "] " << arv_interface_get_device_id(interface,i)<< endl; //cout << "-> [" << i << "] " << arv_get_device_id(i)<< endl; } if(nb == 0) { cout << "-> No cameras detected..." << endl; return false; } } cout << endl << "------------------------------------------------" << endl << endl; return true; }
unsigned int arv_get_n_devices (void) { unsigned int n_devices = 0; unsigned int i; for (i = 0; i < G_N_ELEMENTS (interfaces); i++) { ArvInterface *interface; interface = interfaces[i].get_interface_instance (); n_devices += arv_interface_get_n_devices (interface); } return n_devices; }
unsigned int arv_get_n_devices (void) { unsigned int n_devices = 0; unsigned int i; g_mutex_lock (&arv_system_mutex); for (i = 0; i < G_N_ELEMENTS (interfaces); i++) { ArvInterface *interface; if (interfaces[i].is_available) { interface = interfaces[i].get_interface_instance (); n_devices += arv_interface_get_n_devices (interface); } } g_mutex_unlock (&arv_system_mutex); return n_devices; }
const char * arv_get_device_id (unsigned int index) { unsigned int offset = 0; unsigned int i; for (i = 0; i < G_N_ELEMENTS (interfaces); i++) { ArvInterface *interface; unsigned int n_devices; interface = interfaces[i].get_interface_instance (); n_devices = arv_interface_get_n_devices (interface); if (index - offset < n_devices) return arv_interface_get_device_id (interface, index - offset); offset += n_devices; } return NULL; }
vector<pair<int,string>> CameraGigeAravis::getCamerasList() { vector<pair<int,string>> camerasList; ArvInterface *interface; //arv_update_device_list(); int ni = arv_get_n_interfaces(); for (int j = 0; j< ni; j++){ const char* name = arv_get_interface_id (j); if (strcmp(name,"GigEVision") == 0) { interface = arv_gv_interface_get_instance(); arv_interface_update_device_list(interface); //int nb = arv_get_n_devices(); int nb = arv_interface_get_n_devices(interface); for(int i = 0; i < nb; i++){ pair<int,string> c; c.first = i; //const char* str = arv_get_device_id(i); const char* str = arv_interface_get_device_id(interface,i); const char* addr = arv_interface_get_device_address(interface,i); std::string s = str; c.second = "NAME[" + s + "] SDK[ARAVIS] IP: " + addr; camerasList.push_back(c); } } } return camerasList; }