SolarEnergy/esp32_device/main/secure_api.h

74 lines
1.3 KiB
C
Raw Normal View History

2024-08-18 18:13:03 +00:00
/**
* Secure API functions
*/
2024-09-28 14:35:05 +00:00
#include <stddef.h>
#include <stdbool.h>
#include "sync_response.h"
2024-08-18 18:13:03 +00:00
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Device enrollment status
*/
enum DevEnrollmentStatus
{
/** An error occurred while retrieving device status */
2024-08-18 18:33:26 +00:00
DevEnrollError = 0,
2024-08-18 18:13:03 +00:00
/** Device is unknown by the backend */
2024-08-18 18:33:26 +00:00
DevEnrollUnknown = 1,
2024-08-18 18:13:03 +00:00
/** Device hasn't been validated yet */
2024-08-18 18:33:26 +00:00
DevEnrollPending = 2,
2024-08-18 18:13:03 +00:00
/** Device has been validated by the backend */
2024-08-18 18:33:26 +00:00
DevEnrollValidated = 3,
2024-08-18 18:13:03 +00:00
};
2024-10-05 09:47:41 +00:00
/**
* Log message severity
*/
enum LogMessageSeverity
{
Debug = 0,
Info,
Warn,
Error
};
2024-08-18 18:13:03 +00:00
/**
* Get current device enrollment status
*/
enum DevEnrollmentStatus
secure_api_get_device_enrollment_status();
2024-08-23 19:00:18 +00:00
/**
* Enroll device
*/
int secure_api_enroll_device();
2024-08-28 22:09:47 +00:00
/**
* Get device certificate
*/
char *secure_api_get_dev_certificate();
2024-10-05 09:47:41 +00:00
/**
* 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
*/
2024-09-28 14:35:05 +00:00
sync_response *secure_api_sync_device();
2024-08-18 18:13:03 +00:00
#ifdef __cplusplus
}
#endif