AWS IoT for ESP32 v1.0.0
An ESP-IDF based solution
lib_flash.h File Reference

Flash library header file. More...

Go to the source code of this file.

Enumerations

enum  flashStatus_t {
  FLASH_STATUS_OK , FLASH_STATUS_BUSY , FLASH_STATUS_LOAD_DEFAULT , FLASH_STATUS_READ_FAIL ,
  FLASH_STATUS_WRITE_FAIL , FLASH_STATUS_INVALID_DATASET , FLASH_STATUS_MAX
}
 
enum  systemStatusParams_et { SYSTEM_STATUS_OTA , SYSTEM_STATUS_ALL , SYSTEM_STATUS_MAX }
 
enum  deviceConfigParams_et {
  DEVICE_CONFIG_HOST , DEVICE_CONFIG_PORT , DEVICE_CONFIG_USERNAME , DEVICE_CONFIG_PASSWORD ,
  DEVICE_CONFIG_WIFI , DEVICE_CONFIG_THING_NAME , DEVICE_CONFIG_CLEAR , DEVICE_CONFIG_MAX
}
 
enum  deviceCertType_et { FLASH_CERT_CERTIFICATE_PEM , FLASH_CERT_PRIVATE_KEY , FLAH_CERT_MAX }
 
enum  flashDataSet_et {
  FLASH_DATASET_DEVICE_CONFIG , FLASH_DATASET_SYSTEM_STATUS , FLASH_DATASET_DEVICE_CERTIFICATES , FLASH_DATASET_APP ,
  FLASH_DATASET_MAX
}
 

Functions

void FLASH_printConfig ()
 Print stored device configuration. More...
 
bool FLASH_updatePending ()
 Check if a dataset is updated. More...
 
bool FLASH_isDeviceRegistered ()
 Check if the device is registered with AWS IoT. More...
 
char * FLASH_getCertificate (deviceCertType_et certType_e)
 Get the given certificate from stored configuration. More...
 
const char * FLASH_getThingName ()
 Get thing name from stored configuration. More...
 
bool FLASH_appDataRead (void *pData, uint16_t size_u16)
 Read the data from application dataset. More...
 
bool FLASH_appDataWrite (void *pData, uint16_t size_u16)
 Store the given data to application data set. More...
 
bool FLASH_appDataEraseAll ()
 Erase stored application dataset. More...
 

Detailed Description

Flash library header file.

Enumeration Type Documentation

◆ deviceCertType_et

An enum to represent Device Certificate type.

Enumerator
FLASH_CERT_CERTIFICATE_PEM 

Device certificate

FLASH_CERT_PRIVATE_KEY 

Device private key

FLAH_CERT_MAX 

Total number of device certificate types

◆ deviceConfigParams_et

An enum to represent Device Configuration parameters.

Enumerator
DEVICE_CONFIG_HOST 

AWS IoT Host

DEVICE_CONFIG_PORT 

AWS IoT Port number

DEVICE_CONFIG_USERNAME 

MQTT Username

DEVICE_CONFIG_PASSWORD 

MQTT Password

DEVICE_CONFIG_WIFI 

WIFI configuration parameter

DEVICE_CONFIG_THING_NAME 

Thing name parameter

DEVICE_CONFIG_CLEAR 

Clear configurations

DEVICE_CONFIG_MAX 

Total number of available configuration parameters

◆ flashDataSet_et

An enum to represent available Flash Datasets.

Enumerator
FLASH_DATASET_DEVICE_CONFIG 

Device configuration dataset

FLASH_DATASET_SYSTEM_STATUS 

System status dataset

FLASH_DATASET_DEVICE_CERTIFICATES 

Device certificate dataset

FLASH_DATASET_APP 

Application dataset

FLASH_DATASET_MAX 

Total number of available datasets

◆ flashStatus_t

An enum to represent the status of flash operations.

Enumerator
FLASH_STATUS_OK 

Status ok

FLASH_STATUS_BUSY 

Status busy

FLASH_STATUS_LOAD_DEFAULT 

Load default configuration values

FLASH_STATUS_READ_FAIL 

Read failed

FLASH_STATUS_WRITE_FAIL 

Write failed

FLASH_STATUS_INVALID_DATASET 

Data is invalid

FLASH_STATUS_MAX 

Total number of status for Flash library

◆ systemStatusParams_et

An enum to represent System parameters.

Enumerator
SYSTEM_STATUS_OTA 

System parameter OTA

SYSTEM_STATUS_ALL 

System parameter ALL

SYSTEM_STATUS_MAX 

Total number of parameters

Function Documentation

◆ FLASH_appDataEraseAll()

bool FLASH_appDataEraseAll ( )

Erase stored application dataset.

Parameters
none
Returns
Erase status
Return values
trueon success
falseon failure

◆ FLASH_appDataRead()

bool FLASH_appDataRead ( void *  pData,
uint16_t  size_u16 
)

Read the data from application dataset.

Parameters
[out]pDataData buffer
[in]pDataLength of data
Returns
Read status
Return values
trueon successful read
falseon failure

◆ FLASH_appDataWrite()

bool FLASH_appDataWrite ( void *  pData,
uint16_t  size_u16 
)

Store the given data to application data set.

Parameters
[in]pDataData to be written
[in]size_u16Length of data
Returns
Write status
Return values
trueon success
falseon failure

◆ FLASH_getCertificate()

char * FLASH_getCertificate ( deviceCertType_et  certType_e)

Get the given certificate from stored configuration.

Parameters
[in]certType_eType of certificate
Returns
The certificate as string

◆ FLASH_getThingName()

const char * FLASH_getThingName ( )

Get thing name from stored configuration.

Parameters
none
Returns
The thing name.

◆ FLASH_isDeviceRegistered()

bool FLASH_isDeviceRegistered ( )

Check if the device is registered with AWS IoT.

Parameters
none
Returns
Device registration status.
Return values
trueis device is registered
falseif device is not registered yet.

◆ FLASH_printConfig()

void FLASH_printConfig ( )

Print stored device configuration.

Parameters
none
Returns
none

◆ FLASH_updatePending()

bool FLASH_updatePending ( )

Check if a dataset is updated.

Parameters
none
Returns
Dataset update status.
Return values
trueif a dataset is updated
falseif not updated