GSCAN_ATTRIBUTE_NUM_AP_PER_SCAN,\r
GSCAN_ATTRIBUTE_REPORT_THRESHOLD,\r
GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE,\r
+ GSCAN_ATTRIBUTE_REPORT_THRESHOLD_NUM_SCANS,\r
GSCAN_ATTRIBUTE_BAND = GSCAN_ATTRIBUTE_BUCKETS_BAND,\r
\r
GSCAN_ATTRIBUTE_ENABLE_FEATURE = 20,\r
GSCAN_ATTRIBUTE_SCAN_RESULTS, /* flat array of wifi_scan_result */\r
GSCAN_ATTRIBUTE_NUM_CHANNELS,\r
GSCAN_ATTRIBUTE_CHANNEL_LIST,\r
+ GSCAN_ATTRIBUTE_SCAN_ID,\r
+ GSCAN_ATTRIBUTE_SCAN_FLAGS,\r
\r
/* remaining reserved for additional attributes */\r
\r
return result;\r
}\r
\r
+ result = request.put_u32(GSCAN_ATTRIBUTE_REPORT_THRESHOLD_NUM_SCANS, mParams->report_threshold_num_scans);\r
+ if (result < 0) {\r
+ return result;\r
+ }\r
+\r
result = request.put_u32(GSCAN_ATTRIBUTE_NUM_BUCKETS, mParams->num_buckets);\r
if (result < 0) {\r
return result;\r
}\r
\r
class GetScanResultsCommand : public WifiCommand {\r
- wifi_cached_scan_results *mResults;\r
+ wifi_cached_scan_results *mScans;\r
int mMax;\r
int *mNum;\r
int mRetrieved;\r
byte mFlush;\r
int mCompleted;\r
+ static const int MAX_RESULTS = 320;\r
+ wifi_scan_result mScanResults[MAX_RESULTS];\r
+ int mNextScanResult;\r
public:\r
GetScanResultsCommand(wifi_interface_handle iface, byte flush,\r
wifi_cached_scan_results *results, int max, int *num)\r
- : WifiCommand(iface, -1), mResults(results), mMax(max), mNum(num),\r
+ : WifiCommand(iface, -1), mScans(results), mMax(max), mNum(num),\r
mRetrieved(0), mFlush(flush), mCompleted(0)\r
{ }\r
\r
mCompleted = it.get_u8();\r
ALOGD("retrieved mCompleted flag : %d", mCompleted);\r
} else if (it.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS || it.get_type() == 0) {\r
+ int scan_id = 0, flags = 0, num = 0;\r
for (nl_iterator it2(it.get()); it2.has_next(); it2.next()) {\r
- int num = 0;\r
- if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS) {\r
+ if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_ID) {\r
+ scan_id = it2.get_u32();\r
+ ALOGD("retrieved scan_id : 0x%0x", scan_id);\r
+ } else if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_FLAGS) {\r
+ flags = it2.get_u8();\r
+ ALOGD("retrieved scan_flags : 0x%0x", flags);\r
+ } else if (it2.get_type() == GSCAN_ATTRIBUTE_NUM_OF_RESULTS) {\r
+ num = it2.get_u32();\r
+ ALOGD("retrieved num_results: %d", num);\r
+ } else if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS) {\r
+ if (mRetrieved >= mMax) {\r
+ ALOGW("Stored %d scans, ignoring excess results", mRetrieved);\r
+ break;\r
+ }\r
num = it2.get_len() / sizeof(wifi_scan_result);\r
- num = min(*mNum - mRetrieved, num);\r
- memcpy(mResults + mRetrieved, it2.get_data(),\r
+ num = min(MAX_RESULTS - mNextScanResult, num);\r
+ num = min((int)MAX_AP_CACHE_PER_SCAN, num);\r
+ memcpy(mScanResults + mNextScanResult, it2.get_data(),\r
sizeof(wifi_scan_result) * num);\r
ALOGD("Retrieved %d scan results", num);\r
wifi_scan_result *results = (wifi_scan_result *)it2.get_data();\r
result->bssid[3], result->bssid[4], result->bssid[5],\r
result->rssi);\r
}\r
- mRetrieved += num;\r
+ mScans[mRetrieved].scan_id = scan_id;\r
+ mScans[mRetrieved].flags = flags;\r
+ mScans[mRetrieved].num_results = num;\r
+ ALOGD("Setting result of scan_id : 0x%0x", mScans[mRetrieved].scan_id);\r
+ memcpy(mScans[mRetrieved].results,\r
+ &(mScanResults[mNextScanResult]), num * sizeof(wifi_scan_result));\r
+ mNextScanResult += num;\r
+ mRetrieved++;\r
} else {\r
ALOGW("Ignoring invalid attribute type = %d, size = %d",\r
it.get_type(), it.get_len());\r