Am counting the number of discovered devices in the gDeviceScanned_c event call. For your reference below is the src code of this event method. Let me know if am missing anything here.
static
static void BleApp_ScanningCallback(gapScanningEvent_t *pScanningEvent)
{
switch (pScanningEvent->eventType)
{
case gDeviceScanned_c:
{
(void)Serial_Print(gAppSerMgrIf, "\n\rAddress: ",1);
Serial_PrintDec( gAppSerMgrIf, count );
count++;
(void)Serial_Print(gAppSerMgrIf, " ",1);
Serial_PrintHex( gAppSerMgrIf,
pScanningEvent->eventData.scannedDevice.aAddress,6, 1);
(void)Serial_Print(gAppSerMgrIf, "\r\n ",1);
}
break;
----
}