mermaid::support::io::Device Class Reference

Device class. More...

#include <Device.hpp>

Collaboration diagram for mermaid::support::io::Device:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void callReadHandler (size_t bytesRead, size_t requestedBytes, const char *data, bool success)
 Call the handler which processes read replies.
virtual void callWriteHandler (size_t bytesWritten, size_t requestedBytes, const char *data, bool success, shared_ptr< StreamOperationHandlerMethodBase > streamOperationHandlerWrite)
 Call the handler which processes write replies.
virtual void close ()
 Closes the device.
virtual void configureDevice (shared_ptr< DeviceConfigurator >)
 Configures the device.
 Device (int expectedDataSize, int fileDescriptor, shared_ptr< ActiveObject > owner, shared_ptr< DeviceConfigurator > deviceConfigurator)
 Constructor.
virtual void enableRead (shared_ptr< StreamOperationHandlerMethodBase > streamOperationHandlerRead)
 Starts reading from the device and sets the callback method.
virtual void enableWrite ()
 Enables write operations on this device.
virtual int getExpectedDataSize () const
 Expected data size getter.
virtual int getFileDescriptor () const
 File descriptor getter.
virtual void write (size_t bytesToWrite, const char *data, shared_ptr< StreamOperationHandlerMethodBase > streamOperationHandlerWrite)
 Writes data to the device.

Detailed Description

Device class.

This is the class which represents a device.

Author:
Joao Carreira

Definition at line 48 of file Device.hpp.


Constructor & Destructor Documentation

Device::Device ( int  expectedDataSize,
int  fileDescriptor,
shared_ptr< ActiveObject owner,
shared_ptr< DeviceConfigurator deviceConfigurator 
)

Constructor.

Parameters:
expectedDataSize The size of the data to be read from the device.
fileDescriptor The device's file descriptor.
owner The ActiveObject of the service using the device.
deviceConfigurator The configurator of the file descriptor
Author:
Joao Carreira

Definition at line 43 of file Device.cpp.


Member Function Documentation

void Device::callReadHandler ( size_t  bytesRead,
size_t  requestedBytes,
const char *  data,
bool  success 
) [virtual]

Call the handler which processes read replies.

Parameters:
bytesRead The number of bytes read
requestedBytes The number of bytes requested to be read.
data The data which was read.
success Boolean value which tells if the operation was successful.
Author:
Joao Carreira

Definition at line 75 of file Device.cpp.

void Device::callWriteHandler ( size_t  bytesWritten,
size_t  requestedBytes,
const char *  data,
bool  success,
shared_ptr< StreamOperationHandlerMethodBase streamOperationHandlerWrite 
) [virtual]

Call the handler which processes write replies.

Parameters:
bytesWritten The number of bytes written
requestedBytes The number of bytes requested to be written
data The data which was written
success Boolean value which tells if the operation was successful.
Author:
Joao Carreira

Definition at line 80 of file Device.cpp.

void Device::close (  )  [virtual]

Closes the device.

Author:
Joao Carreira

Definition at line 86 of file Device.cpp.

void Device::configureDevice ( shared_ptr< DeviceConfigurator deviceConfigurator  )  [virtual]

Configures the device.

Author:
Joao Carreira

Definition at line 91 of file Device.cpp.

void Device::enableRead ( shared_ptr< StreamOperationHandlerMethodBase streamOperationHandlerRead  )  [virtual]

Starts reading from the device and sets the callback method.

Parameters:
streamOperationHandlerRead The handler which will receive read replies.
Author:
Joao Carreira

Definition at line 49 of file Device.cpp.

void Device::enableWrite (  )  [virtual]

Enables write operations on this device.

Author:
Joao Carreira

Definition at line 59 of file Device.cpp.

virtual int mermaid::support::io::Device::getExpectedDataSize (  )  const [inline, virtual]

Expected data size getter.

Returns:
The expected size (in bytes) of the read data
Author:
Joao Carreira

Definition at line 126 of file Device.hpp.

virtual int mermaid::support::io::Device::getFileDescriptor (  )  const [inline, virtual]

File descriptor getter.

Returns:
The device's file descriptor
Author:
Joao Carreira

Definition at line 116 of file Device.hpp.

void Device::write ( size_t  bytesToWrite,
const char *  data,
shared_ptr< StreamOperationHandlerMethodBase streamOperationHandlerWrite 
) [virtual]

Writes data to the device.

Parameters:
bytesToWrite Number of bytes to be written
data Data to be written
Author:
Joao Carreira

Definition at line 68 of file Device.cpp.

Generated on Fri Mar 4 22:15:47 2011 for MeRMaID::support by  doxygen 1.6.3