Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 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 "VoiceResponse" |
| 26 | |
| 27 | namespace android::hardware::radio::compat { |
| 28 | |
| 29 | namespace aidl = ::aidl::android::hardware::radio::voice; |
| 30 | |
| 31 | void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioVoiceResponse> voiceCb) { |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 32 | mVoiceCb = voiceCb; |
| 33 | } |
| 34 | |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 35 | std::shared_ptr<aidl::IRadioVoiceResponse> RadioResponse::voiceCb() { |
| 36 | return mVoiceCb.get(); |
| 37 | } |
| 38 | |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 39 | Return<void> RadioResponse::acceptCallResponse(const V1_0::RadioResponseInfo& info) { |
| 40 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 41 | voiceCb()->acceptCallResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 42 | return {}; |
| 43 | } |
| 44 | |
| 45 | Return<void> RadioResponse::conferenceResponse(const V1_0::RadioResponseInfo& info) { |
| 46 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 47 | voiceCb()->conferenceResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 48 | return {}; |
| 49 | } |
| 50 | |
| 51 | Return<void> RadioResponse::dialResponse(const V1_0::RadioResponseInfo& info) { |
| 52 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 53 | voiceCb()->dialResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 54 | return {}; |
| 55 | } |
| 56 | |
| 57 | Return<void> RadioResponse::emergencyDialResponse(const V1_0::RadioResponseInfo& info) { |
| 58 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 59 | voiceCb()->emergencyDialResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 60 | return {}; |
| 61 | } |
| 62 | |
| 63 | Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) { |
| 64 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 65 | voiceCb()->exitEmergencyCallbackModeResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 66 | return {}; |
| 67 | } |
| 68 | |
| 69 | Return<void> RadioResponse::explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) { |
| 70 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 71 | voiceCb()->explicitCallTransferResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 72 | return {}; |
| 73 | } |
| 74 | |
| 75 | Return<void> RadioResponse::getCallForwardStatusResponse( |
| 76 | const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::CallForwardInfo>& callFwdInfos) { |
| 77 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 78 | voiceCb()->getCallForwardStatusResponse(toAidl(info), toAidl(callFwdInfos)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 79 | return {}; |
| 80 | } |
| 81 | |
| 82 | Return<void> RadioResponse::getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable, |
| 83 | int32_t serviceClass) { |
| 84 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 85 | voiceCb()->getCallWaitingResponse(toAidl(info), enable, serviceClass); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 86 | return {}; |
| 87 | } |
| 88 | |
| 89 | Return<void> RadioResponse::getClipResponse(const V1_0::RadioResponseInfo& info, |
| 90 | V1_0::ClipStatus status) { |
| 91 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 92 | voiceCb()->getClipResponse(toAidl(info), aidl::ClipStatus(status)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 93 | return {}; |
| 94 | } |
| 95 | |
| 96 | Return<void> RadioResponse::getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n, |
| 97 | int32_t m) { |
| 98 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 99 | voiceCb()->getClirResponse(toAidl(info), n, m); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 100 | return {}; |
| 101 | } |
| 102 | |
| 103 | Return<void> RadioResponse::getCurrentCallsResponse(const V1_0::RadioResponseInfo& info, |
| 104 | const hidl_vec<V1_0::Call>& calls) { |
| 105 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 106 | voiceCb()->getCurrentCallsResponse(toAidl(info), toAidl(calls)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 107 | return {}; |
| 108 | } |
| 109 | |
| 110 | Return<void> RadioResponse::getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info, |
| 111 | const hidl_vec<V1_2::Call>& calls) { |
| 112 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 113 | voiceCb()->getCurrentCallsResponse(toAidl(info), toAidl(calls)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 114 | return {}; |
| 115 | } |
| 116 | |
| 117 | Return<void> RadioResponse::getCurrentCallsResponse_1_6(const V1_6::RadioResponseInfo& info, |
| 118 | const hidl_vec<V1_6::Call>& calls) { |
| 119 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 120 | voiceCb()->getCurrentCallsResponse(toAidl(info), toAidl(calls)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 121 | return {}; |
| 122 | } |
| 123 | |
| 124 | Return<void> RadioResponse::getLastCallFailCauseResponse( |
| 125 | const V1_0::RadioResponseInfo& info, const V1_0::LastCallFailCauseInfo& failCauseinfo) { |
| 126 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 127 | voiceCb()->getLastCallFailCauseResponse(toAidl(info), toAidl(failCauseinfo)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 128 | return {}; |
| 129 | } |
| 130 | |
| 131 | Return<void> RadioResponse::getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) { |
| 132 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 133 | voiceCb()->getMuteResponse(toAidl(info), enable); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 134 | return {}; |
| 135 | } |
| 136 | |
| 137 | Return<void> RadioResponse::getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info, |
| 138 | bool enable) { |
| 139 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 140 | voiceCb()->getPreferredVoicePrivacyResponse(toAidl(info), enable); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 141 | return {}; |
| 142 | } |
| 143 | |
| 144 | Return<void> RadioResponse::getTTYModeResponse(const V1_0::RadioResponseInfo& info, |
| 145 | V1_0::TtyMode mode) { |
| 146 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 147 | voiceCb()->getTtyModeResponse(toAidl(info), aidl::TtyMode(mode)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 148 | return {}; |
| 149 | } |
| 150 | |
| 151 | Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse( |
| 152 | const V1_0::RadioResponseInfo& info) { |
| 153 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 154 | voiceCb()->handleStkCallSetupRequestFromSimResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 155 | return {}; |
| 156 | } |
| 157 | |
| 158 | Return<void> RadioResponse::hangupConnectionResponse(const V1_0::RadioResponseInfo& info) { |
| 159 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 160 | voiceCb()->hangupConnectionResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 161 | return {}; |
| 162 | } |
| 163 | |
| 164 | Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse( |
| 165 | const V1_0::RadioResponseInfo& info) { |
| 166 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 167 | voiceCb()->hangupForegroundResumeBackgroundResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 168 | return {}; |
| 169 | } |
| 170 | |
| 171 | Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) { |
| 172 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 173 | voiceCb()->hangupWaitingOrBackgroundResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 174 | return {}; |
| 175 | } |
| 176 | |
| 177 | Return<void> RadioResponse::rejectCallResponse(const V1_0::RadioResponseInfo& info) { |
| 178 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 179 | voiceCb()->rejectCallResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 180 | return {}; |
| 181 | } |
| 182 | |
| 183 | Return<void> RadioResponse::sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) { |
| 184 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 185 | voiceCb()->sendBurstDtmfResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 186 | return {}; |
| 187 | } |
| 188 | |
| 189 | Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) { |
| 190 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 191 | voiceCb()->sendCdmaFeatureCodeResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 192 | return {}; |
| 193 | } |
| 194 | |
| 195 | Return<void> RadioResponse::sendDtmfResponse(const V1_0::RadioResponseInfo& info) { |
| 196 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 197 | voiceCb()->sendDtmfResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 198 | return {}; |
| 199 | } |
| 200 | |
| 201 | Return<void> RadioResponse::separateConnectionResponse(const V1_0::RadioResponseInfo& info) { |
| 202 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 203 | voiceCb()->separateConnectionResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 204 | return {}; |
| 205 | } |
| 206 | |
| 207 | Return<void> RadioResponse::setCallForwardResponse(const V1_0::RadioResponseInfo& info) { |
| 208 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 209 | voiceCb()->setCallForwardResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 210 | return {}; |
| 211 | } |
| 212 | |
| 213 | Return<void> RadioResponse::setCallWaitingResponse(const V1_0::RadioResponseInfo& info) { |
| 214 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 215 | voiceCb()->setCallWaitingResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 216 | return {}; |
| 217 | } |
| 218 | |
| 219 | Return<void> RadioResponse::setClirResponse(const V1_0::RadioResponseInfo& info) { |
| 220 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 221 | voiceCb()->setClirResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 222 | return {}; |
| 223 | } |
| 224 | |
| 225 | Return<void> RadioResponse::setMuteResponse(const V1_0::RadioResponseInfo& info) { |
| 226 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 227 | voiceCb()->setMuteResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 228 | return {}; |
| 229 | } |
| 230 | |
| 231 | Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) { |
| 232 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 233 | voiceCb()->setPreferredVoicePrivacyResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 234 | return {}; |
| 235 | } |
| 236 | |
| 237 | Return<void> RadioResponse::setTTYModeResponse(const V1_0::RadioResponseInfo& info) { |
| 238 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 239 | voiceCb()->setTtyModeResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 240 | return {}; |
| 241 | } |
| 242 | |
| 243 | Return<void> RadioResponse::startDtmfResponse(const V1_0::RadioResponseInfo& info) { |
| 244 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 245 | voiceCb()->startDtmfResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 246 | return {}; |
| 247 | } |
| 248 | |
| 249 | Return<void> RadioResponse::stopDtmfResponse(const V1_0::RadioResponseInfo& info) { |
| 250 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 251 | voiceCb()->stopDtmfResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 252 | return {}; |
| 253 | } |
| 254 | |
| 255 | Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse( |
| 256 | const V1_0::RadioResponseInfo& info) { |
| 257 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 258 | voiceCb()->switchWaitingOrHoldingAndActiveResponse(toAidl(info)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 259 | return {}; |
| 260 | } |
| 261 | |
| 262 | } // namespace android::hardware::radio::compat |