ApparatusFramework::Protocol Class Reference
[Communication Services]

#include <CommunicationServices/current/include/Protocol.h>

Inheritance diagram for ApparatusFramework::Protocol:
ApparatusFramework::SupervisedTask ApparatusFramework::Task ApparatusFramework::CANOpenProtocol

List of all members.

Public Member Functions

 Protocol (const char deviceName[], const TaskId taskId, const TaskPriority priority, const StackSize stackSize, const uint16 msgQueueLgth, const char taskName[], const uint8 credit)
virtual ~Protocol ()
virtual void initialize ()
virtual void startup ()
virtual const ConnectiongetConnection (const char *address)=0
virtual bool broadcast (ConnectionMsg *pCommMsg)
virtual void installErrHndl (ErrorHandler *pErrHndl)
virtual void sendError (ErrorStatus &errorStatus)

Detailed Description

Protocol belongs - together with the Connection and the CharDevice - to the "Connection" pattern. This pattern helps its user in implementing a multi connection communication mechanism over standard interfaces.

The mechanism is thought for network & transport layer protocols but can also be used on application level. The protocol manages connections. It holds them and provides access. A client retrieves a connection using the getConnection method of the protocol. The logic of the protocol itself is implemented in the connection over which the client communicates.

The protocol is an active object that waits blocking on a specified character device for data. As soon as this data is received, it determines the receiving connection and dispatches the data to it, using its receive method. The protocol is implemented in a generic way that allows choosing the type of connections it handles. As already stated: One protocol is only able to talk over one physical device. If there are multiple connections using more than one physical device, multiple protocol objects are needed.

Definition at line 89 of file Protocol.h.


Constructor & Destructor Documentation

ApparatusFramework::Protocol::Protocol ( const char  deviceName[],
const TaskId  taskId,
const TaskPriority  priority,
const StackSize  stackSize,
const uint16  msgQueueLgth,
const char  taskName[],
const uint8  credit 
)

constructor, destructor Custom constructor. Each protocol is able to communicate using a char device. The name of this device is a constructor parameter. As protocol is a task, the task parameters have to be provided.

Parameters:
deviceName[] name of the device.
taskId unique id of this protocol task.
priority priority of the task (the deeper the more important).
stackSize size of the stack of this task.
msgQueueLgth size of the message queue for inter task communication.
taskName should also be unique.
credit used for the task supervision.
virtual ApparatusFramework::Protocol::~Protocol (  )  [virtual]

Virtual destructor so that protocols can be deleted with a pointer to this base class.


Member Function Documentation

virtual bool ApparatusFramework::Protocol::broadcast ( ConnectionMsg pCommMsg  )  [virtual]

Broadcasts a message to all fetched connections.

Parameters:
pCommMsg pointer to the communication message to be sent.
Returns:
bool true SUCCESSFUL, false FAILURE.

Reimplemented in ApparatusFramework::CANOpenProtocol.

virtual const Connection* ApparatusFramework::Protocol::getConnection ( const char *  address  )  [pure virtual]

protocol methods Returns a new connection using this protocol.

Parameters:
address a string that may be protocol specific and identifies the node to which the connection shall be built up.
Returns:
Connection* pointer to the connection. 0 if it did not work out.

Implemented in ApparatusFramework::CANOpenProtocol.

virtual void ApparatusFramework::Protocol::initialize (  )  [virtual]

factory startup Initializes the Protocol accordingly to the factory startup pattern.

Reimplemented in ApparatusFramework::CANOpenProtocol.

virtual void ApparatusFramework::Protocol::installErrHndl ( ErrorHandler pErrHndl  )  [virtual]

asynchronous error handling. Installs an error handler which is called whenever an error happens.

Parameters:
pErrHndl pointer to the error handler.
virtual void ApparatusFramework::Protocol::sendError ( ErrorStatus errorStatus  )  [virtual]

Sends a asynchronous error

Parameters:
errorStatus status of the error. It includes the error number, type, senderId and the param.
virtual void ApparatusFramework::Protocol::startup (  )  [virtual]

Starts up the Protocol accordingly to the factory startup pattern.

Reimplemented in ApparatusFramework::CANOpenProtocol.

© 2004-2010 bbv Software Services AG / Apparatus Services