Part One of my Project Course. Implementation of simple I/O and a custom defined protocol over UDP/IP.
Dependencies: C12832 LM75B mbed EthernetInterface mbed-rtos
Diff: slave.h
- Revision:
- 2:6bfe732ba6bc
- Parent:
- 1:b5c534165dfe
diff -r b5c534165dfe -r 6bfe732ba6bc slave.h --- a/slave.h Wed Mar 14 07:59:21 2018 +0000 +++ b/slave.h Mon Mar 19 11:32:54 2018 +0000 @@ -11,9 +11,30 @@ class Slave{ public: + /* + * Constructor for Slave class. + * + @param The id for the slave that is selected on boot. + @param Pointer to temperature class object. + @param Pointer to potentiometer class object. + @param Pointer to lcd class object. + @param Pointer to rgb class object. + @param Pointer to buzzermusic class object. + @return Nothing. + */ Slave(int slave_id, Temperature *temperature, Potentiometer *potentiometer, LCD *lcd, RGB *rgb, BuzzerMusic *buzzerMusic); + + /* + * Method that contains the slave state-machine. + * Waits for incoming UDP packets from master. + * Determines what type of command is received. + * Executes method according to received command. + * Sends acknowledgement back to the master. + * + @param Nothing. + @return Nothing. + */ void handleIncomingFrame(void); - private: enum slaveStates{ @@ -37,6 +58,9 @@ RGB *slaveRgb; BuzzerMusic *slaveBuzzerMusic; + char ip_address[14]; + char *command_info[3]; + float temperatureValue; float potentiometerValue; string response;