Edgehog Device SDK ESP32
ESP32 device SDK for the Edgehog platform
|
Edgehog device SDK API. More...
Go to the source code of this file.
Data Structures | |
struct | edgehog_device_telemetry_config_t |
Edgehog device configuration struct. More... | |
struct | edgehog_device_config_t |
Edgehog device configuration struct. More... | |
Typedefs | |
typedef struct edgehog_device_t * | edgehog_device_handle_t |
Enumerations | |
enum | telemetry_type_t { EDGEHOG_TELEMETRY_INVALID = 0 , EDGEHOG_TELEMETRY_HW_INFO = 1 , EDGEHOG_TELEMETRY_WIFI_SCAN = 2 , EDGEHOG_TELEMETRY_SYSTEM_STATUS = 3 , EDGEHOG_TELEMETRY_STORAGE_USAGE = 4 , EDGEHOG_TELEMETRY_BATTERY_STATUS = 5 , EDGEHOG_TELEMETRY_GEOLOCATION_INFO = 6 } |
Edgehog telemetry types. More... | |
Functions | |
edgehog_device_handle_t | edgehog_device_new (edgehog_device_config_t *config) |
create Edgehog device handle. More... | |
void | edgehog_device_destroy (edgehog_device_handle_t edgehog_device) |
destroy Edgehog device. More... | |
esp_err_t | edgehog_device_set_system_serial_number (edgehog_device_handle_t edgehog_device, const char *serial_num) |
set the system serial number More... | |
esp_err_t | edgehog_device_set_system_part_number (edgehog_device_handle_t edgehog_device, const char *part_num) |
set the system part number More... | |
void | edgehog_device_astarte_event_handler (edgehog_device_handle_t edgehog_device, astarte_device_data_event_t *event) |
receive data from Astarte Server. More... | |
edgehog_err_t | edgehog_device_start (edgehog_device_handle_t edgehog_device) |
start Edgehog device. More... | |
Edgehog device SDK API.
enum telemetry_type_t |
Edgehog telemetry types.
This enum is used for configuring the telemetry type in edgehog_device_telemetry_config_t
struct.
void edgehog_device_astarte_event_handler | ( | edgehog_device_handle_t | edgehog_device, |
astarte_device_data_event_t * | event | ||
) |
receive data from Astarte Server.
This function must be called when an Astarte Data event coming from server.
edgehog_device | A valid Edgehog device handle. |
event | A valid Astarte device data event. |
void edgehog_device_destroy | ( | edgehog_device_handle_t | edgehog_device | ) |
destroy Edgehog device.
This function destroys the device, freeing all its resources.
edgehog_device | A valid Edgehog device handle. |
edgehog_device_handle_t edgehog_device_new | ( | edgehog_device_config_t * | config | ) |
create Edgehog device handle.
This function creates an Edgehog device handle. It must be called before anything else.
Example: astarte_device_handle_t astarte_device = astarte_device_init();
edgehog_device_config_t edgehog_conf = { .astarte_device = astarte_device, };
edgehog_device_handle_t edgehog_device = edgehog_device_new(&edgehog_conf);
config | An edgehog_device_config_t struct. |
esp_err_t edgehog_device_set_system_part_number | ( | edgehog_device_handle_t | edgehog_device, |
const char * | part_num | ||
) |
set the system part number
This function sends the system part number on Astarte and stores it on the nvs.
edgehog_device | A valid Edgehog device handle. |
part_num | The part number to be stored |
esp_err_t edgehog_device_set_system_serial_number | ( | edgehog_device_handle_t | edgehog_device, |
const char * | serial_num | ||
) |
set the system serial number
This function sends the system serial number on Astarte and stores it on the nvs.
edgehog_device | A valid Edgehog device handle. |
serial_num | The serial number to be stored |
edgehog_err_t edgehog_device_start | ( | edgehog_device_handle_t | edgehog_device | ) |
start Edgehog device.
This function starts the device, enabling the telemetry update if configured.
device | A valid Edgehog device handle. |