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/RadioIndication.h> |
| 18 | |
| 19 | #include "commonStructs.h" |
| 20 | #include "debug.h" |
| 21 | #include "structs.h" |
| 22 | |
| 23 | #include "collections.h" |
| 24 | |
| 25 | #define RADIO_MODULE "VoiceIndication" |
| 26 | |
| 27 | namespace android::hardware::radio::compat { |
| 28 | |
| 29 | namespace aidl = ::aidl::android::hardware::radio::voice; |
| 30 | |
| 31 | void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioVoiceIndication> 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::IRadioVoiceIndication> RadioIndication::voiceCb() { |
| 36 | return mVoiceCb.get(); |
| 37 | } |
| 38 | |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 39 | Return<void> RadioIndication::callRing(V1_0::RadioIndicationType type, bool isGsm, |
| 40 | const V1_0::CdmaSignalInfoRecord& record) { |
| 41 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 42 | voiceCb()->callRing(toAidl(type), isGsm, toAidl(record)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 43 | return {}; |
| 44 | } |
| 45 | |
| 46 | Return<void> RadioIndication::callStateChanged(V1_0::RadioIndicationType type) { |
| 47 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 48 | voiceCb()->callStateChanged(toAidl(type)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 49 | return {}; |
| 50 | } |
| 51 | |
| 52 | Return<void> RadioIndication::cdmaCallWaiting(V1_0::RadioIndicationType type, |
| 53 | const V1_0::CdmaCallWaiting& callWaitingRecord) { |
| 54 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 55 | voiceCb()->cdmaCallWaiting(toAidl(type), toAidl(callWaitingRecord)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 56 | return {}; |
| 57 | } |
| 58 | |
| 59 | Return<void> RadioIndication::cdmaInfoRec(V1_0::RadioIndicationType type, |
| 60 | const V1_0::CdmaInformationRecords& records) { |
| 61 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 62 | voiceCb()->cdmaInfoRec(toAidl(type), toAidl(records.infoRec)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 63 | return {}; |
| 64 | } |
| 65 | |
| 66 | Return<void> RadioIndication::cdmaOtaProvisionStatus(V1_0::RadioIndicationType type, |
| 67 | V1_0::CdmaOtaProvisionStatus status) { |
| 68 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 69 | voiceCb()->cdmaOtaProvisionStatus(toAidl(type), aidl::CdmaOtaProvisionStatus(status)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 70 | return {}; |
| 71 | } |
| 72 | |
| 73 | Return<void> RadioIndication::currentEmergencyNumberList( |
| 74 | V1_0::RadioIndicationType type, const hidl_vec<V1_4::EmergencyNumber>& emergencyNumbers) { |
| 75 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 76 | voiceCb()->currentEmergencyNumberList(toAidl(type), toAidl(emergencyNumbers)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 77 | return {}; |
| 78 | } |
| 79 | |
| 80 | Return<void> RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) { |
| 81 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 82 | voiceCb()->enterEmergencyCallbackMode(toAidl(type)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 83 | return {}; |
| 84 | } |
| 85 | |
| 86 | Return<void> RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) { |
| 87 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 88 | voiceCb()->exitEmergencyCallbackMode(toAidl(type)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 89 | return {}; |
| 90 | } |
| 91 | |
| 92 | Return<void> RadioIndication::indicateRingbackTone(V1_0::RadioIndicationType type, bool start) { |
| 93 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 94 | voiceCb()->indicateRingbackTone(toAidl(type), start); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 95 | return {}; |
| 96 | } |
| 97 | |
| 98 | Return<void> RadioIndication::onSupplementaryServiceIndication(V1_0::RadioIndicationType type, |
| 99 | const V1_0::StkCcUnsolSsResult& ss) { |
| 100 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 101 | voiceCb()->onSupplementaryServiceIndication(toAidl(type), toAidl(ss)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 102 | return {}; |
| 103 | } |
| 104 | |
| 105 | Return<void> RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) { |
| 106 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 107 | voiceCb()->resendIncallMute(toAidl(type)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 108 | return {}; |
| 109 | } |
| 110 | |
| 111 | Return<void> RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type, |
| 112 | V1_0::SrvccState state) { |
| 113 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 114 | voiceCb()->srvccStateNotify(toAidl(type), aidl::SrvccState(state)); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 115 | return {}; |
| 116 | } |
| 117 | |
| 118 | Return<void> RadioIndication::stkCallControlAlphaNotify(V1_0::RadioIndicationType type, |
| 119 | const hidl_string& alpha) { |
| 120 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 121 | voiceCb()->stkCallControlAlphaNotify(toAidl(type), alpha); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 122 | return {}; |
| 123 | } |
| 124 | |
| 125 | Return<void> RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) { |
| 126 | LOG_CALL << type; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 127 | voiceCb()->stkCallSetup(toAidl(type), timeout); |
Tomasz Wasilczyk | 6e08418 | 2021-11-05 10:53:55 -0700 | [diff] [blame] | 128 | return {}; |
| 129 | } |
| 130 | |
| 131 | } // namespace android::hardware::radio::compat |