Marco De Silva / Eth_tcp
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Eth_tcp.h Source File

Eth_tcp.h

00001 #ifndef ETH_TCP_H
00002 #define ETH_TCP_H
00003 
00004 #include "mbed.h"
00005 #include "EthernetInterface.h"
00006 #include "TCPServer.h"
00007 #include "TCPSocket.h"
00008 
00009 #include "Hyfliers_robot_eth_msgs.h"
00010 
00011 #include "ethDefineVariables.h"
00012 
00013 
00014 
00015 class Eth_tcp
00016 {
00017 public:
00018 
00019     Eth_tcp(float srv_timeout_);    
00020 
00021     Status updateEthCommunication(ConfigMsg& cnf_msg_, ComandMsg& cmd_msg_, ResponseMsg rsp_msg);
00022 
00023     Status connect();
00024     void reset_connection();
00025     
00026 private:
00027 
00028 
00029     //EthernetInterface eth;
00030     NetworkInterface *eth;
00031 
00032     TCPServer  srv;
00033     TCPSocket  clt_sock;
00034     SocketAddress clt_addr;
00035     int port;
00036     float srv_timeout;    
00037     double eth_time;    
00038     //double eth_time_sample_received;
00039     double eth_time_out; //ms
00040     bool sock_open;
00041     bool result;
00042     bool sendCurrentRsp;
00043     bool srv_accepted; 
00044     uint8_t CheckSumFun(uint8_t* byteData, int length);
00045     bool isNumber(char v);
00046     bool isValidIpAddress(char* addr);
00047     bool isInSameNetwork(const char* sip1, const char* sip2);
00048     void is_connected();
00049     
00050     Status status;
00051 
00052 
00053     Timer comunicationTimer; 
00054 
00055 };
00056 
00057 #endif