96 lines
3.3 KiB
C++
96 lines
3.3 KiB
C++
// --------------------------------------------------------------------------------------------------------------------
|
|
/// \file ota.h
|
|
/// \brief File description
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
//
|
|
// vbchaos software design
|
|
//
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
/// $Revision: $
|
|
/// $Author: $
|
|
/// $Date: $
|
|
// (c) 2023 vbchaos
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
#ifndef MAIN_APPLICATION_INC_OTA_H_
|
|
#define MAIN_APPLICATION_INC_OTA_H_
|
|
|
|
/**
|
|
* ota implementation
|
|
* \defgroup ota
|
|
* \brief {group_description}
|
|
* \addtogroup {Layer}
|
|
*
|
|
* Detailed description
|
|
* @{
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Include files
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
// CompilerIncludes
|
|
// All include files that are provided by the compiler directly
|
|
#include <stdint.h>
|
|
|
|
|
|
// ProjectIncludes
|
|
// All include files that are provided by the project
|
|
#include "esp_event.h"
|
|
#include "esp_http_client.h"
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
// Function declarations
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
class ota
|
|
{
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// Public Section
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
public:
|
|
|
|
static const uint32_t checkInterval_ms = 10000;
|
|
|
|
typedef void (*updateStatusCallback)(int);
|
|
static updateStatusCallback usCallback;
|
|
|
|
// Class Constructor
|
|
ota();
|
|
|
|
void task(void);
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// Protected Section
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
protected:
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
// Private Section
|
|
// -----------------------------------------------------------------------------------------------------------------
|
|
private:
|
|
static bool updateActive;
|
|
static int imageSize;
|
|
static void eventHandler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data);
|
|
|
|
};
|
|
|
|
/** @} */
|
|
|
|
|
|
#endif /* MAIN_APPLICATION_INC_OTA_H_ */
|