blob: d93281190bec6c132538d601d821168cc64631f6 [file] [log] [blame]
Ahmed ElArabawyec905e62020-01-10 12:54:25 -08001/*
2 * Copyright (C) 2020 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 "device_wiphy_capabilities.h"
18
19#include <android-base/logging.h>
20
21#include "wificond/parcelable_utils.h"
22
23using android::status_t;
24
25namespace android {
26namespace net {
27namespace wifi {
Etan Cohen067e1192020-02-15 17:36:36 -080028namespace nl80211 {
Ahmed ElArabawyec905e62020-01-10 12:54:25 -080029
30DeviceWiphyCapabilities::DeviceWiphyCapabilities() {
Ahmed ElArabawy80f1b522020-01-18 23:39:28 -080031 is80211nSupported_ = false;
32 is80211acSupported_ = false;
33 is80211axSupported_ = false;
34 is160MhzSupported_ = false;
35 is80p80MhzSupported_ = false;
36 maxTxStreams_ = 1;
37 maxRxStreams_ = 1;
38}
Ahmed ElArabawyec905e62020-01-10 12:54:25 -080039
40status_t DeviceWiphyCapabilities::writeToParcel(::android::Parcel* parcel) const {
Ahmed ElArabawy80f1b522020-01-18 23:39:28 -080041 RETURN_IF_FAILED(parcel->writeBool(is80211nSupported_));
42 RETURN_IF_FAILED(parcel->writeBool(is80211acSupported_));
43 RETURN_IF_FAILED(parcel->writeBool(is80211axSupported_));
44 RETURN_IF_FAILED(parcel->writeBool(is160MhzSupported_ ));
45 RETURN_IF_FAILED(parcel->writeBool(is80p80MhzSupported_));
46 RETURN_IF_FAILED(parcel->writeUint32(maxTxStreams_));
47 RETURN_IF_FAILED(parcel->writeUint32(maxRxStreams_));
Ahmed ElArabawyec905e62020-01-10 12:54:25 -080048 return ::android::OK;
49}
50
51status_t DeviceWiphyCapabilities::readFromParcel(const ::android::Parcel* parcel) {
Ahmed ElArabawy80f1b522020-01-18 23:39:28 -080052 RETURN_IF_FAILED(parcel->readBool(&is80211nSupported_));
53 RETURN_IF_FAILED(parcel->readBool(&is80211acSupported_));
54 RETURN_IF_FAILED(parcel->readBool(&is80211axSupported_));
55 RETURN_IF_FAILED(parcel->readBool(&is160MhzSupported_));
56 RETURN_IF_FAILED(parcel->readBool(&is80p80MhzSupported_));
57 RETURN_IF_FAILED(parcel->readUint32(&maxTxStreams_));
58 RETURN_IF_FAILED(parcel->readUint32(&maxRxStreams_));
Ahmed ElArabawyec905e62020-01-10 12:54:25 -080059
60 return ::android::OK;
61}
62
Etan Cohen067e1192020-02-15 17:36:36 -080063} // namespace nl80211
Ahmed ElArabawyec905e62020-01-10 12:54:25 -080064} // namespace wifi
65} // namespace net
66} // namespace android