diff --git a/src/modules/virtual/UpdateServer/UpdateServer.cpp b/src/modules/virtual/UpdateServer/UpdateServer.cpp new file mode 100644 index 00000000..b622e1b0 --- /dev/null +++ b/src/modules/virtual/UpdateServer/UpdateServer.cpp @@ -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; + } +} diff --git a/src/modules/virtual/UpdateServer/modinfo.json b/src/modules/virtual/UpdateServer/modinfo.json new file mode 100644 index 00000000..7249644c --- /dev/null +++ b/src/modules/virtual/UpdateServer/modinfo.json @@ -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*": [] + } +} \ No newline at end of file