ApparatusFramework::NullDevice Class Reference
[Device Services]

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

Inheritance diagram for ApparatusFramework::NullDevice:
ApparatusFramework::CharDevice

List of all members.

Public Member Functions

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

Detailed Description

NullDevice Dummy implementation of the CharDevice interface. All operations are always successful.

Definition at line 61 of file NullDevice.h.


Constructor & Destructor Documentation

ApparatusFramework::NullDevice::NullDevice (  ) 

Construction and destruction Constructor.

ApparatusFramework::NullDevice::~NullDevice (  ) 

Destructor.


Member Function Documentation

int32 ApparatusFramework::NullDevice::close (  )  [virtual]

Closes the device, releases resources used for the operation. After another open, the device is ready for communication again.

Returns:
Always CHAR_DEVICE_SUCCESS

Implements ApparatusFramework::CharDevice.

void ApparatusFramework::NullDevice::flush (  )  [virtual]

Writes all internally buffered data onto the device and clears the send and receive buffers.

Implements ApparatusFramework::CharDevice.

int32 ApparatusFramework::NullDevice::ioCtl ( uint32  cmd,
void *  arg 
) [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:
Always CHAR_DEVICE_SUCCESS

Implements ApparatusFramework::CharDevice.

int32 ApparatusFramework::NullDevice::open ( void *  arg  )  [virtual]

Interface methods 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 one choses (default = null).
Returns:
Always CHAR_DEVICE_SUCCESS

Implements ApparatusFramework::CharDevice.

int32 ApparatusFramework::NullDevice::read ( uint8 buffer,
const int32  count 
) [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. It is the buffer that read will use to fill in the fetched data. Since this device is not fetching any data, the buffer is filled with 0
count Number of characters to be read (does not necessarily correspond with the return value).
Returns:
The value of parameter count.

Implements ApparatusFramework::CharDevice.

int32 ApparatusFramework::NullDevice::seek ( uint32  offset,
SeekWhenceEnum  whence 
) [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:
the value of parameter offset.

Implements ApparatusFramework::CharDevice.

int32 ApparatusFramework::NullDevice::write ( uint8 buffer,
const int32  count 
) [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:
The value of parameter count.

Implements ApparatusFramework::CharDevice.

© 2004-2010 bbv Software Services AG / Apparatus Services