SolarEnergy/esp32_device/main/secure_api.h

74 lines
1.3 KiB
C

/**
* Secure API functions
*/
#include <stddef.h>
#include <stdbool.h>
#include "sync_response.h"
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Device enrollment status
*/
enum DevEnrollmentStatus
{
/** An error occurred while retrieving device status */
DevEnrollError = 0,
/** Device is unknown by the backend */
DevEnrollUnknown = 1,
/** Device hasn't been validated yet */
DevEnrollPending = 2,
/** Device has been validated by the backend */
DevEnrollValidated = 3,
};
/**
* Log message severity
*/
enum LogMessageSeverity
{
Debug = 0,
Info,
Warn,
Error
};
/**
* Get current device enrollment status
*/
enum DevEnrollmentStatus
secure_api_get_device_enrollment_status();
/**
* Enroll device
*/
int secure_api_enroll_device();
/**
* Get device certificate
*/
char *secure_api_get_dev_certificate();
/**
* Report log message to backend
*/
void secure_api_report_log_message(enum LogMessageSeverity severity, const char *msg);
/**
* Synchronise device with central backend
*
* Returns NULL in case of failure
*/
sync_response *secure_api_sync_device();
#ifdef __cplusplus
}
#endif