KPN Things Device SDK
ThingsML::HttpFirmwareDownload Class Reference

#include <thingsml_http_firmware.h>

Public Member Functions

 HttpFirmwareDownload (const char baseName[])
 
 HttpFirmwareDownload (const char baseName[], int partSize)
 
void setPartSize (int partSize)
 
int getPartSize ()
 
int getNumParts (int totalSize)
 
size_t getFirmwarePartRequest (int partIndex, char buffer[], int bufferLength, const char host[])
 
bool parseFirmwareMessage (const char message[], int messageLength)
 
String getHost ()
 
int getPort ()
 

Static Public Member Functions

static bool isFirmwareMessage (const char message[], int messageLength)
 
static int getTotalSizeFromResponse (const char message[], int messageLength)
 
static uint32_t getCRC32FromResponse (const char message[], int messageLength)
 
static uint32_t calculateCRC32FromBody (const char body[], int bodyLength)
 

Constructor & Destructor Documentation

◆ HttpFirmwareDownload() [1/2]

ThingsML::HttpFirmwareDownload::HttpFirmwareDownload ( const char  baseName[])
inline

◆ HttpFirmwareDownload() [2/2]

ThingsML::HttpFirmwareDownload::HttpFirmwareDownload ( const char  baseName[],
int  partSize 
)
inline

Member Function Documentation

◆ calculateCRC32FromBody()

uint32_t ThingsML::HttpFirmwareDownload::calculateCRC32FromBody ( const char  body[],
int  bodyLength 
)
static

◆ getCRC32FromResponse()

uint32_t ThingsML::HttpFirmwareDownload::getCRC32FromResponse ( const char  message[],
int  messageLength 
)
static

◆ getFirmwarePartRequest()

size_t ThingsML::HttpFirmwareDownload::getFirmwarePartRequest ( int  partIndex,
char  buffer[],
int  bufferLength,
const char  host[] 
)
Returns
size of the request in bytes

◆ getHost()

String ThingsML::HttpFirmwareDownload::getHost ( )

The return value equal to nullptr indicates that a hostname could not be detected.

Returns
the hostname or ip of the firmware file server

◆ getNumParts()

int ThingsML::HttpFirmwareDownload::getNumParts ( int  totalSize)
inline
Returns
number of times currently configured part size fits into the total size (rounded up).

◆ getPartSize()

int ThingsML::HttpFirmwareDownload::getPartSize ( )
inline
Returns
currently configured part size in bytes

◆ getPort()

int ThingsML::HttpFirmwareDownload::getPort ( )

The return value 0 indicates that a port could not be detected.

Returns
the port to connect to of the firmware file server

◆ getTotalSizeFromResponse()

int ThingsML::HttpFirmwareDownload::getTotalSizeFromResponse ( const char  message[],
int  messageLength 
)
static

This function extracts the total byte size of the resource This can be used to know how many parts need to be requested.

Returns
the total amount of bytes the file contains

◆ isFirmwareMessage()

bool ThingsML::HttpFirmwareDownload::isFirmwareMessage ( const char  message[],
int  messageLength 
)
static
Returns
true if the message contained in the data contains a firmware payload.

◆ parseFirmwareMessage()

bool ThingsML::HttpFirmwareDownload::parseFirmwareMessage ( const char  message[],
int  messageLength 
)

Parse the firmware message

Returns
true if the message was successfully parsed.

◆ setPartSize()

void ThingsML::HttpFirmwareDownload::setPartSize ( int  partSize)
inline
Parameters
partSizesets the currently configured part size in bytes

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