1 /*
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 
23 using android::status_t;
24 
25 namespace android {
26 namespace net {
27 namespace wifi {
28 namespace nl80211 {
29 
DeviceWiphyCapabilities()30 DeviceWiphyCapabilities::DeviceWiphyCapabilities() {
31   is80211nSupported_ = false;
32   is80211acSupported_ = false;
33   is80211axSupported_ = false;
34   is160MhzSupported_ = false;
35   is80p80MhzSupported_ = false;
36   maxTxStreams_ = 1;
37   maxRxStreams_ = 1;
38 }
39 
writeToParcel(::android::Parcel * parcel) const40 status_t DeviceWiphyCapabilities::writeToParcel(::android::Parcel* parcel) const {
41   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_));
48   return ::android::OK;
49 }
50 
readFromParcel(const::android::Parcel * parcel)51 status_t DeviceWiphyCapabilities::readFromParcel(const ::android::Parcel* parcel) {
52   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_));
59 
60   return ::android::OK;
61 }
62 
63 }  // namespace nl80211
64 }  // namespace wifi
65 }  // namespace net
66 }  // namespace android
67