uint16_t Peripheral_ProcessEvent(uint8_t task_id, uint16_t events) { ... if(events & SBP_PERIODIC_EVT) { if(SBP_PERIODIC_EVT_PERIOD) { tmos_start_task(Peripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD); } performPeriodicTask(); return (events ^ SBP_PERIODIC_EVT); } ... } static void performPeriodicTask(void) { uint8_t notiData[SIMPLEPROFILE_CHAR4_LEN] = {0x88}; peripheralChar4Notify(notiData, SIMPLEPROFILE_CHAR4_LEN); } static void peripheralChar4Notify(uint8_t *pValue, uint16_t len) { attHandleValueNoti_t noti; if(len > (peripheralMTU - 3)) { PRINT("Too large noti\r\n"); return; } noti.len = len; noti.pValue = GATT_bm_alloc(peripheralConnList.connHandle, ATT_HANDLE_VALUE_NOTI, noti.len, NULL, 0); if(noti.pValue) { tmos_memcpy(noti.pValue, pValue, noti.len); if(simpleProfile_Notify(peripheralConnList.connHandle, ¬i) != SUCCESS) { GATT_bm_free((gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI); } } }
当BLE调试助手开启Characteristic 4的通知功能 ,上述几个函数将周期向主机发送通知
有几个问题请教各位大神
1、如何触发开启或关闭周期发送通知
2、它是如何知道是gattprofile服务中Characteristic 4 的通知