Ahmed ElArabawy | ec905e6 | 2020-01-10 12:54:25 -0800 | [diff] [blame] | 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 { |
Etan Cohen | 067e119 | 2020-02-15 17:36:36 -0800 | [diff] [blame] | 28 | namespace nl80211 { |
Ahmed ElArabawy | ec905e6 | 2020-01-10 12:54:25 -0800 | [diff] [blame] | 29 | |
| 30 | DeviceWiphyCapabilities::DeviceWiphyCapabilities() { |
Ahmed ElArabawy | 80f1b52 | 2020-01-18 23:39:28 -0800 | [diff] [blame] | 31 | is80211nSupported_ = false; |
| 32 | is80211acSupported_ = false; |
| 33 | is80211axSupported_ = false; |
| 34 | is160MhzSupported_ = false; |
| 35 | is80p80MhzSupported_ = false; |
| 36 | maxTxStreams_ = 1; |
| 37 | maxRxStreams_ = 1; |
| 38 | } |
Ahmed ElArabawy | ec905e6 | 2020-01-10 12:54:25 -0800 | [diff] [blame] | 39 | |
| 40 | status_t DeviceWiphyCapabilities::writeToParcel(::android::Parcel* parcel) const { |
Ahmed ElArabawy | 80f1b52 | 2020-01-18 23:39:28 -0800 | [diff] [blame] | 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_)); |
Ahmed ElArabawy | ec905e6 | 2020-01-10 12:54:25 -0800 | [diff] [blame] | 48 | return ::android::OK; |
| 49 | } |
| 50 | |
| 51 | status_t DeviceWiphyCapabilities::readFromParcel(const ::android::Parcel* parcel) { |
Ahmed ElArabawy | 80f1b52 | 2020-01-18 23:39:28 -0800 | [diff] [blame] | 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_)); |
Ahmed ElArabawy | ec905e6 | 2020-01-10 12:54:25 -0800 | [diff] [blame] | 59 | |
| 60 | return ::android::OK; |
| 61 | } |
| 62 | |
Etan Cohen | 067e119 | 2020-02-15 17:36:36 -0800 | [diff] [blame] | 63 | } // namespace nl80211 |
Ahmed ElArabawy | ec905e6 | 2020-01-10 12:54:25 -0800 | [diff] [blame] | 64 | } // namespace wifi |
| 65 | } // namespace net |
| 66 | } // namespace android |