API Documentation

namespace Mqtt

Typedefs

using RbootPayloadParser = StandardPayloadParser

Deprecated:

Use StandardPayloadParser

Variables

constexpr int8_t VERSION_NOT_READY = {-1}
constexpr int8_t ERROR_INVALID_MQTT_MESSAGE = {-1}
constexpr int8_t ERROR_INVALID_PATCH_VERSION = {-2}
constexpr int8_t ERROR_UNKNOWN_REASON = {-10}
class AdvancedPayloadParser : public OtaUpgrade::Mqtt::PayloadParser
#include <AdvancedPayloadParser.h>

This parser allows the processing of firmware data that can be encrypted or have signature

Public Functions

virtual bool switchRom(const UpdateState &updateState) override

This method is responsible for switching the rom. This method is NOT restarting the system. It will happen lated in the parse method.

Return values:

true – if the switch was successful

virtual ReadWriteStream *getStorageStream(size_t storageSize) override

Creates new stream to store the firmware update.

Parameters:

size_t – storageSize the requested storage size

Return values:

ReadWriteStream*

inline PayloadParser(size_t currentPatchVersion, size_t allowedVersionBytes = 24)
Parameters:
  • currentPatchVersion

  • allowedVersionBytes – - maximum allowed bytes to be used for describing a patch version

class PayloadParser
#include <PayloadParser.h>

Subclassed by OtaUpgrade::Mqtt::AdvancedPayloadParser, OtaUpgrade::Mqtt::StandardPayloadParser

Public Functions

inline PayloadParser(size_t currentPatchVersion, size_t allowedVersionBytes = 24)
Parameters:
  • currentPatchVersion

  • allowedVersionBytes – - maximum allowed bytes to be used for describing a patch version

virtual bool switchRom(const UpdateState &updateState) = 0

This method is responsible for switching the rom. This method is NOT restarting the system. It will happen lated in the parse method.

Return values:

true – if the switch was successful

virtual ReadWriteStream *getStorageStream(size_t storageSize) = 0

Creates new stream to store the firmware update.

Parameters:

size_t – storageSize the requested storage size

Return values:

ReadWriteStream*

int parse(MqttPayloadParserState &state, mqtt_message_t *message, const char *buffer, int length)

This method takes care to read the incoming MQTT message and pass it to the stream that is responsoble for storing the data.

Return values:

int – 0 when everything is ok <0 when an error has occurred

struct UpdateState
#include <PayloadParser.h>
class StandardPayloadParser : public OtaUpgrade::Mqtt::PayloadParser
#include <StandardPayloadParser.h>

This parser allows the processing of firmware data that is directly stored to the flash memory using RbootOutputStream.

Public Functions

virtual bool switchRom(const UpdateState &updateState) override

This method is responsible for switching the rom. This method is NOT restarting the system. It will happen lated in the parse method.

Return values:

true – if the switch was successful

virtual ReadWriteStream *getStorageStream(size_t storageSize) override

Creates new stream to store the firmware update.

Parameters:

size_t – storageSize the requested storage size

Return values:

ReadWriteStream*