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

master.h

Committer:
bertgereels
Date:
2018-03-14
Revision:
1:b5c534165dfe
Parent:
0:88d3b9015f7c
Child:
2:6bfe732ba6bc

File content as of revision 1:b5c534165dfe:

#pragma once

#include "mbed.h"

#define MAX_COMMAND_LENGTH 20

namespace ProjectOne{
 
    class Master{
        public:
            Master(int master_id);
            void sendMessageToPc(char *message_to_pc);
            void handlePcData(void);
            
        private:
            enum masterStates{
                STATE_INIT,
                STATE_RECEIVING_FROM_PC,
                STATE_HANDLE_ID,
                STATE_SEND_UDP_PACKET,
                STATE_HANDLE_RESPONSE,
                STATE_ERROR_STATE
            };
            
            masterStates CurrentMasterState;

            char inputCommandArray[20];
            char client_id[3];
            int char_counter_command, char_counter_id;
            
            int masterId;
            
            const static char *MASK;
            const static char *GATEWAY;
         
    };
 
};