blob: 0a64c56be2313ee8da7ddde07c2d6929ee86a9d6 [file] [log] [blame]
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -07001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <libradiocompat/RadioResponse.h>
18
19#include "commonStructs.h"
20#include "debug.h"
21#include "structs.h"
22
23#include "collections.h"
24
25#define RADIO_MODULE "VoiceResponse"
26
27namespace android::hardware::radio::compat {
28
29namespace aidl = ::aidl::android::hardware::radio::voice;
30
31void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioVoiceResponse> voiceCb) {
32 CHECK(voiceCb);
33 mVoiceCb = voiceCb;
34}
35
36Return<void> RadioResponse::acceptCallResponse(const V1_0::RadioResponseInfo& info) {
37 LOG_CALL << info.serial;
38 CHECK_CB(mVoiceCb);
39 mVoiceCb->acceptCallResponse(toAidl(info));
40 return {};
41}
42
43Return<void> RadioResponse::conferenceResponse(const V1_0::RadioResponseInfo& info) {
44 LOG_CALL << info.serial;
45 CHECK_CB(mVoiceCb);
46 mVoiceCb->conferenceResponse(toAidl(info));
47 return {};
48}
49
50Return<void> RadioResponse::dialResponse(const V1_0::RadioResponseInfo& info) {
51 LOG_CALL << info.serial;
52 CHECK_CB(mVoiceCb);
53 mVoiceCb->dialResponse(toAidl(info));
54 return {};
55}
56
57Return<void> RadioResponse::emergencyDialResponse(const V1_0::RadioResponseInfo& info) {
58 LOG_CALL << info.serial;
59 CHECK_CB(mVoiceCb);
60 mVoiceCb->emergencyDialResponse(toAidl(info));
61 return {};
62}
63
64Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) {
65 LOG_CALL << info.serial;
66 CHECK_CB(mVoiceCb);
67 mVoiceCb->exitEmergencyCallbackModeResponse(toAidl(info));
68 return {};
69}
70
71Return<void> RadioResponse::explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) {
72 LOG_CALL << info.serial;
73 CHECK_CB(mVoiceCb);
74 mVoiceCb->explicitCallTransferResponse(toAidl(info));
75 return {};
76}
77
78Return<void> RadioResponse::getCallForwardStatusResponse(
79 const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::CallForwardInfo>& callFwdInfos) {
80 LOG_CALL << info.serial;
81 CHECK_CB(mVoiceCb);
82 mVoiceCb->getCallForwardStatusResponse(toAidl(info), toAidl(callFwdInfos));
83 return {};
84}
85
86Return<void> RadioResponse::getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable,
87 int32_t serviceClass) {
88 LOG_CALL << info.serial;
89 CHECK_CB(mVoiceCb);
90 mVoiceCb->getCallWaitingResponse(toAidl(info), enable, serviceClass);
91 return {};
92}
93
94Return<void> RadioResponse::getClipResponse(const V1_0::RadioResponseInfo& info,
95 V1_0::ClipStatus status) {
96 LOG_CALL << info.serial;
97 CHECK_CB(mVoiceCb);
98 mVoiceCb->getClipResponse(toAidl(info), aidl::ClipStatus(status));
99 return {};
100}
101
102Return<void> RadioResponse::getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n,
103 int32_t m) {
104 LOG_CALL << info.serial;
105 CHECK_CB(mVoiceCb);
106 mVoiceCb->getClirResponse(toAidl(info), n, m);
107 return {};
108}
109
110Return<void> RadioResponse::getCurrentCallsResponse(const V1_0::RadioResponseInfo& info,
111 const hidl_vec<V1_0::Call>& calls) {
112 LOG_CALL << info.serial;
113 CHECK_CB(mVoiceCb);
114 mVoiceCb->getCurrentCallsResponse(toAidl(info), toAidl(calls));
115 return {};
116}
117
118Return<void> RadioResponse::getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info,
119 const hidl_vec<V1_2::Call>& calls) {
120 LOG_CALL << info.serial;
121 CHECK_CB(mVoiceCb);
122 mVoiceCb->getCurrentCallsResponse(toAidl(info), toAidl(calls));
123 return {};
124}
125
126Return<void> RadioResponse::getCurrentCallsResponse_1_6(const V1_6::RadioResponseInfo& info,
127 const hidl_vec<V1_6::Call>& calls) {
128 LOG_CALL << info.serial;
129 CHECK_CB(mVoiceCb);
130 mVoiceCb->getCurrentCallsResponse(toAidl(info), toAidl(calls));
131 return {};
132}
133
134Return<void> RadioResponse::getLastCallFailCauseResponse(
135 const V1_0::RadioResponseInfo& info, const V1_0::LastCallFailCauseInfo& failCauseinfo) {
136 LOG_CALL << info.serial;
137 CHECK_CB(mVoiceCb);
138 mVoiceCb->getLastCallFailCauseResponse(toAidl(info), toAidl(failCauseinfo));
139 return {};
140}
141
142Return<void> RadioResponse::getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) {
143 LOG_CALL << info.serial;
144 CHECK_CB(mVoiceCb);
145 mVoiceCb->getMuteResponse(toAidl(info), enable);
146 return {};
147}
148
149Return<void> RadioResponse::getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info,
150 bool enable) {
151 LOG_CALL << info.serial;
152 CHECK_CB(mVoiceCb);
153 mVoiceCb->getPreferredVoicePrivacyResponse(toAidl(info), enable);
154 return {};
155}
156
157Return<void> RadioResponse::getTTYModeResponse(const V1_0::RadioResponseInfo& info,
158 V1_0::TtyMode mode) {
159 LOG_CALL << info.serial;
160 CHECK_CB(mVoiceCb);
161 mVoiceCb->getTtyModeResponse(toAidl(info), aidl::TtyMode(mode));
162 return {};
163}
164
165Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
166 const V1_0::RadioResponseInfo& info) {
167 LOG_CALL << info.serial;
168 CHECK_CB(mVoiceCb);
169 mVoiceCb->handleStkCallSetupRequestFromSimResponse(toAidl(info));
170 return {};
171}
172
173Return<void> RadioResponse::hangupConnectionResponse(const V1_0::RadioResponseInfo& info) {
174 LOG_CALL << info.serial;
175 CHECK_CB(mVoiceCb);
176 mVoiceCb->hangupConnectionResponse(toAidl(info));
177 return {};
178}
179
180Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse(
181 const V1_0::RadioResponseInfo& info) {
182 LOG_CALL << info.serial;
183 CHECK_CB(mVoiceCb);
184 mVoiceCb->hangupForegroundResumeBackgroundResponse(toAidl(info));
185 return {};
186}
187
188Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) {
189 LOG_CALL << info.serial;
190 CHECK_CB(mVoiceCb);
191 mVoiceCb->hangupWaitingOrBackgroundResponse(toAidl(info));
192 return {};
193}
194
195Return<void> RadioResponse::rejectCallResponse(const V1_0::RadioResponseInfo& info) {
196 LOG_CALL << info.serial;
197 CHECK_CB(mVoiceCb);
198 mVoiceCb->rejectCallResponse(toAidl(info));
199 return {};
200}
201
202Return<void> RadioResponse::sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) {
203 LOG_CALL << info.serial;
204 CHECK_CB(mVoiceCb);
205 mVoiceCb->sendBurstDtmfResponse(toAidl(info));
206 return {};
207}
208
209Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) {
210 LOG_CALL << info.serial;
211 CHECK_CB(mVoiceCb);
212 mVoiceCb->sendCdmaFeatureCodeResponse(toAidl(info));
213 return {};
214}
215
216Return<void> RadioResponse::sendDtmfResponse(const V1_0::RadioResponseInfo& info) {
217 LOG_CALL << info.serial;
218 CHECK_CB(mVoiceCb);
219 mVoiceCb->sendDtmfResponse(toAidl(info));
220 return {};
221}
222
223Return<void> RadioResponse::separateConnectionResponse(const V1_0::RadioResponseInfo& info) {
224 LOG_CALL << info.serial;
225 CHECK_CB(mVoiceCb);
226 mVoiceCb->separateConnectionResponse(toAidl(info));
227 return {};
228}
229
230Return<void> RadioResponse::setCallForwardResponse(const V1_0::RadioResponseInfo& info) {
231 LOG_CALL << info.serial;
232 CHECK_CB(mVoiceCb);
233 mVoiceCb->setCallForwardResponse(toAidl(info));
234 return {};
235}
236
237Return<void> RadioResponse::setCallWaitingResponse(const V1_0::RadioResponseInfo& info) {
238 LOG_CALL << info.serial;
239 CHECK_CB(mVoiceCb);
240 mVoiceCb->setCallWaitingResponse(toAidl(info));
241 return {};
242}
243
244Return<void> RadioResponse::setClirResponse(const V1_0::RadioResponseInfo& info) {
245 LOG_CALL << info.serial;
246 CHECK_CB(mVoiceCb);
247 mVoiceCb->setClirResponse(toAidl(info));
248 return {};
249}
250
251Return<void> RadioResponse::setMuteResponse(const V1_0::RadioResponseInfo& info) {
252 LOG_CALL << info.serial;
253 CHECK_CB(mVoiceCb);
254 mVoiceCb->setMuteResponse(toAidl(info));
255 return {};
256}
257
258Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) {
259 LOG_CALL << info.serial;
260 CHECK_CB(mVoiceCb);
261 mVoiceCb->setPreferredVoicePrivacyResponse(toAidl(info));
262 return {};
263}
264
265Return<void> RadioResponse::setTTYModeResponse(const V1_0::RadioResponseInfo& info) {
266 LOG_CALL << info.serial;
267 CHECK_CB(mVoiceCb);
268 mVoiceCb->setTtyModeResponse(toAidl(info));
269 return {};
270}
271
272Return<void> RadioResponse::startDtmfResponse(const V1_0::RadioResponseInfo& info) {
273 LOG_CALL << info.serial;
274 CHECK_CB(mVoiceCb);
275 mVoiceCb->startDtmfResponse(toAidl(info));
276 return {};
277}
278
279Return<void> RadioResponse::stopDtmfResponse(const V1_0::RadioResponseInfo& info) {
280 LOG_CALL << info.serial;
281 CHECK_CB(mVoiceCb);
282 mVoiceCb->stopDtmfResponse(toAidl(info));
283 return {};
284}
285
286Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse(
287 const V1_0::RadioResponseInfo& info) {
288 LOG_CALL << info.serial;
289 CHECK_CB(mVoiceCb);
290 mVoiceCb->switchWaitingOrHoldingAndActiveResponse(toAidl(info));
291 return {};
292}
293
294} // namespace android::hardware::radio::compat