发送部分代码在simpleProfileChangeCB( uint8 paramID )中:
while(diff>=20)
{
for(i=0; i<20; i++)
{
senddata[i] = serialbuffer[send_bytes + i];
}
SimpleGATTprofile_Char6_Notify(ConnHandle, senddata, i);
//j++;
send_bytes += 20;
diff -= 20;
/*if(j == 4)
{
Delay_ms(1120);
//osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
j = 0;
}*/
//SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR6, 20, &senddata);
}
这是通知SimpleGATTprofile_Char6_Notify中的代码:
//读出CCC的值Return = GATTServApp_ReadCharCfg(ConnHandle, simpleProfileChar6Config); //判断是否打开通知开关,打开了则发送数据 if (Return & GATT_CLIENT_CFG_NOTIFY) { //填充数据
Noti.handle = simpleProfileAttrTbl[ATTRTBL_CHAR6_VALUE_IDX].handle;Noti.len = Len;Noti.pValue = GATT_bm_alloc(ConnHandle, ATT_HANDLE_VALUE_NOTI, SIMPLEPROFILE_CHAR6_LEN, NULL);
osal_memcpy(Noti.pValue, Value, Len);
/*if (GATT_Notification(ConnHandle, &Noti, FALSE)!= SUCCESS)
{
GATT_bm_free((gattMsg_t *)&Noti, ATT_HANDLE_VALUE_NOTI);
}*/
//发送数据
GATT_Notification(ConnHandle, &Noti, FALSE); }
user5303241:
用的协议栈是BLE-CC254x-1.4.2.2
user5303241:
回复 Alvin Chen:
我改为每发送一条成功就去free下,但是它只接受到几条消息,而且数据的顺序也不对,我用的协议栈是BLE-CC254x-1.4.2.2