Dependencies: ros_lib_kinetic
Diff: HLComms.h
- Revision:
- 7:5b6a2cefbf3b
- Child:
- 9:cd3607ba5643
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HLComms.h Fri Aug 03 14:58:36 2018 +0000 @@ -0,0 +1,47 @@ +// HLComms.h + +#ifndef HLCOMMS_H +#define HLCOMMS_H + +// STANDARD IMPORTS +#include <sstream> // stringstream +#include <vector> // vector +#include <string> // strtok +// MBED IMPORTS +//#include "mbed.h" +#include "EthernetInterface.h" +#include "TCPServer.h" +#include "TCPSocket.h" + +struct msg_format { + double psi[3][3]; + double duration; +}; + +class HLComms +{ + public: + + struct { + EthernetInterface eth; // Indicates which NetworkInterface the socket should be created on + TCPServer srv; // Provides the ability to accept incoming TCP connections + TCPSocket clt_sock; // Provides the ability to send a stream of data over TCP + SocketAddress clt_addr; // Represents the IP address and port pair of a unique network endpoint + } interfaces; + + HLComms(short int port); + int setup_server(void); + int accept_connection(void); + void close_server(void); + msg_format consume_message( unsigned char * msg ); //msg_format receive_msg(void); + + private: + + const bool IS_DHCP = false; + short int _port; + + //msg_format process_msg( unsigned char * msg ); + +}; + +#endif \ No newline at end of file