• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
OnMeeTimeDetailsChange(const CallAttributeInfo & info)33 int32_t CallManagerCallbackTest::OnMeeTimeDetailsChange(const CallAttributeInfo &info)
34 {
35     std::cout << "----------OnMeeTimeDetailsChange--------" << std::endl
36               << "callId:" << info.callId << std::endl
37               << "callType:" << (int32_t)info.callType << std::endl
38               << "callState:" << (int32_t)info.callState << std::endl
39               << "conferenceState:" << (int32_t)info.conferenceState << std::endl
40               << "accountNumber:" << info.accountNumber << std::endl;
41     return RETURN_SUCCESS;
42 }
43 
OnCallEventChange(const CallEventInfo & info)44 int32_t CallManagerCallbackTest::OnCallEventChange(const CallEventInfo &info)
45 {
46     std::cout << "----------OnCallEventChange--------" << std::endl
47               << "eventId:" << (int32_t)info.eventId << std::endl;
48     return RETURN_SUCCESS;
49 }
50 
OnCallDisconnectedCause(const DisconnectedDetails & details)51 int32_t CallManagerCallbackTest::OnCallDisconnectedCause(const DisconnectedDetails &details)
52 {
53     std::cout << "----------OnCallDisconnectedCause--------" << std::endl
54               << "cause:" << (int32_t)(details.reason) << std::endl;
55     return RETURN_SUCCESS;
56 }
57 
OnReportAsyncResults(CallResultReportId reportId,AppExecFwk::PacMap & resultInfo)58 int32_t CallManagerCallbackTest::OnReportAsyncResults(CallResultReportId reportId, AppExecFwk::PacMap &resultInfo)
59 {
60     std::cout << "----------OnReportAsyncResults--------" << std::endl
61               << "reportId:" << (int32_t)reportId << std::endl;
62     switch (reportId) {
63         case CallResultReportId::GET_CALL_WAITING_REPORT_ID:
64             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl
65                       << "status:" << (int32_t)resultInfo.GetIntValue("status", -1) << std::endl
66                       << "classCw:" << (int32_t)resultInfo.GetIntValue("classCw", -1) << std::endl;
67             break;
68         case CallResultReportId::SET_CALL_WAITING_REPORT_ID:
69             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
70             break;
71         case CallResultReportId::GET_CALL_RESTRICTION_REPORT_ID:
72             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl
73                       << "status:" << (int32_t)resultInfo.GetIntValue("status", -1) << std::endl
74                       << "classCw:" << (int32_t)resultInfo.GetIntValue("classCw", -1) << std::endl;
75             break;
76         case CallResultReportId::SET_CALL_RESTRICTION_REPORT_ID:
77             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
78             break;
79         case CallResultReportId::SET_CALL_RESTRICTION_PWD_REPORT_ID:
80             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
81             break;
82         case CallResultReportId::GET_CALL_TRANSFER_REPORT_ID:
83             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl
84                       << "status:" << (int32_t)resultInfo.GetIntValue("status", -1) << std::endl
85                       << "classx:" << (int32_t)resultInfo.GetIntValue("classx", -1) << std::endl
86                       << "number:" << resultInfo.GetStringValue("number", "") << std::endl
87                       << "type:" << (int32_t)resultInfo.GetIntValue("type", -1) << std::endl
88                       << "reason:" << (int32_t)resultInfo.GetIntValue("reason", -1) << std::endl
89                       << "time:" << (int32_t)resultInfo.GetIntValue("time", -1) << std::endl
90                       << "startHour:" << (int32_t)resultInfo.GetIntValue("startHour", -1) << std::endl
91                       << "startMinute:" << (int32_t)resultInfo.GetIntValue("startMinute", -1) << std::endl
92                       << "endHour:" << (int32_t)resultInfo.GetIntValue("endHour", -1) << std::endl
93                       << "endMinute:" << (int32_t)resultInfo.GetIntValue("endMinute", -1) << std::endl;
94             break;
95         case CallResultReportId::SET_CALL_TRANSFER_REPORT_ID:
96             std::cout << "result:" << (int32_t)resultInfo.GetIntValue("result", -1) << std::endl;
97             break;
98         default:
99             break;
100     }
101     return RETURN_SUCCESS;
102 }
103 
OnOttCallRequest(OttCallRequestId requestId,AppExecFwk::PacMap & info)104 int32_t CallManagerCallbackTest::OnOttCallRequest(OttCallRequestId requestId, AppExecFwk::PacMap &info)
105 {
106     std::cout << "----------OnOttCallRequest--------" << std::endl
107               << "requestId:" << (int32_t)requestId << std::endl;
108     return RETURN_SUCCESS;
109 }
110 
OnReportMmiCodeResult(const MmiCodeInfo & info)111 int32_t CallManagerCallbackTest::OnReportMmiCodeResult(const MmiCodeInfo &info)
112 {
113     std::cout << "----------OnReportMmiCodeResult--------" << std::endl
114               << "result:" << info.result << std::endl
115               << "message:" << info.message << std::endl;
116     return RETURN_SUCCESS;
117 }
118 
OnReportAudioDeviceChange(const AudioDeviceInfo & info)119 int32_t CallManagerCallbackTest::OnReportAudioDeviceChange(const AudioDeviceInfo &info)
120 {
121     std::cout << "----------OnReportAudioDeviceChange--------" << std::endl
122               << "currentAudioDeviceType:" << static_cast<int32_t>(info.currentAudioDevice.deviceType) << " "
123               << "address:" << info.currentAudioDevice.address << std::endl
124               << "isMute:" << info.isMuted << std::endl;
125     for (size_t i = 0; i < info.audioDeviceList.size(); i++) {
126         std::cout << "audioDeviceList[" << i
127                   << "] deviceType:" << static_cast<int32_t>(info.audioDeviceList[i].deviceType) << " "
128                   << "audioDeviceList[" << i << "] address:" << info.audioDeviceList[i].address << std::endl;
129     }
130     return RETURN_SUCCESS;
131 }
132 
OnReportPostDialDelay(const std::string & str)133 int32_t CallManagerCallbackTest::OnReportPostDialDelay(const std::string &str)
134 {
135     std::cout << "----------OnReportPostDialDelay--------" << std::endl << "str:" << str << std::endl;
136     return RETURN_SUCCESS;
137 }
138 
OnUpdateImsCallModeChange(const CallMediaModeInfo & imsCallModeInfo)139 int32_t CallManagerCallbackTest::OnUpdateImsCallModeChange(const CallMediaModeInfo &imsCallModeInfo)
140 {
141     std::cout << "----------OnUpdateImsCallModeChange--------" << std::endl
142               << "callId:" << imsCallModeInfo.callId << std::endl
143               << "isRequestInfo:" << imsCallModeInfo.isRequestInfo << std::endl
144               << "result:" << (int32_t)imsCallModeInfo.result << std::endl
145               << "callMode:" << (int32_t)imsCallModeInfo.callMode << std::endl;
146     return RETURN_SUCCESS;
147 }
148 
OnCallSessionEventChange(const CallSessionEvent & callSessionEventOptions)149 int32_t CallManagerCallbackTest::OnCallSessionEventChange(const CallSessionEvent &callSessionEventOptions)
150 {
151     std::cout << "----------OnCallSessionEventChange--------" << std::endl
152               << "callId:" << callSessionEventOptions.callId << std::endl
153               << "eventId:" << (int32_t)callSessionEventOptions.eventId << std::endl;
154     return RETURN_SUCCESS;
155 }
156 
OnPeerDimensionsChange(const PeerDimensionsDetail & peerDimensionsDetail)157 int32_t CallManagerCallbackTest::OnPeerDimensionsChange(const PeerDimensionsDetail &peerDimensionsDetail)
158 {
159     std::cout << "----------OnPeerDimensionsChange--------" << std::endl
160               << "callId:" << peerDimensionsDetail.callId << std::endl
161               << "width:" << peerDimensionsDetail.width << std::endl
162               << "height:" << peerDimensionsDetail.height << std::endl;
163     return RETURN_SUCCESS;
164 }
165 
OnCallDataUsageChange(const int64_t dataUsage)166 int32_t CallManagerCallbackTest::OnCallDataUsageChange(const int64_t dataUsage)
167 {
168     std::cout << "----------OnCallDataUsageChange--------" << std::endl
169               << "dataUsage:" << dataUsage << std::endl;
170     return RETURN_SUCCESS;
171 }
172 
OnUpdateCameraCapabilities(const CameraCapabilities & cameraCapabilities)173 int32_t CallManagerCallbackTest::OnUpdateCameraCapabilities(const CameraCapabilities &cameraCapabilities)
174 {
175     std::cout << "----------OnUpdateCameraCapabilities--------" << std::endl
176               << "callId:" << cameraCapabilities.callId << std::endl
177               << "width:" << cameraCapabilities.width << std::endl
178               << "height:" << cameraCapabilities.height << std::endl;
179     return RETURN_SUCCESS;
180 }
181 } // namespace Telephony
182 } // namespace OHOS
183