blob: 379e4630af62b20f7bab42b1b2e4e865555fa5e6 [file] [log] [blame]
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -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 "MessagingResponse"
26
27namespace android::hardware::radio::compat {
28
29namespace aidl = ::aidl::android::hardware::radio::messaging;
30
31void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingResponse> rmrCb) {
32 CHECK(rmrCb);
33 mMessagingCb = rmrCb;
34}
35
36Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
37 const V1_0::RadioResponseInfo& info) {
38 LOG_CALL << info.serial;
39 CHECK_CB(mMessagingCb);
40 mMessagingCb->acknowledgeIncomingGsmSmsWithPduResponse(toAidl(info));
41 return {};
42}
43
44Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
45 const V1_0::RadioResponseInfo& info) {
46 LOG_CALL << info.serial;
47 CHECK_CB(mMessagingCb);
48 mMessagingCb->acknowledgeLastIncomingCdmaSmsResponse(toAidl(info));
49 return {};
50}
51
52Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(
53 const V1_0::RadioResponseInfo& info) {
54 LOG_CALL << info.serial;
55 CHECK_CB(mMessagingCb);
56 mMessagingCb->acknowledgeLastIncomingGsmSmsResponse(toAidl(info));
57 return {};
58}
59
60Return<void> RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) {
61 LOG_CALL << info.serial;
62 CHECK_CB(mMessagingCb);
63 mMessagingCb->cancelPendingUssdResponse(toAidl(info));
64 return {};
65}
66
67Return<void> RadioResponse::deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) {
68 LOG_CALL << info.serial;
69 CHECK_CB(mMessagingCb);
70 mMessagingCb->deleteSmsOnRuimResponse(toAidl(info));
71 return {};
72}
73
74Return<void> RadioResponse::deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) {
75 LOG_CALL << info.serial;
76 CHECK_CB(mMessagingCb);
77 mMessagingCb->deleteSmsOnSimResponse(toAidl(info));
78 return {};
79}
80
81Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
82 const V1_0::RadioResponseInfo& info,
83 const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configs) {
84 LOG_CALL << info.serial;
85 CHECK_CB(mMessagingCb);
86 mMessagingCb->getCdmaBroadcastConfigResponse(toAidl(info), toAidl(configs));
87 return {};
88}
89
90Return<void> RadioResponse::getGsmBroadcastConfigResponse(
91 const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& cfg) {
92 LOG_CALL << info.serial;
93 CHECK_CB(mMessagingCb);
94 mMessagingCb->getGsmBroadcastConfigResponse(toAidl(info), toAidl(cfg));
95 return {};
96}
97
98Return<void> RadioResponse::getSmscAddressResponse(const V1_0::RadioResponseInfo& info,
99 const hidl_string& smsc) {
100 LOG_CALL << info.serial;
101 CHECK_CB(mMessagingCb);
102 mMessagingCb->getSmscAddressResponse(toAidl(info), smsc);
103 return {};
104}
105
106Return<void> RadioResponse::reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) {
107 LOG_CALL << info.serial;
108 CHECK_CB(mMessagingCb);
109 mMessagingCb->reportSmsMemoryStatusResponse(toAidl(info));
110 return {};
111}
112
113Return<void> RadioResponse::sendCdmaSmsExpectMoreResponse(const V1_0::RadioResponseInfo& info,
114 const V1_0::SendSmsResult& sms) {
115 LOG_CALL << info.serial;
116 CHECK_CB(mMessagingCb);
117 mMessagingCb->sendCdmaSmsExpectMoreResponse(toAidl(info), toAidl(sms));
118 return {};
119}
120
121Return<void> RadioResponse::sendCdmaSmsExpectMoreResponse_1_6(const V1_6::RadioResponseInfo& info,
122 const V1_0::SendSmsResult& sms) {
123 LOG_CALL << info.serial;
124 CHECK_CB(mMessagingCb);
125 mMessagingCb->sendCdmaSmsExpectMoreResponse(toAidl(info), toAidl(sms));
126 return {};
127}
128
129Return<void> RadioResponse::sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info,
130 const V1_0::SendSmsResult& sms) {
131 LOG_CALL << info.serial;
132 CHECK_CB(mMessagingCb);
133 mMessagingCb->sendCdmaSmsResponse(toAidl(info), toAidl(sms));
134 return {};
135}
136
137Return<void> RadioResponse::sendCdmaSmsResponse_1_6(const V1_6::RadioResponseInfo& info,
138 const V1_0::SendSmsResult& sms) {
139 LOG_CALL << info.serial;
140 CHECK_CB(mMessagingCb);
141 mMessagingCb->sendCdmaSmsResponse(toAidl(info), toAidl(sms));
142 return {};
143}
144
145Return<void> RadioResponse::sendImsSmsResponse(const V1_0::RadioResponseInfo& info,
146 const V1_0::SendSmsResult& sms) {
147 LOG_CALL << info.serial;
148 CHECK_CB(mMessagingCb);
149 mMessagingCb->sendImsSmsResponse(toAidl(info), toAidl(sms));
150 return {};
151}
152
153Return<void> RadioResponse::sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info,
154 const V1_0::SendSmsResult& sms) {
155 LOG_CALL << info.serial;
156 CHECK_CB(mMessagingCb);
157 mMessagingCb->sendSmsExpectMoreResponse(toAidl(info), toAidl(sms));
158 return {};
159}
160
161Return<void> RadioResponse::sendSmsExpectMoreResponse_1_6(const V1_6::RadioResponseInfo& info,
162 const V1_0::SendSmsResult& sms) {
163 LOG_CALL << info.serial;
164 CHECK_CB(mMessagingCb);
165 mMessagingCb->sendSmsExpectMoreResponse(toAidl(info), toAidl(sms));
166 return {};
167}
168
169Return<void> RadioResponse::sendSmsResponse(const V1_0::RadioResponseInfo& info,
170 const V1_0::SendSmsResult& sms) {
171 LOG_CALL << info.serial;
172 CHECK_CB(mMessagingCb);
173 mMessagingCb->sendSmsResponse(toAidl(info), toAidl(sms));
174 return {};
175}
176
177Return<void> RadioResponse::sendSmsResponse_1_6(const V1_6::RadioResponseInfo& info,
178 const V1_0::SendSmsResult& sms) {
179 LOG_CALL << info.serial;
180 CHECK_CB(mMessagingCb);
181 mMessagingCb->sendSmsResponse(toAidl(info), toAidl(sms));
182 return {};
183}
184
185Return<void> RadioResponse::sendUssdResponse(const V1_0::RadioResponseInfo& info) {
186 LOG_CALL << info.serial;
187 CHECK_CB(mMessagingCb);
188 mMessagingCb->sendUssdResponse(toAidl(info));
189 return {};
190}
191
192Return<void> RadioResponse::setCdmaBroadcastActivationResponse(
193 const V1_0::RadioResponseInfo& info) {
194 LOG_CALL << info.serial;
195 CHECK_CB(mMessagingCb);
196 mMessagingCb->setCdmaBroadcastActivationResponse(toAidl(info));
197 return {};
198}
199
200Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
201 LOG_CALL << info.serial;
202 CHECK_CB(mMessagingCb);
203 mMessagingCb->setCdmaBroadcastConfigResponse(toAidl(info));
204 return {};
205}
206
207Return<void> RadioResponse::setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) {
208 LOG_CALL << info.serial;
209 CHECK_CB(mMessagingCb);
210 mMessagingCb->setGsmBroadcastActivationResponse(toAidl(info));
211 return {};
212}
213
214Return<void> RadioResponse::setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
215 LOG_CALL << info.serial;
216 CHECK_CB(mMessagingCb);
217 mMessagingCb->setGsmBroadcastConfigResponse(toAidl(info));
218 return {};
219}
220
221Return<void> RadioResponse::setSmscAddressResponse(const V1_0::RadioResponseInfo& info) {
222 LOG_CALL << info.serial;
223 CHECK_CB(mMessagingCb);
224 mMessagingCb->setSmscAddressResponse(toAidl(info));
225 return {};
226}
227
228Return<void> RadioResponse::writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info,
229 uint32_t index) {
230 LOG_CALL << info.serial << ' ' << index;
231 CHECK_CB(mMessagingCb);
232 mMessagingCb->writeSmsToRuimResponse(toAidl(info), index);
233 return {};
234}
235
236Return<void> RadioResponse::writeSmsToSimResponse(const V1_0::RadioResponseInfo& info,
237 int32_t index) {
238 LOG_CALL << info.serial << ' ' << index;
239 CHECK_CB(mMessagingCb);
240 mMessagingCb->writeSmsToSimResponse(toAidl(info), index);
241 return {};
242}
243
244} // namespace android::hardware::radio::compat