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 "radio_config_utils.h"
18 
RadioConfigResponse(RadioServiceTest & parent)19 RadioConfigResponse::RadioConfigResponse(RadioServiceTest& parent) : parent_config(parent) {}
20 
getSimSlotsStatusResponse(const RadioResponseInfo & info,const std::vector<SimSlotStatus> & slotStatus)21 ndk::ScopedAStatus RadioConfigResponse::getSimSlotsStatusResponse(
22         const RadioResponseInfo& info, const std::vector<SimSlotStatus>& slotStatus) {
23     rspInfo = info;
24     simSlotStatus = slotStatus;
25     parent_config.notify(info.serial);
26     return ndk::ScopedAStatus::ok();
27 }
28 
setSimSlotsMappingResponse(const RadioResponseInfo & info)29 ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& info) {
30     rspInfo = info;
31     parent_config.notify(info.serial);
32     return ndk::ScopedAStatus::ok();
33 }
34 
getPhoneCapabilityResponse(const RadioResponseInfo & info,const PhoneCapability & phoneCapability)35 ndk::ScopedAStatus RadioConfigResponse::getPhoneCapabilityResponse(
36         const RadioResponseInfo& info, const PhoneCapability& phoneCapability) {
37     rspInfo = info;
38     phoneCap = phoneCapability;
39     parent_config.notify(info.serial);
40     return ndk::ScopedAStatus::ok();
41 }
42 
getSimultaneousCallingSupportResponse(const RadioResponseInfo & info,const std::vector<int32_t> & enabledLogicalSlots)43 ndk::ScopedAStatus RadioConfigResponse::getSimultaneousCallingSupportResponse(
44         const RadioResponseInfo& info, const std::vector<int32_t>& enabledLogicalSlots) {
45     rspInfo = info;
46     currentEnabledLogicalSlots = enabledLogicalSlots;
47     parent_config.notify(info.serial);
48     return ndk::ScopedAStatus::ok();
49 }
50 
setPreferredDataModemResponse(const RadioResponseInfo & info)51 ndk::ScopedAStatus RadioConfigResponse::setPreferredDataModemResponse(
52         const RadioResponseInfo& info) {
53     rspInfo = info;
54     parent_config.notify(info.serial);
55     return ndk::ScopedAStatus::ok();
56 }
57 
getNumOfLiveModemsResponse(const RadioResponseInfo & info,const int8_t)58 ndk::ScopedAStatus RadioConfigResponse::getNumOfLiveModemsResponse(
59         const RadioResponseInfo& info, const int8_t /* numOfLiveModems */) {
60     rspInfo = info;
61     parent_config.notify(info.serial);
62     return ndk::ScopedAStatus::ok();
63 }
64 
setNumOfLiveModemsResponse(const RadioResponseInfo & info)65 ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(const RadioResponseInfo& info) {
66     rspInfo = info;
67     parent_config.notify(info.serial);
68     return ndk::ScopedAStatus::ok();
69 }
70 
getHalDeviceCapabilitiesResponse(const RadioResponseInfo & info,bool modemReducedFeatures)71 ndk::ScopedAStatus RadioConfigResponse::getHalDeviceCapabilitiesResponse(
72         const RadioResponseInfo& info, bool modemReducedFeatures) {
73     rspInfo = info;
74     modemReducedFeatureSet1 = modemReducedFeatures;
75     parent_config.notify(info.serial);
76     return ndk::ScopedAStatus::ok();
77 }
78