50 const std::shared_ptr<const GenTLWrapper> &_gentl,
const char *_id)
89 std::lock_guard<std::mutex> lock(
mtx);
123 err=
gentl->IFOpenDevice(
parent->getHandle(),
id.c_str(), mode[i], &
dev);
144 std::lock_guard<std::mutex> lock(
mtx);
177 std::lock_guard<std::mutex> lock(
mtx);
190 std::lock_guard<std::mutex> lock(
mtx);
194 size_t size=
sizeof(ret);
204 return static_cast<int>(ret);
210 std::string cDevGetInfo(
const Device *obj,
const std::shared_ptr<const GenTLWrapper> &gentl,
217 size_t tmp_size=
sizeof(tmp);
222 err=gentl->DevGetInfo(obj->
getHandle(), info, &type, tmp, &tmp_size);
224 else if (obj->
getParent()->getHandle() != 0)
226 err=gentl->IFGetDeviceInfo(obj->
getParent()->getHandle(), obj->
getID().c_str(), info, &type,
232 for (
size_t i=0; i<tmp_size && tmp[i] !=
'\0'; i++)
234 ret.push_back(tmp[i]);
249 std::lock_guard<std::mutex> lock(
mtx);
253 timeout=
static_cast<uint64_t
>(_timeout);
270 size_t size=
sizeof(value);
294 std::lock_guard<std::mutex> lock(
mtx);
317 size_t tmp_size=
sizeof(tmp);
320 &type, tmp, &tmp_size);
329 eventid=std::stoi(std::string(tmp), 0, 16);
334 memcpy(&value, tmp,
sizeof(value));
372 catch (
const std::exception &)
380 std::lock_guard<std::mutex> lock(
mtx);
391 int find(
const std::vector<std::shared_ptr<Stream> > &list,
const std::string &
id)
393 for (
size_t i=0; i<list.size(); i++)
395 if (list[i]->getID() ==
id)
397 return static_cast<int>(i);
408 std::lock_guard<std::mutex> lock(
mtx);
410 std::vector<std::shared_ptr<Stream> > ret;
416 std::vector<std::shared_ptr<Stream> > current;
418 for (
size_t i=0; i<
slist.size(); i++)
420 std::shared_ptr<Stream> p=
slist[i].lock();
423 current.push_back(p);
436 for (uint32_t i=0; i<n; i++)
439 size_t size=
sizeof(tmp);
446 int k=find(current, tmp);
450 ret.push_back(current[
static_cast<size_t>(k)]);
454 ret.push_back(std::shared_ptr<Stream>(
new Stream(shared_from_this(),
gentl, tmp)));
461 for (
size_t i=0; i<ret.size(); i++)
463 slist.push_back(ret[i]);
473 std::lock_guard<std::mutex> lock(
mtx);
479 std::lock_guard<std::mutex> lock(
mtx);
485 std::lock_guard<std::mutex> lock(
mtx);
491 std::lock_guard<std::mutex> lock(
mtx);
508 std::lock_guard<std::mutex> lock(
mtx);
513 size_t size=
sizeof(status);
520 else if (
parent->getHandle() != 0)
568 std::lock_guard<std::mutex> lock(
mtx);
575 size_t tmp_size=
sizeof(tmp);
591 for (
size_t i=0; i<tmp_size && tmp[i] !=
'\0'; i++)
593 ret.push_back(tmp[i]);
609 std::lock_guard<std::mutex> lock(
mtx);
615 std::lock_guard<std::mutex> lock(
mtx);
621 std::lock_guard<std::mutex> lock(
mtx);
624 size_t size=
sizeof(freq);
630 else if (
parent->getHandle() != 0)
641 std::lock_guard<std::mutex> lock(
mtx);
654 std::lock_guard<std::mutex> lock(
mtx);
670 std::lock_guard<std::mutex> lock(
mtx);
689 std::vector<std::shared_ptr<Device> >
getDevices(uint64_t timeout)
691 std::vector<std::shared_ptr<Device> > ret;
695 for (
size_t i=0; i<system.size(); i++)
699 std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
701 for (
size_t k=0; k<interf.size(); k++)
705 std::vector<std::shared_ptr<Device> > device=interf[k]->getDevices(timeout);
707 for (
size_t j=0; j<device.size(); j++)
709 ret.push_back(device[j]);
726 std::shared_ptr<Device>
getDevice(
const char *
id, uint64_t timeout)
729 std::shared_ptr<Device> ret;
731 if (
id != 0 && *
id !=
'\0')
735 std::string interfid;
736 std::string devid=id;
738 size_t p=devid.find(
':');
739 if (p != std::string::npos)
741 interfid=devid.substr(0, p);
742 devid=devid.substr(p+1);
749 for (
size_t i=0; i<system.size(); i++)
755 std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
757 if (interfid.size() > 0)
761 for (
size_t k=0; k<interf.size(); k++)
763 if (interf[k]->getID() == interfid)
767 std::shared_ptr<Device> dev=interf[k]->getDevice(devid.c_str(), timeout);
783 std::shared_ptr<Device> dev;
784 for (
size_t k=0; k<interf.size() && !dev; k++)
788 dev=interf[k]->getDevice(devid.c_str(), timeout);
806 std::cerr <<
"ERROR: Finding device '" <<
id <<
"' through different producers."