CommunicationManager Class Reference

#include <CommunicationManager.h>

Inheritance diagram for CommunicationManager:
ListenerObject

# Public Member Functions

void reset ()
 Reset the manager's state.
void enableCommunications (ListenerObject scope)
void disableCommunications ()
 Disable communication on the EXT port.
bool cancelCommunications ()
 Cancel all pending transmissions on the EXT port.
void startSyncCycle ()
bool isConnected ()
bool isMaster ()
bool broadcastData (BYTE *data, int32 numberOfBytes)
void broadcastDataAsync (BYTE *data, int32 numberOfBytes, ListenerObject scope)
bool sendAndReceiveData (WORD message, BYTE *data, int32 numberOfBytes)
bool sendAndReceiveDataAsync (WORD message, BYTE *data, int32 numberOfBytes, ListenerObject scope)
WORD getSentMessage ()
 Retrieve the last sent message on the EXT port.
WORD getReceivedMessage ()
 Retrieve the last received message on the EXT port.
const BYTEgetSentData ()
 Retrieve the last sent data on the EXT port.
const BYTEgetReceivedData ()
 Retrieve the last received data on the EXT port.
void print (int32 x, int32 y)
override bool handleMessage (Telegram telegram)

# Static Public Member Functions

static void interruptHandler ()
 Interrupt handler for COM interrupts.

# Protected Attributes

volatile int32 status
 Status of the communications.
volatile BYTEsentData
 Data sent over the EXT port.
volatile BYTEreceivedData
 Data received over the EXT port.
volatile BYTEsyncSentByte
 Last byte sent synchronously over the EXT port.
volatile BYTEsyncReceivedByte
 Last byte received synchronously over the EXT port.
volatile BYTEasyncSentByte
 Last byte sent asynchronously over the EXT port.
volatile BYTEasyncReceivedByte
 Last byte received asynchronously over the EXT port.
volatile int32 numberOfBytesPendingTransmission
 Number of bytes pending transmission over the EXT port.
int32 numberOfBytesPreviouslySent
 Number of bytes already transmitted over the EXT port.
volatile uint32 broadcast
 Status of broadcast communications.
volatile bool connected
 Flag that indicates if there is something connected to the EXT port.
volatile uint8 communicationMode
 Keeps track of the role as master or slave that the system holds in data transmissions.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
virtual bool onEvent (ListenerObject eventFirer, uint16 eventCode)
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Detailed Description

Class CommunicationManager

Inherits from ListenerObject

Manages communications on the EXT port.

Definition at line 34 of file CommunicationManager.h.

# Member Function Documentation

# broadcastData()

secure bool CommunicationManager::broadcastData ( BYTE * data,
int32 numberOfBytes )

Send data synchronously over the EXT port if there is nothing detectable attached to it.

Parameters
dataData to broadcast
numberOfBytesNumber of bytes to broadcast

Definition at line 315 of file CommunicationManager.c.

# broadcastDataAsync()

secure void CommunicationManager::broadcastDataAsync ( BYTE * data,
int32 numberOfBytes,
ListenerObject scope )

Send data asynchronously over the EXT port if there is nothing detectable attached to it.

Parameters
dataData to broadcast
numberOfBytesNumber of bytes to broadcast
scopeObject that will be notified of communication events

Definition at line 360 of file CommunicationManager.c.

# cancelCommunications()

bool CommunicationManager::cancelCommunications ( )

Cancel all pending transmissions on the EXT port.

Definition at line 228 of file CommunicationManager.c.

# disableCommunications()

void CommunicationManager::disableCommunications ( )

Disable communication on the EXT port.

Definition at line 217 of file CommunicationManager.c.

# enableCommunications()

void CommunicationManager::enableCommunications ( ListenerObject scope)

Enable communications on the EXT port.

Parameters
scopeObject that will be notified of communication events

Definition at line 180 of file CommunicationManager.c.

# getReceivedData()

const BYTE * CommunicationManager::getReceivedData ( )

Retrieve the last received data on the EXT port.

Definition at line 429 of file CommunicationManager.c.

# getReceivedMessage()

WORD CommunicationManager::getReceivedMessage ( )

Retrieve the last received message on the EXT port.

Definition at line 415 of file CommunicationManager.c.

# getSentData()

const BYTE * CommunicationManager::getSentData ( )

Retrieve the last sent data on the EXT port.

Definition at line 422 of file CommunicationManager.c.

# getSentMessage()

WORD CommunicationManager::getSentMessage ( )

Retrieve the last sent message on the EXT port.

Definition at line 408 of file CommunicationManager.c.

# handleMessage()

bool CommunicationManager::handleMessage ( Telegram telegram)
virtual

Receive and process a Telegram.

Parameters
telegramReceived telegram to process
Returns
True if the telegram was processed

Reimplemented from ListenerObject.

Definition at line 122 of file CommunicationManager.c.

# interruptHandler()

static void CommunicationManager::interruptHandler ( )
static

Interrupt handler for COM interrupts.

Definition at line 92 of file CommunicationManager.c.

# isConnected()

bool CommunicationManager::isConnected ( )

Check if there is something attached to the EXT port.

Returns
True if there is something attached to the EXT port; false otherwise

Definition at line 301 of file CommunicationManager.c.

# isMaster()

bool CommunicationManager::isMaster ( )

Check if the system is the master during the next cycle of communications over the EXT port.

Returns
True if the system is the master; false otherwise

Definition at line 308 of file CommunicationManager.c.

# print()

void CommunicationManager::print ( int32 x,
int32 y )

Print the manager's status.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 437 of file CommunicationManager.c.

# reset()

void CommunicationManager::reset ( )

Reset the manager's state.

Definition at line 146 of file CommunicationManager.c.

# sendAndReceiveData()

bool CommunicationManager::sendAndReceiveData ( WORD message,
BYTE * data,
int32 numberOfBytes )

Send and receive data synchronously over the EXT port if there is something detectable attached to it.

Parameters
messageControl message for the receiving partner
dataData to broadcast
numberOfBytesNumber of bytes to broadcast

Definition at line 391 of file CommunicationManager.c.

# sendAndReceiveDataAsync()

bool CommunicationManager::sendAndReceiveDataAsync ( WORD message,
BYTE * data,
int32 numberOfBytes,
ListenerObject scope )

Send and receive data asynchronously over the EXT port if there is something detectable attached to it.

Parameters
messageControl message for the receiving partner
dataData to broadcast
numberOfBytesNumber of bytes to broadcast
scopeObject that will be notified of communication events

Definition at line 398 of file CommunicationManager.c.

# startSyncCycle()

void CommunicationManager::startSyncCycle ( )

Start the sync procedure according to the official documentation once a connection has been stablished.

Definition at line 260 of file CommunicationManager.c.

# Member Data Documentation

# asyncReceivedByte

volatile BYTE* CommunicationManager::asyncReceivedByte
protected

Last byte received asynchronously over the EXT port.

Definition at line 57 of file CommunicationManager.h.

# asyncSentByte

volatile BYTE* CommunicationManager::asyncSentByte
protected

Last byte sent asynchronously over the EXT port.

Definition at line 54 of file CommunicationManager.h.

# broadcast

volatile uint32 CommunicationManager::broadcast
protected

Status of broadcast communications.

Definition at line 66 of file CommunicationManager.h.

# communicationMode

volatile uint8 CommunicationManager::communicationMode
protected

Keeps track of the role as master or slave that the system holds in data transmissions.

Definition at line 72 of file CommunicationManager.h.

# connected

volatile bool CommunicationManager::connected
protected

Flag that indicates if there is something connected to the EXT port.

Definition at line 69 of file CommunicationManager.h.

# numberOfBytesPendingTransmission

volatile int32 CommunicationManager::numberOfBytesPendingTransmission
protected

Number of bytes pending transmission over the EXT port.

Definition at line 60 of file CommunicationManager.h.

# numberOfBytesPreviouslySent

int32 CommunicationManager::numberOfBytesPreviouslySent
protected

Number of bytes already transmitted over the EXT port.

Definition at line 63 of file CommunicationManager.h.

# receivedData

volatile BYTE* CommunicationManager::receivedData
protected

Data received over the EXT port.

Definition at line 45 of file CommunicationManager.h.

# sentData

volatile BYTE* CommunicationManager::sentData
protected

Data sent over the EXT port.

Definition at line 42 of file CommunicationManager.h.

# status

volatile int32 CommunicationManager::status
protected

Status of the communications.

Definition at line 39 of file CommunicationManager.h.

# syncReceivedByte

volatile BYTE* CommunicationManager::syncReceivedByte
protected

Last byte received synchronously over the EXT port.

Definition at line 51 of file CommunicationManager.h.

# syncSentByte

volatile BYTE* CommunicationManager::syncSentByte
protected

Last byte sent synchronously over the EXT port.

Definition at line 48 of file CommunicationManager.h.


The documentation for this class was generated from the following files: