Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 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 | #pragma once |
| 18 | |
| 19 | #include <aidl/android/hardware/radio/config/BnRadioConfigIndication.h> |
| 20 | #include <aidl/android/hardware/radio/config/BnRadioConfigResponse.h> |
| 21 | #include <aidl/android/hardware/radio/config/IRadioConfig.h> |
| 22 | |
| 23 | #include "radio_aidl_hal_utils.h" |
| 24 | |
| 25 | using namespace aidl::android::hardware::radio::config; |
| 26 | |
| 27 | class RadioConfigTest; |
| 28 | |
| 29 | /* Callback class for radio config response */ |
| 30 | class RadioConfigResponse : public BnRadioConfigResponse { |
| 31 | protected: |
| 32 | RadioServiceTest& parent_config; |
| 33 | |
| 34 | public: |
| 35 | RadioConfigResponse(RadioServiceTest& parent_config); |
| 36 | virtual ~RadioConfigResponse() = default; |
| 37 | |
| 38 | RadioResponseInfo rspInfo; |
| 39 | PhoneCapability phoneCap; |
| 40 | bool modemReducedFeatureSet1; |
sandeepjs | 3bb5000 | 2022-02-15 11:41:28 +0000 | [diff] [blame] | 41 | std::vector<SimSlotStatus> simSlotStatus; |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 42 | |
| 43 | virtual ndk::ScopedAStatus getSimSlotsStatusResponse( |
| 44 | const RadioResponseInfo& info, const std::vector<SimSlotStatus>& slotStatus) override; |
| 45 | |
| 46 | virtual ndk::ScopedAStatus setSimSlotsMappingResponse(const RadioResponseInfo& info) override; |
| 47 | |
| 48 | virtual ndk::ScopedAStatus getPhoneCapabilityResponse( |
| 49 | const RadioResponseInfo& info, const PhoneCapability& phoneCapability) override; |
| 50 | |
| 51 | virtual ndk::ScopedAStatus setPreferredDataModemResponse( |
| 52 | const RadioResponseInfo& info) override; |
| 53 | |
| 54 | virtual ndk::ScopedAStatus getNumOfLiveModemsResponse(const RadioResponseInfo& info, |
| 55 | const int8_t numOfLiveModems) override; |
| 56 | |
| 57 | virtual ndk::ScopedAStatus setNumOfLiveModemsResponse(const RadioResponseInfo& info) override; |
| 58 | |
| 59 | virtual ndk::ScopedAStatus getHalDeviceCapabilitiesResponse( |
| 60 | const RadioResponseInfo& info, bool modemReducedFeatureSet1) override; |
| 61 | }; |
| 62 | |
| 63 | /* Callback class for radio config indication */ |
| 64 | class RadioConfigIndication : public BnRadioConfigIndication { |
| 65 | protected: |
| 66 | RadioServiceTest& parent_config; |
| 67 | |
| 68 | public: |
| 69 | RadioConfigIndication(RadioServiceTest& parent_config); |
| 70 | virtual ~RadioConfigIndication() = default; |
| 71 | |
| 72 | virtual ndk::ScopedAStatus simSlotsStatusChanged( |
| 73 | RadioIndicationType type, const std::vector<SimSlotStatus>& slotStatus) override; |
| 74 | }; |
| 75 | |
| 76 | // The main test class for Radio AIDL Config. |
| 77 | class RadioConfigTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest { |
| 78 | public: |
| 79 | virtual void SetUp() override; |
| 80 | ndk::ScopedAStatus updateSimCardStatus(); |
sandeepjs | 3bb5000 | 2022-02-15 11:41:28 +0000 | [diff] [blame] | 81 | /* Override updateSimSlotStatus in RadioServiceTest to not call setResponseFunctions */ |
| 82 | void updateSimSlotStatus(); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 83 | |
| 84 | /* radio config service handle in RadioServiceTest */ |
| 85 | /* radio config response handle */ |
| 86 | std::shared_ptr<RadioConfigResponse> radioRsp_config; |
| 87 | /* radio config indication handle */ |
| 88 | std::shared_ptr<RadioConfigIndication> radioInd_config; |
| 89 | }; |