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