blob: 208c94b05c9dc0cff1938ee1dec4f0e6cafae2af [file] [log] [blame]
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +00001/*
Hunsuk Choid12c2f02022-10-06 01:00:53 +00002 * Copyright (C) 2022 The Android Open Source Project
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +00003 *
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
25using namespace aidl::android::hardware::radio::ims;
26
27class RadioImsTest;
28
29/* Callback class for radio ims response */
30class 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;
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000039 std::optional<ConnectionFailureInfo> startImsTrafficResp;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000040
41 virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override;
42
43 virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse(
44 const RadioResponseInfo& info) override;
45
Hunsuk Choid12c2f02022-10-06 01:00:53 +000046 virtual ndk::ScopedAStatus startImsTrafficResponse(
47 const RadioResponseInfo& info,
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000048 const std::optional<ConnectionFailureInfo>& response) override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000049
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000050 virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override;
Hwayoung1ec992a2022-02-15 09:48:07 +000051
Hunsuk Choi539c9982022-08-01 05:47:36 +000052 virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override;
53
Hwayoung1ec992a2022-02-15 09:48:07 +000054 virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override;
Hunsuk Choiff576452022-10-21 13:15:23 +000055
56 virtual ndk::ScopedAStatus updateImsCallStatusResponse(const RadioResponseInfo& info) override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000057};
58
59/* Callback class for radio ims indication */
60class RadioImsIndication : public BnRadioImsIndication {
61 protected:
62 RadioServiceTest& parent_ims;
63
64 public:
65 RadioImsIndication(RadioServiceTest& parent_ims);
66 virtual ~RadioImsIndication() = default;
67
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000068 virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type,
Hunsuk Choi49b81dd2022-11-01 06:23:18 +000069 int32_t token, const ConnectionFailureInfo& info) override;
Hwayoung1ec992a2022-02-15 09:48:07 +000070
Helenc112be12022-04-26 01:02:40 +000071 virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType,
Hwayoung1ec992a2022-02-15 09:48:07 +000072 ImsStreamDirection direction, int bitsPerSecond) override;
Hunsuk Choidb17f4f2022-04-12 06:26:48 +000073
Hunsuk Choi2456ad42022-09-02 03:52:53 +000074 virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type,
75 ImsDeregistrationReason reason) override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000076};
77
78// The main test class for Radio AIDL Ims.
Sarah China1efe7a2023-05-02 21:11:41 -070079class RadioImsTest : public RadioServiceTest {
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000080 protected:
81 virtual void verifyError(RadioError resp);
82
83 public:
Sarah China1efe7a2023-05-02 21:11:41 -070084 void SetUp() override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000085
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};