Tool/software: TI C/C++ Compiler
Hello Guys,
I am facing problem while i am trying to autoconnect after discovery from central on BLE 5. In the SimpleCentral_processAppMsg function, I am calling the SimpleCentral_doConnect function in SC_EVT_SCAN_DISABLED case, that means the discovery has ended right? Anyways, when I call the SimpleCentral_doConnect function in a for loop with the number of discovered devices, I am not able to connect. It reurns me Pairing failure: 8. Also. when I use the manual buttons on the launch pad and connect to the same device it does connect. What am I missing here?
case SC_EVT_SCAN_DISABLED: { uint8_t numReport; uint8_t i; static uint8_t* pAddrs = NULL; uint8_t* pAddrTemp; uint8_t pAddr; uint16_t itemsToEnable = SC_ITEM_STARTDISC | SC_ITEM_SCANPHY; #if (DEFAULT_DEV_DISC_BY_SVC_UUID == TRUE) numReport = numScanRes; #else // !DEFAULT_DEV_DISC_BY_SVC_UUID GapScan_Evt_AdvRpt_t advRpt; GapScan_Evt_AdvRpt_t advReport; numReport = ((GapScan_Evt_End_t*) (pMsg->pData))->numReport; #endif // DEFAULT_DEV_DISC_BY_SVC_UUID Display_printf(dispHandle, SC_ROW_NON_CONN, 0, "%d devices discovered", numReport); if (nonConnectableScan==TRUE) { connectableScan = FALSE; if(numReport!=0) { Display_printf(dispHandle, 16, 0, "Storing scanned devices"); for (i=0;i<=numReport;i++) { GapScan_getAdvReport(i, &advReport); memcpy(pAddr, Util_convertBdAddr2Str(advReport.addr), SC_ADDR_STR_SIZE); storeDevDisc(pAddr); } Display_printf(dispHandle, 17, 0, "Stored scanned devices"); } enableConnectableScan(); SimpleCentral_doDiscoverDevices(0); } else { if(numReport!=0) { Display_printf(dispHandle, 16,0, "Trying to connect to discovered connectable devices" ); for(i = 0; i < = numReport; i++) { SimpleCentral_doConnect(i); } } enableNonConnectableScan(); SimpleCentral_doDiscoverDevices(0); }