36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
|
#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
|
||
|
bool bNewerVersion(const char* pu8Local, const char* pu8Remote);
|
||
|
esp_err_t errExtractVersionNumber(const char* pu8Data, uint32_t* pu32DataLenght, char* pc8RemoteVersionNumber);
|
||
|
esp_err_t errFindImageStart(const char* pu8Data, uint32_t* pu32DataLenght, uint32_t* pu32StartOffset);
|
||
|
void vPrintOTAProgress(const uint32_t* const pu32TotalImageSize, const uint32_t* const pu32BytesWritten, OTA_MESH_ROLE_t eRole);
|
||
|
void vAddAllNeighboursToQueue(void);
|
||
|
esp_err_t errSendOTAVersionResponse(mesh_addr_t* meshReceiverAddr);
|
||
|
esp_err_t errSendOTAVersionRequest(mesh_addr_t* meshReceiverAddr);
|
||
|
void vClearOtaMessageQueue(mesh_addr_t* pMeshNodeAddr);
|
||
|
|
||
|
//Handler
|
||
|
void vAddNodeToPossibleUpdatableQueue(uint8_t* pu8MAC);
|
||
|
void vAddOtaMessageToQueue(MESH_PACKET_t* puMeshPacket);
|
||
|
void vChangeStateOfServerWorker(bool state);
|
||
|
|
||
|
#endif /* H_MESH_OTA_UTIL */
|