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);
176 for (uint32_t i=0; i<n; i++)
179 size_t size=
sizeof(tmp);
186 int k=find(current, tmp);
190 ret.push_back(current[static_cast<size_t>(k)]);
194 ret.push_back(std::shared_ptr<Device>(
new Device(shared_from_this(),
gentl, tmp)));
201 for (
size_t i=0; i<ret.size(); i++)
203 dlist.push_back(ret[i]);
214 std::vector<std::shared_ptr<Device> > list=
getDevices();
218 std::shared_ptr<Device> ret;
220 for (
size_t i=0; i<list.size(); i++)
222 std::shared_ptr<Device> p=list[i];
224 if (p && (p->getID() == devid || p->getDisplayName() == devid ||
225 p->getSerialNumber() == devid))
229 std::cerr <<
"There is more than one device with ID, serial number or user defined name: " 230 << devid << std::endl;
245 std::string cIFGetInfo(
const Interface *obj,
246 const std::shared_ptr<const GenTLWrapper> &
gentl,
253 size_t tmp_size=
sizeof(tmp);
258 err=gentl->IFGetInfo(obj->
getHandle(), info, &type, tmp, &tmp_size);
260 else if (obj->
getParent()->getHandle() != 0)
262 err=gentl->TLGetInterfaceInfo(obj->
getParent()->getHandle(), obj->
getID().c_str(), info,
263 &type, tmp, &tmp_size);
268 for (
size_t i=0; i<tmp_size && tmp[i] !=
'\0'; i++)
270 ret.push_back(tmp[i]);
281 std::lock_guard<std::mutex> lock(
mtx);
287 std::lock_guard<std::mutex> lock(
mtx);
293 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.