Wyatt
1.0.1
|
#include <Communicator.h>
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 |
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.
Communicator::Communicator | ( | ISensorManager * | sensorManager | ) |
Constructor.
sensorManager | The 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.
void Communicator::queueMessage | ( | IMessage * | message | ) |
Add a message to a queue to be written to the peripheral
msg | A 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
messages | An 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
hardware | The hardware to register |
interface | The interface from which to read/write messages to the hardware |
DuplicateHardwareException | Thrown when hardware is registered more than once. |
Definition at line 19 of file Communicator.cpp.
|
overridevirtual |
Overwritten Thread run function. Continuously reads and writes data to the peripheral
Implements Thread.
Definition at line 68 of file Communicator.cpp.