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