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; |
| 41 | |
| 42 | virtual ndk::ScopedAStatus getSimSlotsStatusResponse( |
| 43 | const RadioResponseInfo& info, const std::vector<SimSlotStatus>& slotStatus) override; |
| 44 | |
| 45 | virtual ndk::ScopedAStatus setSimSlotsMappingResponse(const RadioResponseInfo& info) override; |
| 46 | |
| 47 | virtual ndk::ScopedAStatus getPhoneCapabilityResponse( |
| 48 | const RadioResponseInfo& info, const PhoneCapability& phoneCapability) override; |
| 49 | |
| 50 | virtual ndk::ScopedAStatus setPreferredDataModemResponse( |
| 51 | const RadioResponseInfo& info) override; |
| 52 | |
| 53 | virtual ndk::ScopedAStatus getNumOfLiveModemsResponse(const RadioResponseInfo& info, |
| 54 | const int8_t numOfLiveModems) override; |
| 55 | |
| 56 | virtual ndk::ScopedAStatus setNumOfLiveModemsResponse(const RadioResponseInfo& info) override; |
| 57 | |
| 58 | virtual ndk::ScopedAStatus getHalDeviceCapabilitiesResponse( |
| 59 | const RadioResponseInfo& info, bool modemReducedFeatureSet1) override; |
| 60 | }; |
| 61 | |
| 62 | /* Callback class for radio config indication */ |
| 63 | class RadioConfigIndication : public BnRadioConfigIndication { |
| 64 | protected: |
| 65 | RadioServiceTest& parent_config; |
| 66 | |
| 67 | public: |
| 68 | RadioConfigIndication(RadioServiceTest& parent_config); |
| 69 | virtual ~RadioConfigIndication() = default; |
| 70 | |
| 71 | virtual ndk::ScopedAStatus simSlotsStatusChanged( |
| 72 | RadioIndicationType type, const std::vector<SimSlotStatus>& slotStatus) override; |
| 73 | }; |
| 74 | |
| 75 | // The main test class for Radio AIDL Config. |
| 76 | class RadioConfigTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest { |
| 77 | public: |
| 78 | virtual void SetUp() override; |
| 79 | ndk::ScopedAStatus updateSimCardStatus(); |
| 80 | |
| 81 | /* radio config service handle in RadioServiceTest */ |
| 82 | /* radio config response handle */ |
| 83 | std::shared_ptr<RadioConfigResponse> radioRsp_config; |
| 84 | /* radio config indication handle */ |
| 85 | std::shared_ptr<RadioConfigIndication> radioInd_config; |
| 86 | }; |