1 /* 2 * Copyright (C) 2022 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; 39 std::optional<ConnectionFailureInfo> startImsTrafficResp; 40 41 virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override; 42 43 virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse( 44 const RadioResponseInfo& info) override; 45 46 virtual ndk::ScopedAStatus startImsTrafficResponse( 47 const RadioResponseInfo& info, 48 const std::optional<ConnectionFailureInfo>& response) override; 49 50 virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override; 51 52 virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override; 53 54 virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; 55 56 virtual ndk::ScopedAStatus updateImsCallStatusResponse(const RadioResponseInfo& info) override; 57 }; 58 59 /* Callback class for radio ims indication */ 60 class RadioImsIndication : public BnRadioImsIndication { 61 protected: 62 RadioServiceTest& parent_ims; 63 64 public: 65 RadioImsIndication(RadioServiceTest& parent_ims); 66 virtual ~RadioImsIndication() = default; 67 68 virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, 69 int32_t token, const ConnectionFailureInfo& info) override; 70 71 virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType, 72 ImsStreamDirection direction, int bitsPerSecond) override; 73 74 virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type, 75 ImsDeregistrationReason reason) override; 76 }; 77 78 // The main test class for Radio AIDL Ims. 79 class RadioImsTest : public RadioServiceTest { 80 protected: 81 virtual void verifyError(RadioError resp); 82 83 public: 84 void SetUp() override; 85 86 /* radio ims service handle */ 87 std::shared_ptr<IRadioIms> radio_ims; 88 /* radio ims response handle */ 89 std::shared_ptr<RadioImsResponse> radioRsp_ims; 90 /* radio ims indication handle */ 91 std::shared_ptr<RadioImsIndication> radioInd_ims; 92 }; 93