1d95e75fdSopenharmony_ci/*
2d95e75fdSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
3d95e75fdSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d95e75fdSopenharmony_ci * you may not use this file except in compliance with the License.
5d95e75fdSopenharmony_ci * You may obtain a copy of the License at
6d95e75fdSopenharmony_ci *
7d95e75fdSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8d95e75fdSopenharmony_ci *
9d95e75fdSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d95e75fdSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d95e75fdSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d95e75fdSopenharmony_ci * See the License for the specific language governing permissions and
13d95e75fdSopenharmony_ci * limitations under the License.
14d95e75fdSopenharmony_ci */
15d95e75fdSopenharmony_ci
16d95e75fdSopenharmony_ci#include "satellite_test.h"
17d95e75fdSopenharmony_ci
18d95e75fdSopenharmony_ci#define private public
19d95e75fdSopenharmony_ci#define protected public
20d95e75fdSopenharmony_ci#include "cellular_call_config.h"
21d95e75fdSopenharmony_ci#include "cellular_call_handler.h"
22d95e75fdSopenharmony_ci#include "cellular_call_proxy.h"
23d95e75fdSopenharmony_ci#include "cellular_call_register.h"
24d95e75fdSopenharmony_ci#include "cellular_call_service.h"
25d95e75fdSopenharmony_ci#include "tel_ril_call_parcel.h"
26d95e75fdSopenharmony_ci#include "satellite_call_client.h"
27d95e75fdSopenharmony_ci#include "securec.h"
28d95e75fdSopenharmony_ci
29d95e75fdSopenharmony_cinamespace OHOS {
30d95e75fdSopenharmony_cinamespace Telephony {
31d95e75fdSopenharmony_ciusing namespace testing::ext;
32d95e75fdSopenharmony_ciconst int32_t SIM1_SLOTID = 0;
33d95e75fdSopenharmony_ciconst int32_t SIM2_SLOTID = 1;
34d95e75fdSopenharmony_ciconst int32_t INVALID_SLOTID = 10;
35d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER = "0000000";
36d95e75fdSopenharmony_ci
37d95e75fdSopenharmony_civoid SatelliteTest::SetUpTestCase(void)
38d95e75fdSopenharmony_ci{
39d95e75fdSopenharmony_ci    // step 3: Set Up Test Case
40d95e75fdSopenharmony_ci}
41d95e75fdSopenharmony_ci
42d95e75fdSopenharmony_civoid SatelliteTest::TearDownTestCase(void)
43d95e75fdSopenharmony_ci{
44d95e75fdSopenharmony_ci    // step 3: Tear Down Test Case
45d95e75fdSopenharmony_ci}
46d95e75fdSopenharmony_ci
47d95e75fdSopenharmony_civoid SatelliteTest::SetUp(void)
48d95e75fdSopenharmony_ci{
49d95e75fdSopenharmony_ci    // step 3: input testcase setup step
50d95e75fdSopenharmony_ci}
51d95e75fdSopenharmony_ci
52d95e75fdSopenharmony_civoid SatelliteTest::TearDown(void)
53d95e75fdSopenharmony_ci{
54d95e75fdSopenharmony_ci    // step 3: input testcase teardown step
55d95e75fdSopenharmony_ci}
56d95e75fdSopenharmony_ci
57d95e75fdSopenharmony_ci/**
58d95e75fdSopenharmony_ci * @tc.number   Satellite_call_test_001
59d95e75fdSopenharmony_ci * @tc.name     Test the corresponding functions by entering commands, such as 300 -- SetCallPreferenceMode, 301 --
60d95e75fdSopenharmony_ci *              GetCallPreferenceMode, etc
61d95e75fdSopenharmony_ci * @tc.desc     Function test
62d95e75fdSopenharmony_ci */
63d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_test_001, Function | MediumTest | Level0)
64d95e75fdSopenharmony_ci{
65d95e75fdSopenharmony_ci    std::cout << "HWTEST_F Satellite_call_test_001";
66d95e75fdSopenharmony_ci    AccessToken token;
67d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
68d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
69d95e75fdSopenharmony_ci    auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
70d95e75fdSopenharmony_ci    ASSERT_TRUE(remote != nullptr);
71d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(remote);
72d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
73d95e75fdSopenharmony_ci}
74d95e75fdSopenharmony_ci
75d95e75fdSopenharmony_ci/**
76d95e75fdSopenharmony_ci * @tc.number   Satellite_call_test_002
77d95e75fdSopenharmony_ci * @tc.name     Test the corresponding functions by entering commands, such as 300 -- SetCallPreferenceMode, 301 --
78d95e75fdSopenharmony_ci *              GetCallPreferenceMode, etc
79d95e75fdSopenharmony_ci * @tc.desc     Function test
80d95e75fdSopenharmony_ci */
81d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_test_002, Function | MediumTest | Level1)
82d95e75fdSopenharmony_ci{
83d95e75fdSopenharmony_ci    std::cout << "HWTEST_F Satellite_call_test_002";
84d95e75fdSopenharmony_ci    AccessToken token;
85d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
86d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
87d95e75fdSopenharmony_ci    auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
88d95e75fdSopenharmony_ci    ASSERT_TRUE(remote != nullptr);
89d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(remote);
90d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
91d95e75fdSopenharmony_ci}
92d95e75fdSopenharmony_ci
93d95e75fdSopenharmony_ci/**
94d95e75fdSopenharmony_ci * @tc.number   Satellite_call_DialCall_0001
95d95e75fdSopenharmony_ci * @tc.name     Test for SetClip function by Satellite
96d95e75fdSopenharmony_ci * @tc.desc     Function test
97d95e75fdSopenharmony_ci */
98d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_DialCall_0001, Function | MediumTest | Level2)
99d95e75fdSopenharmony_ci{
100d95e75fdSopenharmony_ci    AccessToken token;
101d95e75fdSopenharmony_ci    TELEPHONY_LOGI("Satellite_call_DialCall_0001 entry");
102d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
103d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
104d95e75fdSopenharmony_ci    auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
105d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpCallRemote != nullptr);
106d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote);
107d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
108d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
109d95e75fdSopenharmony_ci        return;
110d95e75fdSopenharmony_ci    }
111d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
112d95e75fdSopenharmony_ci        int32_t ret = TestDialCallBySatellite(SIM1_SLOTID, PHONE_NUMBER);
113d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
114d95e75fdSopenharmony_ci        ret = TestDialCallBySatellite(INVALID_SLOTID, PHONE_NUMBER);
115d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
116d95e75fdSopenharmony_ci    }
117d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
118d95e75fdSopenharmony_ci        int32_t ret = TestDialCallBySatellite(SIM2_SLOTID, PHONE_NUMBER);
119d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
120d95e75fdSopenharmony_ci        ret = TestDialCallBySatellite(INVALID_SLOTID, PHONE_NUMBER);
121d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
122d95e75fdSopenharmony_ci    }
123d95e75fdSopenharmony_ci}
124d95e75fdSopenharmony_ci
125d95e75fdSopenharmony_ci/**
126d95e75fdSopenharmony_ci * @tc.number   Satellite_call_HangUpCall_0001
127d95e75fdSopenharmony_ci * @tc.name     Test for HangUp function by Satellite
128d95e75fdSopenharmony_ci * @tc.desc     Function test
129d95e75fdSopenharmony_ci */
130d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_HangUpCall_0001, Function | MediumTest | Level2)
131d95e75fdSopenharmony_ci{
132d95e75fdSopenharmony_ci    AccessToken token;
133d95e75fdSopenharmony_ci    TELEPHONY_LOGI("Satellite_call_HangUpCall_0001 entry");
134d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
135d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
136d95e75fdSopenharmony_ci    auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
137d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpCallRemote != nullptr);
138d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote);
139d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
140d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
141d95e75fdSopenharmony_ci        return;
142d95e75fdSopenharmony_ci    }
143d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
144d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
145d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
146d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
147d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
148d95e75fdSopenharmony_ci        EXPECT_GE(ret, TELEPHONY_SUCCESS);
149d95e75fdSopenharmony_ci    }
150d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
151d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
152d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
153d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
154d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
155d95e75fdSopenharmony_ci        EXPECT_GE(ret, TELEPHONY_SUCCESS);
156d95e75fdSopenharmony_ci    }
157d95e75fdSopenharmony_ci}
158d95e75fdSopenharmony_ci
159d95e75fdSopenharmony_ci/**
160d95e75fdSopenharmony_ci * @tc.number   Satellite_call_AnswerCall_0001
161d95e75fdSopenharmony_ci * @tc.name     Test for answer function by Satellite
162d95e75fdSopenharmony_ci * @tc.desc     Function test
163d95e75fdSopenharmony_ci */
164d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_AnswerCall_0001, Function | MediumTest | Level2)
165d95e75fdSopenharmony_ci{
166d95e75fdSopenharmony_ci    AccessToken token;
167d95e75fdSopenharmony_ci    TELEPHONY_LOGI("Satellite_call_AnswerCall_0001 entry");
168d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
169d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
170d95e75fdSopenharmony_ci    auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
171d95e75fdSopenharmony_ci    ASSERT_TRUE(answerCallRemote != nullptr);
172d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(answerCallRemote);
173d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
174d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
175d95e75fdSopenharmony_ci        return;
176d95e75fdSopenharmony_ci    }
177d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
178d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
179d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
180d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
181d95e75fdSopenharmony_ci        ret = telephonyService->Answer(callInfo);
182d95e75fdSopenharmony_ci        EXPECT_GE(ret, TELEPHONY_SUCCESS);
183d95e75fdSopenharmony_ci    }
184d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
185d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
186d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
187d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
188d95e75fdSopenharmony_ci        ret = telephonyService->Answer(callInfo);
189d95e75fdSopenharmony_ci        EXPECT_GE(ret, TELEPHONY_SUCCESS);
190d95e75fdSopenharmony_ci    }
191d95e75fdSopenharmony_ci}
192d95e75fdSopenharmony_ci
193d95e75fdSopenharmony_ci/**
194d95e75fdSopenharmony_ci * @tc.number   Satellite_call_RejectCall_0001
195d95e75fdSopenharmony_ci * @tc.name     Test for reject function by tatellite
196d95e75fdSopenharmony_ci * @tc.desc     Function test
197d95e75fdSopenharmony_ci */
198d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_RejectCall_0001, Function | MediumTest | Level2)
199d95e75fdSopenharmony_ci{
200d95e75fdSopenharmony_ci    AccessToken token;
201d95e75fdSopenharmony_ci    TELEPHONY_LOGI("Satellite_call_RejectCall_0001 entry");
202d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
203d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
204d95e75fdSopenharmony_ci    auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
205d95e75fdSopenharmony_ci    ASSERT_TRUE(rejectCallRemote != nullptr);
206d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(rejectCallRemote);
207d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
208d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
209d95e75fdSopenharmony_ci        return;
210d95e75fdSopenharmony_ci    }
211d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
212d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
213d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
214d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
215d95e75fdSopenharmony_ci        ret = telephonyService->Reject(callInfo);
216d95e75fdSopenharmony_ci        EXPECT_GE(ret, TELEPHONY_SUCCESS);
217d95e75fdSopenharmony_ci    }
218d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
219d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
220d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
221d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
222d95e75fdSopenharmony_ci        ret = telephonyService->Reject(callInfo);
223d95e75fdSopenharmony_ci        EXPECT_GE(ret, TELEPHONY_SUCCESS);
224d95e75fdSopenharmony_ci    }
225d95e75fdSopenharmony_ci}
226d95e75fdSopenharmony_ci/**
227d95e75fdSopenharmony_ci * @tc.number   Satellite_call_StartDtmf_0001
228d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function by satellite
229d95e75fdSopenharmony_ci * @tc.desc     Function test
230d95e75fdSopenharmony_ci */
231d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0001, Function | MediumTest | Level2)
232d95e75fdSopenharmony_ci{
233d95e75fdSopenharmony_ci    AccessToken token;
234d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
235d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
236d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
237d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
238d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
239d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
240d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
241d95e75fdSopenharmony_ci        return;
242d95e75fdSopenharmony_ci    }
243d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
244d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
245d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
246d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
247d95e75fdSopenharmony_ci        char code = '1';
248d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
249d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
250d95e75fdSopenharmony_ci    }
251d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
252d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
253d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
254d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
255d95e75fdSopenharmony_ci        char code = '1';
256d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
257d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
258d95e75fdSopenharmony_ci    }
259d95e75fdSopenharmony_ci}
260d95e75fdSopenharmony_ci
261d95e75fdSopenharmony_ci/**
262d95e75fdSopenharmony_ci * @tc.number   Satellite_call_StartDtmf_0002
263d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function with invalid slot by satellite
264d95e75fdSopenharmony_ci * @tc.desc     Function test
265d95e75fdSopenharmony_ci */
266d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0002, Function | MediumTest | Level2)
267d95e75fdSopenharmony_ci{
268d95e75fdSopenharmony_ci    AccessToken token;
269d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
270d95e75fdSopenharmony_ci        return;
271d95e75fdSopenharmony_ci    }
272d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
273d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
274d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
275d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
276d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
277d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
278d95e75fdSopenharmony_ci    CellularCallInfo callInfo;
279d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
280d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
281d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
282d95e75fdSopenharmony_ci        char code = '1';
283d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
284d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
285d95e75fdSopenharmony_ci    }
286d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
287d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
288d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
289d95e75fdSopenharmony_ci        char code = '1';
290d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
291d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
292d95e75fdSopenharmony_ci    }
293d95e75fdSopenharmony_ci}
294d95e75fdSopenharmony_ci
295d95e75fdSopenharmony_ci/**
296d95e75fdSopenharmony_ci * @tc.number   Satellite_call_StopDtmf_0001
297d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function by satellite
298d95e75fdSopenharmony_ci * @tc.desc     Function test
299d95e75fdSopenharmony_ci */
300d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0001, Function | MediumTest | Level2)
301d95e75fdSopenharmony_ci{
302d95e75fdSopenharmony_ci    AccessToken token;
303d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
304d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
305d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
306d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
307d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
308d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
309d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
310d95e75fdSopenharmony_ci        return;
311d95e75fdSopenharmony_ci    }
312d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
313d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
314d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
315d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
316d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
317d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
318d95e75fdSopenharmony_ci    }
319d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
320d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
321d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
322d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
323d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
324d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
325d95e75fdSopenharmony_ci    }
326d95e75fdSopenharmony_ci}
327d95e75fdSopenharmony_ci
328d95e75fdSopenharmony_ci/**
329d95e75fdSopenharmony_ci * @tc.number   Satellite_call_StopDtmf_0002
330d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function with invalid slot by satellite
331d95e75fdSopenharmony_ci * @tc.desc     Function test
332d95e75fdSopenharmony_ci */
333d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0002, Function | MediumTest | Level2)
334d95e75fdSopenharmony_ci{
335d95e75fdSopenharmony_ci    AccessToken token;
336d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
337d95e75fdSopenharmony_ci        return;
338d95e75fdSopenharmony_ci    }
339d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
340d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
341d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
342d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
343d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
344d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
345d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
346d95e75fdSopenharmony_ci        CellularCallInfo stopDtmfCallInfo;
347d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo);
348d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
349d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(stopDtmfCallInfo);
350d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
351d95e75fdSopenharmony_ci    }
352d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
353d95e75fdSopenharmony_ci        CellularCallInfo stopDtmfCallInfo;
354d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo);
355d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
356d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(stopDtmfCallInfo);
357d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
358d95e75fdSopenharmony_ci    }
359d95e75fdSopenharmony_ci}
360d95e75fdSopenharmony_ci
361d95e75fdSopenharmony_ci/**
362d95e75fdSopenharmony_ci * @tc.number   Satellite_call_SendDtmf_0001
363d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function by satellite
364d95e75fdSopenharmony_ci * @tc.desc     Function test
365d95e75fdSopenharmony_ci */
366d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0001, Function | MediumTest | Level2)
367d95e75fdSopenharmony_ci{
368d95e75fdSopenharmony_ci    AccessToken token;
369d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
370d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
371d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
372d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
373d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
374d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
375d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
376d95e75fdSopenharmony_ci        return;
377d95e75fdSopenharmony_ci    }
378d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
379d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
380d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
381d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
382d95e75fdSopenharmony_ci        char code = '1';
383d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
384d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
385d95e75fdSopenharmony_ci    }
386d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
387d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
388d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
389d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
390d95e75fdSopenharmony_ci        char code = '1';
391d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
392d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
393d95e75fdSopenharmony_ci    }
394d95e75fdSopenharmony_ci}
395d95e75fdSopenharmony_ci
396d95e75fdSopenharmony_ci/**
397d95e75fdSopenharmony_ci * @tc.number   Satellite_call_SendDtmf_0002
398d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function with invalid slot by satellite
399d95e75fdSopenharmony_ci * @tc.desc     Function test
400d95e75fdSopenharmony_ci */
401d95e75fdSopenharmony_ciHWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0002, Function | MediumTest | Level2)
402d95e75fdSopenharmony_ci{
403d95e75fdSopenharmony_ci    AccessToken token;
404d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
405d95e75fdSopenharmony_ci        return;
406d95e75fdSopenharmony_ci    }
407d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
408d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
409d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
410d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
411d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
412d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
413d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
414d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
415d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
416d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
417d95e75fdSopenharmony_ci        char code = '1';
418d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
419d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
420d95e75fdSopenharmony_ci    }
421d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
422d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
423d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
424d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
425d95e75fdSopenharmony_ci        char code = '1';
426d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
427d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
428d95e75fdSopenharmony_ci    }
429d95e75fdSopenharmony_ci}
430d95e75fdSopenharmony_ci} // namespace Telephony
431d95e75fdSopenharmony_ci} // namespace OHOS
432