blob: 84c74fcec7a25f5ae9d125db5ac5724b6cda64ca [file] [log] [blame]
Sarah Chinc83bce42021-12-29 00:35:12 -08001/*
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
25using namespace aidl::android::hardware::radio::config;
26
27class RadioConfigTest;
28
29/* Callback class for radio config response */
30class 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;
sandeepjs2a016742022-02-15 11:41:28 +000041 std::vector<SimSlotStatus> simSlotStatus;
Grant Menke3bc635e2024-01-04 11:48:48 -080042 std::vector<int32_t> currentEnabledLogicalSlots;
Sarah Chinc83bce42021-12-29 00:35:12 -080043
44 virtual ndk::ScopedAStatus getSimSlotsStatusResponse(
45 const RadioResponseInfo& info, const std::vector<SimSlotStatus>& slotStatus) override;
46
47 virtual ndk::ScopedAStatus setSimSlotsMappingResponse(const RadioResponseInfo& info) override;
48
49 virtual ndk::ScopedAStatus getPhoneCapabilityResponse(
50 const RadioResponseInfo& info, const PhoneCapability& phoneCapability) override;
51
Grant Menke37cc14d2023-11-29 19:28:28 -080052 virtual ndk::ScopedAStatus getSimultaneousCallingSupportResponse(
53 const RadioResponseInfo& info, const std::vector<int32_t>& enabledLogicalSlots) override;
54
Sarah Chinc83bce42021-12-29 00:35:12 -080055 virtual ndk::ScopedAStatus setPreferredDataModemResponse(
56 const RadioResponseInfo& info) override;
57
58 virtual ndk::ScopedAStatus getNumOfLiveModemsResponse(const RadioResponseInfo& info,
59 const int8_t numOfLiveModems) override;
60
61 virtual ndk::ScopedAStatus setNumOfLiveModemsResponse(const RadioResponseInfo& info) override;
62
63 virtual ndk::ScopedAStatus getHalDeviceCapabilitiesResponse(
64 const RadioResponseInfo& info, bool modemReducedFeatureSet1) override;
65};
66
67/* Callback class for radio config indication */
68class RadioConfigIndication : public BnRadioConfigIndication {
69 protected:
70 RadioServiceTest& parent_config;
71
72 public:
73 RadioConfigIndication(RadioServiceTest& parent_config);
74 virtual ~RadioConfigIndication() = default;
75
76 virtual ndk::ScopedAStatus simSlotsStatusChanged(
77 RadioIndicationType type, const std::vector<SimSlotStatus>& slotStatus) override;
Grant Menke37cc14d2023-11-29 19:28:28 -080078
79 virtual ndk::ScopedAStatus onSimultaneousCallingSupportChanged(
80 const std::vector<int32_t>& /*enabledLogicalSlots*/) override;
Sarah Chinc83bce42021-12-29 00:35:12 -080081};
82
83// The main test class for Radio AIDL Config.
Sarah China1efe7a2023-05-02 21:11:41 -070084class RadioConfigTest : public RadioServiceTest {
Sarah Chinc83bce42021-12-29 00:35:12 -080085 public:
Sarah China1efe7a2023-05-02 21:11:41 -070086 void SetUp() override;
87
Sarah Chinc83bce42021-12-29 00:35:12 -080088 ndk::ScopedAStatus updateSimCardStatus();
sandeepjs2a016742022-02-15 11:41:28 +000089 /* Override updateSimSlotStatus in RadioServiceTest to not call setResponseFunctions */
90 void updateSimSlotStatus();
Sarah Chinc83bce42021-12-29 00:35:12 -080091
92 /* radio config service handle in RadioServiceTest */
93 /* radio config response handle */
94 std::shared_ptr<RadioConfigResponse> radioRsp_config;
95 /* radio config indication handle */
96 std::shared_ptr<RadioConfigIndication> radioInd_config;
97};