blob: a13feeb9a90357f5f46bf0bfae99f65790d02211 [file] [log] [blame]
Roshan Pius3e2d6712016-10-06 13:16:23 -07001/*
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_STA_IFACE_H_
18#define WIFI_STA_IFACE_H_
19
20#include <android-base/macros.h>
21#include <android/hardware/wifi/1.0/IWifiStaIface.h>
Roshan Piusa04ba3f2016-10-27 14:36:26 -070022#include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
Roshan Pius3e2d6712016-10-06 13:16:23 -070023
24#include "wifi_legacy_hal.h"
25
26namespace android {
27namespace hardware {
28namespace wifi {
29namespace V1_0 {
30namespace implementation {
31
32/**
33 * HIDL interface object used to control a STA Iface instance.
34 */
35class WifiStaIface : public IWifiStaIface {
36 public:
37 WifiStaIface(const std::string& ifname,
38 const std::weak_ptr<WifiLegacyHal> legacy_hal);
39 // Refer to |WifiChip::invalidate()|.
40 void invalidate();
Roshan Pius907d4a22016-10-27 12:48:12 -070041 bool isValid();
Roshan Pius3e2d6712016-10-06 13:16:23 -070042
43 // HIDL methods exposed.
Roshan Pius734fea02016-10-11 08:30:28 -070044 Return<void> getName(getName_cb hidl_status_cb) override;
45 Return<void> getType(getType_cb hidl_status_cb) override;
Roshan Piusa04ba3f2016-10-27 14:36:26 -070046 Return<void> registerEventCallback(
47 const sp<IWifiStaIfaceEventCallback>& callback,
48 registerEventCallback_cb hidl_status_cb) override;
49 Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
50 Return<void> getApfPacketFilterCapabilities(
51 getApfPacketFilterCapabilities_cb hidl_status_cb) override;
52 Return<void> installApfPacketFilter(
53 uint32_t cmd_id,
54 const hidl_vec<uint8_t>& program,
55 installApfPacketFilter_cb hidl_status_cb) override;
56 Return<void> getBackgroundScanCapabilities(
57 getBackgroundScanCapabilities_cb hidl_status_cb) override;
58 Return<void> getValidFrequenciesForBackgroundScan(
59 StaBackgroundScanBand band,
60 getValidFrequenciesForBackgroundScan_cb hidl_status_cb) override;
61 Return<void> startBackgroundScan(
62 uint32_t cmd_id,
63 const StaBackgroundScanParameters& params,
64 startBackgroundScan_cb hidl_status_cb) override;
65 Return<void> stopBackgroundScan(
66 uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override;
67 Return<void> enableLinkLayerStatsCollection(
68 bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override;
69 Return<void> disableLinkLayerStatsCollection(
70 disableLinkLayerStatsCollection_cb hidl_status_cb) override;
71 Return<void> getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override;
72 Return<void> startDebugPacketFateMonitoring(
73 startDebugPacketFateMonitoring_cb hidl_status_cb) override;
74 Return<void> stopDebugPacketFateMonitoring(
75 stopDebugPacketFateMonitoring_cb hidl_status_cb) override;
76 Return<void> getDebugTxPacketFates(
77 getDebugTxPacketFates_cb hidl_status_cb) override;
78 Return<void> getDebugRxPacketFates(
79 getDebugRxPacketFates_cb hidl_status_cb) override;
Roshan Pius3e2d6712016-10-06 13:16:23 -070080
81 private:
Roshan Pius907d4a22016-10-27 12:48:12 -070082 // Corresponding worker functions for the HIDL methods.
83 std::pair<WifiStatus, std::string> getNameInternal();
84 std::pair<WifiStatus, IfaceType> getTypeInternal();
Roshan Piusa04ba3f2016-10-27 14:36:26 -070085 WifiStatus registerEventCallbackInternal(
86 const sp<IWifiStaIfaceEventCallback>& callback);
87 std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
88 std::pair<WifiStatus, StaApfPacketFilterCapabilities>
89 getApfPacketFilterCapabilitiesInternal();
90 WifiStatus installApfPacketFilterInternal(
91 uint32_t cmd_id, const std::vector<uint8_t>& program);
92 std::pair<WifiStatus, StaBackgroundScanCapabilities>
93 getBackgroundScanCapabilitiesInternal();
94 std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
95 getValidFrequenciesForBackgroundScanInternal(StaBackgroundScanBand band);
96 WifiStatus startBackgroundScanInternal(
97 uint32_t cmd_id, const StaBackgroundScanParameters& params);
98 WifiStatus stopBackgroundScanInternal(uint32_t cmd_id);
99 WifiStatus enableLinkLayerStatsCollectionInternal(bool debug);
100 WifiStatus disableLinkLayerStatsCollectionInternal();
101 std::pair<WifiStatus, StaLinkLayerStats> getLinkLayerStatsInternal();
102 WifiStatus startDebugPacketFateMonitoringInternal();
103 WifiStatus stopDebugPacketFateMonitoringInternal();
104 std::pair<WifiStatus, std::vector<WifiDebugTxPacketFateReport>>
105 getDebugTxPacketFatesInternal();
106 std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
107 getDebugRxPacketFatesInternal();
Roshan Pius907d4a22016-10-27 12:48:12 -0700108
Roshan Pius3e2d6712016-10-06 13:16:23 -0700109 std::string ifname_;
110 std::weak_ptr<WifiLegacyHal> legacy_hal_;
Roshan Piusa04ba3f2016-10-27 14:36:26 -0700111 std::vector<sp<IWifiStaIfaceEventCallback>> event_callbacks_;
Roshan Pius3e2d6712016-10-06 13:16:23 -0700112 bool is_valid_;
113
114 DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
115};
116
117} // namespace implementation
118} // namespace V1_0
119} // namespace wifi
120} // namespace hardware
121} // namespace android
122
123#endif // WIFI_STA_IFACE_H_