I'd also like to ask the same question. I've found where these errors are reported in sensor_server.c (see below) so it's clear that the sensor definition needs an array of esp_ble_mesh_sensor_state_t and each of these need a sensor_property_id, at least one state and a raw value. However, it's not clear how to configure these. For example "raw_value" in esp_ble_mesh_sensor_data_t is "struct net_buf_simple" so does it need to be created with the NET_BUF_SIMPLE macro and then initialised with "net_buf_simple_init". An example would be really useful.
Many Thanks
Bob
Code: Select all
static int check_sensor_server_init(struct bt_mesh_sensor_state *state_start,
const u8_t state_count)
{
struct bt_mesh_sensor_state *state = NULL;
struct sensor_setting *setting = NULL;
u8_t i, j;
for (i = 0U; i < state_count; i++) {
state = &state_start[i];
if (state->sensor_property_id == INVALID_SENSOR_PROPERTY_ID) {
BT_ERR("%s, Invalid Sensor Property ID 0x%04x", __func__, state->sensor_property_id);
return -EINVAL;
}
if (state->setting_count == 0U || state->settings == NULL) {
BT_ERR("%s, Invalid Sensor Setting state", __func__);
return -EINVAL;
}
for (j = 0U; j < state->setting_count; j++) {
setting = &state->settings[j];
if (setting->property_id == INVALID_SENSOR_SETTING_PROPERTY_ID || setting->raw == NULL) {
BT_ERR("%s, Invalid Sensor Setting state internal parameter", __func__);
return -EINVAL;
}
}
if (state->cadence) {
if (state->cadence->trigger_delta_down == NULL ||
state->cadence->trigger_delta_up == NULL ||
state->cadence->fast_cadence_low == NULL ||
state->cadence->fast_cadence_high == NULL) {
BT_ERR("%s, Invalid Sensor Cadence state", __func__);
return -EINVAL;
}
}
if (state->sensor_data.raw_value == NULL) {
BT_ERR("%s, Invalid Sensor Data state", __func__);
return -EINVAL;
}
if (state->series_column.raw_value_x == NULL ||
state->series_column.column_width == NULL ||
state->series_column.raw_value_y == NULL) {
BT_ERR("%s, Invalid Sensor Series column state", __func__);
return -EINVAL;
}
}
return 0;
}