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 "cs_test.h"
17d95e75fdSopenharmony_ci
18d95e75fdSopenharmony_ci#define PRIVATE public
19d95e75fdSopenharmony_ci#define PROTECTED public
20d95e75fdSopenharmony_ci#include "cellular_call_callback.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 "cellular_call_supplement.h"
26d95e75fdSopenharmony_ci#include "config_request.h"
27d95e75fdSopenharmony_ci#include "core_service_client.h"
28d95e75fdSopenharmony_ci#include "cs_control.h"
29d95e75fdSopenharmony_ci#include "tel_ril_call_parcel.h"
30d95e75fdSopenharmony_ci#include "operator_config_types.h"
31d95e75fdSopenharmony_ci#include "radio_event.h"
32d95e75fdSopenharmony_ci#include "securec.h"
33d95e75fdSopenharmony_ci#include "sim_state_type.h"
34d95e75fdSopenharmony_ci
35d95e75fdSopenharmony_cinamespace OHOS {
36d95e75fdSopenharmony_cinamespace Telephony {
37d95e75fdSopenharmony_ciusing namespace testing::ext;
38d95e75fdSopenharmony_ciconst int32_t SIM1_SLOTID = 0;
39d95e75fdSopenharmony_ciconst int32_t SIM2_SLOTID = 1;
40d95e75fdSopenharmony_ciconst int32_t INVALID_SLOTID = 0xFF;
41d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER = "0000000";
42d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_SECOND = "1111111";
43d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_THIRD = "2222222";
44d95e75fdSopenharmony_ci
45d95e75fdSopenharmony_ci/**
46d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0001
47d95e75fdSopenharmony_ci * @tc.name     Test for SetClip function by cs
48d95e75fdSopenharmony_ci * @tc.desc     Function test
49d95e75fdSopenharmony_ci */
50d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0001, Function | MediumTest | Level2)
51d95e75fdSopenharmony_ci{
52d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
53d95e75fdSopenharmony_ci        return;
54d95e75fdSopenharmony_ci    }
55d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
56d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#");
57d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
58d95e75fdSopenharmony_ci    }
59d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
60d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#");
61d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
62d95e75fdSopenharmony_ci    }
63d95e75fdSopenharmony_ci}
64d95e75fdSopenharmony_ci
65d95e75fdSopenharmony_ci/**
66d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0002
67d95e75fdSopenharmony_ci * @tc.name     Test for SetClip function by cs
68d95e75fdSopenharmony_ci * @tc.desc     Function test
69d95e75fdSopenharmony_ci */
70d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0002, Function | MediumTest | Level2)
71d95e75fdSopenharmony_ci{
72d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
73d95e75fdSopenharmony_ci        return;
74d95e75fdSopenharmony_ci    }
75d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
76d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#");
77d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
78d95e75fdSopenharmony_ci    }
79d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
80d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#");
81d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
82d95e75fdSopenharmony_ci    }
83d95e75fdSopenharmony_ci}
84d95e75fdSopenharmony_ci
85d95e75fdSopenharmony_ci/**
86d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0003
87d95e75fdSopenharmony_ci * @tc.name     Test for getClip function by cs
88d95e75fdSopenharmony_ci * @tc.desc     Function test
89d95e75fdSopenharmony_ci */
90d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0003, Function | MediumTest | Level2)
91d95e75fdSopenharmony_ci{
92d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
93d95e75fdSopenharmony_ci        return;
94d95e75fdSopenharmony_ci    }
95d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
96d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#");
97d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
98d95e75fdSopenharmony_ci    }
99d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
100d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#");
101d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
102d95e75fdSopenharmony_ci    }
103d95e75fdSopenharmony_ci}
104d95e75fdSopenharmony_ci
105d95e75fdSopenharmony_ci/**
106d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0004
107d95e75fdSopenharmony_ci * @tc.name     Test for SetClir function by cs
108d95e75fdSopenharmony_ci * @tc.desc     Function test
109d95e75fdSopenharmony_ci */
110d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0004, Function | MediumTest | Level2)
111d95e75fdSopenharmony_ci{
112d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
113d95e75fdSopenharmony_ci        return;
114d95e75fdSopenharmony_ci    }
115d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
116d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#");
117d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
118d95e75fdSopenharmony_ci    }
119d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
120d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#");
121d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
122d95e75fdSopenharmony_ci    }
123d95e75fdSopenharmony_ci}
124d95e75fdSopenharmony_ci
125d95e75fdSopenharmony_ci/**
126d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0005
127d95e75fdSopenharmony_ci * @tc.name     Test for SetClir function by cs
128d95e75fdSopenharmony_ci * @tc.desc     Function test
129d95e75fdSopenharmony_ci */
130d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0005, Function | MediumTest | Level2)
131d95e75fdSopenharmony_ci{
132d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
133d95e75fdSopenharmony_ci        return;
134d95e75fdSopenharmony_ci    }
135d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
136d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#");
137d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
138d95e75fdSopenharmony_ci    }
139d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
140d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#");
141d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
142d95e75fdSopenharmony_ci    }
143d95e75fdSopenharmony_ci}
144d95e75fdSopenharmony_ci
145d95e75fdSopenharmony_ci/**
146d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0006
147d95e75fdSopenharmony_ci * @tc.name     Test for GetClir function by cs
148d95e75fdSopenharmony_ci * @tc.desc     Function test
149d95e75fdSopenharmony_ci */
150d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0006, Function | MediumTest | Level2)
151d95e75fdSopenharmony_ci{
152d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
153d95e75fdSopenharmony_ci        return;
154d95e75fdSopenharmony_ci    }
155d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
156d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#");
157d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
158d95e75fdSopenharmony_ci    }
159d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
160d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#");
161d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
162d95e75fdSopenharmony_ci    }
163d95e75fdSopenharmony_ci}
164d95e75fdSopenharmony_ci
165d95e75fdSopenharmony_ci/**
166d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0007
167d95e75fdSopenharmony_ci * @tc.name     Test for SetCallTransfer function by cs
168d95e75fdSopenharmony_ci * @tc.desc     Function test
169d95e75fdSopenharmony_ci */
170d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0007, Function | MediumTest | Level2)
171d95e75fdSopenharmony_ci{
172d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
173d95e75fdSopenharmony_ci        return;
174d95e75fdSopenharmony_ci    }
175d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
176d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#");
177d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
178d95e75fdSopenharmony_ci    }
179d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
180d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#");
181d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
182d95e75fdSopenharmony_ci    }
183d95e75fdSopenharmony_ci}
184d95e75fdSopenharmony_ci
185d95e75fdSopenharmony_ci/**
186d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0008
187d95e75fdSopenharmony_ci * @tc.name     Test for SetCallTransfer function by cs
188d95e75fdSopenharmony_ci * @tc.desc     Function test
189d95e75fdSopenharmony_ci */
190d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0008, Function | MediumTest | Level2)
191d95e75fdSopenharmony_ci{
192d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
193d95e75fdSopenharmony_ci        return;
194d95e75fdSopenharmony_ci    }
195d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
196d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#");
197d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
198d95e75fdSopenharmony_ci    }
199d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
200d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#");
201d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
202d95e75fdSopenharmony_ci    }
203d95e75fdSopenharmony_ci}
204d95e75fdSopenharmony_ci
205d95e75fdSopenharmony_ci/**
206d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0009
207d95e75fdSopenharmony_ci * @tc.name     Test for GetCallTransfer function by cs
208d95e75fdSopenharmony_ci * @tc.desc     Function test
209d95e75fdSopenharmony_ci */
210d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0009, Function | MediumTest | Level2)
211d95e75fdSopenharmony_ci{
212d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
213d95e75fdSopenharmony_ci        return;
214d95e75fdSopenharmony_ci    }
215d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
216d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#");
217d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
218d95e75fdSopenharmony_ci    }
219d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
220d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#");
221d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
222d95e75fdSopenharmony_ci    }
223d95e75fdSopenharmony_ci}
224d95e75fdSopenharmony_ci
225d95e75fdSopenharmony_ci/**
226d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0010
227d95e75fdSopenharmony_ci * @tc.name     Test for SetCallRestriction function by cs
228d95e75fdSopenharmony_ci * @tc.desc     Function test
229d95e75fdSopenharmony_ci */
230d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0010, Function | MediumTest | Level2)
231d95e75fdSopenharmony_ci{
232d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
233d95e75fdSopenharmony_ci        return;
234d95e75fdSopenharmony_ci    }
235d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
236d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#");
237d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
238d95e75fdSopenharmony_ci    }
239d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
240d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#");
241d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
242d95e75fdSopenharmony_ci    }
243d95e75fdSopenharmony_ci}
244d95e75fdSopenharmony_ci
245d95e75fdSopenharmony_ci/**
246d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0011
247d95e75fdSopenharmony_ci * @tc.name     Test for SetCallRestriction function by cs
248d95e75fdSopenharmony_ci * @tc.desc     Function test
249d95e75fdSopenharmony_ci */
250d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0011, Function | MediumTest | Level2)
251d95e75fdSopenharmony_ci{
252d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
253d95e75fdSopenharmony_ci        return;
254d95e75fdSopenharmony_ci    }
255d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
256d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#");
257d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
258d95e75fdSopenharmony_ci    }
259d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
260d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#");
261d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
262d95e75fdSopenharmony_ci    }
263d95e75fdSopenharmony_ci}
264d95e75fdSopenharmony_ci
265d95e75fdSopenharmony_ci/**
266d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0012
267d95e75fdSopenharmony_ci * @tc.name     Test for GetCallRestriction function by cs
268d95e75fdSopenharmony_ci * @tc.desc     Function test
269d95e75fdSopenharmony_ci */
270d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0012, Function | MediumTest | Level2)
271d95e75fdSopenharmony_ci{
272d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
273d95e75fdSopenharmony_ci        return;
274d95e75fdSopenharmony_ci    }
275d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
276d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#");
277d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
278d95e75fdSopenharmony_ci    }
279d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
280d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#");
281d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
282d95e75fdSopenharmony_ci    }
283d95e75fdSopenharmony_ci}
284d95e75fdSopenharmony_ci
285d95e75fdSopenharmony_ci/**
286d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0013
287d95e75fdSopenharmony_ci * @tc.name     Test for SetCallWaiting function by cs
288d95e75fdSopenharmony_ci * @tc.desc     Function test
289d95e75fdSopenharmony_ci */
290d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0013, Function | MediumTest | Level2)
291d95e75fdSopenharmony_ci{
292d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
293d95e75fdSopenharmony_ci        return;
294d95e75fdSopenharmony_ci    }
295d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
296d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#");
297d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
298d95e75fdSopenharmony_ci    }
299d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
300d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#");
301d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
302d95e75fdSopenharmony_ci    }
303d95e75fdSopenharmony_ci}
304d95e75fdSopenharmony_ci
305d95e75fdSopenharmony_ci/**
306d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0014
307d95e75fdSopenharmony_ci * @tc.name     Test for SetCallWaiting function by cs
308d95e75fdSopenharmony_ci * @tc.desc     Function test
309d95e75fdSopenharmony_ci */
310d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0014, Function | MediumTest | Level2)
311d95e75fdSopenharmony_ci{
312d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
313d95e75fdSopenharmony_ci        return;
314d95e75fdSopenharmony_ci    }
315d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
316d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#");
317d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
318d95e75fdSopenharmony_ci    }
319d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
320d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#");
321d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
322d95e75fdSopenharmony_ci    }
323d95e75fdSopenharmony_ci}
324d95e75fdSopenharmony_ci
325d95e75fdSopenharmony_ci/**
326d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0015
327d95e75fdSopenharmony_ci * @tc.name     Test for GetCallWaiting function by cs
328d95e75fdSopenharmony_ci * @tc.desc     Function test
329d95e75fdSopenharmony_ci */
330d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0015, Function | MediumTest | Level2)
331d95e75fdSopenharmony_ci{
332d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
333d95e75fdSopenharmony_ci        return;
334d95e75fdSopenharmony_ci    }
335d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
336d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#");
337d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
338d95e75fdSopenharmony_ci    }
339d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
340d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#");
341d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
342d95e75fdSopenharmony_ci    }
343d95e75fdSopenharmony_ci}
344d95e75fdSopenharmony_ci
345d95e75fdSopenharmony_ci/**
346d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0016
347d95e75fdSopenharmony_ci * @tc.name     Test for AlterPinPassword function by cs
348d95e75fdSopenharmony_ci * @tc.desc     Function test
349d95e75fdSopenharmony_ci */
350d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0016, Function | MediumTest | Level2)
351d95e75fdSopenharmony_ci{
352d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
353d95e75fdSopenharmony_ci        return;
354d95e75fdSopenharmony_ci    }
355d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
356d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#");
357d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
358d95e75fdSopenharmony_ci    }
359d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
360d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#");
361d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
362d95e75fdSopenharmony_ci    }
363d95e75fdSopenharmony_ci}
364d95e75fdSopenharmony_ci
365d95e75fdSopenharmony_ci/**
366d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0017
367d95e75fdSopenharmony_ci * @tc.name     Test for UnlockPuk function by cs
368d95e75fdSopenharmony_ci * @tc.desc     Function test
369d95e75fdSopenharmony_ci */
370d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0017, Function | MediumTest | Level2)
371d95e75fdSopenharmony_ci{
372d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
373d95e75fdSopenharmony_ci        return;
374d95e75fdSopenharmony_ci    }
375d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
376d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#");
377d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
378d95e75fdSopenharmony_ci    }
379d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
380d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#");
381d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
382d95e75fdSopenharmony_ci    }
383d95e75fdSopenharmony_ci}
384d95e75fdSopenharmony_ci
385d95e75fdSopenharmony_ci/**
386d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0018
387d95e75fdSopenharmony_ci * @tc.name     Test for AlterPin2Password function by cs
388d95e75fdSopenharmony_ci * @tc.desc     Function test
389d95e75fdSopenharmony_ci */
390d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0018, Function | MediumTest | Level2)
391d95e75fdSopenharmony_ci{
392d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
393d95e75fdSopenharmony_ci        return;
394d95e75fdSopenharmony_ci    }
395d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
396d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#");
397d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
398d95e75fdSopenharmony_ci    }
399d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
400d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#");
401d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
402d95e75fdSopenharmony_ci    }
403d95e75fdSopenharmony_ci}
404d95e75fdSopenharmony_ci
405d95e75fdSopenharmony_ci/**
406d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0019
407d95e75fdSopenharmony_ci * @tc.name     Test for UnlockPuk2 function by cs
408d95e75fdSopenharmony_ci * @tc.desc     Function test
409d95e75fdSopenharmony_ci */
410d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0019, Function | MediumTest | Level2)
411d95e75fdSopenharmony_ci{
412d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
413d95e75fdSopenharmony_ci        return;
414d95e75fdSopenharmony_ci    }
415d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
416d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#");
417d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
418d95e75fdSopenharmony_ci    }
419d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
420d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#");
421d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
422d95e75fdSopenharmony_ci    }
423d95e75fdSopenharmony_ci}
424d95e75fdSopenharmony_ci
425d95e75fdSopenharmony_ci/**
426d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0020
427d95e75fdSopenharmony_ci * @tc.name     Test for SendUssd function by cs
428d95e75fdSopenharmony_ci * @tc.desc     Function test
429d95e75fdSopenharmony_ci */
430d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0020, Function | MediumTest | Level2)
431d95e75fdSopenharmony_ci{
432d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
433d95e75fdSopenharmony_ci        return;
434d95e75fdSopenharmony_ci    }
435d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
436d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#");
437d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
438d95e75fdSopenharmony_ci    }
439d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
440d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#");
441d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
442d95e75fdSopenharmony_ci    }
443d95e75fdSopenharmony_ci}
444d95e75fdSopenharmony_ci
445d95e75fdSopenharmony_ci/**
446d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0021
447d95e75fdSopenharmony_ci * @tc.name     Test for dial function with invalid slot by cs
448d95e75fdSopenharmony_ci * @tc.desc     Function test
449d95e75fdSopenharmony_ci */
450d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0021, Function | MediumTest | Level2)
451d95e75fdSopenharmony_ci{
452d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
453d95e75fdSopenharmony_ci        return;
454d95e75fdSopenharmony_ci    }
455d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
456d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER);
457d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
458d95e75fdSopenharmony_ci    }
459d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
460d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER);
461d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
462d95e75fdSopenharmony_ci    }
463d95e75fdSopenharmony_ci}
464d95e75fdSopenharmony_ci
465d95e75fdSopenharmony_ci/**
466d95e75fdSopenharmony_ci * @tc.number   cellular_call_HangUpCall_0001
467d95e75fdSopenharmony_ci * @tc.name     Test for HangUp function by cs
468d95e75fdSopenharmony_ci * @tc.desc     Function test
469d95e75fdSopenharmony_ci */
470d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HangUpCall_0001, Function | MediumTest | Level2)
471d95e75fdSopenharmony_ci{
472d95e75fdSopenharmony_ci    AccessToken token;
473d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
474d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
475d95e75fdSopenharmony_ci    auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
476d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpCallRemote != nullptr);
477d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote);
478d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
479d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
480d95e75fdSopenharmony_ci        return;
481d95e75fdSopenharmony_ci    }
482d95e75fdSopenharmony_ci    CellularCallInfo hangUpCallInfo;
483d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
484d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, hangUpCallInfo);
485d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
486d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT);
487d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
488d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
489d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
490d95e75fdSopenharmony_ci    }
491d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
492d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, hangUpCallInfo);
493d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
494d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT);
495d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
496d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
497d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
498d95e75fdSopenharmony_ci    }
499d95e75fdSopenharmony_ci}
500d95e75fdSopenharmony_ci
501d95e75fdSopenharmony_ci/**
502d95e75fdSopenharmony_ci * @tc.number   cellular_call_HangUpCall_0002
503d95e75fdSopenharmony_ci * @tc.name     Test for HangUp function with invalid slot by cs
504d95e75fdSopenharmony_ci * @tc.desc     Function test
505d95e75fdSopenharmony_ci */
506d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HangUpCall_0002, Function | MediumTest | Level2)
507d95e75fdSopenharmony_ci{
508d95e75fdSopenharmony_ci    AccessToken token;
509d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
510d95e75fdSopenharmony_ci        return;
511d95e75fdSopenharmony_ci    }
512d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
513d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
514d95e75fdSopenharmony_ci    auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
515d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpCallRemote != nullptr);
516d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote);
517d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
518d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
519d95e75fdSopenharmony_ci        CellularCallInfo hangUpCallInfo;
520d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo);
521d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
522d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT);
523d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
524d95e75fdSopenharmony_ci    }
525d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
526d95e75fdSopenharmony_ci        CellularCallInfo hangUpCallInfo;
527d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo);
528d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
529d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT);
530d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
531d95e75fdSopenharmony_ci    }
532d95e75fdSopenharmony_ci}
533d95e75fdSopenharmony_ci
534d95e75fdSopenharmony_ci/**
535d95e75fdSopenharmony_ci * @tc.number   cellular_call_AnswerCall_0001
536d95e75fdSopenharmony_ci * @tc.name     Test for answer function by cs
537d95e75fdSopenharmony_ci * @tc.desc     Function test
538d95e75fdSopenharmony_ci */
539d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_AnswerCall_0001, Function | MediumTest | Level2)
540d95e75fdSopenharmony_ci{
541d95e75fdSopenharmony_ci    AccessToken token;
542d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
543d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
544d95e75fdSopenharmony_ci    auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
545d95e75fdSopenharmony_ci    ASSERT_TRUE(answerCallRemote != nullptr);
546d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(answerCallRemote);
547d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
548d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
549d95e75fdSopenharmony_ci        return;
550d95e75fdSopenharmony_ci    }
551d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
552d95e75fdSopenharmony_ci        CellularCallInfo answerCallInfo;
553d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo);
554d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
555d95e75fdSopenharmony_ci        ret = telephonyService->Answer(answerCallInfo);
556d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
557d95e75fdSopenharmony_ci    }
558d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
559d95e75fdSopenharmony_ci        CellularCallInfo answerCallInfo;
560d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, answerCallInfo);
561d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
562d95e75fdSopenharmony_ci        ret = telephonyService->Answer(answerCallInfo);
563d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
564d95e75fdSopenharmony_ci    }
565d95e75fdSopenharmony_ci}
566d95e75fdSopenharmony_ci
567d95e75fdSopenharmony_ci/**
568d95e75fdSopenharmony_ci * @tc.number   cellular_call_AnswerCall_0002
569d95e75fdSopenharmony_ci * @tc.name     Test for answer function with invalid slot by cs
570d95e75fdSopenharmony_ci * @tc.desc     Function test
571d95e75fdSopenharmony_ci */
572d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_AnswerCall_0002, Function | MediumTest | Level2)
573d95e75fdSopenharmony_ci{
574d95e75fdSopenharmony_ci    AccessToken token;
575d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
576d95e75fdSopenharmony_ci        return;
577d95e75fdSopenharmony_ci    }
578d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
579d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
580d95e75fdSopenharmony_ci    auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
581d95e75fdSopenharmony_ci    ASSERT_TRUE(answerCallRemote != nullptr);
582d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(answerCallRemote);
583d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
584d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
585d95e75fdSopenharmony_ci        CellularCallInfo answerCallInfo;
586d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo);
587d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
588d95e75fdSopenharmony_ci        ret = telephonyService->Answer(answerCallInfo);
589d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
590d95e75fdSopenharmony_ci    }
591d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
592d95e75fdSopenharmony_ci        CellularCallInfo answerCallInfo;
593d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo);
594d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
595d95e75fdSopenharmony_ci        ret = telephonyService->Answer(answerCallInfo);
596d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
597d95e75fdSopenharmony_ci    }
598d95e75fdSopenharmony_ci}
599d95e75fdSopenharmony_ci
600d95e75fdSopenharmony_ci/**
601d95e75fdSopenharmony_ci * @tc.number   cellular_call_RejectCall_0001
602d95e75fdSopenharmony_ci * @tc.name     Test for reject function by cs
603d95e75fdSopenharmony_ci * @tc.desc     Function test
604d95e75fdSopenharmony_ci */
605d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_RejectCall_0001, Function | MediumTest | Level2)
606d95e75fdSopenharmony_ci{
607d95e75fdSopenharmony_ci    AccessToken token;
608d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
609d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
610d95e75fdSopenharmony_ci    auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
611d95e75fdSopenharmony_ci    ASSERT_TRUE(rejectCallRemote != nullptr);
612d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(rejectCallRemote);
613d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
614d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
615d95e75fdSopenharmony_ci        return;
616d95e75fdSopenharmony_ci    }
617d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
618d95e75fdSopenharmony_ci        CellularCallInfo rejectCallInfo;
619d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo);
620d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
621d95e75fdSopenharmony_ci        ret = telephonyService->Reject(rejectCallInfo);
622d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
623d95e75fdSopenharmony_ci    }
624d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
625d95e75fdSopenharmony_ci        CellularCallInfo rejectCallInfo;
626d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, rejectCallInfo);
627d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
628d95e75fdSopenharmony_ci        ret = telephonyService->Reject(rejectCallInfo);
629d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
630d95e75fdSopenharmony_ci    }
631d95e75fdSopenharmony_ci}
632d95e75fdSopenharmony_ci
633d95e75fdSopenharmony_ci/**
634d95e75fdSopenharmony_ci * @tc.number   cellular_call_RejectCall_0002
635d95e75fdSopenharmony_ci * @tc.name     Test for reject function with invalid slot by cs
636d95e75fdSopenharmony_ci * @tc.desc     Function test
637d95e75fdSopenharmony_ci */
638d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_RejectCall_0002, Function | MediumTest | Level2)
639d95e75fdSopenharmony_ci{
640d95e75fdSopenharmony_ci    AccessToken token;
641d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
642d95e75fdSopenharmony_ci        return;
643d95e75fdSopenharmony_ci    }
644d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
645d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
646d95e75fdSopenharmony_ci    auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
647d95e75fdSopenharmony_ci    ASSERT_TRUE(rejectCallRemote != nullptr);
648d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(rejectCallRemote);
649d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
650d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
651d95e75fdSopenharmony_ci        CellularCallInfo rejectCallInfo;
652d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo);
653d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
654d95e75fdSopenharmony_ci        ret = telephonyService->Reject(rejectCallInfo);
655d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
656d95e75fdSopenharmony_ci    }
657d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
658d95e75fdSopenharmony_ci        CellularCallInfo rejectCallInfo;
659d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo);
660d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
661d95e75fdSopenharmony_ci        ret = telephonyService->Reject(rejectCallInfo);
662d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
663d95e75fdSopenharmony_ci    }
664d95e75fdSopenharmony_ci}
665d95e75fdSopenharmony_ci
666d95e75fdSopenharmony_ci/**
667d95e75fdSopenharmony_ci * @tc.number   cellular_call_HoldCall_0001
668d95e75fdSopenharmony_ci * @tc.name     Test for hold call function by cs
669d95e75fdSopenharmony_ci * @tc.desc     Function test
670d95e75fdSopenharmony_ci */
671d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HoldCall_0001, Function | MediumTest | Level2)
672d95e75fdSopenharmony_ci{
673d95e75fdSopenharmony_ci    AccessToken token;
674d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
675d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
676d95e75fdSopenharmony_ci    auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
677d95e75fdSopenharmony_ci    ASSERT_TRUE(holdCallRemote != nullptr);
678d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(holdCallRemote);
679d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
680d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
681d95e75fdSopenharmony_ci        return;
682d95e75fdSopenharmony_ci    }
683d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
684d95e75fdSopenharmony_ci        CellularCallInfo holdCallInfo;
685d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo);
686d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
687d95e75fdSopenharmony_ci        ret = telephonyService->HoldCall(holdCallInfo);
688d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
689d95e75fdSopenharmony_ci    }
690d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
691d95e75fdSopenharmony_ci        CellularCallInfo holdCallInfo;
692d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, holdCallInfo);
693d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
694d95e75fdSopenharmony_ci        ret = telephonyService->HoldCall(holdCallInfo);
695d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
696d95e75fdSopenharmony_ci    }
697d95e75fdSopenharmony_ci}
698d95e75fdSopenharmony_ci
699d95e75fdSopenharmony_ci/**
700d95e75fdSopenharmony_ci * @tc.number   cellular_call_HoldCall_0002
701d95e75fdSopenharmony_ci * @tc.name     Test for hold function with invalid slot by cs
702d95e75fdSopenharmony_ci * @tc.desc     Function test
703d95e75fdSopenharmony_ci */
704d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HoldCall_0002, Function | MediumTest | Level2)
705d95e75fdSopenharmony_ci{
706d95e75fdSopenharmony_ci    AccessToken token;
707d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
708d95e75fdSopenharmony_ci        return;
709d95e75fdSopenharmony_ci    }
710d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
711d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
712d95e75fdSopenharmony_ci    auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
713d95e75fdSopenharmony_ci    ASSERT_TRUE(holdCallRemote != nullptr);
714d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(holdCallRemote);
715d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
716d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
717d95e75fdSopenharmony_ci        CellularCallInfo holdCallInfo;
718d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo);
719d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
720d95e75fdSopenharmony_ci        ret = telephonyService->HoldCall(holdCallInfo);
721d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
722d95e75fdSopenharmony_ci    }
723d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
724d95e75fdSopenharmony_ci        CellularCallInfo holdCallInfo;
725d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo);
726d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
727d95e75fdSopenharmony_ci        ret = telephonyService->HoldCall(holdCallInfo);
728d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
729d95e75fdSopenharmony_ci    }
730d95e75fdSopenharmony_ci}
731d95e75fdSopenharmony_ci
732d95e75fdSopenharmony_ci/**
733d95e75fdSopenharmony_ci * @tc.number   cellular_call_UnHoldCall_0001
734d95e75fdSopenharmony_ci * @tc.name     Test for unhold call function by cs
735d95e75fdSopenharmony_ci * @tc.desc     Function test
736d95e75fdSopenharmony_ci */
737d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2)
738d95e75fdSopenharmony_ci{
739d95e75fdSopenharmony_ci    AccessToken token;
740d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
741d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
742d95e75fdSopenharmony_ci    auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
743d95e75fdSopenharmony_ci    ASSERT_TRUE(unHoldCallRemote != nullptr);
744d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(unHoldCallRemote);
745d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
746d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
747d95e75fdSopenharmony_ci        return;
748d95e75fdSopenharmony_ci    }
749d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
750d95e75fdSopenharmony_ci        CellularCallInfo unHoldCallInfo;
751d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo);
752d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
753d95e75fdSopenharmony_ci        ret = telephonyService->UnHoldCall(unHoldCallInfo);
754d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
755d95e75fdSopenharmony_ci    }
756d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
757d95e75fdSopenharmony_ci        CellularCallInfo unHoldCallInfo;
758d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, unHoldCallInfo);
759d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
760d95e75fdSopenharmony_ci        ret = telephonyService->UnHoldCall(unHoldCallInfo);
761d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
762d95e75fdSopenharmony_ci    }
763d95e75fdSopenharmony_ci}
764d95e75fdSopenharmony_ci
765d95e75fdSopenharmony_ci/**
766d95e75fdSopenharmony_ci * @tc.number   cellular_call_UnHoldCall_0002
767d95e75fdSopenharmony_ci * @tc.name     Test for unhold function with invalid slot by cs
768d95e75fdSopenharmony_ci * @tc.desc     Function test
769d95e75fdSopenharmony_ci */
770d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_UnHoldCall_0002, Function | MediumTest | Level2)
771d95e75fdSopenharmony_ci{
772d95e75fdSopenharmony_ci    AccessToken token;
773d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
774d95e75fdSopenharmony_ci        return;
775d95e75fdSopenharmony_ci    }
776d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
777d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
778d95e75fdSopenharmony_ci    auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
779d95e75fdSopenharmony_ci    ASSERT_TRUE(unHoldCallRemote != nullptr);
780d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(unHoldCallRemote);
781d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
782d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
783d95e75fdSopenharmony_ci        CellularCallInfo unHoldCallInfo;
784d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo);
785d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
786d95e75fdSopenharmony_ci        ret = telephonyService->UnHoldCall(unHoldCallInfo);
787d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
788d95e75fdSopenharmony_ci    }
789d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
790d95e75fdSopenharmony_ci        CellularCallInfo unHoldCallInfo;
791d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo);
792d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
793d95e75fdSopenharmony_ci        ret = telephonyService->UnHoldCall(unHoldCallInfo);
794d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
795d95e75fdSopenharmony_ci    }
796d95e75fdSopenharmony_ci}
797d95e75fdSopenharmony_ci
798d95e75fdSopenharmony_ci/**
799d95e75fdSopenharmony_ci * @tc.number   cellular_call_SwitchCall_0001
800d95e75fdSopenharmony_ci * @tc.name     Test for switch call function by cs
801d95e75fdSopenharmony_ci * @tc.desc     Function test
802d95e75fdSopenharmony_ci */
803d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SwitchCall_0001, Function | MediumTest | Level2)
804d95e75fdSopenharmony_ci{
805d95e75fdSopenharmony_ci    AccessToken token;
806d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
807d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
808d95e75fdSopenharmony_ci    auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
809d95e75fdSopenharmony_ci    ASSERT_TRUE(switchCallRemote != nullptr);
810d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(switchCallRemote);
811d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
812d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
813d95e75fdSopenharmony_ci        return;
814d95e75fdSopenharmony_ci    }
815d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
816d95e75fdSopenharmony_ci        CellularCallInfo switchCallInfo;
817d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo);
818d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
819d95e75fdSopenharmony_ci        ret = telephonyService->SwitchCall(switchCallInfo);
820d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
821d95e75fdSopenharmony_ci    }
822d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
823d95e75fdSopenharmony_ci        CellularCallInfo switchCallInfo;
824d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, switchCallInfo);
825d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
826d95e75fdSopenharmony_ci        ret = telephonyService->SwitchCall(switchCallInfo);
827d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
828d95e75fdSopenharmony_ci    }
829d95e75fdSopenharmony_ci}
830d95e75fdSopenharmony_ci
831d95e75fdSopenharmony_ci/**
832d95e75fdSopenharmony_ci * @tc.number   cellular_call_SwitchCall_0002
833d95e75fdSopenharmony_ci * @tc.name     Test for switch function with invalid slot by cs
834d95e75fdSopenharmony_ci * @tc.desc     Function test
835d95e75fdSopenharmony_ci */
836d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SwitchCall_0002, Function | MediumTest | Level2)
837d95e75fdSopenharmony_ci{
838d95e75fdSopenharmony_ci    AccessToken token;
839d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
840d95e75fdSopenharmony_ci        return;
841d95e75fdSopenharmony_ci    }
842d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
843d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
844d95e75fdSopenharmony_ci    auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
845d95e75fdSopenharmony_ci    ASSERT_TRUE(switchCallRemote != nullptr);
846d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(switchCallRemote);
847d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
848d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
849d95e75fdSopenharmony_ci        CellularCallInfo switchCallInfo;
850d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo);
851d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
852d95e75fdSopenharmony_ci        ret = telephonyService->SwitchCall(switchCallInfo);
853d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
854d95e75fdSopenharmony_ci    }
855d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
856d95e75fdSopenharmony_ci        CellularCallInfo switchCallInfo;
857d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo);
858d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
859d95e75fdSopenharmony_ci        ret = telephonyService->SwitchCall(switchCallInfo);
860d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
861d95e75fdSopenharmony_ci    }
862d95e75fdSopenharmony_ci}
863d95e75fdSopenharmony_ci
864d95e75fdSopenharmony_ci/**
865d95e75fdSopenharmony_ci * @tc.number   cellular_call_CombineConference_0001
866d95e75fdSopenharmony_ci * @tc.name     Test for combineConference function by cs
867d95e75fdSopenharmony_ci * @tc.desc     Function test
868d95e75fdSopenharmony_ci */
869d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CombineConference_0001, Function | MediumTest | Level2)
870d95e75fdSopenharmony_ci{
871d95e75fdSopenharmony_ci    AccessToken token;
872d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
873d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
874d95e75fdSopenharmony_ci    auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
875d95e75fdSopenharmony_ci    ASSERT_TRUE(combineRemote != nullptr);
876d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(combineRemote);
877d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
878d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
879d95e75fdSopenharmony_ci        return;
880d95e75fdSopenharmony_ci    }
881d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
882d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
883d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, conferenceCallInfo);
884d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
885d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
886d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
887d95e75fdSopenharmony_ci    }
888d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
889d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
890d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, conferenceCallInfo);
891d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
892d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
893d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
894d95e75fdSopenharmony_ci    }
895d95e75fdSopenharmony_ci}
896d95e75fdSopenharmony_ci
897d95e75fdSopenharmony_ci/**
898d95e75fdSopenharmony_ci * @tc.number   cellular_call_CombineConference_0002
899d95e75fdSopenharmony_ci * @tc.name     Test for combineConference function with invalid slot by cs
900d95e75fdSopenharmony_ci * @tc.desc     Function test
901d95e75fdSopenharmony_ci */
902d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CombineConference_0002, Function | MediumTest | Level2)
903d95e75fdSopenharmony_ci{
904d95e75fdSopenharmony_ci    AccessToken token;
905d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
906d95e75fdSopenharmony_ci        return;
907d95e75fdSopenharmony_ci    }
908d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
909d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
910d95e75fdSopenharmony_ci    auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
911d95e75fdSopenharmony_ci    ASSERT_TRUE(combineRemote != nullptr);
912d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(combineRemote);
913d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
914d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
915d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
916d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo);
917d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
918d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
919d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
920d95e75fdSopenharmony_ci    }
921d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
922d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
923d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo);
924d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
925d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
926d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
927d95e75fdSopenharmony_ci    }
928d95e75fdSopenharmony_ci}
929d95e75fdSopenharmony_ci
930d95e75fdSopenharmony_ci/**
931d95e75fdSopenharmony_ci * @tc.number   cellular_call_SeparateConference_0001
932d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function by cs
933d95e75fdSopenharmony_ci * @tc.desc     Function test
934d95e75fdSopenharmony_ci */
935d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SeparateConference_0001, Function | MediumTest | Level2)
936d95e75fdSopenharmony_ci{
937d95e75fdSopenharmony_ci    AccessToken token;
938d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
939d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
940d95e75fdSopenharmony_ci    auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
941d95e75fdSopenharmony_ci    ASSERT_TRUE(separateRemote != nullptr);
942d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(separateRemote);
943d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
944d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
945d95e75fdSopenharmony_ci        return;
946d95e75fdSopenharmony_ci    }
947d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
948d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
949d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
950d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
951d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(callInfo);
952d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
953d95e75fdSopenharmony_ci    }
954d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
955d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
956d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
957d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
958d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(callInfo);
959d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
960d95e75fdSopenharmony_ci    }
961d95e75fdSopenharmony_ci}
962d95e75fdSopenharmony_ci
963d95e75fdSopenharmony_ci/**
964d95e75fdSopenharmony_ci * @tc.number   cellular_call_SeparateConference_0002
965d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function with invalid slot by cs
966d95e75fdSopenharmony_ci * @tc.desc     Function test
967d95e75fdSopenharmony_ci */
968d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SeparateConference_0002, Function | MediumTest | Level2)
969d95e75fdSopenharmony_ci{
970d95e75fdSopenharmony_ci    AccessToken token;
971d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
972d95e75fdSopenharmony_ci        return;
973d95e75fdSopenharmony_ci    }
974d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
975d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
976d95e75fdSopenharmony_ci    auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
977d95e75fdSopenharmony_ci    ASSERT_TRUE(separateRemote != nullptr);
978d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(separateRemote);
979d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
980d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
981d95e75fdSopenharmony_ci        CellularCallInfo separateCallInfo;
982d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo);
983d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
984d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(separateCallInfo);
985d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
986d95e75fdSopenharmony_ci    }
987d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
988d95e75fdSopenharmony_ci        CellularCallInfo separateCallInfo;
989d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo);
990d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
991d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(separateCallInfo);
992d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
993d95e75fdSopenharmony_ci    }
994d95e75fdSopenharmony_ci}
995d95e75fdSopenharmony_ci
996d95e75fdSopenharmony_ci/**
997d95e75fdSopenharmony_ci * @tc.number   cellular_call_KickOutFromConference_0001
998d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function by cs
999d95e75fdSopenharmony_ci * @tc.desc     Function test
1000d95e75fdSopenharmony_ci */
1001d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_KickOutFromConference_0001, Function | MediumTest | Level2)
1002d95e75fdSopenharmony_ci{
1003d95e75fdSopenharmony_ci    AccessToken token;
1004d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1005d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1006d95e75fdSopenharmony_ci    auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1007d95e75fdSopenharmony_ci    ASSERT_TRUE(kickOutRemote != nullptr);
1008d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(kickOutRemote);
1009d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1010d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1011d95e75fdSopenharmony_ci        return;
1012d95e75fdSopenharmony_ci    }
1013d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1014d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
1015d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, kickOutCallInfo);
1016d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1017d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
1018d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1019d95e75fdSopenharmony_ci    }
1020d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1021d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
1022d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, kickOutCallInfo);
1023d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1024d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
1025d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1026d95e75fdSopenharmony_ci    }
1027d95e75fdSopenharmony_ci}
1028d95e75fdSopenharmony_ci
1029d95e75fdSopenharmony_ci/**
1030d95e75fdSopenharmony_ci * @tc.number   cellular_call_KickOutFromConference_0002
1031d95e75fdSopenharmony_ci * @tc.name     Test for KickOutFromConference function with invalid slot by cs
1032d95e75fdSopenharmony_ci * @tc.desc     Function test
1033d95e75fdSopenharmony_ci */
1034d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_KickOutFromConference_0002, Function | MediumTest | Level2)
1035d95e75fdSopenharmony_ci{
1036d95e75fdSopenharmony_ci    AccessToken token;
1037d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1038d95e75fdSopenharmony_ci        return;
1039d95e75fdSopenharmony_ci    }
1040d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1041d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1042d95e75fdSopenharmony_ci    auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1043d95e75fdSopenharmony_ci    ASSERT_TRUE(kickOutRemote != nullptr);
1044d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(kickOutRemote);
1045d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1046d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1047d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
1048d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo);
1049d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1050d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
1051d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1052d95e75fdSopenharmony_ci    }
1053d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1054d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
1055d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo);
1056d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1057d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
1058d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1059d95e75fdSopenharmony_ci    }
1060d95e75fdSopenharmony_ci}
1061d95e75fdSopenharmony_ci
1062d95e75fdSopenharmony_ci/**
1063d95e75fdSopenharmony_ci * @tc.number   cellular_call_HangUpAllConnection_0001
1064d95e75fdSopenharmony_ci * @tc.name     Test for hangup all connection function by cs
1065d95e75fdSopenharmony_ci * @tc.desc     Function test
1066d95e75fdSopenharmony_ci */
1067d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HangUpAllConnection_0001, Function | MediumTest | Level2)
1068d95e75fdSopenharmony_ci{
1069d95e75fdSopenharmony_ci    AccessToken token;
1070d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1071d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1072d95e75fdSopenharmony_ci    auto hangUpAllConRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1073d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpAllConRemote != nullptr);
1074d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpAllConRemote);
1075d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1076d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1077d95e75fdSopenharmony_ci        return;
1078d95e75fdSopenharmony_ci    }
1079d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1080d95e75fdSopenharmony_ci        int32_t ret = telephonyService->HangUpAllConnection();
1081d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1082d95e75fdSopenharmony_ci    }
1083d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1084d95e75fdSopenharmony_ci        int32_t ret = telephonyService->HangUpAllConnection();
1085d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1086d95e75fdSopenharmony_ci    }
1087d95e75fdSopenharmony_ci}
1088d95e75fdSopenharmony_ci
1089d95e75fdSopenharmony_ci/**
1090d95e75fdSopenharmony_ci * @tc.number   cellular_call_StartDtmf_0001
1091d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function by cs
1092d95e75fdSopenharmony_ci * @tc.desc     Function test
1093d95e75fdSopenharmony_ci */
1094d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StartDtmf_0001, Function | MediumTest | Level2)
1095d95e75fdSopenharmony_ci{
1096d95e75fdSopenharmony_ci    AccessToken token;
1097d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1098d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1099d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1100d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
1101d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
1102d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1103d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1104d95e75fdSopenharmony_ci        return;
1105d95e75fdSopenharmony_ci    }
1106d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1107d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
1108d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1109d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1110d95e75fdSopenharmony_ci        char code = '1';
1111d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
1112d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1113d95e75fdSopenharmony_ci    }
1114d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1115d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
1116d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1117d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1118d95e75fdSopenharmony_ci        char code = '1';
1119d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
1120d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1121d95e75fdSopenharmony_ci    }
1122d95e75fdSopenharmony_ci}
1123d95e75fdSopenharmony_ci
1124d95e75fdSopenharmony_ci/**
1125d95e75fdSopenharmony_ci * @tc.number   cellular_call_StartDtmf_0002
1126d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function with invalid slot by cs
1127d95e75fdSopenharmony_ci * @tc.desc     Function test
1128d95e75fdSopenharmony_ci */
1129d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StartDtmf_0002, Function | MediumTest | Level2)
1130d95e75fdSopenharmony_ci{
1131d95e75fdSopenharmony_ci    AccessToken token;
1132d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1133d95e75fdSopenharmony_ci        return;
1134d95e75fdSopenharmony_ci    }
1135d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1136d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1137d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1138d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
1139d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
1140d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1141d95e75fdSopenharmony_ci    CellularCallInfo callInfo;
1142d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1143d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1144d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1145d95e75fdSopenharmony_ci        char code = '1';
1146d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
1147d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1148d95e75fdSopenharmony_ci    }
1149d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1150d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1151d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1152d95e75fdSopenharmony_ci        char code = '1';
1153d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
1154d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1155d95e75fdSopenharmony_ci    }
1156d95e75fdSopenharmony_ci}
1157d95e75fdSopenharmony_ci
1158d95e75fdSopenharmony_ci/**
1159d95e75fdSopenharmony_ci * @tc.number   cellular_call_StopDtmf_0001
1160d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function by cs
1161d95e75fdSopenharmony_ci * @tc.desc     Function test
1162d95e75fdSopenharmony_ci */
1163d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StopDtmf_0001, Function | MediumTest | Level2)
1164d95e75fdSopenharmony_ci{
1165d95e75fdSopenharmony_ci    AccessToken token;
1166d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1167d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1168d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1169d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
1170d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
1171d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1172d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1173d95e75fdSopenharmony_ci        return;
1174d95e75fdSopenharmony_ci    }
1175d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1176d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
1177d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1178d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1179d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
1180d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1181d95e75fdSopenharmony_ci    }
1182d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1183d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
1184d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1185d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1186d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
1187d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1188d95e75fdSopenharmony_ci    }
1189d95e75fdSopenharmony_ci}
1190d95e75fdSopenharmony_ci
1191d95e75fdSopenharmony_ci/**
1192d95e75fdSopenharmony_ci * @tc.number   cellular_call_StopDtmf_0002
1193d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function with invalid slot by cs
1194d95e75fdSopenharmony_ci * @tc.desc     Function test
1195d95e75fdSopenharmony_ci */
1196d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StopDtmf_0002, Function | MediumTest | Level2)
1197d95e75fdSopenharmony_ci{
1198d95e75fdSopenharmony_ci    AccessToken token;
1199d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1200d95e75fdSopenharmony_ci        return;
1201d95e75fdSopenharmony_ci    }
1202d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1203d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1204d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1205d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
1206d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
1207d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1208d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1209d95e75fdSopenharmony_ci        CellularCallInfo stopDtmfCallInfo;
1210d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo);
1211d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1212d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(stopDtmfCallInfo);
1213d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1214d95e75fdSopenharmony_ci    }
1215d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1216d95e75fdSopenharmony_ci        CellularCallInfo stopDtmfCallInfo;
1217d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo);
1218d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1219d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(stopDtmfCallInfo);
1220d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1221d95e75fdSopenharmony_ci    }
1222d95e75fdSopenharmony_ci}
1223d95e75fdSopenharmony_ci
1224d95e75fdSopenharmony_ci/**
1225d95e75fdSopenharmony_ci * @tc.number   cellular_call_SendDtmf_0001
1226d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function by cs
1227d95e75fdSopenharmony_ci * @tc.desc     Function test
1228d95e75fdSopenharmony_ci */
1229d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SendDtmf_0001, Function | MediumTest | Level2)
1230d95e75fdSopenharmony_ci{
1231d95e75fdSopenharmony_ci    AccessToken token;
1232d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1233d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1234d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1235d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
1236d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
1237d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1238d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1239d95e75fdSopenharmony_ci        return;
1240d95e75fdSopenharmony_ci    }
1241d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1242d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
1243d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
1244d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1245d95e75fdSopenharmony_ci        char code = '1';
1246d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
1247d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1248d95e75fdSopenharmony_ci    }
1249d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1250d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
1251d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
1252d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1253d95e75fdSopenharmony_ci        char code = '1';
1254d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
1255d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1256d95e75fdSopenharmony_ci    }
1257d95e75fdSopenharmony_ci}
1258d95e75fdSopenharmony_ci
1259d95e75fdSopenharmony_ci/**
1260d95e75fdSopenharmony_ci * @tc.number   cellular_call_SendDtmf_0002
1261d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function with invalid slot by cs
1262d95e75fdSopenharmony_ci * @tc.desc     Function test
1263d95e75fdSopenharmony_ci */
1264d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SendDtmf_0002, Function | MediumTest | Level2)
1265d95e75fdSopenharmony_ci{
1266d95e75fdSopenharmony_ci    AccessToken token;
1267d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1268d95e75fdSopenharmony_ci        return;
1269d95e75fdSopenharmony_ci    }
1270d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1271d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
1272d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1273d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
1274d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
1275d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
1276d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
1277d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
1278d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
1279d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1280d95e75fdSopenharmony_ci        char code = '1';
1281d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
1282d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1283d95e75fdSopenharmony_ci    }
1284d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
1285d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
1286d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
1287d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1288d95e75fdSopenharmony_ci        char code = '1';
1289d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
1290d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1291d95e75fdSopenharmony_ci    }
1292d95e75fdSopenharmony_ci}
1293d95e75fdSopenharmony_ci} // namespace Telephony
1294d95e75fdSopenharmony_ci} // namespace OHOS
1295