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);
307 std::lock_guard<std::mutex> lock(
mtx);
312 size_t size=
sizeof(status);
319 else if (
parent->getHandle() != 0)
367 std::lock_guard<std::mutex> lock(
mtx);
373 std::lock_guard<std::mutex> lock(
mtx);
379 std::lock_guard<std::mutex> lock(
mtx);
385 std::lock_guard<std::mutex> lock(
mtx);
388 size_t size=
sizeof(freq);
394 else if (
parent->getHandle() != 0)
405 std::lock_guard<std::mutex> lock(
mtx);
418 std::lock_guard<std::mutex> lock(
mtx);
439 std::vector<std::shared_ptr<Device> > ret;
443 for (
size_t i=0; i<system.size(); i++)
447 std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
449 for (
size_t k=0; k<interf.size(); k++)
453 std::vector<std::shared_ptr<Device> > device=interf[k]->getDevices();
455 for (
size_t j=0; j<device.size(); j++)
457 ret.push_back(device[j]);
472 std::shared_ptr<Device> ret;
474 if (
id != 0 && *
id !=
'\0')
478 std::string interfid;
479 std::string devid=
id;
481 size_t p=devid.find(
':');
482 if (p != std::string::npos)
484 interfid=devid.substr(0, p);
485 devid=devid.substr(p+1);
492 for (
size_t i=0; i<system.size(); i++)
498 std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
500 if (interfid.size() > 0)
504 for (
size_t k=0; k<interf.size(); k++)
506 if (interf[k]->
getID() == interfid)
510 std::shared_ptr<Device>
dev=interf[k]->getDevice(devid.c_str());
526 std::shared_ptr<Device>
dev;
527 for (
size_t k=0; k<interf.size() && !
dev; k++)
531 dev=interf[k]->getDevice(devid.c_str());
549 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.
void open(ACCESS access)
Opens the device for working with it.
static std::vector< std::shared_ptr< System > > getSystems()
Returns a list of systems (i.e.
const std::string & getID() const
Get the internal ID of this device.
std::shared_ptr< CPort > rport
void * getHandle() const
Get internal interface handle.
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.
Device(const std::shared_ptr< Interface > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs a device class.
std::shared_ptr< Interface > getParent() const
Returns the pointer to the parent interface object.
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.
std::string getModel()
Returns the model of the device.
int32_t DEVICE_ACCESS_FLAGS
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.