Sarah Chin | b071f8a | 2019-11-07 10:43:16 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.1 (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.1 |
| 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 "RadioConfig.h" |
| 18 | |
| 19 | namespace android { |
| 20 | namespace hardware { |
| 21 | namespace radio { |
| 22 | namespace config { |
| 23 | namespace V1_3 { |
| 24 | namespace implementation { |
| 25 | |
| 26 | using namespace ::android::hardware::radio::V1_0; |
| 27 | using namespace ::android::hardware::radio::config; |
| 28 | |
| 29 | // Methods from ::android::hardware::radio::config::V1_0::IRadioConfig follow. |
| 30 | Return<void> RadioConfig::setResponseFunctions( |
| 31 | const sp<V1_0::IRadioConfigResponse>& radioConfigResponse, |
| 32 | const sp<V1_0::IRadioConfigIndication>& radioConfigIndication) { |
| 33 | mRadioConfigResponse = radioConfigResponse; |
| 34 | mRadioConfigIndication = radioConfigIndication; |
| 35 | |
| 36 | mRadioConfigResponseV1_3 = |
| 37 | V1_3::IRadioConfigResponse::castFrom(mRadioConfigResponse).withDefault(nullptr); |
| 38 | mRadioConfigIndicationV1_3 = |
| 39 | V1_3::IRadioConfigIndication::castFrom(mRadioConfigIndication).withDefault(nullptr); |
| 40 | if (mRadioConfigResponseV1_3 == nullptr || mRadioConfigIndicationV1_3 == nullptr) { |
| 41 | mRadioConfigResponseV1_3 = nullptr; |
| 42 | mRadioConfigIndicationV1_3 = nullptr; |
| 43 | } |
| 44 | |
| 45 | mRadioConfigResponseV1_2 = |
| 46 | V1_2::IRadioConfigResponse::castFrom(mRadioConfigResponse).withDefault(nullptr); |
| 47 | mRadioConfigIndicationV1_2 = |
| 48 | V1_2::IRadioConfigIndication::castFrom(mRadioConfigIndication).withDefault(nullptr); |
| 49 | if (mRadioConfigResponseV1_2 == nullptr || mRadioConfigIndicationV1_2 == nullptr) { |
| 50 | mRadioConfigResponseV1_2 = nullptr; |
| 51 | mRadioConfigIndicationV1_2 = nullptr; |
| 52 | } |
| 53 | |
| 54 | mRadioConfigResponseV1_1 = |
| 55 | V1_1::IRadioConfigResponse::castFrom(mRadioConfigResponse).withDefault(nullptr); |
| 56 | mRadioConfigIndicationV1_1 = |
| 57 | V1_1::IRadioConfigIndication::castFrom(mRadioConfigIndication).withDefault(nullptr); |
| 58 | if (mRadioConfigResponseV1_1 == nullptr || mRadioConfigIndicationV1_1 == nullptr) { |
| 59 | mRadioConfigResponseV1_1 = nullptr; |
| 60 | mRadioConfigIndicationV1_1 = nullptr; |
| 61 | } |
| 62 | |
| 63 | return Void(); |
| 64 | } |
| 65 | |
| 66 | Return<void> RadioConfig::getSimSlotsStatus(int32_t /* serial */) { |
| 67 | hidl_vec<V1_0::SimSlotStatus> slotStatus; |
| 68 | RadioResponseInfo info; |
| 69 | mRadioConfigResponse->getSimSlotsStatusResponse(info, slotStatus); |
| 70 | return Void(); |
| 71 | } |
| 72 | |
| 73 | Return<void> RadioConfig::setSimSlotsMapping(int32_t /* serial */, |
| 74 | const hidl_vec<uint32_t>& /* slotMap */) { |
| 75 | RadioResponseInfo info; |
| 76 | mRadioConfigResponse->setSimSlotsMappingResponse(info); |
| 77 | return Void(); |
| 78 | } |
| 79 | |
| 80 | // Methods from ::android::hardware::radio::config::V1_1::IRadioConfig follow. |
| 81 | Return<void> RadioConfig::getPhoneCapability(int32_t /* serial */) { |
| 82 | V1_1::PhoneCapability phoneCapability; |
| 83 | RadioResponseInfo info; |
| 84 | mRadioConfigResponseV1_1->getPhoneCapabilityResponse(info, phoneCapability); |
| 85 | return Void(); |
| 86 | } |
| 87 | |
| 88 | Return<void> RadioConfig::setPreferredDataModem(int32_t /* serial */, uint8_t /* modemId */) { |
| 89 | RadioResponseInfo info; |
| 90 | mRadioConfigResponseV1_1->setPreferredDataModemResponse(info); |
| 91 | return Void(); |
| 92 | } |
| 93 | |
| 94 | Return<void> RadioConfig::setModemsConfig(int32_t /* serial */, |
| 95 | const V1_1::ModemsConfig& /* modemsConfig */) { |
| 96 | RadioResponseInfo info; |
| 97 | mRadioConfigResponseV1_1->setModemsConfigResponse(info); |
| 98 | return Void(); |
| 99 | } |
| 100 | |
| 101 | Return<void> RadioConfig::getModemsConfig(int32_t /* serial */) { |
| 102 | V1_1::ModemsConfig modemsConfig; |
| 103 | RadioResponseInfo info; |
| 104 | mRadioConfigResponseV1_1->getModemsConfigResponse(info, modemsConfig); |
| 105 | return Void(); |
| 106 | } |
| 107 | |
| 108 | } // namespace implementation |
| 109 | } // namespace V1_3 |
| 110 | } // namespace config |
| 111 | } // namespace radio |
| 112 | } // namespace hardware |
| 113 | } // namespace android |