Telegram Bot Api Client  0.6.1
Client_for_accessing_Telegram's_Bot_API
Classes | Macros | Enumerations
JsonWebClient.h File Reference

Header of a simple web client receiving json uses an underlying implementation of Client interface. It implements a pseudo background behavior by providing a loop() method that can be polled and calls callback on receiving valid data. More...

#include "TBCDebug.h"
#include "Arduino.h"
#include <Client.h>
#include <ArduinoJson.h>

Go to the source code of this file.

Classes

class  JsonWebClient
 

Macros

#define JsonWebClient_h
 
#define JWC_BUFF_SIZE   10000
 
#define JWC_CALLBACK_MESSAGE_SIGNATURE   void (*callbackSuccess)(void*, JwcProcessError, JsonObject&)
 
#define JWC_CALLBACK_ERROR_SIGNATURE   void (*callbackError)(void*, JwcProcessError, Client*)
 

Enumerations

enum  JwcProcessError : int { JwcProcessError::Ok = 0, JwcProcessError::HttpErr = -1, JwcProcessError::MsgTooBig = -2, JwcProcessError::MsgJsonErr = -3 }
 
enum  JwcClientState : int {
  JwcClientState::Unconnected = 0, JwcClientState::Connected = 1, JwcClientState::Waiting = 2, JwcClientState::Headers = 3,
  JwcClientState::Json = 4
}
 

Detailed Description

Header of a simple web client receiving json uses an underlying implementation of Client interface. It implements a pseudo background behavior by providing a loop() method that can be polled and calls callback on receiving valid data.

JSONWebClient (netClient, "www.example.com", 80, CallBackObject, callBackMessage, callBackError);.

JwcClientState state = JwcClientState::Unconnected;.

JwcProcessError state = JwcProcessError::Ok;.

Part of TelegramBotClient (https://github.com/schlingensiepen/TelegramBotClient) Jörn Schlingensiepen joern.nosp@m.@sch.nosp@m.linge.nosp@m.nsie.nosp@m.pen.c.nosp@m.om

Enumeration to indicate internal process state of JsonWebClient.

Note
Should only be used as a part of TelegramBotClient (https://github.com/schlingensiepen/TelegramBotClient)
Author
Jörn Schlingensiepen joern.nosp@m.@sch.nosp@m.linge.nosp@m.nsie.nosp@m.pen.c.nosp@m.om

This class implements a minimum http client to receive json data from a host. It uses an underlying implementation of Client interface and can be used with raw client or ssl client.

Note
Should only be used as a part of TelegramBotClient (https://github.com/schlingensiepen/TelegramBotClient)
Author
Jörn Schlingensiepen joern.nosp@m.@sch.nosp@m.linge.nosp@m.nsie.nosp@m.pen.c.nosp@m.om

Enumeration Type Documentation

◆ JwcClientState

enum JwcClientState : int
strong
Enumerator
Unconnected 

Client is not connected

Connected 

Client is connected but no command was sent.

Waiting 

Client is waiting for response from server.

Headers 

Client is processing headers.

Json 

Client is processing json from response

◆ JwcProcessError

enum JwcProcessError : int
strong
Enumerator
Ok 

Everything Ok, no error

HttpErr 

Not found HTTP 200 Header –> Server Error

MsgTooBig 

Message bigger than JWC_BUFF_SIZE adjust JWC_BUFF_SIZE to avoid this, beware ArduinoJSON still needs to fit to your device's memory

MsgJsonErr 

ArduinoJSON was not able to parse the message