Skip to content

About

Flexible semver based OTA client SDK for voyagerota-core platform, Github releases and any JSON based apis.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

VoyagerOTAClient

License SDK

A semver-based OTA client SDK for the VoyagerOTA. That also supports structured way for GitHub Releases and custom JSON backend for ESP32 OTA.

Getting Started

Quick Start (VoyagerOTA)

For VoyagerOTA, define __USE_STAGING_CHANNEL__ as true or false before including VoyagerOTAClient.h. This macro determines which release channel the OTA client uses. When set to true, it fetches the latest staging release for testing and development. When set to false, it uses the production channel for production devices.

Kindly note that the firmware compiled with __USE_STAGING_CHANNEL__ set to true is identified as a staging build and will be rejected during VoyagerOTA's artifact build inspection process. Therefore, always set __USE_STAGING_CHANNEL__ to false before uploading the firmware to VoyagerOTA as a production release.

// Staging mode is for for staging environment builds for testing....
// Make sure to always disable the [__USE_STAGING_CHANNEL__] flag to false
// while uploading the Binary to VoyagerOTA Platform as staging builds are not
// allowed....And by disabling it the build is treated as production build...
#define __USE_STAGING_CHANNEL__ true
#define CURRENT_FIRMWARE_VERSION "1.0.0"

#include <VoyagerOTAClient.h>
#include <WiFi.h>
using namespace Voyager;

void connectToWifi() {
    WiFi.begin("SSID", "PASSWORD");
    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(50);
    }
    Serial.println("Connected to Internet");
}

void setup() {
    Serial.begin(9600);
    connectToWifi();
    OTA<HTTPResponseData, VoyagerReleaseModel> ota(CURRENT_FIRMWARE_VERSION);

    ota.setCredentials("voyager-project-id-here....", "voyager-api-key-here...");
    ota.setBaseURL("voyager-base-url.....");

    auto release = ota.fetchLatestRelease();

    if (release && ota.isNewVersion(release->version)) {
        Serial.println("New version available: " + release->version);
        Serial.println("Changelog: " + release->changeLog);
        ota.setDownloadURL(release->downloadURL);
        ota.performUpdate();
    } else {
        Serial.println("No updates available");
    }
}

void loop() {}

Advanced Mode

Enable advanced mode for custom OTA backend support:

#define __ENABLE_ADVANCED_MODE__ true

#include <VoyagerOTAClient.h>

All custom payload models must extend Voyager::BaseModel.

Each model inherits:

  • version release used for semver comparison.
  • downloadURL of the firmware binary.

Voyager-specific features are disabled in advanced mode.

Examples

Requirements

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Flexible semver based OTA client SDK for voyagerota-core platform, Github releases and any JSON based apis.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Contributors

Languages