ApparatusFramework::FileDevice Class Reference
[Device Services]

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

Inheritance diagram for ApparatusFramework::FileDevice:
ApparatusFramework::CharDevice ApparatusFramework::LogFileDevice

List of all members.

Public Member Functions

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

Detailed Description

A file device (standard C).

Definition at line 74 of file FileDevice.h.


Constructor & Destructor Documentation

ApparatusFramework::FileDevice::FileDevice (  ) 

Construction, destruction Constructs a new file device. Nothing more (no opening, configuring etc.)

ApparatusFramework::FileDevice::~FileDevice (  ) 

Destructs a file device. Closes it if needed.


Member Function Documentation

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

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

Returns:
Status of the method. See CharDeviceRetVal

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

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

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

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

virtual int32 ApparatusFramework::FileDevice::ioCtl ( uint32  cmd,
void *  arg 
) [virtual]

Universal method that may be used to configure the file device and implement functionality not provided by the interface.

Parameters:
cmd A command that specifies the function to be executed by the method. Those are the command defined:

  • FILE_DEVICE_SET_FILE_ATTRIBUTES: File attributes as used in the C standard functions
arg A pointer to an argument passed to the function to be executed
Returns:
Status of the method. See CharDeviceRetVal

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

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

Inherited interface methods Opens the file 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

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

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

Reads a specified number of characters from the file 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.

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

virtual int32 ApparatusFramework::FileDevice::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:
Status of the method.

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

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

Writes a specified number of characters from a buffer onto the file 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.

Implements ApparatusFramework::CharDevice.

Reimplemented in ApparatusFramework::LogFileDevice.

© 2004-2010 bbv Software Services AG / Apparatus Services