Hello,
I'm using the Simple Central project with the cc2650lp and i'm trying to enable the HID notifications by enabling the CCC in the HID device.
For now i'm using the HidKbd project for the cc2650lp as the keyboard device but in the long run i want to do this with any HID device.
I have modified the SimpleCentral example based on the spp_ble client and it seems that i receive the "enable notification" write request in the HidKbd project but i can't catch any notification on the Central side.
i modified the 'SimpleBLECentral_processGATTDiscEvent' function
static void SimpleBLECentral_processGATTDiscEvent(gattMsgEvent_t *pMsg) { if (discState == BLE_DISC_STATE_MTU) { // MTU size response received, discover simple BLE service if (pMsg->method == ATT_EXCHANGE_MTU_RSP) { uint8_t uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(HIDKBD_SERV_UUID), HI_UINT16(HIDKBD_SERV_UUID) }; // Just in case we're using the default MTU size (23 octets) Display_print1(dispHandle, ROW_THREE, 0, "MTU Size: %d", ATT_MTU_SIZE); discState = BLE_DISC_STATE_SVC; // Discovery simple BLE service VOID GATT_DiscPrimaryServiceByUUID(connHandle, uuid, ATT_BT_UUID_SIZE, selfEntity); } } else if (discState == BLE_DISC_STATE_SVC) { // Service found, store handles if (pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP && pMsg->msg.findByTypeValueRsp.numInfo > 0) { svcStartHdl = ATT_ATTR_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); svcEndHdl = ATT_GRP_END_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); } // If procedure complete if (((pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP) && (pMsg->hdr.status == bleProcedureComplete)) || (pMsg->method == ATT_ERROR_RSP)) { if (svcStartHdl != 0) { GATT_DiscAllCharDescs(connHandle, svcStartHdl, svcEndHdl, selfEntity); discState = BLE_DISC_STATE_CHAR; } } } else if (discState == BLE_DISC_STATE_CHAR) { // Characteristic descriptors found if (pMsg->method == ATT_FIND_INFO_RSP && pMsg->msg.findInfoRsp.numInfo > 0) { uint8_t i; // For each handle/uuid pair for (i = 0; i < pMsg->msg.findInfoRsp.numInfo; i++) { if(pMsg->msg.findInfoRsp.format == ATT_HANDLE_BT_UUID_TYPE) { // Look for CCCD if (ATT_BT_PAIR_UUID(pMsg->msg.findInfoRsp.pInfo, i) == GATT_CLIENT_CHAR_CFG_UUID) { // CCCD found charCCCDHdl = ATT_PAIR_HANDLE(pMsg->msg.findInfoRsp.pInfo, i); break; } } } } // If procedure complete if ((pMsg->method == ATT_FIND_INFO_RSP && pMsg->hdr.status == bleProcedureComplete) || (pMsg->method == ATT_ERROR_RSP)) { SimpleBLECentral_EnableNotification( connHandle, charCCCDHdl ); procedureInProgress = FALSE; discState = BLE_DISC_STATE_IDLE; } } }
and the 'SimpleBLECentral_EnableNotification' is
static void SimpleBLECentral_EnableNotification( uint16 connHandle, uint16 attrHandle ) { attWriteReq_t req; req.pValue = GATT_bm_alloc( connHandle, ATT_WRITE_REQ, 2, NULL ); if ( req.pValue != NULL ) { uint8 notificationsOn[] = {0x01, 0x00}; // attAttribute_t req.handle = attrHandle; req.len = 2; memcpy(req.pValue, notificationsOn, 2); req.sig = FALSE; req.cmd = TRUE; if ( GATT_WriteNoRsp( connHandle, &req ) != SUCCESS ) { GATT_bm_free( (gattMsg_t *)&req, ATT_WRITE_REQ ); } } }
I am able catch the write request of enable notification in the 'HidDev_WriteAttrCB' function in hidKbd project, after notifications are enabled i can't seem to catch (breakpoints and ex..) any Notification on the Central GATT Handlers.
what i'm missing?
Thanks for the help!