blob: d4656e1224794a1377dfd911dc170b25424345a7 [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_P2P_IFACE_H_
18#define WIFI_P2P_IFACE_H_
19
20#include <android-base/macros.h>
21#include <android/hardware/wifi/1.0/IWifiP2pIface.h>
22
23#include "wifi_legacy_hal.h"
24
25namespace android {
26namespace hardware {
27namespace wifi {
28namespace V1_0 {
29namespace implementation {
30
31/**
32 * HIDL interface object used to control a P2P Iface instance.
33 */
34class WifiP2pIface : public IWifiP2pIface {
35 public:
36 WifiP2pIface(const std::string& ifname,
37 const std::weak_ptr<WifiLegacyHal> legacy_hal);
38 // Refer to |WifiChip::invalidate()|.
39 void invalidate();
Roshan Pius907d4a22016-10-27 12:48:12 -070040 bool isValid();
Roshan Pius3e2d6712016-10-06 13:16:23 -070041
42 // HIDL methods exposed.
Roshan Pius734fea02016-10-11 08:30:28 -070043 Return<void> getName(getName_cb hidl_status_cb) override;
44 Return<void> getType(getType_cb hidl_status_cb) override;
Roshan Pius3e2d6712016-10-06 13:16:23 -070045
46 private:
Roshan Pius907d4a22016-10-27 12:48:12 -070047 // Corresponding worker functions for the HIDL methods.
48 std::pair<WifiStatus, std::string> getNameInternal();
49 std::pair<WifiStatus, IfaceType> getTypeInternal();
50
Roshan Pius3e2d6712016-10-06 13:16:23 -070051 std::string ifname_;
52 std::weak_ptr<WifiLegacyHal> legacy_hal_;
53 bool is_valid_;
54
55 DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
56};
57
58} // namespace implementation
59} // namespace V1_0
60} // namespace wifi
61} // namespace hardware
62} // namespace android
63
64#endif // WIFI_P2P_IFACE_H_