blob: 349a158fb510c04285ef086ceb08626412488794 [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#include "wifi_p2p_iface.h"
18
19#include <android-base/logging.h>
20
21#include "failure_reason_util.h"
22
23namespace android {
24namespace hardware {
25namespace wifi {
26namespace V1_0 {
27namespace implementation {
28
29WifiP2pIface::WifiP2pIface(const std::string& ifname,
30 const std::weak_ptr<WifiLegacyHal> legacy_hal)
31 : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
32
33void WifiP2pIface::invalidate() {
34 legacy_hal_.reset();
35 is_valid_ = false;
36}
37
38Return<void> WifiP2pIface::getName(getName_cb cb) {
39 hidl_string hidl_ifname;
40 hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
41 cb(hidl_ifname);
42 return Void();
43}
44
45Return<IfaceType> WifiP2pIface::getType() {
46 return IfaceType::P2P;
47}
48
49} // namespace implementation
50} // namespace V1_0
51} // namespace wifi
52} // namespace hardware
53} // namespace android