Part Number: CC2652R
I wrote a small function accessible by the menu in simple_central.c
/*********************************************************************
* @fn SimpleCentral_enableNotif
*
* @brief Enable Notifications
*
* @param index - NOT USED
*
* @return always true
*/
bool SimpleCentral_enableNotif(uint8_t index) {
uint8_t connIndex = SimpleCentral_getConnIndex(scConnHandle);
status_t status;
attWriteReq_t req;
req.pValue = GATT_bm_alloc(scConnHandle, ATT_WRITE_REQ, 2, NULL);
if (req.pValue != NULL) {
req.handle = connList[connIndex].charHandle;
req.len = 2;
req.pValue[0] = LO_UINT16(GATT_CLIENT_CFG_NOTIFY);
req.pValue[1] = HI_UINT16(GATT_CLIENT_CFG_NOTIFY);
req.sig = 0;
req.cmd = 0;
status = GATT_WriteCharValue(scConnHandle, &req, selfEntity);
if (status != SUCCESS) {
GATT_bm_free((gattMsg_t*) &req, ATT_WRITE_REQ);
}
}
return (true);
}
This is called after BLE_DISC_STATE_CHAR has been encountered and the charHandle has been set. I get status = 0x00 from the function but in SimpleCentral_processGATTMsg I end up with a write error (0x03). I'm pretty confused about getting these notifications enabled. They work on my iPhone central apps, so I know the peripheral is setup correctly and pushing notifications once subscribed.
This example helped a lot and is very near what I'm doing. So I assume it has to do with the handle, do I need to find the CCCD to pass? And how?
SDK 5.20.00.52