ESP32C6, BLE MESH,使用 Vendor,如何广播信息呢,
Posted: Tue Mar 19, 2024 1:51 am
找到一个 esp_ble_mesh_model_publish(),但是试了好多办法,都没有成功,
esp_ble_mesh_model_publish()说明中提到 esp_ble_mesh_model_pub_t.msg 必须包含一个有效数据,且必须再事件ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT 中调用该函数,但是ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT这个事件如何触发呢?
Code: Select all
esp_ble_mesh_model_pub_t vendor_model_pub_config;
static const esp_ble_mesh_client_op_pair_t vnd_op_pair[] = {
{ ESP_BLE_MESH_VND_MODEL_OP_SEND, ESP_BLE_MESH_VND_MODEL_OP_STATUS },
};
static esp_ble_mesh_client_t vendor_client = {
.op_pair_size = ARRAY_SIZE(vnd_op_pair),
.op_pair = vnd_op_pair,
};
static esp_ble_mesh_model_op_t vnd_op_status[] = {
ESP_BLE_MESH_MODEL_OP(ESP_BLE_MESH_VND_MODEL_OP_STATUS, 2),
ESP_BLE_MESH_MODEL_OP_END,
};
static esp_ble_mesh_model_t vnd_models_cli[] = {
ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_CLIENT,
vnd_op_status, &vendor_model_pub_config, &vendor_client),
};