I am trying to do a GATT write character value from the device to an iPhone.
A few things behind our project:
The 2640 acts as a peripheral based off of the simple_peripheral_app example.
I know the handle of the value I am writing to. I used Nordic's MasterControlPannel to write to that handle, and it worked.
Here is the code I am using to write a value from the device to the phone:
attWriteReq_t req;
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &bleconnHandle);
req.pValue = GATT_bm_alloc(bleconnHandle, ATT_WRITE_REQ, 1, NULL);
if ( req.pValue != NULL )
{
req.handle = 0x0068;
req.len = 1;
req.pValue[0] = 0x02;
req.sig = 0;
req.cmd = 1;
status = GATT_WriteCharValue(bleconnHandle, &req, selfEntity);
if ( status != SUCCESS )
{
GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
}
}
I am getting the status and not SUCCESS. Is there anything I might be doing wrong, or something I haven’t initialized in order to do the GATT write?