Class Device

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Device >

Class Documentation

class Device : public std::enable_shared_from_this<Device>

The device class encapsulates a Genicam device.

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

Public Types

enum ACCESS

Values:

enumerator READONLY
enumerator CONTROL
enumerator EXCLUSIVE

Public Functions

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.

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

Returns the pointer to the parent interface object.

Returns:

Pointer to parent interface object.

const std::string &getID() const

Get the internal ID of this device.

Returns:

ID.

void 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:

access – Access mode.

void close()

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

void enableModuleEvents()

Enable module events for the local device. Does nothing if they are already enabled.

int 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.

int64_t 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:

timeout – Timeout 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.

void abortWaitingForModuleEvents()

Aborts waiting for module events.

std::vector<std::shared_ptr<Stream>> 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.

std::string 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.

std::string 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.

std::string 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.

std::string 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.

std::string 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.

std::string 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.

std::string 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.

std::string 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.

uint64_t 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.

std::shared_ptr<GenApi::CNodeMapRef> 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:

xml – Path 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.

std::shared_ptr<GenApi::CNodeMapRef> 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:

xml – Path 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.

std::shared_ptr<CPort> getRemotePort()

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

Returns:

Remote port.

void *getHandle() const

Get internal interface handle.

Returns:

Internal handle.