#include <HttpUpgrader.h>

Inheritance diagram for Ota::Network::HttpUpgrader:
Collaboration diagram for Ota::Network::HttpUpgrader:

Classes

struct  Item
 
class  ItemList
 

Public Types

using CompletedDelegate = Delegate< void(HttpUpgrader &client, bool result)>
 
using Partition = Storage::Partition
 

Public Member Functions

bool addItem (const String &firmwareFileUrl, Partition partition, ReadWriteStream *stream=nullptr)
 Add an item to update. More...
 
void start ()
 
void switchToRom (uint8_t romSlot)
 On completion, switch to the given ROM slot. More...
 
void setCallback (CompletedDelegate reqUpdateDelegate)
 
void setDelegate (CompletedDelegate reqUpdateDelegate)
 
void setBaseRequest (HttpRequest *request)
 Sets the base request that can be used to pass. More...
 
const ItemListgetItems () const
 Allow read access to item list. More...
 

Protected Member Functions

void applyUpdate ()
 
void updateFailed ()
 
virtual int itemComplete (HttpConnection &client, bool success)
 
virtual int updateComplete (HttpConnection &client, bool success)
 
- Protected Member Functions inherited from HttpClient
String getCacheKey (const Url &url)
 
virtual ~HttpClient ()
 HttpClient destructor. More...
 
bool sendRequest (const Url &url, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, const String &body, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, String &&body, RequestCompletedDelegate requestComplete) noexcept
 
bool downloadString (const Url &url, RequestCompletedDelegate requestComplete, size_t maxLength=NETWORK_SEND_BUFFER_SIZE)
 Queue request to download content as string (in memory) More...
 
bool downloadFile (const Url &url, RequestCompletedDelegate requestComplete=nullptr)
 
bool downloadFile (const Url &url, const String &saveFileName, RequestCompletedDelegate requestComplete=nullptr)
 Queue request to download a file. More...
 
bool send (HttpRequest *request)
 
HttpRequestcreateRequest (const Url &url)
 Helper function to create a new request on a URL. More...
 

Protected Attributes

ItemList items
 
CompletedDelegate updateDelegate
 
HttpRequestbaseRequest {nullptr}
 
uint8_t romSlot {NO_ROM_SWITCH}
 
uint8_t currentItem {0}
 

Additional Inherited Members

- Protected Types inherited from HttpClient
using HttpConnectionPool = ObjectMap< String, HttpClientConnection >
 
- Static Protected Member Functions inherited from HttpClient
static void cleanup ()
 Use this method to clean all object pools. More...
 
- Static Protected Attributes inherited from HttpClient
static HttpConnectionPool httpConnectionPool
 

Member Typedef Documentation

◆ CompletedDelegate

◆ Partition

Member Function Documentation

◆ addItem()

bool Ota::Network::HttpUpgrader::addItem ( const String firmwareFileUrl,
Partition  partition,
ReadWriteStream stream = nullptr 
)
inline

Add an item to update.

Parameters
firmwareFileUrl
partitionTarget partition to write
stream
Return values
bool

◆ applyUpdate()

void Ota::Network::HttpUpgrader::applyUpdate ( )
protected

◆ getItems()

const ItemList& Ota::Network::HttpUpgrader::getItems ( ) const
inline

Allow read access to item list.

◆ itemComplete()

virtual int Ota::Network::HttpUpgrader::itemComplete ( HttpConnection client,
bool  success 
)
protectedvirtual

◆ setBaseRequest()

void Ota::Network::HttpUpgrader::setBaseRequest ( HttpRequest request)
inline

Sets the base request that can be used to pass.

   - default request parameters, like request headers...
   - default SSL options
   - default SSL fingeprints
   - default SSL client certificates
Parameters
request

◆ setCallback()

void Ota::Network::HttpUpgrader::setCallback ( CompletedDelegate  reqUpdateDelegate)
inline

◆ setDelegate()

void Ota::Network::HttpUpgrader::setDelegate ( CompletedDelegate  reqUpdateDelegate)
inline

◆ start()

void Ota::Network::HttpUpgrader::start ( )

◆ switchToRom()

void Ota::Network::HttpUpgrader::switchToRom ( uint8_t  romSlot)
inline

On completion, switch to the given ROM slot.

Parameters
romSlotspecify NO_ROM_SWITCH (the default) to cancel any previously set switch

◆ updateComplete()

virtual int Ota::Network::HttpUpgrader::updateComplete ( HttpConnection client,
bool  success 
)
protectedvirtual

◆ updateFailed()

void Ota::Network::HttpUpgrader::updateFailed ( )
protected

Member Data Documentation

◆ baseRequest

HttpRequest* Ota::Network::HttpUpgrader::baseRequest {nullptr}
protected

◆ currentItem

uint8_t Ota::Network::HttpUpgrader::currentItem {0}
protected

◆ items

ItemList Ota::Network::HttpUpgrader::items
protected

◆ romSlot

uint8_t Ota::Network::HttpUpgrader::romSlot {NO_ROM_SWITCH}
protected

◆ updateDelegate

CompletedDelegate Ota::Network::HttpUpgrader::updateDelegate
protected

The documentation for this class was generated from the following file: