VisionBox Interface Library  1.7.9.0 (2023-09-08)
VIB::iDevice Class Referenceabstract
+ Inheritance diagram for VIB::iDevice:

Detailed Description

The interface for all device implementations

See also Devices for a detailed description.

Public Member Functions

bool Close ()
 Closes a device More...
 
virtual bool GetType (eDeviceType &DeviceType) const =0
 Returns the device type for the current object More...
 
 iDevice (const iDevice &device)
 The copy constructor makes a copy of the existing device object More...
 
bool isOpen (bool &state)
 Returns the open state of a device object More...
 
bool Open (unsigned int Index=0)
 Opens a device More...
 
iDeviceoperator= (const iDevice &device)
 The assignment operator makes a copy of the existing device object More...
 
virtual ~iDevice ()
 Deletes the device object More...
 

Constructor & Destructor Documentation

◆ iDevice()

VIB::iDevice::iDevice ( const iDevice device)

The copy constructor makes a copy of the existing device object

If the original object was created with Open(), a reference count is incremented to make sure that the device is only closed for the last copy of the object.

Example:
std::vector<VIB::DigitalOutput> digOutVector;
// Open all DigitalOutput devices and store them in digOutVector
for (int i = 0; true; i++)
{
if (!digOut.Open(i))
break;
digOutVector.push_back(digOut); // => uses copy constructor
}
// work with devices
for (VIB::DigitalOutput digOut : digOutVector) // => uses copy constructor
digOut.Reset();

◆ ~iDevice()

VIB::iDevice::~iDevice ( )
virtual

Deletes the device object

If the device was opened with Open(), it will be closed automatically if no duplicates of the objects exist.

Member Function Documentation

◆ Close()

bool VIB::iDevice::Close ( )

Closes a device

The object must be in open state when calling this function.

After a device object is closed, the device can't be used until it's opened again.

Internally, a reference count is stored for each device to make sure that the device is only closed for the last copy of the object.

Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetType()

virtual bool VIB::iDevice::GetType ( eDeviceType DeviceType) const
pure virtual

Returns the device type for the current object

Parameters
DeviceTypeDevice type eDeviceType
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ isOpen()

bool VIB::iDevice::isOpen ( bool &  state)

Returns the open state of a device object

Parameters
stateState of the device, true if opened

◆ Open()

bool VIB::iDevice::Open ( unsigned int  Index = 0)

Opens a device

The object must be in a closed state when calling this function.

See page Open devices using the Open() method for a detailed description.

Parameters
IndexDevice index across all hardware entities
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ operator=()

iDevice & VIB::iDevice::operator= ( const iDevice device)

The assignment operator makes a copy of the existing device object

If the original object was created with Open(), a reference count is incremented to make sure that the device is only closed for the last copy of the object.

If the device for the target object is open, it will be closed automatically before assigning the new object.

VIB::DigitalOutput
This class controls a group of digital output signals.
Definition: VIB_Interface.h:464
VIB::DigitalOutput::Reset
bool Reset()
Resets the device to default settings.
Definition: DigitalOutput.cpp:81
VIB::iDevice::Open
bool Open(unsigned int Index=0)
Opens a device
Definition: iDevice.cpp:109