1 /*
2 * Copyright (C) 2021 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 <libradiocompat/RadioConfigResponse.h>
18
19 #include "commonStructs.h"
20 #include "debug.h"
21 #include "structs.h"
22
23 #include "collections.h"
24
25 #define RADIO_MODULE "ConfigResponse"
26
27 namespace android::hardware::radio::compat {
28
29 namespace aidl = ::aidl::android::hardware::radio::config;
30
setResponseFunction(std::shared_ptr<aidl::IRadioConfigResponse> callback)31 void RadioConfigResponse::setResponseFunction(
32 std::shared_ptr<aidl::IRadioConfigResponse> callback) {
33 mCallback = callback;
34 }
35
respond()36 std::shared_ptr<aidl::IRadioConfigResponse> RadioConfigResponse::respond() {
37 return mCallback.get();
38 }
39
getSimSlotsStatusResponse(const V1_0::RadioResponseInfo & info,const hidl_vec<config::V1_0::SimSlotStatus> & slotStatus)40 Return<void> RadioConfigResponse::getSimSlotsStatusResponse(
41 const V1_0::RadioResponseInfo& info,
42 const hidl_vec<config::V1_0::SimSlotStatus>& slotStatus) {
43 LOG_CALL << info.serial;
44 respond()->getSimSlotsStatusResponse(toAidl(info), toAidl(slotStatus));
45 return {};
46 };
47
getSimSlotsStatusResponse_1_2(const V1_0::RadioResponseInfo & info,const hidl_vec<config::V1_2::SimSlotStatus> & slotStatus)48 Return<void> RadioConfigResponse::getSimSlotsStatusResponse_1_2(
49 const V1_0::RadioResponseInfo& info,
50 const hidl_vec<config::V1_2::SimSlotStatus>& slotStatus) {
51 LOG_CALL << info.serial;
52 respond()->getSimSlotsStatusResponse(toAidl(info), toAidl(slotStatus));
53 return {};
54 };
55
setSimSlotsMappingResponse(const V1_0::RadioResponseInfo & info)56 Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const V1_0::RadioResponseInfo& info) {
57 LOG_CALL << info.serial;
58 respond()->setSimSlotsMappingResponse(toAidl(info));
59 return {};
60 };
61
getPhoneCapabilityResponse(const V1_0::RadioResponseInfo & info,const config::V1_1::PhoneCapability & phoneCapability)62 Return<void> RadioConfigResponse::getPhoneCapabilityResponse(
63 const V1_0::RadioResponseInfo& info, const config::V1_1::PhoneCapability& phoneCapability) {
64 LOG_CALL << info.serial;
65 respond()->getPhoneCapabilityResponse(toAidl(info), toAidl(phoneCapability));
66 return {};
67 };
68
setPreferredDataModemResponse(const V1_0::RadioResponseInfo & info)69 Return<void> RadioConfigResponse::setPreferredDataModemResponse(
70 const V1_0::RadioResponseInfo& info) {
71 LOG_CALL << info.serial;
72 respond()->setPreferredDataModemResponse(toAidl(info));
73 return {};
74 };
75
setModemsConfigResponse(const V1_0::RadioResponseInfo & info)76 Return<void> RadioConfigResponse::setModemsConfigResponse(const V1_0::RadioResponseInfo& info) {
77 LOG_CALL << info.serial;
78 respond()->setNumOfLiveModemsResponse(toAidl(info));
79 return {};
80 };
81
getModemsConfigResponse(const V1_0::RadioResponseInfo & info,const config::V1_1::ModemsConfig & modemsConfig)82 Return<void> RadioConfigResponse::getModemsConfigResponse(
83 const V1_0::RadioResponseInfo& info, const config::V1_1::ModemsConfig& modemsConfig) {
84 LOG_CALL << info.serial;
85 respond()->getNumOfLiveModemsResponse(toAidl(info), modemsConfig.numOfLiveModems);
86 return {};
87 };
88
getHalDeviceCapabilitiesResponse(const V1_6::RadioResponseInfo & info,bool modemReducedFeatureSet1)89 Return<void> RadioConfigResponse::getHalDeviceCapabilitiesResponse(
90 const V1_6::RadioResponseInfo& info, bool modemReducedFeatureSet1) {
91 LOG_CALL << info.serial;
92 respond()->getHalDeviceCapabilitiesResponse(toAidl(info), modemReducedFeatureSet1);
93 return {};
94 };
95
96 } // namespace android::hardware::radio::compat
97