我正在使用调试板,试图获得通知。这在ble_app_peripheral示例中工作,所以我尝试复制它。树立我的个性:
user_custs1_def.h
enum {CUST1_IDX_SVC = 0, CUST1_IDX_CONTROL_POINT_CHAR、CUST1_IDX_CONTROL_POINT_VAL CUST1_IDX_CONTROL_POINT_USER_DESC, CUST1_IDX_LED_STATE_CHAR, CUST1_IDX_LED_STATE_VAL, CUST1_IDX_LED_STATE_USER_DESC, CUST1_IDX_PRESSURE_CHAR, CUST1_IDX_PRESSURE_VAL, CUST1_IDX_PRESSURE_NTF_CFG, CUST1_IDX_PRESSURE_USER_DESC,
user_cust1_def.c
static struct att_char128_desc cust1_pressure_char = {ATT_CHAR_PROP_RD | ATT_CHAR_PROP_NTF, {0,0}, DEF_CUST1_PRESSURE_UUID_128};
/ /压力特征宣言[CUST1_IDX_PRESSURE_CHAR] = {(uint8_t *) &att_decl_char ATT_UUID_16_LEN,烫(RD,启用),sizeof (cust1_pressure_char), sizeof (cust1_pressure_char), (uint8_t *) &cust1_pressure_char}, / /压力特征值[CUST1_IDX_PRESSURE_VAL] = {CUST1_PRESSURE_UUID_128 ATT_UUID_128_LEN,烫(RD,// ADC值1 Client Characteristic Configuration Descriptor [CUST1_IDX_PRESSURE_NTF_CFG] = {(uint8_t*)&att_decl_cfg, ATT_UUID_16_LEN, PERM(RD, ENABLE) | PERM(WR, ENABLE), sizeof(uint16_t), 0, NULL},//压力特性用户描述[CUST1_IDX_PRESSURE_USER_DESC] = {(uint8_t*)&att_decl_user_desc, ATT_UUID_16_LEN, PERM(RD, ENABLE), sizeof(CUST1_PRESSURE_USER_DESC) - 1, sizeof(CUST1_PRESSURE_USER_DESC) - 1, CUST1_PRESSURE_USER_DESC},
设置我正在使用的值:
struct custs1_val_set_req *req = KE_MSG_ALLOC_DYN(custs1_val_set_req, TASK_CUSTS1, TASK_APP, custs1_val_set_req, DEF_CUST1_PRESSURE_CHAR_LEN);申请- > conhdl = app_env - > conhdl;申请- >处理= CUST1_IDX_PRESSURE_VAL;申请- >长度= DEF_CUST1_PRESSURE_CHAR_LEN;浅黄色,memcpy(请求- >价值DEF_CUST1_PRESSURE_CHAR_LEN);ke_msg_send(要求的);
我可以看到,通知是启用的,但我从来没有收到他们在我的BLE测试应用程序。我错过了什么?
谢谢你!
约翰
设备:
嗨,约翰,
发送到sdk配置文件的消息应该是CUSTS1_VAL_NTF_REQ,而不是CUSTS1_VAL_SET_REQ。