Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
HttpClient Class Reference
Inheritance diagram for HttpClient:
TcpClient TcpConnection HttpFirmwareUpdate rBootHttpUpdate

Public Member Functions

 HttpClient (bool autoDestruct=false)
 
bool downloadString (String url, HttpClientCompletedDelegate onCompleted)
 
String getResponseString ()
 
bool downloadFile (String url, HttpClientCompletedDelegate onCompleted=NULL)
 
bool downloadFile (String url, String saveFileName, HttpClientCompletedDelegate onCompleted=NULL)
 
void setPostBody (const String &_method)
 
String getPostBody ()
 
void setRequestHeader (const String name, const String value)
 
bool hasRequestHeader (const String name)
 
void setRequestContentType (String _content_type)
 
__forceinline int getResponseCode ()
 
__forceinline bool isSuccessful ()
 
__forceinline bool isProcessing ()
 
__forceinline TcpClientState getConnectionState ()
 
String getResponseHeader (String headerName, String defaultValue="")
 
DateTime getLastModifiedDate ()
 
DateTime getServerDate ()
 
void reset ()
 

Protected Member Functions

bool startDownload (URL uri, HttpClientMode mode, HttpClientCompletedDelegate onCompleted)
 
void onFinished (TcpClientState finishState)
 
virtual err_t onReceive (pbuf *buf)
 
virtual void writeRawData (pbuf *buf, int startPos)
 
void parseHeaders (pbuf *buf, int headerEnd)
 
- Protected Member Functions inherited from TcpClient
virtual err_t onConnected (err_t err)
 
virtual err_t onSent (uint16_t len)
 
virtual void onError (err_t err)
 
virtual void onReadyToSendData (TcpConnectionEvent sourceEvent)
 
void pushAsyncPart ()
 
 TcpClient (bool autoDestruct)
 
 TcpClient (tcp_pcb *clientTcp, TcpClientDataDelegate clientReceive, TcpClientCompleteDelegate onCompleted)
 
 TcpClient (TcpClientCompleteDelegate onCompleted, TcpClientEventDelegate onReadyToSend, TcpClientDataDelegate onReceive=NULL)
 
 TcpClient (TcpClientCompleteDelegate onCompleted, TcpClientDataDelegate onReceive=NULL)
 
 TcpClient (TcpClientDataDelegate onReceive)
 
virtual bool connect (String server, int port)
 
virtual bool connect (IPAddress addr, uint16_t port)
 
virtual void close ()
 
bool send (const char *data, uint8_t len, bool forceCloseAfterSent=false)
 
bool sendString (String data, bool forceCloseAfterSent=false)
 
__forceinline bool isProcessing ()
 
__forceinline TcpClientState getConnectionState ()
 
- Protected Member Functions inherited from TcpConnection
bool internalTcpConnect (IPAddress addr, uint16_t port)
 
virtual err_t onPoll ()
 
void initialize (tcp_pcb *pcb)
 
 TcpConnection (bool autoDestruct)
 
 TcpConnection (tcp_pcb *connection, bool autoDestruct)
 
int writeString (const char *data, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
 
int writeString (const String data, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
 
virtual int write (const char *data, int len, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
 
int write (IDataSourceStream *stream)
 
__forceinline uint16_t getAvailableWriteSize ()
 
void flush ()
 
void setTimeOut (uint16_t waitTimeOut)
 
IPAddress getRemoteIp ()
 
uint16_t getRemotePort ()
 

Protected Attributes

bool waitParse = false
 
bool writeError = false
 
- Protected Attributes inherited from TcpConnection
tcp_pcb * tcp
 
uint16_t sleep
 
uint16_t timeOut
 
bool canSend
 
bool autoSelfDestruct
 

Additional Inherited Members

- Static Protected Member Functions inherited from TcpConnection
static err_t staticOnConnected (void *arg, tcp_pcb *tcp, err_t err)
 
static err_t staticOnReceive (void *arg, tcp_pcb *tcp, pbuf *p, err_t err)
 
static err_t staticOnSent (void *arg, tcp_pcb *tcp, uint16_t len)
 
static err_t staticOnPoll (void *arg, tcp_pcb *tcp)
 
static void staticOnError (void *arg, err_t err)
 
static void staticDnsResponse (const char *name, ip_addr_t *ipaddr, void *arg)
 
static void closeTcpConnection (tcp_pcb *tpcb)