CVB++ 14.0
DigitalIO Class Reference

Digital I/O operations on a device. More...

#include <cvb/driver/digital_io.hpp>

Public Member Functions

DevicePtr Parent () const noexcept
 Gets the parent device of this interface. More...
 
int InputCount () const
 Gets the number of digital input ports of the device. More...
 
int OutputCount () const
 Gets the number of digital output ports of the device. More...
 
bool ReadInputBit (int port) const
 Reads a single input port from the device. More...
 
std::bitset< 32 > ReadInputGroup (int group) const
 Reads a group of input ports from the device. More...
 
bool ReadOutputBit (int port) const
 Reads a single output port from the device. More...
 
std::bitset< 32 > ReadOutputGroup (int group) const
 Reads a group of output ports from the device. More...
 
void WriteOutputBit (int port, bool value)
 Write a single output port to the device. More...
 
void WriteOutputGroup (int group, std::bitset< 32 > value)
 Writes the output group to the device. More...
 
void WriteOutputGroup (int group, std::bitset< 32 > value, std::bitset< 32 > mask)
 Writes the output group to the device. More...
 

Detailed Description

Digital I/O operations on a device.

Member Function Documentation

◆ InputCount()

int InputCount ( ) const
inline

Gets the number of digital input ports of the device.

Returns
Number of inputs.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ OutputCount()

int OutputCount ( ) const
inline

Gets the number of digital output ports of the device.

Returns
Number of outputs.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Parent()

DevicePtr Parent ( ) const
inlinenoexcept

Gets the parent device of this interface.

Returns
The parent device pointer, or a null pointer if disconnected.
Exceptions
Doesnot throw any exception.

◆ ReadInputBit()

bool ReadInputBit ( int  port) const
inline

Reads a single input port from the device.

Parameters
[in]portPort index to read.
Returns
True for input high state; false for low.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ReadInputGroup()

std::bitset< 32 > ReadInputGroup ( int  group) const
inline

Reads a group of input ports from the device.

Parameters
[in]groupGroup index to read.
Returns
State of the requested ports mapped to a 32 bit integer.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ReadOutputBit()

bool ReadOutputBit ( int  port) const
inline

Reads a single output port from the device.

Parameters
[in]portPort index to read.
Returns
True for output high state; false for low.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ReadOutputGroup()

std::bitset< 32 > ReadOutputGroup ( int  group) const
inline

Reads a group of output ports from the device.

Parameters
[in]groupGroup index to read.
Returns
State of the requested ports mapped to a 32 bit integer.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ WriteOutputBit()

void WriteOutputBit ( int  port,
bool  value 
)
inline

Write a single output port to the device.

Parameters
[in]portPort index to write.
[in]valueValue of port state.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ WriteOutputGroup() [1/2]

void WriteOutputGroup ( int  group,
std::bitset< 32 >  value 
)
inline

Writes the output group to the device.

Parameters
[in]groupGroup index to read.
[in]valueTrue for output high state; false for low.
Exceptions
Anyexception derived from std::exception including CvbException.

An output group consists of 32 single ports. Non existent ports are ignored. Thus there are only more than one output group if output count is larger than 32.

◆ WriteOutputGroup() [2/2]

void WriteOutputGroup ( int  group,
std::bitset< 32 >  value,
std::bitset< 32 >  mask 
)
inline

Writes the output group to the device.

Parameters
[in]groupGroup index to read.
[in]valueVector of port states.
[in]maskBit mask for the bits being actually set to the ports.
Exceptions
Anyexception derived from std::exception including CvbException.

An output group consists of 32 single ports. Non existent ports are ignored. Thus there are only more than one output group if output count is larger than 32.