blob: cdcc1bcdb3594a5d7e881737863b235a22647ec1 [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;
Muralidhar Reddy9120ebd2024-12-02 22:49:34 +000065
66 virtual ndk::ScopedAStatus getSimTypeInfoResponse(
67 const RadioResponseInfo& info, const std::vector<SimTypeInfo>& simTypeInfo) override;
68
69 virtual ndk::ScopedAStatus setSimTypeResponse(const RadioResponseInfo& info) override;
Sarah Chinc83bce42021-12-29 00:35:12 -080070};
71
72/* Callback class for radio config indication */
73class RadioConfigIndication : public BnRadioConfigIndication {
74 protected:
75 RadioServiceTest& parent_config;
76
77 public:
78 RadioConfigIndication(RadioServiceTest& parent_config);
79 virtual ~RadioConfigIndication() = default;
80
81 virtual ndk::ScopedAStatus simSlotsStatusChanged(
82 RadioIndicationType type, const std::vector<SimSlotStatus>& slotStatus) override;
Grant Menke37cc14d2023-11-29 19:28:28 -080083
84 virtual ndk::ScopedAStatus onSimultaneousCallingSupportChanged(
85 const std::vector<int32_t>& /*enabledLogicalSlots*/) override;
Sarah Chinc83bce42021-12-29 00:35:12 -080086};
87
88// The main test class for Radio AIDL Config.
Sarah China1efe7a2023-05-02 21:11:41 -070089class RadioConfigTest : public RadioServiceTest {
Sarah Chinc83bce42021-12-29 00:35:12 -080090 public:
Sarah China1efe7a2023-05-02 21:11:41 -070091 void SetUp() override;
92
Sarah Chinc83bce42021-12-29 00:35:12 -080093 ndk::ScopedAStatus updateSimCardStatus();
sandeepjs2a016742022-02-15 11:41:28 +000094 /* Override updateSimSlotStatus in RadioServiceTest to not call setResponseFunctions */
95 void updateSimSlotStatus();
Sarah Chinc83bce42021-12-29 00:35:12 -080096
97 /* radio config service handle in RadioServiceTest */
98 /* radio config response handle */
99 std::shared_ptr<RadioConfigResponse> radioRsp_config;
100 /* radio config indication handle */
101 std::shared_ptr<RadioConfigIndication> radioInd_config;
102};