Y SI / Mbed OS TCP-Server-sample
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #ifndef MAIN_H
00002 #define MAIN_H
00003 
00004 #define MBED_PROJECT    "TCP-sample"
00005 #define IP_SERVER       "192.168.1.25"
00006 #define PORT_SERVER     80
00007 #define TIMEOUT_SERVER  100
00008 #define BUFFER_SIZE     1072
00009 
00010 #include "mbed.h"
00011 #include "EthernetInterface.h"
00012 #include <sstream>
00013 
00014 EthernetInterface   eth;
00015 TCPSocket           serverTCP, *clientTCP;
00016 EventQueue          *queue = NULL;
00017 BusOut              Led(LED1, LED2, LED3);
00018 
00019 bool CONNECT = false;
00020 
00021 enum enum_status { WHITE, CYAN, MAGENTA_ACCEPT, BLUE_CLIENT, YELLOW_CONNECTING, GREEN_GLOBAL_UP, RED_DISCONNECTED, BLACK_INITIALIZE }
00022     eth_status = RED_DISCONNECTED;
00023 
00024 bool            eth_connect(void);
00025 void            eth_event(nsapi_event_t, intptr_t);
00026 void            eth_state(void);
00027 
00028 bool            serverTCP_connect(void);
00029 void            serverTCP_event(void);
00030 void            serverTCP_accept(void);
00031 
00032 enum_status     recv(void);
00033 nsapi_error_t   send(const string& buff);
00034 #endif