status_t status = bleInternalError; pstrConfig->u16ScanInterval = SCANAL_MS_TO_625US_UNITS(pstrConfig->u16ScanInterval); pstrConfig->u16ScanWindow = SCANAL_MS_TO_625US_UNITS(pstrConfig->u16ScanWindow); // Set all scan parameters before enabling the scanner status = GapScan_setPhyParams(translatedPhy, (GapScan_ScanType_t)pstrConfig->u8ScanType, pstrConfig->u16ScanInterval, pstrConfig->u16ScanWindow); if (status == SUCCESS) { status = GapScan_setParam(SCAN_PARAM_PRIM_PHYS, &translatedPhy); } if (status == SUCCESS) { status = GapScan_setParam(SCAN_PARAM_FLT_POLICY, &pstrConfig->u8FilterPolicy); } if (status == SUCCESS) { status = GapScan_setParam(SCAN_PARAM_FLT_DUP, &pstrConfig->u8FilterDuplicates); } if (status == SUCCESS) { // Set initiating PHY parameters status = GapInit_setPhyParam(translatedPhy, INIT_PHYPARAM_CONN_INT_MIN, u16INIT_CONN_INTERVAL_MIN_VAL); status = GapInit_setPhyParam(translatedPhy, INIT_PHYPARAM_CONN_INT_MAX, u16INIT_CONN_INTERVAL_MAX_VAL); } if (status == SUCCESS) { // NOTE: maxNumReport is hardcoded to 30. Consider making this configurable // by adding it to the SCANAL_tstrConfigParam struct if needed. SCANAL_u8BeforeSCANEnable++; status = GapScan_enable(pstrConfig->u16Period, pstrConfig->u16Duration, 30u); SCANAL_u8AfterSCANEnable++; }