Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -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/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; |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 26 | |
| 27 | class RadioDataTest; |
| 28 | |
| 29 | /* Callback class for radio data response */ |
| 30 | class RadioDataResponse : public BnRadioDataResponse { |
| 31 | protected: |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 32 | RadioServiceTest& parent_data; |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 33 | |
| 34 | public: |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 35 | RadioDataResponse(RadioServiceTest& parent_data); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 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: |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 82 | RadioServiceTest& parent_data; |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 83 | |
| 84 | public: |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 85 | RadioDataIndication(RadioServiceTest& parent_data); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 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; |
Sooraj Sasindran | d561cc3 | 2022-01-11 09:42:21 -0800 | [diff] [blame] | 98 | virtual ndk::ScopedAStatus slicingConfigChanged(RadioIndicationType type, |
| 99 | const SlicingConfig& slicingConfig) override; |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | // The main test class for Radio AIDL Data. |
Sarah Chin | bb35a43 | 2023-05-02 21:11:41 -0700 | [diff] [blame] | 103 | class RadioDataTest : public RadioServiceTest { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 104 | protected: |
| 105 | /* Get current data call list */ |
| 106 | ndk::ScopedAStatus getDataCallList(); |
| 107 | |
| 108 | public: |
Sarah Chin | bb35a43 | 2023-05-02 21:11:41 -0700 | [diff] [blame] | 109 | void SetUp() override; |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 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 | }; |