AWS IoT for ESP32 v1.0.0
An ESP-IDF based solution
lib_system.h
Go to the documentation of this file.
1
11#ifndef _LIB_SYSTEM_H_
12#define _LIB_SYSTEM_H_
13
14#include "freertos/FreeRTOS.h"
15#include "freertos/task.h"
16#include "freertos/event_groups.h"
17#include "freertos/queue.h"
18
19#include "lib_aws.h"
20#include "lib_ota.h"
21#include "stdutils.h"
22
23
29typedef enum
30{
39
45typedef enum
46{
58
64typedef void (*systemEventCb_t)(systemEvents_et eventId);
65
71typedef struct
72{
75 char *pLicenseIdStr;
78 char *pDeviceNamePrefixStr; // max 15 bytes
82
91void SYSTEM_start();
92void SYSTEM_startOta(char *pUrlStr);
93
104
112bool SYSTEM_startFileDownload(char *pUrlStr);
113
119void SYSTEM_restart(uint32_t restartDelay_u32);
120
121bool SYSTEM_isWaitingForRestart();
122
129
130
142
150void SYSTEM_abort(char *pMsgStr, const char *pFunNameStr, uint32_t errorCode_u32);
151void SYSTEM_factoryReset(bool useFactoryPartition_b8, bool eraseAllData_b8);
152
159
165const char *SYSTEM_getMacAddr();
166
188
189#endif
An AWS library file.
logLevels_et
Levels of debug messages for printing.
Definition: lib_config.h:33
OTA library header file.
firmUpdateType_et
Definition: lib_ota.h:51
void SYSTEM_restart(uint32_t restartDelay_u32)
Restarts device.
const char * SYSTEM_getMacAddr()
Get the MAC address of the device.
const char * SYSTEM_getDeviceName()
Get the device name as registered in AWS IoT.
systemMode_et SYSTEM_getMode()
Get the system mode.
const char * SYSTEM_getModeString()
Get the system mode as string.
const char * SYSTEM_getResetCause()
Get the cause of device reset.
bool SYSTEM_startFileDownload(char *pUrlStr)
Start firmware file download.
void SYSTEM_abort(char *pMsgStr, const char *pFunNameStr, uint32_t errorCode_u32)
Puts the system in abort mode and restarts the system.
systemMode_et
Definition: lib_system.h:30
@ SYSTEM_MODE_OTA
Definition: lib_system.h:35
@ SYSTEM_MODE_NORMAL
Definition: lib_system.h:34
@ SYSTEM_MODE_ABORT
Definition: lib_system.h:36
@ SYSTEM_MODE_TEST
Definition: lib_system.h:32
@ SYSTEM_MODE_IDLE
Definition: lib_system.h:31
@ SYSTEM_MODE_CONFIG
Definition: lib_system.h:33
@ SYSTEM_MODE_MAX
Definition: lib_system.h:37
void(* systemEventCb_t)(systemEvents_et eventId)
System events callback function type. The application should define the callback function and initial...
Definition: lib_system.h:64
systemEvents_et
Definition: lib_system.h:46
@ EVENT_AWS_DISCONNECTED
Definition: lib_system.h:50
@ EVENT_BLE_DISCONNECTED
Definition: lib_system.h:53
@ EVENT_BLE_CONNECTED
Definition: lib_system.h:51
@ EVENT_MQTT_CONNECTED
Definition: lib_system.h:54
@ EVENT_AWS_CONNECTED
Definition: lib_system.h:49
@ EVENT_WIFI_DISCONNECTED
Definition: lib_system.h:48
@ EVENT_BLE_AUTHENTICATED
Definition: lib_system.h:52
@ EVENT_MQTT_DISCONNECTED
Definition: lib_system.h:55
@ EVENT_WIFI_CONNECTED
Definition: lib_system.h:47
@ EVENT_MAX
Definition: lib_system.h:56
bool SYSTEM_init(systemInitConfig_st *s_pConfig)
Initiliaze the system with given configuration.
bool SYSTEM_startFirmwareUpdate(firmUpdateType_et e_type, char *pUrlStr)
Initialize the device for OTA firmware update and put the system into SYSTEM_MODE_OTA mode.
AWS configuration structure used by the library.
Definition: lib_aws.h:105
System configuration structure. The application should define the system configuration variable and c...
Definition: lib_system.h:72
logLevels_et * pLogLevels_e
Definition: lib_system.h:73
awsConfig_st s_awsConfig
Definition: lib_system.h:80
char * pWifiSsidStr
Definition: lib_system.h:76
uint8_t logModulesCount_u8
Definition: lib_system.h:74
systemEventCb_t systemEventCallBack
Definition: lib_system.h:79
char * pWifiPwdStr
Definition: lib_system.h:77