gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
IIODevice Class Reference

#include <IIODevice.H>

Inheritance diagram for IIODevice:
[legend]
Collaboration diagram for IIODevice:
[legend]

Public Member Functions

 IIODevice (const std::string &devicePathIn, const std::string &chipNameIn)
 
virtual ~IIODevice ()
 
int scanDevice (void)
 
uint getChCnt (void)
 
void printInfo ()
 
int open (void)
 
int open (int flags)
 
int close (void)
 
int read (uint frames, void *buf)
 
uint getChFrameSize (void)
 
int enable (bool enable)
 
int getBufferSize ()
 
int setBufferSize (int bufferSize)
 
int getChannelBufferCnt ()
 
int setChannelBufferCnt (int chBufferCnt)
 
int getFD ()
 

Private Attributes

std::string devicePath
 The device path. More...
 
std::string chipName
 The device chip name. More...
 
float scale
 How to scale the input value to get a real world value. More...
 
std::string readDev
 The read buffer device, e.g. "/dev/iio:device0". More...
 
int fd
 The file descriptor of the open device. More...
 

Detailed Description

Maintain an IIO device. It inherits a std::vector of channels.

Definition at line 34 of file IIODevice.H.

Constructor & Destructor Documentation

◆ IIODevice()

IIODevice::IIODevice ( const std::string &  devicePathIn,
const std::string &  chipNameIn 
)
inline

Constructor specifying the device path and the chip name

Parameters
devicePathInThe device's path, such as "/sys/bus/iio/devices/iio:device0"
chipNameInThe device's chip, such as "AD7476A"

Definition at line 48 of file IIODevice.H.

◆ ~IIODevice()

virtual IIODevice::~IIODevice ( )
inlinevirtual

Definition at line 56 of file IIODevice.H.

Here is the call graph for this function:

Member Function Documentation

◆ close()

int IIODevice::close ( void  )
inline

Close the device.

Returns
NO_ERROR, or the arropriate error on failure.

Definition at line 163 of file IIODevice.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enable()

int IIODevice::enable ( bool  enable)
inline

Enable or disable the device.

Parameters
enableTrue to enable, false to disable.
Returns
NO_ERROR or the appropriate error on failure.

Definition at line 228 of file IIODevice.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBufferSize()

int IIODevice::getBufferSize ( )
inline

Find the DMA buffer size.

Returns
The buffer size in samples, or the appropriate error on failure.

Definition at line 240 of file IIODevice.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChannelBufferCnt()

int IIODevice::getChannelBufferCnt ( )
inline

Find the number of samples per channel which the buffer can hold.

Returns
the maximum number of samples which the buffer can hold.

Definition at line 265 of file IIODevice.H.

Here is the call graph for this function:

◆ getChCnt()

uint IIODevice::getChCnt ( void  )
inline

Get the number of enabled channels for this device.

Returns
The number of enabled channels.

Definition at line 107 of file IIODevice.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChFrameSize()

uint IIODevice::getChFrameSize ( void  )
inline

Find the number of bytes per channel.

Returns
The total number of bytes in one channel or the appropriate error on failure

Definition at line 214 of file IIODevice.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFD()

int IIODevice::getFD ( )
inline

Get the device's file descriptor.

Returns
the file descriptor

Definition at line 281 of file IIODevice.H.

◆ open() [1/2]

int IIODevice::open ( void  )
inline

Open the device.

Returns
NO_ERROR, or the arropriate error on failure.

Definition at line 126 of file IIODevice.H.

Here is the caller graph for this function:

◆ open() [2/2]

int IIODevice::open ( int  flags)
inline

Open the device.

Parameters
flagsThe flags to open the device with.
Returns
NO_ERROR, or the arropriate error on failure.

Definition at line 138 of file IIODevice.H.

Here is the call graph for this function:

◆ printInfo()

void IIODevice::printInfo ( )
inline

Print the info for each channel.

Definition at line 113 of file IIODevice.H.

Here is the call graph for this function:

◆ read()

int IIODevice::read ( uint  frames,
void *  buf 
)
inline

Read from the device.

Parameters
framesThe number of samples to read
bufPointer to the read location.
Returns
NO_ERROR, or the arropriate error on failure. The buffer holds count bytes in it.

Definition at line 181 of file IIODevice.H.

Here is the call graph for this function:

◆ scanDevice()

int IIODevice::scanDevice ( void  )
inline

Scan an IIO device for channel requirements.

Returns
NO_ERROR, or the arropriate error on failure.

Definition at line 63 of file IIODevice.H.

Here is the call graph for this function:

◆ setBufferSize()

int IIODevice::setBufferSize ( int  bufferSize)
inline

Set the DMA buffer size

Returns
The resulting buffer size in samples for all channels, or the appropriate error on failure.

Definition at line 252 of file IIODevice.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChannelBufferCnt()

int IIODevice::setChannelBufferCnt ( int  chBufferCnt)
inline

Set the number of samples per channel which the buffer can hold.

Parameters
chBufferCntThe number of samples per channel the buffer can hold.
Returns
the maximum number of samples which the buffer can hold or error.

Definition at line 273 of file IIODevice.H.

Here is the call graph for this function:

Member Data Documentation

◆ chipName

std::string IIODevice::chipName
private

The device chip name.

Definition at line 36 of file IIODevice.H.

◆ devicePath

std::string IIODevice::devicePath
private

The device path.

Definition at line 35 of file IIODevice.H.

◆ fd

int IIODevice::fd
private

The file descriptor of the open device.

Definition at line 41 of file IIODevice.H.

◆ readDev

std::string IIODevice::readDev
private

The read buffer device, e.g. "/dev/iio:device0".

Definition at line 39 of file IIODevice.H.

◆ scale

float IIODevice::scale
private

How to scale the input value to get a real world value.

Definition at line 37 of file IIODevice.H.


The documentation for this class was generated from the following file:
gtkIOStream: IIODevice Class Reference
GTK+ IOStream  Beta