diff options
author | Ningyuan Wang | 2016-09-20 13:00:11 -0500 |
---|---|---|
committer | Ningyuan Wang | 2016-09-20 13:11:55 -0500 |
commit | c9566b1dc5f3bd92e03ed8806e59af9cba2b672f (patch) | |
tree | 7f74c626ee00f039db4657d189ab6dc79697d4c7 /net | |
parent | a12253e46c1328548c4b37d7f365b4009a6e5776 (diff) | |
download | system-connectivity-wificond-c9566b1dc5f3bd92e03ed8806e59af9cba2b672f.tar.gz system-connectivity-wificond-c9566b1dc5f3bd92e03ed8806e59af9cba2b672f.tar.xz system-connectivity-wificond-c9566b1dc5f3bd92e03ed8806e59af9cba2b672f.zip |
Notify scan aborted events
Bug: 31495091
Test: compile, manual tests
Change-Id: I94c50f44449bd1f0c7c445775434a34d5ca7390a
Diffstat (limited to 'net')
-rw-r--r-- | net/netlink_manager.cpp | 19 | ||||
-rw-r--r-- | net/netlink_manager.h | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/net/netlink_manager.cpp b/net/netlink_manager.cpp index 3469dc3..e17f25c 100644 --- a/net/netlink_manager.cpp +++ b/net/netlink_manager.cpp | |||
@@ -449,7 +449,10 @@ void NetlinkManager::BroadcastHandler(unique_ptr<const NL80211Packet> packet) { | |||
449 | // There is another scan result notification: NL80211_CMD_SCHED_SCAN_RESULTS. | 449 | // There is another scan result notification: NL80211_CMD_SCHED_SCAN_RESULTS. |
450 | // which is used by PNO scan. Wificond is not going to handle that at this | 450 | // which is used by PNO scan. Wificond is not going to handle that at this |
451 | // time. | 451 | // time. |
452 | if (command == NL80211_CMD_NEW_SCAN_RESULTS) { | 452 | if (command == NL80211_CMD_NEW_SCAN_RESULTS || |
453 | // Scan was aborted, for unspecified reasons.partial scan results may be | ||
454 | // available. | ||
455 | command == NL80211_CMD_SCAN_ABORTED) { | ||
453 | OnScanResultsReady(std::move(packet)); | 456 | OnScanResultsReady(std::move(packet)); |
454 | } | 457 | } |
455 | } | 458 | } |
@@ -460,6 +463,10 @@ void NetlinkManager::OnScanResultsReady(unique_ptr<const NL80211Packet> packet) | |||
460 | LOG(ERROR) << "Failed to get interface index from scan result notification"; | 463 | LOG(ERROR) << "Failed to get interface index from scan result notification"; |
461 | return; | 464 | return; |
462 | } | 465 | } |
466 | bool aborted = false; | ||
467 | if (packet->GetCommand() == NL80211_CMD_SCAN_ABORTED) { | ||
468 | aborted = true; | ||
469 | } | ||
463 | 470 | ||
464 | auto handler = on_scan_result_ready_handler_.find(if_index); | 471 | auto handler = on_scan_result_ready_handler_.find(if_index); |
465 | if (handler == on_scan_result_ready_handler_.end()) { | 472 | if (handler == on_scan_result_ready_handler_.end()) { |
@@ -471,7 +478,9 @@ void NetlinkManager::OnScanResultsReady(unique_ptr<const NL80211Packet> packet) | |||
471 | vector<vector<uint8_t>> ssids; | 478 | vector<vector<uint8_t>> ssids; |
472 | NL80211NestedAttr ssids_attr(0); | 479 | NL80211NestedAttr ssids_attr(0); |
473 | if (!packet->GetAttribute(NL80211_ATTR_SCAN_SSIDS, &ssids_attr)) { | 480 | if (!packet->GetAttribute(NL80211_ATTR_SCAN_SSIDS, &ssids_attr)) { |
474 | LOG(WARNING) << "Failed to get scan ssids from scan result notification"; | 481 | if (!aborted) { |
482 | LOG(WARNING) << "Failed to get scan ssids from scan result notification"; | ||
483 | } | ||
475 | } else { | 484 | } else { |
476 | if (!ssids_attr.GetListOfAttributeValues(&ssids)) { | 485 | if (!ssids_attr.GetListOfAttributeValues(&ssids)) { |
477 | return; | 486 | return; |
@@ -480,14 +489,16 @@ void NetlinkManager::OnScanResultsReady(unique_ptr<const NL80211Packet> packet) | |||
480 | vector<uint32_t> freqs; | 489 | vector<uint32_t> freqs; |
481 | NL80211NestedAttr freqs_attr(0); | 490 | NL80211NestedAttr freqs_attr(0); |
482 | if (!packet->GetAttribute(NL80211_ATTR_SCAN_FREQUENCIES, &freqs_attr)) { | 491 | if (!packet->GetAttribute(NL80211_ATTR_SCAN_FREQUENCIES, &freqs_attr)) { |
483 | LOG(WARNING) << "Failed to get scan freqs from scan result notification"; | 492 | if (!aborted) { |
493 | LOG(WARNING) << "Failed to get scan freqs from scan result notification"; | ||
494 | } | ||
484 | } else { | 495 | } else { |
485 | if (!freqs_attr.GetListOfAttributeValues(&freqs)) { | 496 | if (!freqs_attr.GetListOfAttributeValues(&freqs)) { |
486 | return; | 497 | return; |
487 | } | 498 | } |
488 | } | 499 | } |
489 | // Run scan result notification handler. | 500 | // Run scan result notification handler. |
490 | handler->second(if_index, ssids, freqs); | 501 | handler->second(if_index, aborted, ssids, freqs); |
491 | } | 502 | } |
492 | 503 | ||
493 | void NetlinkManager::SubscribeScanResultNotification( | 504 | void NetlinkManager::SubscribeScanResultNotification( |
diff --git a/net/netlink_manager.h b/net/netlink_manager.h index 36f2772..c61fb6d 100644 --- a/net/netlink_manager.h +++ b/net/netlink_manager.h | |||
@@ -48,12 +48,14 @@ struct MessageType { | |||
48 | // This describes a type of function handling scan results ready notification. | 48 | // This describes a type of function handling scan results ready notification. |
49 | // |interface_index| is the index of interface which the scan results | 49 | // |interface_index| is the index of interface which the scan results |
50 | // are from. | 50 | // are from. |
51 | // |aborted| is a boolean indicating if this scan request was aborted or not. | ||
51 | // |ssids| is a vector of scan ssids associated with the corresponding | 52 | // |ssids| is a vector of scan ssids associated with the corresponding |
52 | // scan request. | 53 | // scan request. |
53 | // |frequencies| is a vector of scan frequencies associated with the | 54 | // |frequencies| is a vector of scan frequencies associated with the |
54 | // corresponding scan request. | 55 | // corresponding scan request. |
55 | typedef std::function<void( | 56 | typedef std::function<void( |
56 | uint32_t interface_index, | 57 | uint32_t interface_index, |
58 | bool aborted, | ||
57 | std::vector<std::vector<uint8_t>>& ssids, | 59 | std::vector<std::vector<uint8_t>>& ssids, |
58 | std::vector<uint32_t>& frequencies)> OnScanResultsReadyHandler; | 60 | std::vector<uint32_t>& frequencies)> OnScanResultsReadyHandler; |
59 | 61 | ||