|
AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
|
Classes | |
| class | Announce |
| class | Data |
| class | DataRequest |
| class | State |
Typedefs | |
| typedef std::function< size_t(painlessmesh::plugin::ota::DataRequest, char *buffer)> | otaDataPacketCallbackType_t |
Enumerations | |
| enum class | OTA_OP_CODES { ANNOUNCE = 10 , DATA_REQUEST = 11 , DATA = 12 } |
Functions | |
| template<class T > | |
| void | addSendPackageCallback (Scheduler &scheduler, plugin::PackageHandler< T > &mesh, otaDataPacketCallbackType_t callback, size_t otaPartSize) |
| template<class T > | |
| void | addReceivePackageCallback (Scheduler &scheduler, plugin::PackageHandler< T > &mesh, TSTRING role="", std::function< void(int, int)> progress_cb=NULL) |
OTA over the mesh
OTA is implemented as a painlessmesh::plugin.
The protocol consists of three message types: ota::Announce, ota::DataRequest and ota::Data. The first message is generally send by the node that distributes the firmware and announces the current version of firmware available for each hardware and role. Firmware version is determined by its MD5 signature. See painlessMeshBoost for a possible implementation of a distribution node.
Once a node receives an announce message it will check it against its own role and hardware to discover if it is suitable this node. If that checks out and the MD5 is different than its own MD5 it will send a data request back to the firmware distribution node. This request also includes a partNo, to determine which part of the data it needs (starting from zero).
When the distribution node receives a data request, it sends the data back to the node (with a data message). The node will then write this data and request the next part of the data. This exchange continuous until the node has all the data, written it and reboots into the new firmware.
| typedef std::function<size_t(painlessmesh::plugin::ota::DataRequest, char* buffer)> painlessmesh::plugin::ota::otaDataPacketCallbackType_t |
|
strong |
| void painlessmesh::plugin::ota::addReceivePackageCallback | ( | Scheduler & | scheduler, |
| plugin::PackageHandler< T > & | mesh, | ||
| TSTRING | role = "", |
||
| std::function< void(int, int)> | progress_cb = NULL |
||
| ) |
| void painlessmesh::plugin::ota::addSendPackageCallback | ( | Scheduler & | scheduler, |
| plugin::PackageHandler< T > & | mesh, | ||
| otaDataPacketCallbackType_t | callback, | ||
| size_t | otaPartSize | ||
| ) |