Dear all,
I am using CC2650 Launchpad with SimpleCentral on it. I am trying to implement a timeout handler when there is no response after calling GAPCentralRole_EstablishLink.
I found my program stuck at the handler after calling GAPCentralRole_TerminateLink(0xFFFE) and SimpleBLECentral_enqueueMsg.
GAPCentralRole_TerminateLink gave me a result 2, which is invalid parameter.
Here is my code.
if (scanIdx < scanRes) { peerAddr = devList[scanIdx].addr; addrType = devList[scanIdx].addrType; state = BLE_STATE_CONNECTING; ConnState = BLE_CONN_CONNECTING; GAPCentralRole_EstablishLink(DEFAULT_LINK_HIGH_DUTY_CYCLE, DEFAULT_LINK_WHITE_LIST, addrType, peerAddr); scanIdx++; if (scanIdx == scanRes) { scanIdx = 0; } // TODO Add timeout Util_startClock(&startConnClock); }
When timeout, it jumps to the handler and doesn't run anymore.
void SimpleBLECentral_startConnHandler(UArg a0) { // FIXME not work UartPrintf("expired\n\r\n"); GAPCentralRole_TerminateLink(0xFFFE); state = BLE_STATE_IDLE; ConnState = BLE_CONN_READY; discState = BLE_DISC_STATE_IDLE; charHdl = 0; procedureInProgress = FALSE; ActualDev--; #ifdef DEBUGPRINT1 UartPrintf("Disconnected \r\n"); #endif Connect2Dev();// Enqueue here #ifdef DEBUGPRINT1 UartPrintf("Restarting\r\n"); #endif }
Any suggestion is welcomed.