#include <Device.hpp>
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. |
Device class.
This is the class which represents a device.
Definition at line 48 of file Device.hpp.
Device::Device | ( | int | expectedDataSize, | |
int | fileDescriptor, | |||
shared_ptr< ActiveObject > | owner, | |||
shared_ptr< DeviceConfigurator > | deviceConfigurator | |||
) |
Constructor.
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 |
Definition at line 43 of file Device.cpp.
void Device::callReadHandler | ( | size_t | bytesRead, | |
size_t | requestedBytes, | |||
const char * | data, | |||
bool | success | |||
) | [virtual] |
Call the handler which processes read replies.
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. |
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.
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. |
Definition at line 80 of file Device.cpp.
void Device::close | ( | ) | [virtual] |
Closes the device.
Definition at line 86 of file Device.cpp.
void Device::configureDevice | ( | shared_ptr< DeviceConfigurator > | deviceConfigurator | ) | [virtual] |
Configures the device.
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.
streamOperationHandlerRead | The handler which will receive read replies. |
Definition at line 49 of file Device.cpp.
void Device::enableWrite | ( | ) | [virtual] |
Enables write operations on this device.
Definition at line 59 of file Device.cpp.
virtual int mermaid::support::io::Device::getExpectedDataSize | ( | ) | const [inline, virtual] |
Expected data size getter.
Definition at line 126 of file Device.hpp.
virtual int mermaid::support::io::Device::getFileDescriptor | ( | ) | const [inline, virtual] |
File descriptor getter.
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.
bytesToWrite | Number of bytes to be written | |
data | Data to be written |
Definition at line 68 of file Device.cpp.