blob: c0d0a0054d70219a7e07cabca1e87e2f266ea6f1 [file] [log] [blame]
Roshan Pius59268282016-10-06 20:23:47 -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_rtt_controller.h"
18
19#include <android-base/logging.h>
20
Roshan Pius734fea02016-10-11 08:30:28 -070021#include "wifi_status_util.h"
Roshan Pius59268282016-10-06 20:23:47 -070022
23namespace android {
24namespace hardware {
25namespace wifi {
26namespace V1_0 {
27namespace implementation {
28
29WifiRttController::WifiRttController(
30 const sp<IWifiIface>& bound_iface,
31 const std::weak_ptr<WifiLegacyHal> legacy_hal)
32 : bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {}
33
34void WifiRttController::invalidate() {
35 legacy_hal_.reset();
36 is_valid_ = false;
37}
38
Roshan Pius734fea02016-10-11 08:30:28 -070039Return<void> WifiRttController::getBoundIface(getBoundIface_cb hidl_status_cb) {
40 if (!is_valid_) {
41 hidl_status_cb(
42 createWifiStatus(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID),
43 nullptr);
44 return Void();
45 }
46 hidl_status_cb(createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_);
Roshan Pius59268282016-10-06 20:23:47 -070047 return Void();
48}
49
50} // namespace implementation
51} // namespace V1_0
52} // namespace wifi
53} // namespace hardware
54} // namespace android