如题:
以下是调用的函数,出现的次很多,倒至数据通信超时。
uint8_t label_writedata(uint8_t *data, uint8_t len)
{
// Do a write
attWriteReq_t req;
uint8_t status;
// Allocate GATT write request
req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, len, NULL);//分配内存
// If successfully allocated
if (req.pValue != NULL)
{
// Fill up request
req.handle = 0x17;
req.len = len;
memcpy(req.pValue, data, len);
req.sig = 0;
req.cmd = 1;
// Send GATT write to controller
status = GATT_WriteNoRsp(connHandle, &req);//写ble从机
//status = GATT_WriteLongCharValue(connHandle, &req, selfEntity);
// If not sucessfully sent
if ( status != SUCCESS )
{
// Free write request as the controller will not
GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
}
else
{
Util_restartClock(&startConClock,MR_CONNECT_EVT_PERIOD);//add lhj 191115
}
}
else
{
//GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);//del lhj 191202
status = FAILURE;
}
return status;
}