blob: b46425be72880e58334d2240c778562dc4c9e560 [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_AP_IFACE_H_
18#define WIFI_AP_IFACE_H_
19
20#include <android-base/macros.h>
21#include <android/hardware/wifi/1.0/IWifiApIface.h>
22
23#include "wifi_legacy_hal.h"
24
25namespace android {
26namespace hardware {
27namespace wifi {
Etan Cohen6ce50902017-09-14 07:30:57 -070028namespace V1_2 {
Roshan Pius3e2d6712016-10-06 13:16:23 -070029namespace implementation {
Roshan Piusdbd83ef2017-06-20 12:05:40 -070030using namespace android::hardware::wifi::V1_0;
Roshan Pius3e2d6712016-10-06 13:16:23 -070031
32/**
33 * HIDL interface object used to control a AP Iface instance.
34 */
Roshan Piusdbd83ef2017-06-20 12:05:40 -070035class WifiApIface : public V1_0::IWifiApIface {
Roshan Pius3e2d6712016-10-06 13:16:23 -070036 public:
37 WifiApIface(const std::string& ifname,
Roshan Pius6cedc972016-10-28 10:11:17 -070038 const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
Roshan Pius3e2d6712016-10-06 13:16:23 -070039 // 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 Pius32fc12e2017-01-25 17:44:42 -080046 Return<void> setCountryCode(const hidl_array<int8_t, 2>& code,
47 setCountryCode_cb hidl_status_cb) override;
Roshan Pius7f4574d2017-02-22 09:48:03 -080048 Return<void> getValidFrequenciesForBand(
49 WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
Roshan Pius3e2d6712016-10-06 13:16:23 -070050
51 private:
Roshan Pius907d4a22016-10-27 12:48:12 -070052 // Corresponding worker functions for the HIDL methods.
53 std::pair<WifiStatus, std::string> getNameInternal();
54 std::pair<WifiStatus, IfaceType> getTypeInternal();
Roshan Pius32fc12e2017-01-25 17:44:42 -080055 WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code);
Roshan Pius7f4574d2017-02-22 09:48:03 -080056 std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
57 getValidFrequenciesForBandInternal(WifiBand band);
Roshan Pius907d4a22016-10-27 12:48:12 -070058
Roshan Pius3e2d6712016-10-06 13:16:23 -070059 std::string ifname_;
Roshan Pius6cedc972016-10-28 10:11:17 -070060 std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
Roshan Pius3e2d6712016-10-06 13:16:23 -070061 bool is_valid_;
62
63 DISALLOW_COPY_AND_ASSIGN(WifiApIface);
64};
65
66} // namespace implementation
Etan Cohen6ce50902017-09-14 07:30:57 -070067} // namespace V1_2
Roshan Pius3e2d6712016-10-06 13:16:23 -070068} // namespace wifi
69} // namespace hardware
70} // namespace android
71
72#endif // WIFI_AP_IFACE_H_