ESP32-Mesh-OTA/components/mesh_ota/include/Mesh_OTA_Util.h

38 lines
1.4 KiB
C
Raw Normal View History

#ifndef H_MESH_OTA_UTIL
#define H_MESH_OTA_UTIL
#include "esp_system.h"
#include "esp_event.h"
#include "esp_log.h"
#include "Mesh_Network.h"
#include "HTTPS_Client.h"
#include "Mesh_OTA.h"
enum otaMeshRole
{
Transmitter,
Receiver
};
typedef enum otaMeshRole OTA_MESH_ROLE_t;
//helper functions
2021-01-20 22:39:18 +01:00
bool bMeshOtaUtilNewerVersion(const char* cpu8Local, const char* cpu8Remote);
esp_err_t errMeshOtaUtilExtractVersionNumber(const char* cpu8Data, uint32_t* const cpu32DataLenght, char* const pc8RemoteVersionNumber);
esp_err_t errMeshOtaUtilFindImageStart(const char* const cpu8Data, const uint32_t* const cpu32DataLenght, uint32_t* const cpu32StartOffset);
esp_err_t errMeshOtaUtilSendOTAVersionRequest(const mesh_addr_t* const cpcMeshReceiverAddr);
esp_err_t errMeshOtaUtilSendOTAVersionResponse(const mesh_addr_t* const cpcMeshReceiverAddr);
void vMeshOtaUtilPrintOTAProgress(const uint32_t* const cpcu32TotalImageSize, const uint32_t* const cpcu32BytesWritten, const OTA_MESH_ROLE_t ceRole);
2021-01-20 21:40:51 +01:00
void vMeshOtaUtilAddAllNeighboursToQueue(void);
2021-01-20 22:39:18 +01:00
void vMeshOtaUtilClearOtaMessageQueue(const mesh_addr_t* const cpcMeshNodeAddr);
void vMeshOtaUtilClearNeighboursQueue(const mesh_addr_t* const cpcMeshNodeAddr);
//Handler
2021-01-20 22:39:18 +01:00
void vMeshOtaUtilAddNodeToPossibleUpdatableQueue(const uint8_t* const cpcu8MAC);
void vMeshOtaUtilAddOtaMessageToQueue(const MESH_PACKET_t* const cpcuMeshPacket);
void vMeshOtaUtilChangeStateOfServerWorker(const bool cbState);
#endif /* H_MESH_OTA_UTIL */
2021-01-20 22:39:18 +01:00