mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем альтернативный источник обновлений
This commit is contained in:
23
src/modules/virtual/UpdateServer/UpdateServer.cpp
Normal file
23
src/modules/virtual/UpdateServer/UpdateServer.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include "Global.h"
|
||||||
|
#include "classes/IoTItem.h"
|
||||||
|
|
||||||
|
class UpdateServer : public IoTItem {
|
||||||
|
public:
|
||||||
|
UpdateServer(String parameters) : IoTItem(parameters) {}
|
||||||
|
|
||||||
|
void onModuleOrder(String &key, String &value) {
|
||||||
|
if (key == "startUpdate") {
|
||||||
|
upgrade_firmware(3, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~UpdateServer() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
void* getAPI_UpdateServer(String subtype, String param) {
|
||||||
|
if (subtype == F("UpdateServer")) {
|
||||||
|
return new UpdateServer(param);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/modules/virtual/UpdateServer/modinfo.json
Normal file
39
src/modules/virtual/UpdateServer/modinfo.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"menuSection": "virtual_elments",
|
||||||
|
"configItem": [
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "Свой сервер обновлений",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "UpdateServer",
|
||||||
|
"id": "UpdateServer",
|
||||||
|
"widget": "",
|
||||||
|
"page": "",
|
||||||
|
"descr": "",
|
||||||
|
"btn-startUpdate": "http://192.168.11.112/iotm"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"about": {
|
||||||
|
"authorName": "Ilya Belyakov",
|
||||||
|
"authorContact": "https://t.me/Biveraxe",
|
||||||
|
"authorGit": "https://github.com/biveraxe",
|
||||||
|
"exampleURL": "https://iotmanager.org/",
|
||||||
|
"specialThanks": "",
|
||||||
|
"moduleName": "UpdateServer",
|
||||||
|
"moduleVersion": "1.0",
|
||||||
|
"usedRam": {
|
||||||
|
"esp32_4mb": 15,
|
||||||
|
"esp8266_4mb": 15
|
||||||
|
},
|
||||||
|
"title": "Свой сервер обновлений",
|
||||||
|
"moduleDesc": "Модуль для получения прошивки из своего сервера обновлений.",
|
||||||
|
"propInfo": {
|
||||||
|
"btn-startUpdate": "Кнопка запуска процесса обновления из указанного URL"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defActive": true,
|
||||||
|
"usedLibs": {
|
||||||
|
"esp32*": [],
|
||||||
|
"esp82*": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user