Wlan Scan giving less number of AP's than available AP most of the time .
long lRetVal = -1;
unsigned char i;
unsigned short ucIndex;
unsigned char ucpolicyOpt;
// Wlan Network Entry
union
{
unsigned char ucPolicy[4];
unsigned int uiPolicyLen;
}policyVal;
//
// enable scan
//
ucpolicyOpt = SL_SCAN_POLICY(1);
//
// set scan cycle to 10 seconds
//
policyVal.uiPolicyLen = 10;
//
// set scan policy - this starts the scan
//
lRetVal = sl_WlanPolicySet(SL_POLICY_SCAN , ucpolicyOpt,
(unsigned char*)(policyVal.ucPolicy), sizeof(policyVal));
if(lRetVal!=0)
{
#ifdef DEBUG_MSG
Message("policy not set\n\r");
#endif
//UART_PRINT("Unable to set the Scan Policy\n\r");
//Send msg to BLE
}
Task_sleep(1000); /* giving 1s delay */
//
// get scan results - all 20 entries in one transaction
//
ucIndex = 0;
//
// retVal indicates the valid number of entries
// The scan results are occupied in netEntries[]
//
for(i=0;i<3;i++){ /* trying three time to get more num of AP */
valid_ap = sl_WlanGetNetworkList(ucIndex, (unsigned char)WLAN_SCAN_COUNT,
&netEntries[ucIndex]);
}
if(valid_ap ==0)
{
#ifdef DEBUG_MSG
Message("profiles not received\n\r");
#endif
//UART_PRINT("Unable to retreive the network list\n\r");
//Send msg to BLE
}
for(i=0;i<valid_ap;i++){
Report("%s\n\r",netEntries[i].ssid);
}