Page 1 of 1

ESP32蓝牙mesh的订阅问题

Posted: Sat Sep 16, 2023 3:11 am
by XiongJL001
基于ESP32C3 IDF 4.4.5 在蓝牙mesh的provisioner中怎么给设置节点的订阅,我写的这个函数为啥实现不了

Code: Select all

void subsetstatustmp(void)
{
    esp_ble_mesh_client_common_param_t common = {0};
    esp_ble_mesh_cfg_client_set_state_t set = {0};
    esp_ble_mesh_node_t *node = NULL;
    esp_err_t err;
    node = esp_ble_mesh_provisioner_get_node_with_addr(0x00a0);
    if (!node) {
        ESP_LOGE(TAG, "Failed to get node 0x%04x info", 0x00a0);
        return;
    }   
    ble_mesh_set_msg_common(&common, node, config_client.model, ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD);
    set.model_sub_add.element_addr = node->unicast_addr;
    set.model_sub_add.sub_addr = 0xc00c;
    set.model_sub_add.model_id = ESP_BLE_MESH_VND_MODEL_ID_SERVER;
    set.model_sub_add.company_id = CID_ESP;
    err = esp_ble_mesh_config_client_set_state(&common, &set);
    if (err != ESP_OK) {
        ESP_LOGE(TAG, "Failed to send Config Model SUB add");
    } 
}