49 const std::shared_ptr<const GenTLWrapper> &_gentl,
const char *_id)
87 std::lock_guard<std::mutex> lock(
mtx);
121 err=
gentl->IFOpenDevice(
parent->getHandle(),
id.c_str(), mode[i], &
dev);
139 std::lock_guard<std::mutex> lock(
mtx);
165 int find(
const std::vector<std::shared_ptr<Stream> > &list,
const std::string &
id)
167 for (
size_t i=0; i<list.size(); i++)
171 return static_cast<int>(i);
182 std::lock_guard<std::mutex> lock(
mtx);
184 std::vector<std::shared_ptr<Stream> > ret;
190 std::vector<std::shared_ptr<Stream> > current;
192 for (
size_t i=0; i<
slist.size(); i++)
194 std::shared_ptr<Stream> p=
slist[i].lock();
197 current.push_back(p);
210 for (uint32_t i=0; i<n; i++)
213 size_t size=
sizeof(tmp);
220 int k=find(current, tmp);
224 ret.push_back(current[static_cast<size_t>(k)]);
228 ret.push_back(std::shared_ptr<Stream>(
new Stream(shared_from_this(),
gentl, tmp)));
235 for (
size_t i=0; i<ret.size(); i++)
237 slist.push_back(ret[i]);
248 std::string cDevGetInfo(
const Device *obj,
const std::shared_ptr<const GenTLWrapper> &
gentl,
255 size_t tmp_size=
sizeof(tmp);
260 err=gentl->DevGetInfo(obj->
getHandle(), info, &type, tmp, &tmp_size);
262 else if (obj->
getParent()->getHandle() != 0)
264 err=gentl->IFGetDeviceInfo(obj->
getParent()->getHandle(), obj->
getID().c_str(), info, &type,
270 for (
size_t i=0; i<tmp_size && tmp[i] !=
'\0'; i++)
272 ret.push_back(tmp[i]);
283 std::lock_guard<std::mutex> lock(
mtx);
289 std::lock_guard<std::mutex> lock(
mtx);
295 std::lock_guard<std::mutex> lock(
mtx);
301 std::lock_guard<std::mutex> lock(
mtx);
318 std::lock_guard<std::mutex> lock(
mtx);
323 size_t size=
sizeof(status);
330 else if (
parent->getHandle() != 0)
378 std::lock_guard<std::mutex> lock(
mtx);
384 std::lock_guard<std::mutex> lock(
mtx);
390 std::lock_guard<std::mutex> lock(
mtx);
396 std::lock_guard<std::mutex> lock(
mtx);
399 size_t size=
sizeof(freq);
405 else if (
parent->getHandle() != 0)
416 std::lock_guard<std::mutex> lock(
mtx);
429 std::lock_guard<std::mutex> lock(
mtx);
450 std::vector<std::shared_ptr<Device> > ret;
454 for (
size_t i=0; i<system.size(); i++)
458 std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
460 for (
size_t k=0; k<interf.size(); k++)
464 std::vector<std::shared_ptr<Device> > device=interf[k]->getDevices();
466 for (
size_t j=0; j<device.size(); j++)
468 ret.push_back(device[j]);
483 std::shared_ptr<Device> ret;
485 if (
id != 0 && *
id !=
'\0')
489 std::string interfid;
490 std::string devid=
id;
492 size_t p=devid.find(
':');
493 if (p != std::string::npos)
495 interfid=devid.substr(0, p);
496 devid=devid.substr(p+1);
503 for (
size_t i=0; i<system.size(); i++)
509 std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
511 if (interfid.size() > 0)
515 for (
size_t k=0; k<interf.size(); k++)
517 if (interf[k]->
getID() == interfid)
521 std::shared_ptr<Device>
dev=interf[k]->getDevice(devid.c_str());
537 std::shared_ptr<Device>
dev;
538 for (
size_t k=0; k<interf.size() && !
dev; k++)
542 dev=interf[k]->getDevice(devid.c_str());
560 std::cerr <<
"ERROR: Finding device '" <<
id <<
"' through different producers." std::vector< std::shared_ptr< Stream > > getStreams()
Returns the currently available streams of this device.
std::shared_ptr< Device > getDevice(const char *id)
Searches across all transport layers and interfaces for a device.
std::string getDisplayName()
Returns the display name of the device.
This is the port definition that connects GenAPI to GenTL.
int32_t DEVICE_ACCESS_FLAGS
void open(ACCESS access)
Opens the device for working with it.
static std::vector< std::shared_ptr< System > > getSystems()
This function creates systems for all producers that can be found.
std::shared_ptr< CPort > rport
std::string getVendor()
Returns the vendor of the device.
std::string getUserDefinedName()
Returns the user defined name of the device.
std::shared_ptr< GenApi::CNodeMapRef > rnodemap
std::shared_ptr< const GenTLWrapper > gentl
std::string getSerialNumber()
Returns the serial number of the device.
std::shared_ptr< GenApi::CNodeMapRef > getRemoteNodeMap(const char *xml=0)
Returns the node map of the remote device.
std::shared_ptr< Interface > getParent() const
Returns the pointer to the parent interface object.
Device(const std::shared_ptr< Interface > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs a device class.
const std::string & getID() const
Get the internal ID of this device.
std::shared_ptr< GenApi::CNodeMapRef > allocNodeMap(std::shared_ptr< const GenTLWrapper > gentl, void *port, CPort *cport, const char *xml)
Convenience function that returns a GenICam node map from the given port.
std::shared_ptr< CPort > cport
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
std::string getTLType()
Returns the transport layer type of the device.
void * getHandle() const
Get internal interface handle.
std::string getModel()
Returns the model of the device.
std::shared_ptr< GenApi::CNodeMapRef > nodemap
std::vector< std::shared_ptr< Device > > getDevices()
Returns a list of all devices that are available across all transport layers and interfaces.
uint64_t getTimestampFrequency()
Returns the timestamp frequency of the device.
std::string getVersion()
Returns the version of the device.
std::vector< std::weak_ptr< Stream > > slist
std::shared_ptr< Interface > parent
The device class encapsulates a Genicam device.
The stream class encapsulates a Genicam stream.
std::string getAccessStatus()
Returns the access status of the device.
void close()
Closes the device.