blob: 359fce0321e89dfd151594f006d654908aa315f1 [file] [log] [blame]
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -07001/*
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
27namespace android::hardware::radio::compat {
28
29namespace aidl = ::aidl::android::hardware::radio::voice;
30
31void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioVoiceIndication> voiceCb) {
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070032 mVoiceCb = voiceCb;
33}
34
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080035std::shared_ptr<aidl::IRadioVoiceIndication> RadioIndication::voiceCb() {
36 return mVoiceCb.get();
37}
38
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070039Return<void> RadioIndication::callRing(V1_0::RadioIndicationType type, bool isGsm,
40 const V1_0::CdmaSignalInfoRecord& record) {
41 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080042 voiceCb()->callRing(toAidl(type), isGsm, toAidl(record));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070043 return {};
44}
45
46Return<void> RadioIndication::callStateChanged(V1_0::RadioIndicationType type) {
47 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080048 voiceCb()->callStateChanged(toAidl(type));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070049 return {};
50}
51
52Return<void> RadioIndication::cdmaCallWaiting(V1_0::RadioIndicationType type,
53 const V1_0::CdmaCallWaiting& callWaitingRecord) {
54 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080055 voiceCb()->cdmaCallWaiting(toAidl(type), toAidl(callWaitingRecord));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070056 return {};
57}
58
59Return<void> RadioIndication::cdmaInfoRec(V1_0::RadioIndicationType type,
60 const V1_0::CdmaInformationRecords& records) {
61 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080062 voiceCb()->cdmaInfoRec(toAidl(type), toAidl(records.infoRec));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070063 return {};
64}
65
66Return<void> RadioIndication::cdmaOtaProvisionStatus(V1_0::RadioIndicationType type,
67 V1_0::CdmaOtaProvisionStatus status) {
68 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080069 voiceCb()->cdmaOtaProvisionStatus(toAidl(type), aidl::CdmaOtaProvisionStatus(status));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070070 return {};
71}
72
73Return<void> RadioIndication::currentEmergencyNumberList(
74 V1_0::RadioIndicationType type, const hidl_vec<V1_4::EmergencyNumber>& emergencyNumbers) {
75 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080076 voiceCb()->currentEmergencyNumberList(toAidl(type), toAidl(emergencyNumbers));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070077 return {};
78}
79
80Return<void> RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) {
81 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080082 voiceCb()->enterEmergencyCallbackMode(toAidl(type));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070083 return {};
84}
85
86Return<void> RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) {
87 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080088 voiceCb()->exitEmergencyCallbackMode(toAidl(type));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070089 return {};
90}
91
92Return<void> RadioIndication::indicateRingbackTone(V1_0::RadioIndicationType type, bool start) {
93 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080094 voiceCb()->indicateRingbackTone(toAidl(type), start);
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -070095 return {};
96}
97
98Return<void> RadioIndication::onSupplementaryServiceIndication(V1_0::RadioIndicationType type,
99 const V1_0::StkCcUnsolSsResult& ss) {
100 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800101 voiceCb()->onSupplementaryServiceIndication(toAidl(type), toAidl(ss));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -0700102 return {};
103}
104
105Return<void> RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) {
106 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800107 voiceCb()->resendIncallMute(toAidl(type));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -0700108 return {};
109}
110
111Return<void> RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type,
112 V1_0::SrvccState state) {
113 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800114 voiceCb()->srvccStateNotify(toAidl(type), aidl::SrvccState(state));
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -0700115 return {};
116}
117
118Return<void> RadioIndication::stkCallControlAlphaNotify(V1_0::RadioIndicationType type,
119 const hidl_string& alpha) {
120 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800121 voiceCb()->stkCallControlAlphaNotify(toAidl(type), alpha);
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -0700122 return {};
123}
124
125Return<void> RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) {
126 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800127 voiceCb()->stkCallSetup(toAidl(type), timeout);
Tomasz Wasilczyk6e084182021-11-05 10:53:55 -0700128 return {};
129}
130
131} // namespace android::hardware::radio::compat