BLE mesh sensor server model pararmeter settings

Posts: 2
Joined: Thu Mar 26, 2020 12:42 am

BLE mesh sensor server model pararmeter settings

Postby sheldon123z » Sat Apr 04, 2020 10:31 pm


I am very confused about the sensor server model parameter setting. I have referenced the mesh model specification and tried to define a sensor model. However, I don't know how to set the states parameter in the esp_ble_mesh_sensor_srv_t and esp_ble_mesh_sensor_setup_srv_t, so I get errors when flashes the code to the board like this:

Code: Select all

E (1054) BLE_MESH: sensor_server_init, Invalid Sensor state parameter, model_id 0x1100
E (1054) BLE_MESH: sensor_server_init, Invalid parameter, model_id 0x1101
any help?

Posts: 4
Joined: Mon Jan 20, 2020 5:41 pm

Re: BLE mesh sensor server model pararmeter settings

Postby jackland » Thu Apr 30, 2020 7:56 am

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


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;

Who is online

Users browsing this forum: Bing [Bot] and 31 guests