Y SI
/
TCP-Server-sample
TCP-Server-sample
Diff: main.h
- Revision:
- 0:d3cd3a4b962c
- Child:
- 1:263b4d8f37b9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Thu Apr 08 12:39:50 2021 +0000 @@ -0,0 +1,35 @@ +#ifndef MAIN_H +#define MAIN_H + +#define MBED_PROJECT "TCP-sample" +#define IP_SERVER "192.168.1.25" +#define PORT_SERVER 80 +#define TIMEOUT_SERVER 100 +#define BUFFER_SIZE 1072 + +#include "mbed.h" +#include "EthernetInterface.h" +#include <sstream> + +EthernetInterface eth; +TCPSocket serverTCP, *clientTCP; +EventQueue *queue = NULL; +BusOut Led(LED1, LED2, LED3); +UnbufferedSerial pc(USBTX, USBRX, 230400); + +bool CONNECT = false; + +enum enum_status { WHITE, CYAN, MAGENTA_ACCEPT, BLUE_CLIENT, YELLOW_CONNECTING, GREEN_GLOBAL_UP, RED_DISCONNECTED, BLACK_INITIALIZE } + eth_status = RED_DISCONNECTED; + +bool eth_connect(void); +void eth_event(nsapi_event_t, intptr_t); +void eth_state(void); + +bool serverTCP_connect(void); +void serverTCP_event(void); +void serverTCP_accept(void); + +enum_status recv(void); +nsapi_error_t send(const string& buff); +#endif \ No newline at end of file