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/data/BnRadioDataIndication.h> 20 #include <aidl/android/hardware/radio/data/BnRadioDataResponse.h> 21 #include <aidl/android/hardware/radio/data/IRadioData.h> 22 23 #include "radio_aidl_hal_utils.h" 24 25 using namespace aidl::android::hardware::radio::data; 26 27 class RadioDataTest; 28 29 /* Callback class for radio data response */ 30 class RadioDataResponse : public BnRadioDataResponse { 31 protected: 32 RadioServiceTest& parent_data; 33 34 public: 35 RadioDataResponse(RadioServiceTest& parent_data); 36 virtual ~RadioDataResponse() = default; 37 38 RadioResponseInfo rspInfo; 39 int32_t allocatedPduSessionId; 40 SetupDataCallResult setupDataCallResult; 41 42 virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override; 43 44 virtual ndk::ScopedAStatus allocatePduSessionIdResponse(const RadioResponseInfo& info, 45 int32_t id) override; 46 47 virtual ndk::ScopedAStatus cancelHandoverResponse(const RadioResponseInfo& info) override; 48 49 virtual ndk::ScopedAStatus deactivateDataCallResponse(const RadioResponseInfo& info) override; 50 51 virtual ndk::ScopedAStatus getDataCallListResponse( 52 const RadioResponseInfo& info, 53 const std::vector<SetupDataCallResult>& dcResponse) override; 54 55 virtual ndk::ScopedAStatus getSlicingConfigResponse( 56 const RadioResponseInfo& info, const SlicingConfig& slicingConfig) override; 57 58 virtual ndk::ScopedAStatus releasePduSessionIdResponse(const RadioResponseInfo& info) override; 59 60 virtual ndk::ScopedAStatus setDataAllowedResponse(const RadioResponseInfo& info) override; 61 62 virtual ndk::ScopedAStatus setDataProfileResponse(const RadioResponseInfo& info) override; 63 64 virtual ndk::ScopedAStatus setDataThrottlingResponse(const RadioResponseInfo& info) override; 65 66 virtual ndk::ScopedAStatus setInitialAttachApnResponse(const RadioResponseInfo& info) override; 67 68 virtual ndk::ScopedAStatus setupDataCallResponse( 69 const RadioResponseInfo& info, const SetupDataCallResult& dcResponse) override; 70 71 virtual ndk::ScopedAStatus startHandoverResponse(const RadioResponseInfo& info) override; 72 73 virtual ndk::ScopedAStatus startKeepaliveResponse(const RadioResponseInfo& info, 74 const KeepaliveStatus& status) override; 75 76 virtual ndk::ScopedAStatus stopKeepaliveResponse(const RadioResponseInfo& info) override; 77 }; 78 79 /* Callback class for radio data indication */ 80 class RadioDataIndication : public BnRadioDataIndication { 81 protected: 82 RadioServiceTest& parent_data; 83 84 public: 85 RadioDataIndication(RadioServiceTest& parent_data); 86 virtual ~RadioDataIndication() = default; 87 88 virtual ndk::ScopedAStatus dataCallListChanged( 89 RadioIndicationType type, const std::vector<SetupDataCallResult>& dcList) override; 90 91 virtual ndk::ScopedAStatus keepaliveStatus(RadioIndicationType type, 92 const KeepaliveStatus& status) override; 93 94 virtual ndk::ScopedAStatus pcoData(RadioIndicationType type, const PcoDataInfo& pco) override; 95 96 virtual ndk::ScopedAStatus unthrottleApn(RadioIndicationType type, 97 const DataProfileInfo& dataProfile) override; 98 virtual ndk::ScopedAStatus slicingConfigChanged(RadioIndicationType type, 99 const SlicingConfig& slicingConfig) override; 100 }; 101 102 // The main test class for Radio AIDL Data. 103 class RadioDataTest : public RadioServiceTest { 104 protected: 105 /* Get current data call list */ 106 ndk::ScopedAStatus getDataCallList(); 107 108 public: 109 void SetUp() override; 110 111 /* radio data service handle */ 112 std::shared_ptr<IRadioData> radio_data; 113 /* radio data response handle */ 114 std::shared_ptr<RadioDataResponse> radioRsp_data; 115 /* radio data indication handle */ 116 std::shared_ptr<RadioDataIndication> radioInd_data; 117 }; 118