Brick
Loading...
Searching...
No Matches
crust::Device Class Reference

#include <device.h>

Description

Base class for devices connected to physical Smart Ports.

Stores the physical port, expected device type, and C SDK handle. Derived classes use handle() to call C SDK functions.

Inheritance diagram for crust::Device:

Public Member Functions

int port () const
 Gets the physical Smart Port number.
bool installed () const
 Checks whether the expected device is currently connected.

Protected Member Functions

 Device (int port, int expected_type)
 Resolves and caches the C SDK handle for a physical Smart Port.
 ~Device ()=default
 Destroys the device.
_V5_Device * handle () const
 Provides the device handle associated with this port.

Constructor & Destructor Documentation

◆ Device()

crust::Device::Device ( int port,
int expected_type )
protected

Resolves and caches the C SDK handle for a physical Smart Port.

Parameters
portPhysical Smart Port number [1, 21].
expected_typeC SDK device type supplied by the base class.

Member Function Documentation

◆ installed()

bool crust::Device::installed ( ) const

Checks whether the expected device is currently connected.

Returns
True if this port has a valid handle and reports the expected device type; false if disconnected, occupied by another device type, or no status is available.

◆ port()

int crust::Device::port ( ) const
inline

Gets the physical Smart Port number.

Returns
Port number [1, 21], rather than the C SDK's [0, 20] index.

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