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) { |
| 32 | CHECK(voiceCb); |
| 33 | mVoiceCb = voiceCb; |
| 34 | } |
| 35 | |
| 36 | Return<void> RadioIndication::callRing(V1_0::RadioIndicationType type, bool isGsm, |
| 37 | const V1_0::CdmaSignalInfoRecord& record) { |
| 38 | LOG_CALL << type; |
| 39 | CHECK_CB(mVoiceCb); |
| 40 | mVoiceCb->callRing(toAidl(type), isGsm, toAidl(record)); |
| 41 | return {}; |
| 42 | } |
| 43 | |
| 44 | Return<void> RadioIndication::callStateChanged(V1_0::RadioIndicationType type) { |
| 45 | LOG_CALL << type; |
| 46 | CHECK_CB(mVoiceCb); |
| 47 | mVoiceCb->callStateChanged(toAidl(type)); |
| 48 | return {}; |
| 49 | } |
| 50 | |
| 51 | Return<void> RadioIndication::cdmaCallWaiting(V1_0::RadioIndicationType type, |
| 52 | const V1_0::CdmaCallWaiting& callWaitingRecord) { |
| 53 | LOG_CALL << type; |
| 54 | CHECK_CB(mVoiceCb); |
| 55 | mVoiceCb->cdmaCallWaiting(toAidl(type), toAidl(callWaitingRecord)); |
| 56 | return {}; |
| 57 | } |
| 58 | |
| 59 | Return<void> RadioIndication::cdmaInfoRec(V1_0::RadioIndicationType type, |
| 60 | const V1_0::CdmaInformationRecords& records) { |
| 61 | LOG_CALL << type; |
| 62 | CHECK_CB(mVoiceCb); |
| 63 | mVoiceCb->cdmaInfoRec(toAidl(type), toAidl(records.infoRec)); |
| 64 | return {}; |
| 65 | } |
| 66 | |
| 67 | Return<void> RadioIndication::cdmaOtaProvisionStatus(V1_0::RadioIndicationType type, |
| 68 | V1_0::CdmaOtaProvisionStatus status) { |
| 69 | LOG_CALL << type; |
| 70 | CHECK_CB(mVoiceCb); |
| 71 | mVoiceCb->cdmaOtaProvisionStatus(toAidl(type), aidl::CdmaOtaProvisionStatus(status)); |
| 72 | return {}; |
| 73 | } |
| 74 | |
| 75 | Return<void> RadioIndication::currentEmergencyNumberList( |
| 76 | V1_0::RadioIndicationType type, const hidl_vec<V1_4::EmergencyNumber>& emergencyNumbers) { |
| 77 | LOG_CALL << type; |
| 78 | CHECK_CB(mVoiceCb); |
| 79 | mVoiceCb->currentEmergencyNumberList(toAidl(type), toAidl(emergencyNumbers)); |
| 80 | return {}; |
| 81 | } |
| 82 | |
| 83 | Return<void> RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) { |
| 84 | LOG_CALL << type; |
| 85 | CHECK_CB(mVoiceCb); |
| 86 | mVoiceCb->enterEmergencyCallbackMode(toAidl(type)); |
| 87 | return {}; |
| 88 | } |
| 89 | |
| 90 | Return<void> RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) { |
| 91 | LOG_CALL << type; |
| 92 | CHECK_CB(mVoiceCb); |
| 93 | mVoiceCb->exitEmergencyCallbackMode(toAidl(type)); |
| 94 | return {}; |
| 95 | } |
| 96 | |
| 97 | Return<void> RadioIndication::indicateRingbackTone(V1_0::RadioIndicationType type, bool start) { |
| 98 | LOG_CALL << type; |
| 99 | CHECK_CB(mVoiceCb); |
| 100 | mVoiceCb->indicateRingbackTone(toAidl(type), start); |
| 101 | return {}; |
| 102 | } |
| 103 | |
| 104 | Return<void> RadioIndication::onSupplementaryServiceIndication(V1_0::RadioIndicationType type, |
| 105 | const V1_0::StkCcUnsolSsResult& ss) { |
| 106 | LOG_CALL << type; |
| 107 | CHECK_CB(mVoiceCb); |
| 108 | mVoiceCb->onSupplementaryServiceIndication(toAidl(type), toAidl(ss)); |
| 109 | return {}; |
| 110 | } |
| 111 | |
| 112 | Return<void> RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) { |
| 113 | LOG_CALL << type; |
| 114 | CHECK_CB(mVoiceCb); |
| 115 | mVoiceCb->resendIncallMute(toAidl(type)); |
| 116 | return {}; |
| 117 | } |
| 118 | |
| 119 | Return<void> RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type, |
| 120 | V1_0::SrvccState state) { |
| 121 | LOG_CALL << type; |
| 122 | CHECK_CB(mVoiceCb); |
| 123 | mVoiceCb->srvccStateNotify(toAidl(type), aidl::SrvccState(state)); |
| 124 | return {}; |
| 125 | } |
| 126 | |
| 127 | Return<void> RadioIndication::stkCallControlAlphaNotify(V1_0::RadioIndicationType type, |
| 128 | const hidl_string& alpha) { |
| 129 | LOG_CALL << type; |
| 130 | CHECK_CB(mVoiceCb); |
| 131 | mVoiceCb->stkCallControlAlphaNotify(toAidl(type), alpha); |
| 132 | return {}; |
| 133 | } |
| 134 | |
| 135 | Return<void> RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) { |
| 136 | LOG_CALL << type; |
| 137 | CHECK_CB(mVoiceCb); |
| 138 | mVoiceCb->stkCallSetup(toAidl(type), timeout); |
| 139 | return {}; |
| 140 | } |
| 141 | |
| 142 | } // namespace android::hardware::radio::compat |