IDF注册通知代码如下:
esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,esp_bd_addr_t server_bda, uint16_t handle)
{
btc_msg_t msg = {0};
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_REG_FOR_NOTIFY;
arg.reg_for_notify.gattc_if = gattc_if;
memcpy(arg.reg_for_notify.remote_bda, server_bda, sizeof(esp_bd_addr_t));
arg.reg_for_notify.handle = handle;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
注册结果进入回调前如下:
static void btc_gattc_reg_for_notify(btc_ble_gattc_args_t *arg)
{
tBTA_GATT_STATUS status;
esp_ble_gattc_cb_param_t param;
status = BTA_GATTC_RegisterForNotifications(arg->reg_for_notify.gattc_if,
arg->reg_for_notify.remote_bda,
arg->reg_for_notify.handle);
memset(¶m, 0, sizeof(esp_ble_gattc_cb_param_t));
param.reg_for_notify.status = status;
param.reg_for_notify.handle = arg->reg_for_notify.handle;
btc_gattc_cb_to_app(ESP_GATTC_REG_FOR_NOTIFY_EVT, arg->reg_for_notify.gattc_if, ¶m);
}
我就搞不明白,明明底层带了对等设备地址,为啥传给上层时就给丢掉了。这是逼我自己改底层?开发人员出来挨打!
BLE 多从机通知注册成功时,无法区分是哪个设备的回调。
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 81 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.