ApparatusFramework::CharDevice Class Reference

#include <DeviceServices/common/current/include/CharDevice.h>

Inheritance diagram for ApparatusFramework::CharDevice:
ApparatusFramework::ConsoleDevice ApparatusFramework::File ApparatusFramework::FileDevice ApparatusFramework::NullDevice ApparatusFramework::SerialDevice ApparatusFramework::TcpClientDevice ApparatusFramework::TcpServerDevice ApparatusFramework::UDPDevice

List of all members.

Public Member Functions

Construction and destruction

virtual ~CharDevice ()
Interface

Methods which have to be implemented by any derived class

virtual int32 open (void *arg=0)=0
virtual int32 close ()=0
virtual int32 read (uint8 *buffer, const int32 count)=0
virtual int32 write (uint8 *buffer, const int32 count)=0
virtual int32 ioCtl (uint32 cmd, void *arg)=0
virtual int32 seek (uint32 offset, SeekWhenceEnum whence)=0
virtual void flush ()=0

Detailed Description

CharDevice represents an interface for all character based device drivers that run over the ApparatusServices. CharDevice is an abstract class. The API of a device was inspired by the UNIX/Linux approach. The interface looks quite similar to a file handling interface. Several OSs implement their drivers as files.

Definition at line 103 of file CharDevice.h.


Constructor & Destructor Documentation

virtual ApparatusFramework::CharDevice::~CharDevice (  )  [inline, virtual]

Virtual destructor, so that derived classes can be deleted with a pointer to CharDevice

Definition at line 111 of file CharDevice.h.


Member Function Documentation

virtual int32 ApparatusFramework::CharDevice::close (  )  [pure virtual]
virtual void ApparatusFramework::CharDevice::flush (  )  [pure virtual]
virtual int32 ApparatusFramework::CharDevice::ioCtl ( uint32  cmd,
void *  arg 
) [pure virtual]

Universal method that may be used to configure the device and implement functionality not provided by the interface. The meaning of the different commands executed by this function is entirely device dependent (cmd 1 on device A may be something completely different on device B).

Parameters:
cmd A command that specifies the function to be executed by the method
arg A pointer to an argument passed to the function to be executed
Returns:
Status of the method. See CharDeviceRetVal

Implemented in ApparatusFramework::LogFileDevice, ApparatusFramework::SerialDevice, ApparatusFramework::TcpClientDevice, ApparatusFramework::TcpServerDevice, ApparatusFramework::UDPDevice, ApparatusFramework::WinFile, ApparatusFramework::ConsoleDevice, ApparatusFramework::File, ApparatusFramework::FileDevice, and ApparatusFramework::NullDevice.

virtual int32 ApparatusFramework::CharDevice::open ( void *  arg = 0  )  [pure virtual]

Opens a character device. First method to be called after the instantiation. If this method returns successfully, the device is ready to use.

Parameters:
arg A void pointer that can be used for whatever one choses (default = null).
Returns:
Status of the method. See CharDeviceRetVal

Implemented in ApparatusFramework::LogFileDevice, ApparatusFramework::SerialDevice, ApparatusFramework::TcpClientDevice, ApparatusFramework::TcpServerDevice, ApparatusFramework::UDPDevice, ApparatusFramework::ConsoleDevice, ApparatusFramework::File, ApparatusFramework::FileDevice, and ApparatusFramework::NullDevice.

virtual int32 ApparatusFramework::CharDevice::read ( uint8 buffer,
const int32  count 
) [pure virtual]

Reads a specified number of characters from the device into a provided buffer. This read method for a device is usually implemented blocking (blocks the calling client).

Parameters:
buffer Pointer to a character buffer. Its the buffer that read will use to fill in the fetched data.
count Number of characters to be read (does not necessarily correspond with the return value).
Returns:
Status of the method.

Implemented in ApparatusFramework::LogFileDevice, ApparatusFramework::SerialDevice, ApparatusFramework::TcpClientDevice, ApparatusFramework::TcpServerDevice, ApparatusFramework::UDPDevice, ApparatusFramework::WinFile, ApparatusFramework::ConsoleDevice, ApparatusFramework::File, ApparatusFramework::FileDevice, and ApparatusFramework::NullDevice.

virtual int32 ApparatusFramework::CharDevice::seek ( uint32  offset,
SeekWhenceEnum  whence 
) [pure virtual]

Allows to jump onto a certain position. Seek uses an offset that specifies the location from a certain starting point. (e.g. used in files to write onto a specified position). seek may also be used to find the size of a file (return value of seek(0, SEEK_END)).

Parameters:
offset A number that specifies the amount of chars the wanted position is away from a given starting position (whence defines that).
whence Defines the starting position or how the given index should be interpreted. See SeekWhenceEnum
Returns:
Status of the method.

Implemented in ApparatusFramework::LogFileDevice, ApparatusFramework::SerialDevice, ApparatusFramework::TcpClientDevice, ApparatusFramework::TcpServerDevice, ApparatusFramework::UDPDevice, ApparatusFramework::WinFile, ApparatusFramework::ConsoleDevice, ApparatusFramework::File, ApparatusFramework::FileDevice, and ApparatusFramework::NullDevice.

virtual int32 ApparatusFramework::CharDevice::write ( uint8 buffer,
const int32  count 
) [pure virtual]

Writes a specified number of characters from a buffer onto the device.

Parameters:
buffer Pointer to a character buffer. Its the buffer that write takes as data source.
count Number of characters to be taken out of the buffer onto the device.
Returns:
Status of the method.

Implemented in ApparatusFramework::LogFileDevice, ApparatusFramework::SerialDevice, ApparatusFramework::TcpClientDevice, ApparatusFramework::TcpServerDevice, ApparatusFramework::UDPDevice, ApparatusFramework::WinFile, ApparatusFramework::ConsoleDevice, ApparatusFramework::File, ApparatusFramework::FileDevice, and ApparatusFramework::NullDevice.

© 2004-2010 bbv Software Services AG / Apparatus Services