Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ros_lib_kinetic
HLComms.h
- Committer:
- WD40andTape
- Date:
- 2018-11-27
- Revision:
- 19:e5acb2183d4e
- Parent:
- 17:bbaf3e8440ad
- Child:
- 28:8e0c502c1a50
File content as of revision 19:e5acb2183d4e:
// 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" // CUSTOM IMPORTS #include "MLSettings.h" struct msg_format { double psi[3][3]; double speed; }; 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); int receive_message(void); msg_format process_message(void); int send_duration_message(double *dblTime); int send_sensor_message(double positions[], double pressures[]); private: short int _port; unsigned char recv_buffer[400]; //1024 char send_buffer[400]; //65 Mutex recv_mutex; Mutex send_mutex; int send_message(void); }; #endif