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++)
128 if (list[i]->getID() ==
id)
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, timeout);
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]);
240 std::vector<std::shared_ptr<Device> > list=
getDevices(timeout);
244 std::shared_ptr<Device> ret;
246 for (
size_t i=0; i<list.size(); i++)
248 std::shared_ptr<Device> p=list[i];
250 if (p && (p->getID() == devid || p->getDisplayName() == devid ||
251 p->getSerialNumber() == devid))
255 std::cerr <<
"There is more than one device with ID, serial number or user defined name: "
256 << devid << std::endl;
265 if (!ret &&
ifh != 0)
276 gentl->DevClose(dev);
282 ret=std::shared_ptr<Device>(
new Device(shared_from_this(),
gentl, devid));
297 std::string cIFGetInfo(
const Interface *obj,
298 const std::shared_ptr<const GenTLWrapper> &gentl,
305 size_t tmp_size=
sizeof(tmp);
310 err=gentl->IFGetInfo(obj->
getHandle(), info, &type, tmp, &tmp_size);
312 else if (obj->
getParent()->getHandle() != 0)
314 err=gentl->TLGetInterfaceInfo(obj->
getParent()->getHandle(), obj->
getID().c_str(), info,
315 &type, tmp, &tmp_size);
320 for (
size_t i=0; i<tmp_size && tmp[i] !=
'\0'; i++)
322 ret.push_back(tmp[i]);
333 std::lock_guard<std::mutex> lock(
mtx);
339 std::lock_guard<std::mutex> lock(
mtx);
345 std::lock_guard<std::mutex> lock(
mtx);