All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
device.cc
Go to the documentation of this file.
1 /*
2  * This file is part of the rc_genicam_api package.
3  *
4  * Copyright (c) 2017 Roboception GmbH
5  * All rights reserved
6  *
7  * Author: Heiko Hirschmueller
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #include "device.h"
37 #include "stream.h"
38 #include "config.h"
39 
40 #include "gentl_wrapper.h"
41 #include "exception.h"
42 #include "cport.h"
43 
44 #include <iostream>
45 
46 namespace rcg
47 {
48 
49 Device::Device(const std::shared_ptr<Interface> &_parent,
50  const std::shared_ptr<const GenTLWrapper> &_gentl, const char *_id)
51 {
52  parent=_parent;
53  gentl=_gentl;
54  id=_id;
55 
56  n_open=0;
57  dev=0;
58  rp=0;
59  event=0;
60 }
61 
63 {
64  if (n_open > 0)
65  {
66  try
67  {
68  gentl->DevClose(dev);
69  }
70  catch (...) // do not throw exceptions in destructor
71  { }
72 
73  parent->close();
74  }
75 }
76 
77 std::shared_ptr<Interface> Device::getParent() const
78 {
79  return parent;
80 }
81 
82 const std::string &Device::getID() const
83 {
84  return id;
85 }
86 
87 void Device::open(ACCESS access)
88 {
89  std::lock_guard<std::mutex> lock(mtx);
90 
91  if (n_open == 0)
92  {
93  parent->open();
94 
95  // convert access mode to GenTL flags
96 
99 
100  int i=0;
101  switch (access)
102  {
103  case READONLY:
104  i=0;
105  break;
106 
107  case CONTROL:
108  i=1;
109  break;
110 
111  default:
112  case EXCLUSIVE:
113  i=2;
114  break;
115  }
116 
117  // open device (if readonly fails, try control; if control fails try
118  // exclusive)
119 
121  while (err == GenTL::GC_ERR_NOT_IMPLEMENTED && i < 3)
122  {
123  err=gentl->IFOpenDevice(parent->getHandle(), id.c_str(), mode[i], &dev);
124  i++;
125  }
126 
127  event=0;
128  eventadapter.reset();
129 
130  // check if open was successful
131 
132  if (err != GenTL::GC_ERR_SUCCESS)
133  {
134  parent->close();
135  throw GenTLException("Device::open() failed: "+std::to_string(err), gentl);
136  }
137  }
138 
139  n_open++;
140 }
141 
143 {
144  std::lock_guard<std::mutex> lock(mtx);
145 
146  if (n_open > 0)
147  {
148  n_open--;
149 
150  if (n_open == 0)
151  {
152  eventadapter.reset();
153 
154  if (event)
155  {
156  gentl->GCUnregisterEvent(dev, GenTL::EVENT_MODULE);
157  }
158 
159  gentl->DevClose(dev);
160  dev=0;
161  rp=0;
162  event=0;
163 
164  nodemap=0;
165  rnodemap=0;
166 
167  cport=0;
168  rport=0;
169 
170  parent->close();
171  }
172  }
173 }
174 
176 {
177  std::lock_guard<std::mutex> lock(mtx);
178 
179  if (dev && !event)
180  {
181  if (gentl->GCRegisterEvent(dev, GenTL::EVENT_MODULE, &event) != GenTL::GC_ERR_SUCCESS)
182  {
183  throw GenTLException("Device::enableModuleEvents()", gentl);
184  }
185  }
186 }
187 
189 {
190  std::lock_guard<std::mutex> lock(mtx);
191  size_t ret=0;
192 
194  size_t size=sizeof(ret);
195 
196  if (event != 0)
197  {
198  if (gentl->EventGetInfo(event, GenTL::EVENT_NUM_IN_QUEUE, &type, &ret, &size) != GenTL::GC_ERR_SUCCESS)
199  {
200  ret=0;
201  }
202  }
203 
204  return static_cast<int>(ret);
205 }
206 
207 namespace
208 {
209 
210 std::string cDevGetInfo(const Device *obj, const std::shared_ptr<const GenTLWrapper> &gentl,
212 {
213  std::string ret;
214 
216  char tmp[1024]="";
217  size_t tmp_size=sizeof(tmp);
219 
220  if (obj->getHandle() != 0)
221  {
222  err=gentl->DevGetInfo(obj->getHandle(), info, &type, tmp, &tmp_size);
223  }
224  else if (obj->getParent()->getHandle() != 0)
225  {
226  err=gentl->IFGetDeviceInfo(obj->getParent()->getHandle(), obj->getID().c_str(), info, &type,
227  tmp, &tmp_size);
228  }
229 
231  {
232  for (size_t i=0; i<tmp_size && tmp[i] != '\0'; i++)
233  {
234  ret.push_back(tmp[i]);
235  }
236  }
237 
238  return ret;
239 }
240 
241 }
242 
244 {
245  int64_t eventid=-1;
246  uint64_t timeout=GENTL_INFINITE;
247 
248  {
249  std::lock_guard<std::mutex> lock(mtx);
250 
251  if (_timeout >= 0)
252  {
253  timeout=static_cast<uint64_t>(_timeout);
254  }
255 
256  // check that streaming had been started
257 
258  if (event == 0)
259  {
260  return -3;
261  }
262 
263  // determine memory for receiving the event
264 
265  if (event_buffer.size() == 0)
266  {
267  size_t value=0;
268 
270  size_t size=sizeof(value);
271 
272  if (gentl->EventGetInfo(event, GenTL::EVENT_SIZE_MAX, &type, &value, &size) == GenTL::GC_ERR_SUCCESS)
273  {
274  event_buffer.resize(value);
275  event_value.resize(value);
276  }
277  }
278 
279  // clear buffer
280 
281  for (size_t i=0; i<event_buffer.size(); i++)
282  {
283  event_buffer[i]=0;
284  event_value[i]=0;
285  }
286  }
287 
288  // get event data
289 
290  size_t size=event_buffer.size();
291 
292  GenTL::GC_ERROR err=gentl->EventGetData(event, event_buffer.data(), &size, timeout);
293 
294  std::lock_guard<std::mutex> lock(mtx);
295 
296  // return 0 in case of abort and timeout and throw exception in case of
297  // another error
298 
299  if (err == GenTL::GC_ERR_TIMEOUT)
300  {
301  return -1;
302  }
303  else if (err == GenTL::GC_ERR_ABORT)
304  {
305  return -2;
306  }
307  else if (err != GenTL::GC_ERR_SUCCESS)
308  {
309  throw GenTLException("Device::getModuleEvent()", gentl);
310  }
311 
312  // get event ID
313 
314  {
316  char tmp[80];
317  size_t tmp_size=sizeof(tmp);
318 
319  err=gentl->EventGetDataInfo(event, event_buffer.data(), size, GenTL::EVENT_DATA_ID,
320  &type, tmp, &tmp_size);
321 
322  if (err != GenTL::GC_ERR_SUCCESS)
323  {
324  throw GenTLException("Device::getModuleEvent()", gentl);
325  }
326 
327  if (type == GenTL::INFO_DATATYPE_STRING)
328  {
329  eventid=std::stoi(std::string(tmp), 0, 16);
330  }
331  else if (type == GenTL::INFO_DATATYPE_INT32)
332  {
333  int32_t value=0;
334  memcpy(&value, tmp, sizeof(value));
335  eventid=value;
336  }
337  }
338 
339  // get event value
340 
341  {
343  size=event_value.size();
344 
345  err=gentl->EventGetDataInfo(event, event_buffer.data(), size, GenTL::EVENT_DATA_VALUE,
346  &type, event_value.data(), &size);
347 
348  if (err != GenTL::GC_ERR_SUCCESS)
349  {
350  throw GenTLException("Device::getModuleEvent()", gentl);
351  }
352  }
353 
354  if (!nodemap)
355  {
356  cport=std::shared_ptr<CPort>(new CPort(gentl, &dev));
357  nodemap=allocNodeMap(gentl, dev, cport.get(), 0);
358  }
359 
360  try
361  {
362  if (!eventadapter)
363  {
364  eventadapter=std::shared_ptr<GenApi::CEventAdapterGeneric>(new GenApi::CEventAdapterGeneric(nodemap->_Ptr));
365  }
366 
367  if (eventid > 0)
368  {
369  eventadapter->DeliverMessage(event_value.data(), size, static_cast<uint64_t>(eventid));
370  }
371  }
372  catch (const std::exception &)
373  { }
374 
375  return eventid;
376 }
377 
379 {
380  std::lock_guard<std::mutex> lock(mtx);
381 
382  if (event != 0)
383  {
384  gentl->EventKill(event);
385  }
386 }
387 
388 namespace
389 {
390 
391 int find(const std::vector<std::shared_ptr<Stream> > &list, const std::string &id)
392 {
393  for (size_t i=0; i<list.size(); i++)
394  {
395  if (list[i]->getID() == id)
396  {
397  return static_cast<int>(i);
398  }
399  }
400 
401  return -1;
402 }
403 
404 }
405 
406 std::vector<std::shared_ptr<Stream> > Device::getStreams()
407 {
408  std::lock_guard<std::mutex> lock(mtx);
409 
410  std::vector<std::shared_ptr<Stream> > ret;
411 
412  if (dev != 0)
413  {
414  // get list of previously requested streams that are still in use
415 
416  std::vector<std::shared_ptr<Stream> > current;
417 
418  for (size_t i=0; i<slist.size(); i++)
419  {
420  std::shared_ptr<Stream> p=slist[i].lock();
421  if (p)
422  {
423  current.push_back(p);
424  }
425  }
426 
427  // create list of streams, using either existing streams or
428  // instantiating new ones
429 
430  uint32_t n=0;
431  if (gentl->DevGetNumDataStreams(dev, &n) != GenTL::GC_ERR_SUCCESS)
432  {
433  throw GenTLException("Device::getStreams()", gentl);
434  }
435 
436  for (uint32_t i=0; i<n; i++)
437  {
438  char tmp[256]="";
439  size_t size=sizeof(tmp);
440 
441  if (gentl->DevGetDataStreamID(dev, i, tmp, &size) != GenTL::GC_ERR_SUCCESS)
442  {
443  throw GenTLException("Device::getStreams()", gentl);
444  }
445 
446  int k=find(current, tmp);
447 
448  if (k >= 0)
449  {
450  ret.push_back(current[static_cast<size_t>(k)]);
451  }
452  else
453  {
454  ret.push_back(std::shared_ptr<Stream>(new Stream(shared_from_this(), gentl, tmp)));
455  }
456  }
457 
458  // update internal list of streams for reusage on next call
459 
460  slist.clear();
461  for (size_t i=0; i<ret.size(); i++)
462  {
463  slist.push_back(ret[i]);
464  }
465  }
466 
467  return ret;
468 
469 }
470 
471 std::string Device::getVendor()
472 {
473  std::lock_guard<std::mutex> lock(mtx);
474  return cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_VENDOR);
475 }
476 
477 std::string Device::getModel()
478 {
479  std::lock_guard<std::mutex> lock(mtx);
480  return cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_MODEL);
481 }
482 
483 std::string Device::getTLType()
484 {
485  std::lock_guard<std::mutex> lock(mtx);
486  return cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_TLTYPE);
487 }
488 
490 {
491  std::lock_guard<std::mutex> lock(mtx);
492 
493  // return user defined name if available, otherwise the display name that
494  // the producer provides
495 
496  std::string ret=cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_USER_DEFINED_NAME);
497 
498  if (ret.size() == 0)
499  {
500  ret=cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_DISPLAYNAME);
501  }
502 
503  return ret;
504 }
505 
507 {
508  std::lock_guard<std::mutex> lock(mtx);
509  std::string ret;
510 
512  int32_t status=-1;
513  size_t size=sizeof(status);
515 
516  if (dev != 0)
517  {
518  err=gentl->DevGetInfo(dev, GenTL::DEVICE_INFO_ACCESS_STATUS, &type, &status, &size);
519  }
520  else if (parent->getHandle() != 0)
521  {
522  err=gentl->IFGetDeviceInfo(getParent()->getHandle(), id.c_str(),
523  GenTL::DEVICE_INFO_ACCESS_STATUS, &type, &status, &size);
524  }
525 
526  if (err == GenTL::GC_ERR_SUCCESS)
527  {
528  if (type == GenTL::INFO_DATATYPE_INT32)
529  {
530  switch (status)
531  {
533  ret="ReadWrite";
534  break;
535 
537  ret="ReadOnly";
538  break;
539 
541  ret="NoAccess";
542  break;
543 
545  ret="Busy";
546  break;
547 
549  ret="OpenReadWrite";
550  break;
551 
553  ret="OpenReadWrite";
554  break;
555 
556  default:
557  ret="Unknown";
558  break;
559  }
560  }
561  }
562 
563  return ret;
564 }
565 
567 {
568  std::lock_guard<std::mutex> lock(mtx);
569  std::string ret;
570 
571  // try to get user defined name
572 
574  char tmp[100]="";
575  size_t tmp_size=sizeof(tmp);
577 
578  if (getHandle() != 0)
579  {
580  err=gentl->DevGetInfo(getHandle(), GenTL::DEVICE_INFO_USER_DEFINED_NAME, &type, tmp,
581  &tmp_size);
582  }
583  else if (getParent()->getHandle() != 0)
584  {
585  err=gentl->IFGetDeviceInfo(getParent()->getHandle(), getID().c_str(),
586  GenTL::DEVICE_INFO_USER_DEFINED_NAME, &type, tmp, &tmp_size);
587  }
588 
590  {
591  for (size_t i=0; i<tmp_size && tmp[i] != '\0'; i++)
592  {
593  ret.push_back(tmp[i]);
594  }
595  }
596  else
597  {
598  // since user defined name is optional, fall back to display name in case
599  // of an error
600 
601  ret=cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_DISPLAYNAME);
602  }
603 
604  return ret;
605 }
606 
608 {
609  std::lock_guard<std::mutex> lock(mtx);
610  return cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_SERIAL_NUMBER);
611 }
612 
613 std::string Device::getVersion()
614 {
615  std::lock_guard<std::mutex> lock(mtx);
616  return cDevGetInfo(this, gentl, GenTL::DEVICE_INFO_VERSION);
617 }
618 
620 {
621  std::lock_guard<std::mutex> lock(mtx);
623  uint64_t freq=0;
624  size_t size=sizeof(freq);
625 
626  if (dev != 0)
627  {
628  gentl->DevGetInfo(dev, GenTL::DEVICE_INFO_TIMESTAMP_FREQUENCY, &type, &freq, &size);
629  }
630  else if (parent->getHandle() != 0)
631  {
632  gentl->IFGetDeviceInfo(getParent()->getHandle(), id.c_str(),
633  GenTL::DEVICE_INFO_TIMESTAMP_FREQUENCY, &type, &freq, &size);
634  }
635 
636  return freq;
637 }
638 
639 std::shared_ptr<GenApi::CNodeMapRef> Device::getNodeMap(const char *xml)
640 {
641  std::lock_guard<std::mutex> lock(mtx);
642 
643  if (dev != 0 && !nodemap)
644  {
645  cport=std::shared_ptr<CPort>(new CPort(gentl, &dev));
646  nodemap=allocNodeMap(gentl, dev, cport.get(), xml);
647  }
648 
649  return nodemap;
650 }
651 
652 std::shared_ptr<GenApi::CNodeMapRef> Device::getRemoteNodeMap(const char *xml)
653 {
654  std::lock_guard<std::mutex> lock(mtx);
655 
656  if (dev != 0 && !rnodemap)
657  {
658  if (gentl->DevGetPort(dev, &rp) == GenTL::GC_ERR_SUCCESS)
659  {
660  rport=std::shared_ptr<CPort>(new CPort(gentl, &rp));
661  rnodemap=allocNodeMap(gentl, rp, rport.get(), xml);
662  }
663  }
664 
665  return rnodemap;
666 }
667 
668 std::shared_ptr<CPort> Device::getRemotePort()
669 {
670  std::lock_guard<std::mutex> lock(mtx);
671 
672  if (dev != 0 && !rnodemap)
673  {
674  if (gentl->DevGetPort(dev, &rp) == GenTL::GC_ERR_SUCCESS)
675  {
676  rport=std::shared_ptr<CPort>(new CPort(gentl, &rp));
677  rnodemap=allocNodeMap(gentl, rp, rport.get(), 0);
678  }
679  }
680 
681  return rport;
682 }
683 
684 void *Device::getHandle() const
685 {
686  return dev;
687 }
688 
689 std::vector<std::shared_ptr<Device> > getDevices(uint64_t timeout)
690 {
691  std::vector<std::shared_ptr<Device> > ret;
692 
693  std::vector<std::shared_ptr<System> > system=System::getSystems();
694 
695  for (size_t i=0; i<system.size(); i++)
696  {
697  system[i]->open();
698 
699  std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
700 
701  for (size_t k=0; k<interf.size(); k++)
702  {
703  interf[k]->open();
704 
705  std::vector<std::shared_ptr<Device> > device=interf[k]->getDevices(timeout);
706 
707  for (size_t j=0; j<device.size(); j++)
708  {
709  ret.push_back(device[j]);
710  }
711 
712  interf[k]->close();
713  }
714 
715  system[i]->close();
716  }
717 
718  return ret;
719 }
720 
721 std::vector<std::shared_ptr<Device> > getDevices()
722 {
723  return getDevices(1000);
724 }
725 
726 std::shared_ptr<Device> getDevice(const char *id, uint64_t timeout)
727 {
728  int found=0;
729  std::shared_ptr<Device> ret;
730 
731  if (id != 0 && *id != '\0')
732  {
733  // split into interface and device id
734 
735  std::string interfid;
736  std::string devid=id;
737 
738  size_t p=devid.find(':');
739  if (p != std::string::npos)
740  {
741  interfid=devid.substr(0, p);
742  devid=devid.substr(p+1);
743  }
744 
745  // go through all systems
746 
747  std::vector<std::shared_ptr<System> > system=System::getSystems();
748 
749  for (size_t i=0; i<system.size(); i++)
750  {
751  system[i]->open();
752 
753  // get all interfaces
754 
755  std::vector<std::shared_ptr<Interface> > interf=system[i]->getInterfaces();
756 
757  if (interfid.size() > 0)
758  {
759  // if an interface is defined, then only search this interface
760 
761  for (size_t k=0; k<interf.size(); k++)
762  {
763  if (interf[k]->getID() == interfid)
764  {
765  interf[k]->open();
766 
767  std::shared_ptr<Device> dev=interf[k]->getDevice(devid.c_str(), timeout);
768 
769  if (dev)
770  {
771  ret=dev;
772  found++;
773  }
774 
775  interf[k]->close();
776  }
777  }
778  }
779  else
780  {
781  // if interface is not defined, then check all interfaces
782 
783  std::shared_ptr<Device> dev;
784  for (size_t k=0; k<interf.size() && !dev; k++)
785  {
786  interf[k]->open();
787 
788  dev=interf[k]->getDevice(devid.c_str(), timeout);
789 
790  if (dev)
791  {
792  ret=dev;
793  found++;
794  }
795 
796  interf[k]->close();
797  }
798  }
799 
800  system[i]->close();
801  }
802  }
803 
804  if (found > 1)
805  {
806  std::cerr << "ERROR: Finding device '" << id << "' through different producers."
807  << std::endl;
808  ret.reset();
809  }
810 
811  return ret;
812 }
813 
814 std::shared_ptr<Device> getDevice(const char *id)
815 {
816  return getDevice(id, 1000);
817 }
818 
819 }
rcg::Device::getRemoteNodeMap
std::shared_ptr< GenApi::CNodeMapRef > getRemoteNodeMap(const char *xml=0)
Returns the node map of the remote device.
Definition: device.cc:652
rcg::Device::close
void close()
Closes the device.
Definition: device.cc:142
INFO_DATATYPE
int32_t INFO_DATATYPE
Definition: GenTL_v1_6.h:261
INFO_DATATYPE_STRING
@ INFO_DATATYPE_STRING
Definition: GenTL_v1_6.h:244
rcg::Device::open
void open(ACCESS access)
Opens the device for working with it.
Definition: device.cc:87
rcg::Device::getParent
std::shared_ptr< Interface > getParent() const
Returns the pointer to the parent interface object.
Definition: device.cc:77
DEVICE_ACCESS_STATUS_BUSY
@ DEVICE_ACCESS_STATUS_BUSY
Definition: GenTL_v1_6.h:319
rcg::Device::~Device
~Device()
Definition: device.cc:62
rcg::Device::rnodemap
std::shared_ptr< GenApi::CNodeMapRef > rnodemap
Definition: device.h:324
rcg::Device::getUserDefinedName
std::string getUserDefinedName()
Returns the user defined name of the device.
Definition: device.cc:566
rcg::Device::getNodeMap
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap(const char *xml=0)
Returns the node map of this object.
Definition: device.cc:639
rcg::Device::getModel
std::string getModel()
Returns the model of the device.
Definition: device.cc:477
GENTL_INFINITE
#define GENTL_INFINITE
Definition: GenTL_v1_6.h:238
rcg::Device::id
std::string id
Definition: device.h:312
rcg::getDevice
std::shared_ptr< Device > getDevice(const char *id, uint64_t timeout)
Searches across all transport layers and interfaces for a device.
Definition: device.cc:726
DEVICE_INFO_SERIAL_NUMBER
@ DEVICE_INFO_SERIAL_NUMBER
Definition: GenTL_v1_6.h:337
DEVICE_INFO_TIMESTAMP_FREQUENCY
@ DEVICE_INFO_TIMESTAMP_FREQUENCY
Definition: GenTL_v1_6.h:339
rcg::Stream
The stream class encapsulates a Genicam stream.
Definition: stream.h:55
GENAPI_NAMESPACE::CEventAdapterGeneric
Connects a generic event to a node map.
Definition: EventAdapterGeneric.h:37
GC_ERR_NOT_IMPLEMENTED
@ GC_ERR_NOT_IMPLEMENTED
Definition: GenTL_v1_6.h:161
rcg::Device::cport
std::shared_ptr< CPort > cport
Definition: device.h:323
GC_ERROR
int32_t GC_ERROR
Definition: GenTL_v1_6.h:185
rcg
Definition: buffer.cc:47
device.h
EVENT_MODULE
@ EVENT_MODULE
Definition: GenTL_v1_6.h:586
DEVICE_INFO_MODEL
@ DEVICE_INFO_MODEL
Definition: GenTL_v1_6.h:332
rcg::Device::rport
std::shared_ptr< CPort > rport
Definition: device.h:323
DEVICE_INFO_CMD
int32_t DEVICE_INFO_CMD
Definition: GenTL_v1_6.h:343
rcg::Device::EXCLUSIVE
@ EXCLUSIVE
Definition: device.h:60
rcg::Device::getID
const std::string & getID() const
Get the internal ID of this device.
Definition: device.cc:82
GC_ERR_ERROR
@ GC_ERR_ERROR
Definition: GenTL_v1_6.h:159
rcg::Device::getSerialNumber
std::string getSerialNumber()
Returns the serial number of the device.
Definition: device.cc:607
EVENT_SIZE_MAX
@ EVENT_SIZE_MAX
Definition: GenTL_v1_6.h:598
DEVICE_ACCESS_CONTROL
@ DEVICE_ACCESS_CONTROL
Definition: GenTL_v1_6.h:305
DEVICE_INFO_VERSION
@ DEVICE_INFO_VERSION
Definition: GenTL_v1_6.h:338
rcg::CPort
This is the port definition that connects GenAPI to GenTL.
Definition: cport.h:52
rcg::Device::getVersion
std::string getVersion()
Returns the version of the device.
Definition: device.cc:613
rcg::Device::getModuleEvent
int64_t getModuleEvent(int64_t timeout=-1)
Gets the next module event for the device and attaches it to the local device nodemap.
Definition: device.cc:243
rcg::Device::getAvailableModuleEvents
int getAvailableModuleEvents()
Returns the number of module events that are currently in the queue.
Definition: device.cc:188
GC_ERR_SUCCESS
@ GC_ERR_SUCCESS
Definition: GenTL_v1_6.h:158
rcg::Device::event_value
std::vector< uint8_t > event_value
Definition: device.h:321
rcg::Device
The device class encapsulates a Genicam device.
Definition: device.h:56
DEVICE_ACCESS_STATUS_READONLY
@ DEVICE_ACCESS_STATUS_READONLY
Definition: GenTL_v1_6.h:317
rcg::allocNodeMap
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.
Definition: cport.cc:156
rcg::Device::dev
void * dev
Definition: device.h:317
rcg::Device::getHandle
void * getHandle() const
Get internal interface handle.
Definition: device.cc:684
DEVICE_ACCESS_STATUS_OPEN_READWRITE
@ DEVICE_ACCESS_STATUS_OPEN_READWRITE
Definition: GenTL_v1_6.h:320
DEVICE_INFO_USER_DEFINED_NAME
@ DEVICE_INFO_USER_DEFINED_NAME
Definition: GenTL_v1_6.h:336
rcg::Device::rp
void * rp
Definition: device.h:318
stream.h
DEVICE_INFO_TLTYPE
@ DEVICE_INFO_TLTYPE
Definition: GenTL_v1_6.h:333
rcg::Device::CONTROL
@ CONTROL
Definition: device.h:60
rcg::Device::eventadapter
std::shared_ptr< GenApi::CEventAdapterGeneric > eventadapter
Definition: device.h:325
DEVICE_INFO_VENDOR
@ DEVICE_INFO_VENDOR
Definition: GenTL_v1_6.h:331
rcg::Device::event_buffer
std::vector< uint8_t > event_buffer
Definition: device.h:320
DEVICE_INFO_ACCESS_STATUS
@ DEVICE_INFO_ACCESS_STATUS
Definition: GenTL_v1_6.h:335
DEVICE_ACCESS_FLAGS
int32_t DEVICE_ACCESS_FLAGS
Definition: GenTL_v1_6.h:310
rcg::Device::slist
std::vector< std::weak_ptr< Stream > > slist
Definition: device.h:327
rcg::getDevices
std::vector< std::shared_ptr< Device > > getDevices(uint64_t timeout)
Returns a list of all devices that are available across all transport layers and interfaces.
Definition: device.cc:689
DEVICE_INFO_DISPLAYNAME
@ DEVICE_INFO_DISPLAYNAME
Definition: GenTL_v1_6.h:334
EVENT_NUM_IN_QUEUE
@ EVENT_NUM_IN_QUEUE
Definition: GenTL_v1_6.h:596
rcg::Device::parent
std::shared_ptr< Interface > parent
Definition: device.h:310
DEVICE_ACCESS_STATUS_NOACCESS
@ DEVICE_ACCESS_STATUS_NOACCESS
Definition: GenTL_v1_6.h:318
config.h
GC_ERR_ABORT
@ GC_ERR_ABORT
Definition: GenTL_v1_6.h:170
rcg::Device::ACCESS
ACCESS
Definition: device.h:60
DEVICE_ACCESS_STATUS_READWRITE
@ DEVICE_ACCESS_STATUS_READWRITE
Definition: GenTL_v1_6.h:316
INFO_DATATYPE_INT32
@ INFO_DATATYPE_INT32
Definition: GenTL_v1_6.h:248
INFO_DATATYPE_UNKNOWN
@ INFO_DATATYPE_UNKNOWN
Definition: GenTL_v1_6.h:243
rcg::Device::enableModuleEvents
void enableModuleEvents()
Enable module events for the local device.
Definition: device.cc:175
rcg::Device::getTLType
std::string getTLType()
Returns the transport layer type of the device.
Definition: device.cc:483
int64_t
__int64 int64_t
Definition: config-win32.h:21
rcg::Device::nodemap
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: device.h:324
rcg::Device::Device
Device(const std::shared_ptr< Interface > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs a device class.
Definition: device.cc:49
DEVICE_ACCESS_READONLY
@ DEVICE_ACCESS_READONLY
Definition: GenTL_v1_6.h:304
rcg::Device::mtx
std::mutex mtx
Definition: device.h:314
rcg::Device::getTimestampFrequency
uint64_t getTimestampFrequency()
Returns the timestamp frequency of the device.
Definition: device.cc:619
EVENT_DATA_ID
@ EVENT_DATA_ID
Definition: GenTL_v1_6.h:608
cport.h
rcg::Device::n_open
int n_open
Definition: device.h:316
exception.h
DEVICE_ACCESS_STATUS_OPEN_READONLY
@ DEVICE_ACCESS_STATUS_OPEN_READONLY
Definition: GenTL_v1_6.h:321
rcg::Device::event
void * event
Definition: device.h:319
rcg::Device::getAccessStatus
std::string getAccessStatus()
Returns the access status of the device.
Definition: device.cc:506
rcg::Device::getVendor
std::string getVendor()
Returns the vendor of the device.
Definition: device.cc:471
rcg::Device::getStreams
std::vector< std::shared_ptr< Stream > > getStreams()
Returns the currently available streams of this device.
Definition: device.cc:406
GC_ERR_TIMEOUT
@ GC_ERR_TIMEOUT
Definition: GenTL_v1_6.h:169
DEVICE_ACCESS_EXCLUSIVE
@ DEVICE_ACCESS_EXCLUSIVE
Definition: GenTL_v1_6.h:306
rcg::Device::getRemotePort
std::shared_ptr< CPort > getRemotePort()
Returns the remote port that is used by the remote node map to read and write registers.
Definition: device.cc:668
rcg::System::getSystems
static std::vector< std::shared_ptr< System > > getSystems()
This function creates systems for all producers that can be found.
Definition: system.cc:201
gentl_wrapper.h
rcg::Device::abortWaitingForModuleEvents
void abortWaitingForModuleEvents()
Aborts waiting for module events.
Definition: device.cc:378
rcg::Device::getDisplayName
std::string getDisplayName()
Returns the display name of the device.
Definition: device.cc:489
rcg::Device::gentl
std::shared_ptr< const GenTLWrapper > gentl
Definition: device.h:311
rcg::GenTLException
Definition: exception.h:47
EVENT_DATA_VALUE
@ EVENT_DATA_VALUE
Definition: GenTL_v1_6.h:609
rcg::Device::READONLY
@ READONLY
Definition: device.h:60


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11