Hunsuk Choi | 9d4f38c | 2021-12-16 21:50:04 +0000 | [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/ims/BnRadioImsIndication.h> |
| 20 | #include <aidl/android/hardware/radio/ims/BnRadioImsResponse.h> |
| 21 | #include <aidl/android/hardware/radio/ims/IRadioIms.h> |
| 22 | |
| 23 | #include "radio_aidl_hal_utils.h" |
| 24 | |
| 25 | using namespace aidl::android::hardware::radio::ims; |
| 26 | |
| 27 | class RadioImsTest; |
| 28 | |
| 29 | /* Callback class for radio ims response */ |
| 30 | class RadioImsResponse : public BnRadioImsResponse { |
| 31 | protected: |
| 32 | RadioServiceTest& parent_ims; |
| 33 | |
| 34 | public: |
| 35 | RadioImsResponse(RadioServiceTest& parent_ims); |
| 36 | virtual ~RadioImsResponse() = default; |
| 37 | |
| 38 | RadioResponseInfo rspInfo; |
Hunsuk Choi | f3ef4ff | 2022-03-29 03:10:35 +0000 | [diff] [blame] | 39 | std::optional<ConnectionFailureInfo> startImsTrafficResp; |
Hunsuk Choi | 9d4f38c | 2021-12-16 21:50:04 +0000 | [diff] [blame] | 40 | |
| 41 | virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override; |
| 42 | |
| 43 | virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse( |
| 44 | const RadioResponseInfo& info) override; |
| 45 | |
Hunsuk Choi | f3ef4ff | 2022-03-29 03:10:35 +0000 | [diff] [blame] | 46 | virtual ndk::ScopedAStatus startImsTrafficResponse(const RadioResponseInfo& info, |
| 47 | const std::optional<ConnectionFailureInfo>& response) override; |
Hunsuk Choi | 9d4f38c | 2021-12-16 21:50:04 +0000 | [diff] [blame] | 48 | |
Hunsuk Choi | f3ef4ff | 2022-03-29 03:10:35 +0000 | [diff] [blame] | 49 | virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override; |
Hwayoung | 1ec992a | 2022-02-15 09:48:07 +0000 | [diff] [blame] | 50 | |
Hunsuk Choi | 539c998 | 2022-08-01 05:47:36 +0000 | [diff] [blame] | 51 | virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override; |
| 52 | |
Hwayoung | 1ec992a | 2022-02-15 09:48:07 +0000 | [diff] [blame] | 53 | virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; |
Hunsuk Choi | 9d4f38c | 2021-12-16 21:50:04 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | /* Callback class for radio ims indication */ |
| 57 | class RadioImsIndication : public BnRadioImsIndication { |
| 58 | protected: |
| 59 | RadioServiceTest& parent_ims; |
| 60 | |
| 61 | public: |
| 62 | RadioImsIndication(RadioServiceTest& parent_ims); |
| 63 | virtual ~RadioImsIndication() = default; |
| 64 | |
Hunsuk Choi | f3ef4ff | 2022-03-29 03:10:35 +0000 | [diff] [blame] | 65 | virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, |
| 66 | const std::string& token, const ConnectionFailureInfo& info) override; |
Hwayoung | 1ec992a | 2022-02-15 09:48:07 +0000 | [diff] [blame] | 67 | |
Helen | c112be1 | 2022-04-26 01:02:40 +0000 | [diff] [blame] | 68 | virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType, |
Hwayoung | 1ec992a | 2022-02-15 09:48:07 +0000 | [diff] [blame] | 69 | ImsStreamDirection direction, int bitsPerSecond) override; |
Hunsuk Choi | db17f4f | 2022-04-12 06:26:48 +0000 | [diff] [blame] | 70 | |
Hunsuk Choi | 2456ad4 | 2022-09-02 03:52:53 +0000 | [diff] [blame] | 71 | virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type, |
| 72 | ImsDeregistrationReason reason) override; |
Hunsuk Choi | 9d4f38c | 2021-12-16 21:50:04 +0000 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | // The main test class for Radio AIDL Ims. |
| 76 | class RadioImsTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest { |
| 77 | protected: |
| 78 | virtual void verifyError(RadioError resp); |
| 79 | |
| 80 | public: |
| 81 | virtual void SetUp() override; |
| 82 | |
| 83 | /* radio ims service handle */ |
| 84 | std::shared_ptr<IRadioIms> radio_ims; |
| 85 | /* radio ims response handle */ |
| 86 | std::shared_ptr<RadioImsResponse> radioRsp_ims; |
| 87 | /* radio ims indication handle */ |
| 88 | std::shared_ptr<RadioImsIndication> radioInd_ims; |
| 89 | }; |