13 #ifndef JsonWebClient_h 14 #define JsonWebClient_h 19 #include <ArduinoJson.h> 23 #define JWC_BUFF_SIZE 1000 25 #define JWC_BUFF_SIZE 10000 61 static String JwcProcessErrorString[] = {
"Ok",
"HttpErr",
"MsgTooBig",
"MsgJsonErr"};
65 return JwcProcessErrorString[(-1) * (
int) err];
73 #define JWC_CALLBACK_MESSAGE_SIGNATURE std::function<void(void*, JwcProcessError, JsonObject&)> callbackSuccess 74 #define JWC_CALLBACK_ERROR_SIGNATURE std::function<void(void*, JwcProcessError, Client*)> callbackError 76 #define JWC_CALLBACK_MESSAGE_SIGNATURE void (*callbackSuccess)(void*, JwcProcessError, JsonObject&) 77 #define JWC_CALLBACK_ERROR_SIGNATURE void (*callbackError)(void*, JwcProcessError, Client*) 110 static String JwcClientStateString[] = {
"Unconnected",
"Connected",
"Waiting",
"Headers",
"Json"};
114 return JwcClientStateString[(int) state];
199 void* callBackObject,
213 bool fire (String commands[],
int count);
Definition: JsonWebClient.h:136
JwcClientState state()
Current state of the client.
Definition: JsonWebClient.cpp:157
bool stop()
Stops the client.
Definition: JsonWebClient.cpp:53
bool HttpStatusOk
Definition: JsonWebClient.h:150
void reConnect()
Reconnects to host.
Definition: JsonWebClient.cpp:32
bool processJson()
Process JSON.
Definition: JsonWebClient.cpp:78
JWC_CALLBACK_ERROR_SIGNATURE
Definition: JsonWebClient.h:164
bool loop()
Method to poll client processing.
Definition: JsonWebClient.cpp:116
void * CallBackObject
Definition: JsonWebClient.h:160
String Host
Definition: JsonWebClient.h:144
JwcClientState State
Definition: JsonWebClient.h:140
long ContentLength
Definition: JsonWebClient.h:148
bool fire(String commands[], int count)
Executes a list of commands.
Definition: JsonWebClient.cpp:162
int Port
Definition: JsonWebClient.h:146
Client * NetClient
Definition: JsonWebClient.h:142
JsonWebClient(Client *netClient, String host, int port, void *callBackObject, JWC_CALLBACK_MESSAGE_SIGNATURE, JWC_CALLBACK_ERROR_SIGNATURE)
Definition: JsonWebClient.cpp:15
JWC_CALLBACK_MESSAGE_SIGNATURE
Definition: JsonWebClient.h:162
bool processHeader()
Process a header.
Definition: JsonWebClient.cpp:61