diff options
Diffstat (limited to 'wifi/1.2/default/wifi_rtt_controller.h')
-rw-r--r-- | wifi/1.2/default/wifi_rtt_controller.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/wifi/1.2/default/wifi_rtt_controller.h b/wifi/1.2/default/wifi_rtt_controller.h new file mode 100644 index 00000000..f1a55da9 --- /dev/null +++ b/wifi/1.2/default/wifi_rtt_controller.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef WIFI_RTT_CONTROLLER_H_ | ||
18 | #define WIFI_RTT_CONTROLLER_H_ | ||
19 | |||
20 | #include <android-base/macros.h> | ||
21 | #include <android/hardware/wifi/1.0/IWifiIface.h> | ||
22 | #include <android/hardware/wifi/1.0/IWifiRttController.h> | ||
23 | #include <android/hardware/wifi/1.0/IWifiRttControllerEventCallback.h> | ||
24 | |||
25 | #include "wifi_legacy_hal.h" | ||
26 | |||
27 | namespace android { | ||
28 | namespace hardware { | ||
29 | namespace wifi { | ||
30 | namespace V1_2 { | ||
31 | namespace implementation { | ||
32 | |||
33 | /** | ||
34 | * HIDL interface object used to control all RTT operations. | ||
35 | */ | ||
36 | class WifiRttController : public V1_0::IWifiRttController { | ||
37 | public: | ||
38 | WifiRttController(const sp<IWifiIface>& bound_iface, | ||
39 | const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal); | ||
40 | // Refer to |WifiChip::invalidate()|. | ||
41 | void invalidate(); | ||
42 | bool isValid(); | ||
43 | std::vector<sp<IWifiRttControllerEventCallback>> getEventCallbacks(); | ||
44 | |||
45 | // HIDL methods exposed. | ||
46 | Return<void> getBoundIface(getBoundIface_cb hidl_status_cb) override; | ||
47 | Return<void> registerEventCallback( | ||
48 | const sp<IWifiRttControllerEventCallback>& callback, | ||
49 | registerEventCallback_cb hidl_status_cb) override; | ||
50 | Return<void> rangeRequest(uint32_t cmd_id, | ||
51 | const hidl_vec<RttConfig>& rtt_configs, | ||
52 | rangeRequest_cb hidl_status_cb) override; | ||
53 | Return<void> rangeCancel(uint32_t cmd_id, | ||
54 | const hidl_vec<hidl_array<uint8_t, 6>>& addrs, | ||
55 | rangeCancel_cb hidl_status_cb) override; | ||
56 | Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override; | ||
57 | Return<void> setLci(uint32_t cmd_id, | ||
58 | const RttLciInformation& lci, | ||
59 | setLci_cb hidl_status_cb) override; | ||
60 | Return<void> setLcr(uint32_t cmd_id, | ||
61 | const RttLcrInformation& lcr, | ||
62 | setLcr_cb hidl_status_cb) override; | ||
63 | Return<void> getResponderInfo(getResponderInfo_cb hidl_status_cb) override; | ||
64 | Return<void> enableResponder(uint32_t cmd_id, | ||
65 | const WifiChannelInfo& channel_hint, | ||
66 | uint32_t max_duration_seconds, | ||
67 | const RttResponder& info, | ||
68 | enableResponder_cb hidl_status_cb) override; | ||
69 | Return<void> disableResponder(uint32_t cmd_id, | ||
70 | disableResponder_cb hidl_status_cb) override; | ||
71 | |||
72 | private: | ||
73 | // Corresponding worker functions for the HIDL methods. | ||
74 | std::pair<WifiStatus, sp<IWifiIface>> getBoundIfaceInternal(); | ||
75 | WifiStatus registerEventCallbackInternal( | ||
76 | const sp<IWifiRttControllerEventCallback>& callback); | ||
77 | WifiStatus rangeRequestInternal(uint32_t cmd_id, | ||
78 | const std::vector<RttConfig>& rtt_configs); | ||
79 | WifiStatus rangeCancelInternal( | ||
80 | uint32_t cmd_id, const std::vector<hidl_array<uint8_t, 6>>& addrs); | ||
81 | std::pair<WifiStatus, RttCapabilities> getCapabilitiesInternal(); | ||
82 | WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci); | ||
83 | WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr); | ||
84 | std::pair<WifiStatus, RttResponder> getResponderInfoInternal(); | ||
85 | WifiStatus enableResponderInternal(uint32_t cmd_id, | ||
86 | const WifiChannelInfo& channel_hint, | ||
87 | uint32_t max_duration_seconds, | ||
88 | const RttResponder& info); | ||
89 | WifiStatus disableResponderInternal(uint32_t cmd_id); | ||
90 | |||
91 | sp<IWifiIface> bound_iface_; | ||
92 | std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; | ||
93 | std::vector<sp<IWifiRttControllerEventCallback>> event_callbacks_; | ||
94 | bool is_valid_; | ||
95 | |||
96 | DISALLOW_COPY_AND_ASSIGN(WifiRttController); | ||
97 | }; | ||
98 | |||
99 | } // namespace implementation | ||
100 | } // namespace V1_2 | ||
101 | } // namespace wifi | ||
102 | } // namespace hardware | ||
103 | } // namespace android | ||
104 | |||
105 | #endif // WIFI_RTT_CONTROLLER_H_ | ||