49 const std::shared_ptr<const GenTLWrapper> &_gentl,
const char *_id)
80 std::lock_guard<std::mutex> lock(
mtx);
88 gentl->TLUpdateInterfaceList(
parent->getHandle(), 0, 10);
102 std::lock_guard<std::mutex> lock(
mtx);
124 int find(
const std::vector<std::shared_ptr<Device> > &list,
const std::string &
id)
126 for (
size_t i=0; i<list.size(); i++)
130 return static_cast<int>(i);
141 std::lock_guard<std::mutex> lock(
mtx);
143 std::vector<std::shared_ptr<Device> > ret;
149 std::vector<std::shared_ptr<Device> > current;
151 for (
size_t i=0; i<
dlist.size(); i++)
153 std::shared_ptr<Device> p=
dlist[i].lock();
156 current.push_back(p);
180 err=
gentl->IFUpdateDeviceList(
ifh, 0, 1000);
185 throw GenTLException(std::string(
"Interface::getDevices() (1) ")+
id+
" "+std::to_string(err),
gentl);
197 for (uint32_t i=0; i<n; i++)
200 size_t size=
sizeof(tmp);
207 int k=find(current, tmp);
211 ret.push_back(current[static_cast<size_t>(k)]);
215 ret.push_back(std::shared_ptr<Device>(
new Device(shared_from_this(),
gentl, tmp)));
222 for (
size_t i=0; i<ret.size(); i++)
224 dlist.push_back(ret[i]);
235 std::vector<std::shared_ptr<Device> > list=
getDevices();
239 std::shared_ptr<Device> ret;
241 for (
size_t i=0; i<list.size(); i++)
243 std::shared_ptr<Device> p=list[i];
245 if (p && (p->getID() == devid || p->getDisplayName() == devid ||
246 p->getSerialNumber() == devid))
250 std::cerr <<
"There is more than one device with ID, serial number or user defined name: " 251 << devid << std::endl;
260 if (!ret &&
ifh != 0)
271 gentl->DevClose(dev);
277 ret=std::shared_ptr<Device>(
new Device(shared_from_this(),
gentl, devid));
287 std::string cIFGetInfo(
const Interface *obj,
288 const std::shared_ptr<const GenTLWrapper> &
gentl,
295 size_t tmp_size=
sizeof(tmp);
300 err=gentl->IFGetInfo(obj->
getHandle(), info, &type, tmp, &tmp_size);
302 else if (obj->
getParent()->getHandle() != 0)
304 err=gentl->TLGetInterfaceInfo(obj->
getParent()->getHandle(), obj->
getID().c_str(), info,
305 &type, tmp, &tmp_size);
310 for (
size_t i=0; i<tmp_size && tmp[i] !=
'\0'; i++)
312 ret.push_back(tmp[i]);
323 std::lock_guard<std::mutex> lock(
mtx);
329 std::lock_guard<std::mutex> lock(
mtx);
335 std::lock_guard<std::mutex> lock(
mtx);
std::vector< std::weak_ptr< Device > > dlist
std::string getDisplayName()
Returns the display name of the interface.
int32_t INTERFACE_INFO_CMD
std::vector< std::shared_ptr< Device > > getDevices()
Returns the currently available devices on this interface.
std::shared_ptr< CPort > cport
This is the port definition that connects GenAPI to GenTL.
const std::string & getID() const
Get the internal ID of this interface.
void * getHandle() const
Get internal interace handle.
Interface(const std::shared_ptr< System > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs an interface class.
std::string getTLType()
Returns the transport layer type of the interface.
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
std::shared_ptr< System > parent
std::shared_ptr< Device > getDevice(const char *devid)
Returns a device with the given device id.
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.
void close()
Closes the interface.
std::shared_ptr< GenApi::CNodeMapRef > nodemap
void open()
Opens the interface for working with it.
std::shared_ptr< const GenTLWrapper > gentl
std::shared_ptr< System > getParent() const
Returns the pointer to the parent system object.
The device class encapsulates a Genicam device.
The interface class encapsulates a Genicam interface.