![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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: master.h
- Revision:
- 2:6bfe732ba6bc
- Parent:
- 1:b5c534165dfe
- Child:
- 3:538e17979246
diff -r b5c534165dfe -r 6bfe732ba6bc master.h --- a/master.h Wed Mar 14 07:59:21 2018 +0000 +++ b/master.h Mon Mar 19 11:32:54 2018 +0000 @@ -8,8 +8,33 @@ class Master{ public: + /* + * Constructor for Master class. + * + @param The id for the master that is selected on boot. + @return Nothing. + */ Master(int master_id); - void sendMessageToPc(char *message_to_pc); + + /* + * Method that sends characters to serial connection on pc. + * + @param Characters that need to be displayed. + @return Nothing. + */ + void sendMessageToPc(char *thingsToDisplay); + + /* + * Method that contains the master state-machine. + * Waits for input from the user entered via a serial connection. + * When command is entered, prompts user for slave id to send to. + * Sends UDP packet to slave. + * Waits for the response/acknowledgement from the slave. + * Displays acknowledgement. + * + @param Char array containing the characters to display. + @return Nothing. + */ void handlePcData(void); private: @@ -24,7 +49,7 @@ masterStates CurrentMasterState; - char inputCommandArray[20]; + char inputCommandArray[512]; char client_id[3]; int char_counter_command, char_counter_id; @@ -32,6 +57,8 @@ const static char *MASK; const static char *GATEWAY; + + Timer timer; };