Other Parts Discussed in Thread: CC2640R2F
chipset: CC2640R2F
sdk: simplelink_cc13x2_26x2_sdk_2_40_00_81
IDE: IAR8.22.2
您好
我寫了2個藍芽notify function分別為Ble_Send_Task跟Ble_Send_Task_251用來傳送DATA,寫法基本一樣,差異只有藍芽傳送封包長度
現在遇到使用Ble_Send_Task 傳送數據後,disconnect再次連接devic是可以成功的,功能也正常
使用Ble_Send_Task_251後卻不能再次連線,後來發現是在SimplePeripheral_taskFxn 的for loop中ICall_fetchServiceMsg這個fxn回傳值不為ICALL_ERRNO_SUCCESS
導致後面GAP paring也沒辦法
使用Ble_Send_Task_251後ICall_fetchServiceMsg只會回傳ICALL_ERRNO_NOMSG
Please Suggest what could be going wrong.
Regards
// Application main loop
for (;;)
{
uint32_t events;
// Waits for an event to be posted associated with the calling thread.
// Note that an event associated with a thread is posted when a
// message is queued to the message receive queue of the thread
events = Event_pend(syncEvent, Event_Id_NONE, SP_ALL_EVENTS,
ICALL_TIMEOUT_FOREVER);
if (events)
{
ICall_EntityID dest;
ICall_ServiceEnum src;
ICall_HciExtEvt *pMsg = NULL;
// Fetch any available messages that might have been sent from the stack
msgreturn = ICall_fetchServiceMsg(&src, &dest,
(void **)&pMsg);
if (msgreturn == ICALL_ERRNO_SUCCESS)
{
uint8_t safeToDealloc = TRUE;
if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity))
{
ICall_Stack_Event *pEvt = (ICall_Stack_Event *)pMsg;
// Check for BLE stack events first
if (pEvt->signature != 0xffff)
{
// Process inter-task message
safeToDealloc = SimplePeripheral_processStackMsg((ICall_Hdr *)pMsg);
}
}
void Ble_Send_Task_251(void)
{
uint16_t len;
bStatus_t status;
attHandleValueNoti_t notify_back;
notify_back.pValue=(uint8*)GATT_bm_alloc(gapConnHandle, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &len);
if(notify_back.pValue != NULL)
{
notify_back.len = 220;
notify_back.handle = 0x0029;
memcpy(notify_back.pValue, Master_Command251, 220);
status = GATT_Notification(gapConnHandle, ¬ify_back, FALSE);
if(status != SUCCESS)
{
GATT_bm_free( (gattMsg_t *)¬ify_back, ATT_HANDLE_VALUE_NOTI );
}
}
else
{
GATT_bm_free( (gattMsg_t *)¬ify_back, ATT_HANDLE_VALUE_NOTI );
}
}
/*Ble_Send notify*/
void Ble_Send_Task(void)
{
uint16_t len;
bStatus_t status;
attHandleValueNoti_t notify_back;
notify_back.pValue=(uint8*)GATT_bm_alloc(gapConnHandle, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &len);
if(notify_back.pValue != NULL)
{
notify_back.len = 20;
notify_back.handle = 0x0029;
memcpy(notify_back.pValue, Master_Command, 20);
status = GATT_Notification(gapConnHandle, ¬ify_back, FALSE);
test_status=status;
if(status != SUCCESS)
{
GATT_bm_free( (gattMsg_t *)¬ify_back, ATT_HANDLE_VALUE_NOTI );
}
}
else
{
GATT_bm_free( (gattMsg_t *)¬ify_back, ATT_HANDLE_VALUE_NOTI );
}
}