Simplify using of UnbufferedSerial(Serial), USBCDC, TCP, SMTP, NTP Fork : https://github.com/YSI-LPS/lib_Transmission
Dependents: lib_Transmission_Serial_example 2022_TICE_Electrolyse lib_Transmission_TCP_example
Diff: lib_Transmission.h
- Revision:
- 10:25e049353db5
- Parent:
- 9:abd4a4944399
- Child:
- 11:de94dcd67561
diff -r abd4a4944399 -r 25e049353db5 lib_Transmission.h --- a/lib_Transmission.h Wed Oct 14 08:29:22 2020 +0000 +++ b/lib_Transmission.h Tue Nov 24 15:58:38 2020 +0000 @@ -31,7 +31,7 @@ #define SMTP_SERVER "129.175.212.70" // IP sinon utilisation du DNS avec _eth.getHostByName("smtp.u-psud.fr") #define NTP_SERVER "129.175.34.43" // IP sinon utilisation du DNS avec _eth.getHostByName("ntp.u-psud.fr") -enum enumTRANSMISSION { TCP, SERIAL, BOTH }; +enum enumTRANSMISSION { SERIAL, TCP, HTTP, ANY }; enum enumTRANSTATUS { WHITE, CYAN, MAGENTA_ACCEPT, BLUE_CLIENT, YELLOW_CONNECTING, GREEN_GLOBAL_UP, RED_DISCONNECTED, BLACK_INITIALIZE }; /** Transmission class @@ -45,7 +45,7 @@ * @param * @param */ - Transmission(UnbufferedSerial *serial, EthernetInterface *eth, void(*init)(void), void(*processing)(string, const enumTRANSMISSION&)); + Transmission(UnbufferedSerial *serial, EthernetInterface *eth, void(*init)(void), void(*processing)(string, enumTRANSMISSION)); /** * @@ -53,7 +53,7 @@ * @param * @returns none */ - void set(bool TCP, const char* IP="", uint16_t PORT=80); + string set(bool SET, const char* IP="", uint16_t PORT=80); /** * * @param @@ -89,13 +89,6 @@ * @returns none */ time_t ntp(const char* ADDRESS=""); - /** - * - * @param - * @param - * @returns none - */ - void http(void); private: Thread _queueThread; @@ -105,10 +98,6 @@ TCPSocket *_clientTCP = NULL; TCPSocket _serverTCP; - /* Transmission */ - void (*_init)(void); - void (*_processing)(string, const enumTRANSMISSION&); - /* EthernetInterface */ void eth_state(void); bool eth_connect(void); @@ -121,7 +110,9 @@ void serverTCP_accept(void); void serverTCP_event(void); - struct typeTRANSMISSION { string buffer[2]; enumTRANSTATUS status; bool TCP; bool HTTP; bool BREAK; bool DHCP; bool CONNECT; string IP; uint16_t PORT; } - message = { {"", ""}, RED_DISCONNECTED, false, false, false, false, false, "", 80 }; + /* Transmission */ + void (*_init)(void); + void (*_processing)(string, enumTRANSMISSION); + struct typeTRANSMISSION { string serial; enumTRANSTATUS status; bool SET; bool BREAK; bool DHCP; bool CONNECT; string IP; uint16_t PORT; } message = { "", RED_DISCONNECTED, false, false, false, false, "", 80 }; }; #endif \ No newline at end of file