Skip to content

Update functionality

Tim Fischbach edited this page May 10, 2022 · 6 revisions

Functions:

void setDeviceName(String DevName);

Sets device name. Important for Data collection.

String getDeviceName();

outputs DeviceName

void setVersion(String ver);

Sets Version of your program.

String getVersion();

outputs Version of your program.

void setDlLink(String DLL);

Set your webserver link and location of the files (more about that in the chapter "Update Server")

String getDlLink();

outputs Server link

void setBetaState(bool sbeta);

setting if beta should be downloaded instead of stable (default: false)(more about that in the chapter "Update Server")

bool getBetaState();

outputs Beta setting state

void setDevState(bool sdev);

sets device into developer mode. Stable and Beta will be completely ignored. (default false)(more about that in the chapter "Update Server")

bool getDevState();

outputs Dev setting state

String checkUpdate();

Checks for a new version and generates download link. Needs to be executed first before performUpdate()

Returns:

"NO_VARIABLES_SET" // Error. necessary variables are not set. Please make sure you've set DeviceName, Version and DLlink
"NO_UPDATE_AVAILABLE" // Check complete! No Update available!
"UPDATE_AVAILABLE" // Check complete! Update available and link generated.
"UPDATE_SERVER_DOWN" // Check failed. No internet connection or server down.

String performUpdate();

Performs update. Make sure you've run checkUpdate() before or else, it'll return a HTTP error.

Returns:

"NO_VARIABLES_SET" // Error. necessary variables are not set. Please make sure you've set DeviceName, Version and DLlink
"UPDATE_LOOP_DETECTED" // Version in sourcecode and filename weren't the same. An infinite updateloop was triggered, but blocked by UpdateLoopProtection. Updates are blocked for 24hours (or even shorter. When device gets rebooted, the timer resets). Please update the versions to the same version number.
"UPDATE_LOOP_BLOCK" // The 24 hours block by the UpdateLoopProtection aren't over yet. Please wait or reboot the device.
"HTTP_ERROR" // No internet connection, server down or file not found.
"HTTP_UPDATE_NO_UPDATES" // (unknown functionality. will probably be removed soon)
"HTTP_UPDATE_OK" // Update is getting downloaded. No errors so far.