注意,使用esp_ble_gatts_create_service创建服务时,如果是多个特征需要增加句柄数量。
esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if,
esp_gatt_srvc_id_t *service_id, uint16_t num_handle)
gatts_if:GATT 服务器访问接口
service_id: 服务UUID相关信息
num_handle:
该服务所需的句柄数 service、characteristic declaration、 characteristic value、characteristic description 的句柄数总和。
Demo中用的是4(1+3),如果有两个特征,则为7(1+3+3)
之后再用esp_ble_gatts_add_char添加特征,有几个特征调用几次
博客介绍了使用esp_ble_gatts_create_service创建服务时,若有多个特征需增加句柄数量,说明了函数各参数含义,如gatts_if是GATT服务器访问接口等,还给出不同特征数量对应的句柄数示例,之后提到用esp_ble_gatts_add_char添加特征的调用次数规则。
1298





