Wyatt  1.0.1
Public Member Functions | List of all members
Communicator Class Reference

#include <Communicator.h>

Inheritance diagram for Communicator:
Inheritance graph
[legend]
Collaboration diagram for Communicator:
Collaboration graph
[legend]

Public Member Functions

 Communicator (ISensorManager *sensorManager)
 
 ~Communicator ()
 
void registerHardware (Hardware hardware, IHardwareInterface *interface)
 
void queueMessage (IMessage *message)
 
void queueMessage (std::list< IMessage * > *messages)
 
void * run () override
 
- Public Member Functions inherited from Thread
int start ()
 
int join ()
 
int detach ()
 
void signal (int signal)
 
pthread_t self ()
 

Additional Inherited Members

- Protected Attributes inherited from Thread
std::atomic< int > m_signal
 

Detailed Description

Class that oversees communication between the Raspberry pi and a single peripheral. Data that is read/written to/from a peripheral must pass through this class. This class runs on its own thread and exposes functions to queue messages.

Data read from the peripheral is immediately passed to the ISensorManager object for handing.

Definition at line 22 of file Communicator.h.

Constructor & Destructor Documentation

Communicator::Communicator ( ISensorManager sensorManager)

Constructor.

Parameters
sensorManagerThe ISensorManager object to pass data to.

Definition at line 6 of file Communicator.cpp.

Communicator::~Communicator ( )

Deconstructor. Deletes all pointer references.

Definition at line 13 of file Communicator.cpp.

Member Function Documentation

void Communicator::queueMessage ( IMessage message)

Add a message to a queue to be written to the peripheral

Parameters
msgA Message object to be written

Definition at line 29 of file Communicator.cpp.

void Communicator::queueMessage ( std::list< IMessage * > *  messages)

Add a list of messages to a queue to be written to the peripheral

Parameters
messagesAn std::list of Messages to be written

Definition at line 36 of file Communicator.cpp.

void Communicator::registerHardware ( Hardware  hardware,
IHardwareInterface interface 
)

Registers a piece of hardware with the communicator

Parameters
hardwareThe hardware to register
interfaceThe interface from which to read/write messages to the hardware
Exceptions
DuplicateHardwareExceptionThrown when hardware is registered more than once.

Definition at line 19 of file Communicator.cpp.

void * Communicator::run ( )
overridevirtual

Overwritten Thread run function. Continuously reads and writes data to the peripheral

Returns
NULL

Implements Thread.

Definition at line 68 of file Communicator.cpp.


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