All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
rcg::Device Class Reference

The device class encapsulates a Genicam device. More...

#include <device.h>

Inheritance diagram for rcg::Device:

Public Types

enum  ACCESS { READONLY, CONTROL, EXCLUSIVE }
 

Public Member Functions

void abortWaitingForModuleEvents ()
 Aborts waiting for module events. More...
 
void close ()
 Closes the device. More...
 
 Device (const std::shared_ptr< Interface > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
 Constructs a device class. More...
 
void enableModuleEvents ()
 Enable module events for the local device. More...
 
std::string getAccessStatus ()
 Returns the access status of the device. More...
 
int getAvailableModuleEvents ()
 Returns the number of module events that are currently in the queue. More...
 
std::string getDisplayName ()
 Returns the display name of the device. More...
 
void * getHandle () const
 Get internal interface handle. More...
 
const std::string & getID () const
 Get the internal ID of this device. More...
 
std::string getModel ()
 Returns the model of the device. More...
 
int64_t getModuleEvent (int64_t timeout=-1)
 Gets the next module event for the device and attaches it to the local device nodemap. More...
 
std::shared_ptr< GenApi::CNodeMapRefgetNodeMap (const char *xml=0)
 Returns the node map of this object. More...
 
std::shared_ptr< InterfacegetParent () const
 Returns the pointer to the parent interface object. More...
 
std::shared_ptr< GenApi::CNodeMapRefgetRemoteNodeMap (const char *xml=0)
 Returns the node map of the remote device. More...
 
std::shared_ptr< CPortgetRemotePort ()
 Returns the remote port that is used by the remote node map to read and write registers. More...
 
std::string getSerialNumber ()
 Returns the serial number of the device. More...
 
std::vector< std::shared_ptr< Stream > > getStreams ()
 Returns the currently available streams of this device. More...
 
uint64_t getTimestampFrequency ()
 Returns the timestamp frequency of the device. More...
 
std::string getTLType ()
 Returns the transport layer type of the device. More...
 
std::string getUserDefinedName ()
 Returns the user defined name of the device. More...
 
std::string getVendor ()
 Returns the vendor of the device. More...
 
std::string getVersion ()
 Returns the version of the device. More...
 
void open (ACCESS access)
 Opens the device for working with it. More...
 
 ~Device ()
 

Private Member Functions

 Device (class Device &)
 
Deviceoperator= (const Device &)
 

Private Attributes

std::shared_ptr< CPortcport
 
void * dev
 
void * event
 
std::vector< uint8_t > event_buffer
 
std::vector< uint8_t > event_value
 
std::shared_ptr< GenApi::CEventAdapterGenericeventadapter
 
std::shared_ptr< const GenTLWrappergentl
 
std::string id
 
std::mutex mtx
 
int n_open
 
std::shared_ptr< GenApi::CNodeMapRefnodemap
 
std::shared_ptr< Interfaceparent
 
std::shared_ptr< GenApi::CNodeMapRefrnodemap
 
void * rp
 
std::shared_ptr< CPortrport
 
std::vector< std::weak_ptr< Stream > > slist
 

Detailed Description

The device class encapsulates a Genicam device.

NOTE: A GenTLException is thrown in case of a severe error.

Definition at line 56 of file device.h.

Member Enumeration Documentation

◆ ACCESS

Enumerator
READONLY 
CONTROL 
EXCLUSIVE 

Definition at line 60 of file device.h.

Constructor & Destructor Documentation

◆ Device() [1/2]

rcg::Device::Device ( const std::shared_ptr< Interface > &  parent,
const std::shared_ptr< const GenTLWrapper > &  gentl,
const char *  id 
)

Constructs a device class.

Devices must only be created by the interface class.

Definition at line 49 of file device.cc.

◆ ~Device()

rcg::Device::~Device ( )

Definition at line 62 of file device.cc.

◆ Device() [2/2]

rcg::Device::Device ( class Device )
private

Member Function Documentation

◆ abortWaitingForModuleEvents()

void rcg::Device::abortWaitingForModuleEvents ( )

Aborts waiting for module events.

Definition at line 378 of file device.cc.

◆ close()

void rcg::Device::close ( )

Closes the device.

Each call of open() must be followed by a call to close() at some point in time.

Definition at line 142 of file device.cc.

◆ enableModuleEvents()

void rcg::Device::enableModuleEvents ( )

Enable module events for the local device.

Does nothing if they are already enabled.

Definition at line 175 of file device.cc.

◆ getAccessStatus()

std::string rcg::Device::getAccessStatus ( )

Returns the access status of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Access status.

Definition at line 506 of file device.cc.

◆ getAvailableModuleEvents()

int rcg::Device::getAvailableModuleEvents ( )

Returns the number of module events that are currently in the queue.

This returns 0 if modules events have not been enabled.

Returns
Module event count.

Definition at line 188 of file device.cc.

◆ getDisplayName()

std::string rcg::Device::getDisplayName ( )

Returns the display name of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Display name.

Definition at line 489 of file device.cc.

◆ getHandle()

void * rcg::Device::getHandle ( ) const

Get internal interface handle.

Returns
Internal handle.

Definition at line 684 of file device.cc.

◆ getID()

const std::string & rcg::Device::getID ( ) const

Get the internal ID of this device.

Returns
ID.

Definition at line 82 of file device.cc.

◆ getModel()

std::string rcg::Device::getModel ( )

Returns the model of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Model.

Definition at line 477 of file device.cc.

◆ getModuleEvent()

int64_t rcg::Device::getModuleEvent ( int64_t  timeout = -1)

Gets the next module event for the device and attaches it to the local device nodemap.

NOTE: This can be called from a different thread to wait for the event.

Parameters
timeoutTimeout in ms. A value < 0 sets waiting time to infinite.
Returns
Event ID or -1 if the method returned due to timeout, -2 if waiting was interrupted due to calling abortWaitingForModuleEvents(), -3 if module events have not been enabled.

Definition at line 243 of file device.cc.

◆ getNodeMap()

std::shared_ptr< GenApi::CNodeMapRef > rcg::Device::getNodeMap ( const char *  xml = 0)

Returns the node map of this object.

NOTE: open() must be called before calling this method. The returned pointer remains valid until close() of this object is called.

Parameters
xmlPath and name for storing the received XML file. An empty string for using the filename on the device or 0 if xml file should not be stored.
Returns
Node map of this object.

Definition at line 639 of file device.cc.

◆ getParent()

std::shared_ptr< Interface > rcg::Device::getParent ( ) const

Returns the pointer to the parent interface object.

Returns
Pointer to parent interface object.

Definition at line 77 of file device.cc.

◆ getRemoteNodeMap()

std::shared_ptr< GenApi::CNodeMapRef > rcg::Device::getRemoteNodeMap ( const char *  xml = 0)

Returns the node map of the remote device.

NOTE: open() must be called before calling this method. The returned pointer remains valid until close() of this object is called.

Parameters
xmlPath and name for storing the received XML file. An empty string for using the filename on the device or 0 if xml file should not be stored.
Returns
Node map of this object.

Definition at line 652 of file device.cc.

◆ getRemotePort()

std::shared_ptr< CPort > rcg::Device::getRemotePort ( )

Returns the remote port that is used by the remote node map to read and write registers.

Returns
Remote port.

Definition at line 668 of file device.cc.

◆ getSerialNumber()

std::string rcg::Device::getSerialNumber ( )

Returns the serial number of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Serial number.

Definition at line 607 of file device.cc.

◆ getStreams()

std::vector< std::shared_ptr< Stream > > rcg::Device::getStreams ( )

Returns the currently available streams of this device.

NOTE: The device must have been opened with the open() call before calling this method.

Returns
List of streams.

Definition at line 406 of file device.cc.

◆ getTimestampFrequency()

uint64_t rcg::Device::getTimestampFrequency ( )

Returns the timestamp frequency of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Tick-frequency of the time stamp clock.

Definition at line 619 of file device.cc.

◆ getTLType()

std::string rcg::Device::getTLType ( )

Returns the transport layer type of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Transport layer type.

Definition at line 483 of file device.cc.

◆ getUserDefinedName()

std::string rcg::Device::getUserDefinedName ( )

Returns the user defined name of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
User defined name.

Definition at line 566 of file device.cc.

◆ getVendor()

std::string rcg::Device::getVendor ( )

Returns the vendor of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Vendor.

Definition at line 471 of file device.cc.

◆ getVersion()

std::string rcg::Device::getVersion ( )

Returns the version of the device.

NOTE: This method only returns a non empty string if the parent interface has NOT been closed after Interface::getDevice() or Interface::getDevices() call, or if this device itself has been opened with the open() call.

Returns
Version.

Definition at line 613 of file device.cc.

◆ open()

void rcg::Device::open ( ACCESS  access)

Opens the device for working with it.

The interface may be opened multiple times. However, for each open(), the close() method must be called as well.

Parameters
accessAccess mode.

Definition at line 87 of file device.cc.

◆ operator=()

Device& rcg::Device::operator= ( const Device )
private

Member Data Documentation

◆ cport

std::shared_ptr<CPort> rcg::Device::cport
private

Definition at line 323 of file device.h.

◆ dev

void* rcg::Device::dev
private

Definition at line 317 of file device.h.

◆ event

void* rcg::Device::event
private

Definition at line 319 of file device.h.

◆ event_buffer

std::vector<uint8_t> rcg::Device::event_buffer
private

Definition at line 320 of file device.h.

◆ event_value

std::vector<uint8_t> rcg::Device::event_value
private

Definition at line 321 of file device.h.

◆ eventadapter

std::shared_ptr<GenApi::CEventAdapterGeneric> rcg::Device::eventadapter
private

Definition at line 325 of file device.h.

◆ gentl

std::shared_ptr<const GenTLWrapper> rcg::Device::gentl
private

Definition at line 311 of file device.h.

◆ id

std::string rcg::Device::id
private

Definition at line 312 of file device.h.

◆ mtx

std::mutex rcg::Device::mtx
private

Definition at line 314 of file device.h.

◆ n_open

int rcg::Device::n_open
private

Definition at line 316 of file device.h.

◆ nodemap

std::shared_ptr<GenApi::CNodeMapRef> rcg::Device::nodemap
private

Definition at line 324 of file device.h.

◆ parent

std::shared_ptr<Interface> rcg::Device::parent
private

Definition at line 310 of file device.h.

◆ rnodemap

std::shared_ptr<GenApi::CNodeMapRef> rcg::Device::rnodemap
private

Definition at line 324 of file device.h.

◆ rp

void* rcg::Device::rp
private

Definition at line 318 of file device.h.

◆ rport

std::shared_ptr<CPort> rcg::Device::rport
private

Definition at line 323 of file device.h.

◆ slist

std::vector<std::weak_ptr<Stream> > rcg::Device::slist
private

Definition at line 327 of file device.h.


The documentation for this class was generated from the following files:


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