Skip to content

Commit e13640c

Browse files
committed
Merge branch 'contrib/github_pr_578' into 'master'
fix(sensor_hub): Fix compilation issues when using C++ compilers (GitHub PR) Closes AEGHB-1217 See merge request ae_group/esp-iot-solution!1388
2 parents 36d8130 + cb4d187 commit e13640c

File tree

8 files changed

+12
-10
lines changed

8 files changed

+12
-10
lines changed

components/sensors/sensor_hub/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.1.3 - 2025-9-11
4+
5+
### Bug Fixes:
6+
7+
- Fix compilation issue of `iot_sensor_hub` when using c++
8+
39
## v0.1.2 - 2025-3-12
410

511
### Bug Fixes:

components/sensors/sensor_hub/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "0.1.2"
1+
version: "0.1.3"
22
description: Unified Framework for Sensor Management
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/sensors/sensor_hub
44
repository: https://github.com/espressif/esp-iot-solution.git

components/sensors/sensor_hub/include/hal/humiture_hal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ esp_err_t humiture_acquire(sensor_humiture_handle_t sensor, sensor_data_group_t
192192
esp_err_t humiture_control(sensor_humiture_handle_t sensor, sensor_command_t cmd, void *args);
193193

194194
#ifdef __cplusplus
195-
extern "C"
196195
}
197196
#endif
198197

components/sensors/sensor_hub/include/hal/imu_hal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ esp_err_t imu_acquire(sensor_imu_handle_t sensor, sensor_data_group_t *data_grou
197197
esp_err_t imu_control(sensor_imu_handle_t sensor, sensor_command_t cmd, void *args);
198198

199199
#ifdef __cplusplus
200-
extern "C"
201200
}
202201
#endif
203202

components/sensors/sensor_hub/include/hal/light_sensor_hal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ esp_err_t light_sensor_acquire(sensor_light_handle_t sensor, sensor_data_group_t
220220
esp_err_t light_sensor_control(sensor_light_handle_t sensor, sensor_command_t cmd, void *args);
221221

222222
#ifdef __cplusplus
223-
extern "C"
224223
}
225224
#endif
226225

components/sensors/sensor_hub/include/iot_sensor_hub.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ esp_err_t iot_sensor_handler_register_with_type(sensor_type_t sensor_type, int32
227227
esp_err_t iot_sensor_handler_unregister_with_type(sensor_type_t sensor_type, int32_t event_id, sensor_event_handler_instance_t context);
228228

229229
#ifdef __cplusplus
230-
extern "C"
231230
}
232231
#endif
233232
#endif

components/sensors/sensor_hub/include/sensor_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ typedef struct {
203203
typedef struct {
204204
sensor_type_t type; /*!< sensor type */
205205
sensor_driver_handle_t (*create)(bus_handle_t, const char *sensor_name, uint8_t addr); /*!< create a sensor */
206-
esp_err_t (*delete)(sensor_driver_handle_t *); /*!< delete a sensor */
206+
esp_err_t (*remove)(sensor_driver_handle_t *); /*!< delete a sensor */
207207
esp_err_t (*acquire)(sensor_driver_handle_t, sensor_data_group_t *); /*!< acquire a group of sensor data */
208208
esp_err_t (*control)(sensor_driver_handle_t, sensor_command_t cmd, void *args); /*!< modify the sensor configuration */
209209
} iot_sensor_impl_t;

components/sensors/sensor_hub/iot_sensor_hub.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static iot_sensor_impl_t s_sensor_impls[] = {
101101
{
102102
.type = HUMITURE_ID,
103103
.create = humiture_create,
104-
.delete = humiture_delete,
104+
.remove = humiture_delete,
105105
.acquire = humiture_acquire,
106106
.control = humiture_control,
107107
},
@@ -110,7 +110,7 @@ static iot_sensor_impl_t s_sensor_impls[] = {
110110
{
111111
.type = IMU_ID,
112112
.create = imu_create,
113-
.delete = imu_delete,
113+
.remove = imu_delete,
114114
.acquire = imu_acquire,
115115
.control = imu_control,
116116
},
@@ -119,7 +119,7 @@ static iot_sensor_impl_t s_sensor_impls[] = {
119119
{
120120
.type = LIGHT_SENSOR_ID,
121121
.create = light_sensor_create,
122-
.delete = light_sensor_delete,
122+
.remove = light_sensor_delete,
123123
.acquire = light_sensor_acquire,
124124
.control = light_sensor_control,
125125
},
@@ -567,7 +567,7 @@ esp_err_t iot_sensor_delete(sensor_handle_t p_sensor_handle)
567567
ESP_LOGW(TAG, "sensor set power failed ret = %s", esp_err_to_name(ret));
568568
}
569569

570-
ret = sensor->impl->delete (&sensor->driver_handle);
570+
ret = sensor->impl->remove(&sensor->driver_handle);
571571
SENSOR_CHECK(ret == ESP_OK && sensor->driver_handle == NULL, "sensor driver delete failed", ret);
572572

573573
/*free the resource then set handle to NULL*/

0 commit comments

Comments
 (0)