Edgehog Device SDK ESP32
ESP32 device SDK for the Edgehog platform
edgehog_device.h
Go to the documentation of this file.
1 /*
2  * This file is part of Edgehog.
3  *
4  * Copyright 2021 SECO Mind Srl
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  */
20 
26 #ifndef EDGEHOG_DEVICE_H
27 #define EDGEHOG_DEVICE_H
28 
29 typedef struct edgehog_device_t *edgehog_device_handle_t;
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include "edgehog.h"
36 #include <astarte_device.h>
37 #include <esp_err.h>
38 #include <nvs.h>
39 
46 typedef enum
47 {
56 
67 typedef struct
68 {
69  telemetry_type_t type;
70  long period_seconds;
72 
82 typedef struct
83 {
84  astarte_device_handle_t astarte_device;
85  const char *partition_label;
86  edgehog_device_telemetry_config_t *telemetry_config;
87  size_t telemetry_config_len;
89 
108 edgehog_device_handle_t edgehog_device_new(edgehog_device_config_t *config);
109 
116 void edgehog_device_destroy(edgehog_device_handle_t edgehog_device);
117 
128  edgehog_device_handle_t edgehog_device, const char *serial_num);
129 
140  edgehog_device_handle_t edgehog_device, const char *part_num);
141 
151  edgehog_device_handle_t edgehog_device, astarte_device_data_event_t *event);
152 
160 edgehog_err_t edgehog_device_start(edgehog_device_handle_t edgehog_device);
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif // EDGEHOG_DEVICE_H
Edgehog types and defines.
edgehog_err_t
Edgehog return codes.
Definition: edgehog.h:39
telemetry_type_t
Edgehog telemetry types.
Definition: edgehog_device.h:47
@ EDGEHOG_TELEMETRY_INVALID
Definition: edgehog_device.h:48
@ EDGEHOG_TELEMETRY_GEOLOCATION_INFO
Definition: edgehog_device.h:54
@ EDGEHOG_TELEMETRY_SYSTEM_STATUS
Definition: edgehog_device.h:51
@ EDGEHOG_TELEMETRY_WIFI_SCAN
Definition: edgehog_device.h:50
@ EDGEHOG_TELEMETRY_HW_INFO
Definition: edgehog_device.h:49
@ EDGEHOG_TELEMETRY_STORAGE_USAGE
Definition: edgehog_device.h:52
@ EDGEHOG_TELEMETRY_BATTERY_STATUS
Definition: edgehog_device.h:53
esp_err_t edgehog_device_set_system_part_number(edgehog_device_handle_t edgehog_device, const char *part_num)
set the system part number
edgehog_err_t edgehog_device_start(edgehog_device_handle_t edgehog_device)
start Edgehog device.
void edgehog_device_destroy(edgehog_device_handle_t edgehog_device)
destroy Edgehog device.
void edgehog_device_astarte_event_handler(edgehog_device_handle_t edgehog_device, astarte_device_data_event_t *event)
receive data from Astarte Server.
edgehog_device_handle_t edgehog_device_new(edgehog_device_config_t *config)
create Edgehog device handle.
esp_err_t edgehog_device_set_system_serial_number(edgehog_device_handle_t edgehog_device, const char *serial_num)
set the system serial number
Edgehog device configuration struct.
Definition: edgehog_device.h:83
Edgehog device configuration struct.
Definition: edgehog_device.h:68