1 /*
2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "call_manager_callback_test.h"
17
18 namespace OHOS {
19 namespace Telephony {
20 constexpr int16_t RETURN_SUCCESS = 0;
21
OnCallDetailsChange(const CallAttributeInfo & info)22 int32_t CallManagerCallbackTest::OnCallDetailsChange(const CallAttributeInfo &info)
23 {
24 std::cout << "----------OnCallDetailsChange--------" << std::endl
25 << "callId:" << info.callId << std::endl
26 << "callType:" << (int32_t)info.callType << std::endl
27 << "callState:" << (int32_t)info.callState << std::endl
28 << "conferenceState:" << (int32_t)info.conferenceState << std::endl
29 << "accountNumber:" << info.accountNumber << std::endl;
30 return RETURN_SUCCESS;
31 }
32
OnCallEventChange(const CallEventInfo & info)33 int32_t CallManagerCallbackTest::OnCallEventChange(const CallEventInfo &info)
34 {
35 std::cout << "----------OnCallEventChange--------" << std::endl
36 << "eventId:" << (int32_t)info.eventId << std::endl;
37 return RETURN_SUCCESS;
38 }
39
OnCallDisconnectedCause(const DisconnectedDetails & details)40 int32_t CallManagerCallbackTest::OnCallDisconnectedCause(const DisconnectedDetails &details)
41 {
42 std::cout << "----------OnCallDisconnectedCause--------" << std::endl
43 << "cause:" << (int32_t)(details.reason) << std::endl;
44 return RETURN_SUCCESS;
45 }
46
OnReportAsyncResults(CallResultReportId reportId,AppExecFwk::PacMap & resultInfo)47 int32_t CallManagerCallbackTest::OnReportAsyncResults(CallResultReportId reportId, AppExecFwk::PacMap &resultInfo)
48 {
49 std::cout << "----------OnReportAsyncResults--------" << std::endl
50 << "reportId:" << (int32_t)reportId << std::endl;
51 switch (reportId) {
52 case CallResultReportId::GET_CALL_WAITING_REPORT_ID:
53 std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl
54 << "status:" << (int32_t)resultInfo.GetIntValue("status", -1) << std::endl
55 << "classCw:" << (int32_t)resultInfo.GetIntValue("classCw", -1) << std::endl;
56 break;
57 case CallResultReportId::SET_CALL_WAITING_REPORT_ID:
58 std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
59 break;
60 case CallResultReportId::GET_CALL_RESTRICTION_REPORT_ID:
61 std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl
62 << "status:" << (int32_t)resultInfo.GetIntValue("status", -1) << std::endl
63 << "classCw:" << (int32_t)resultInfo.GetIntValue("classCw", -1) << std::endl;
64 break;
65 case CallResultReportId::SET_CALL_RESTRICTION_REPORT_ID:
66 std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
67 break;
68 case CallResultReportId::GET_CALL_TRANSFER_REPORT_ID:
69 std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl
70 << "status:" << (int32_t)resultInfo.GetIntValue("status", -1) << std::endl
71 << "classx:" << (int32_t)resultInfo.GetIntValue("classx", -1) << std::endl
72 << "number:" << resultInfo.GetStringValue("number", "") << std::endl
73 << "type:" << (int32_t)resultInfo.GetIntValue("type", -1) << std::endl
74 << "reason:" << (int32_t)resultInfo.GetIntValue("reason", -1) << std::endl
75 << "time:" << (int32_t)resultInfo.GetIntValue("time", -1) << std::endl
76 << "startHour:" << (int32_t)resultInfo.GetIntValue("startHour", -1) << std::endl
77 << "startMinute:" << (int32_t)resultInfo.GetIntValue("startMinute", -1) << std::endl
78 << "endHour:" << (int32_t)resultInfo.GetIntValue("endHour", -1) << std::endl
79 << "endMinute:" << (int32_t)resultInfo.GetIntValue("endMinute", -1) << std::endl;
80 break;
81 case CallResultReportId::SET_CALL_TRANSFER_REPORT_ID:
82 std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
83 break;
84 default:
85 break;
86 }
87 return RETURN_SUCCESS;
88 }
89
OnOttCallRequest(OttCallRequestId requestId,AppExecFwk::PacMap & info)90 int32_t CallManagerCallbackTest::OnOttCallRequest(OttCallRequestId requestId, AppExecFwk::PacMap &info)
91 {
92 std::cout << "----------OnOttCallRequest--------" << std::endl
93 << "requestId:" << (int32_t)requestId << std::endl;
94 return RETURN_SUCCESS;
95 }
96
OnReportMmiCodeResult(const MmiCodeInfo & info)97 int32_t CallManagerCallbackTest::OnReportMmiCodeResult(const MmiCodeInfo &info)
98 {
99 std::cout << "----------OnReportMmiCodeResult--------" << std::endl
100 << "result:" << info.result << std::endl
101 << "message:" << info.message << std::endl;
102 return RETURN_SUCCESS;
103 }
104 } // namespace Telephony
105 } // namespace OHOS
106