blob: 91cf5145a8ed4910fd413ed0e5a251f36df9d45c [file] [log] [blame]
Roshan Pius3c4e8a32016-10-03 14:53:58 -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_chip.h"
18
19#include <android-base/logging.h>
20
21#include "failure_reason_util.h"
22
23namespace android {
24namespace hardware {
25namespace wifi {
Roshan Pius79a99752016-10-04 13:03:58 -070026namespace V1_0 {
27namespace implementation {
Roshan Pius3c4e8a32016-10-03 14:53:58 -070028
Roshan Piusaabe5752016-09-29 09:03:59 -070029WifiChip::WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal)
30 : legacy_hal_(legacy_hal) {}
Roshan Pius3c4e8a32016-10-03 14:53:58 -070031
Roshan Piusaabe5752016-09-29 09:03:59 -070032void WifiChip::invalidate() {
33 legacy_hal_.reset();
Roshan Pius3c4e8a32016-10-03 14:53:58 -070034 callbacks_.clear();
35}
36
37Return<void> WifiChip::registerEventCallback(
Roshan Pius79a99752016-10-04 13:03:58 -070038 const sp<IWifiChipEventCallback>& callback) {
Roshan Piusaabe5752016-09-29 09:03:59 -070039 if (!legacy_hal_.lock())
Roshan Pius79a99752016-10-04 13:03:58 -070040 return Void();
Roshan Pius3c4e8a32016-10-03 14:53:58 -070041 // TODO(b/31632518): remove the callback when the client is destroyed
42 callbacks_.insert(callback);
43 return Void();
44}
45
46Return<void> WifiChip::getAvailableModes(getAvailableModes_cb cb) {
Roshan Piusaabe5752016-09-29 09:03:59 -070047 if (!legacy_hal_.lock()) {
Roshan Pius3c4e8a32016-10-03 14:53:58 -070048 cb(hidl_vec<ChipMode>());
49 return Void();
50 } else {
51 // TODO add implementation
52 return Void();
53 }
54}
55
56Return<void> WifiChip::configureChip(uint32_t /*mode_id*/) {
Roshan Piusaabe5752016-09-29 09:03:59 -070057 if (!legacy_hal_.lock())
Roshan Pius79a99752016-10-04 13:03:58 -070058 return Void();
Roshan Pius3c4e8a32016-10-03 14:53:58 -070059 // TODO add implementation
60 return Void();
61}
62
63Return<uint32_t> WifiChip::getMode() {
Roshan Piusaabe5752016-09-29 09:03:59 -070064 if (!legacy_hal_.lock())
Roshan Pius79a99752016-10-04 13:03:58 -070065 return 0;
Roshan Pius3c4e8a32016-10-03 14:53:58 -070066 // TODO add implementation
67 return 0;
68}
69
70Return<void> WifiChip::requestChipDebugInfo() {
Roshan Piusaabe5752016-09-29 09:03:59 -070071 if (!legacy_hal_.lock())
Roshan Pius79a99752016-10-04 13:03:58 -070072 return Void();
Roshan Piusaabe5752016-09-29 09:03:59 -070073 // TODO add implementation
Roshan Pius3c4e8a32016-10-03 14:53:58 -070074 return Void();
75}
76
77Return<void> WifiChip::requestDriverDebugDump() {
78 // TODO implement
79 return Void();
80}
81
82Return<void> WifiChip::requestFirmwareDebugDump() {
83 // TODO implement
84 return Void();
85}
86
Roshan Pius79a99752016-10-04 13:03:58 -070087} // namespace implementation
88} // namespace V1_0
Roshan Pius3c4e8a32016-10-03 14:53:58 -070089} // namespace wifi
90} // namespace hardware
91} // namespace android