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

Public Member Functions

void addItem (int offset, String firmwareFileUrl)
 
void start ()
 
void switchToRom (uint8 romSlot)
 
void setCallback (OtaUpdateDelegate reqUpdateDelegate)
 
void setDelegate (OtaUpdateDelegate reqUpdateDelegate)
 
rBootHttpUpdateItem getItem (unsigned int index)
 

Protected Member Functions

void onTimer ()
 
virtual void writeRawData (pbuf *buf, int startPos)
 
void applyUpdate ()
 
void updateFailed ()
 
virtual void writeInit ()
 
virtual bool writeFlash (const u8 *data, u16 size)
 
virtual bool writeEnd ()
 
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 ()
 
bool startDownload (URL uri, HttpClientMode mode, HttpClientCompletedDelegate onCompleted)
 
void onFinished (TcpClientState finishState)
 
virtual err_t onReceive (pbuf *buf)
 
void parseHeaders (pbuf *buf, int headerEnd)
 
virtual bool connect (String server, int port, boolean useSsl=false, uint32_t sslOptions=0)
 
virtual bool connect (IPAddress addr, uint16_t port, boolean useSsl=false, uint32_t sslOptions=0)
 
virtual bool connect (String server, int port, bool useSsl=false, uint32_t sslOptions=0)
 
virtual bool connect (IPAddress addr, uint16_t port, bool useSsl=false, uint32_t sslOptions=0)
 
virtual void close ()
 
void setReceiveDelegate (TcpClientDataDelegate receiveCb=NULL)
 Set or clear the callback for received data. More...
 
void setCompleteDelegate (TcpClientCompleteDelegate completeCb=NULL)
 Set or clear the callback for connection close. More...
 
bool send (const char *data, uint16_t len, bool forceCloseAfterSent=false)
 
bool sendString (String data, bool forceCloseAfterSent=false)
 
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 ()
 
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 ()
 
bool internalTcpConnect (IPAddress addr, uint16_t port)
 
virtual err_t onPoll ()
 
void initialize (tcp_pcb *pcb)
 

Static Protected Member Functions

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)
 

Protected Attributes

Vector< rBootHttpUpdateItemitems
 
Timer timer
 
int currentItem
 
rboot_write_status rBootWriteStatus
 
uint8 romSlot
 
OtaUpdateDelegate updateDelegate
 
bool waitParse = false
 
bool writeError = false
 
tcp_pcb * tcp = NULL
 
uint16_t sleep
 
uint16_t timeOut
 
bool canSend
 
bool autoSelfDestruct
 
bool useSsl = false
 

Member Function Documentation

void TcpClient::setCompleteDelegate ( TcpClientCompleteDelegate  completeCb = NULL)
inherited

Set or clear the callback for connection close.

Parameters
completeCbcallback delegate or NULL
void TcpClient::setReceiveDelegate ( TcpClientDataDelegate  receiveCb = NULL)
inherited

Set or clear the callback for received data.

Parameters
receiveCbcallback delegate or NULL