• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
17 
18 #include "DriverContext.h"
19 #include "GuaranteedCallback.h"
20 
21 #include <aidl/android/hardware/radio/data/IRadioDataIndication.h>
22 #include <aidl/android/hardware/radio/ims/IRadioImsIndication.h>
23 #include <aidl/android/hardware/radio/messaging/IRadioMessagingIndication.h>
24 #include <aidl/android/hardware/radio/modem/IRadioModemIndication.h>
25 #include <aidl/android/hardware/radio/network/IRadioNetworkIndication.h>
26 #include <aidl/android/hardware/radio/sim/IRadioSimIndication.h>
27 #include <aidl/android/hardware/radio/voice/IRadioVoiceIndication.h>
28 #include <android/hardware/radio/1.6/IRadioIndication.h>
29 
30 namespace android::hardware::radio::compat {
31 
32 class RadioIndication : public V1_6::IRadioIndication {
33     std::shared_ptr<DriverContext> mContext;
34 
35     GuaranteedCallback<  //
36             ::aidl::android::hardware::radio::data::IRadioDataIndication,
37             ::aidl::android::hardware::radio::data::IRadioDataIndicationDefault, true>
38             mDataCb;
39     GuaranteedCallback<  //
40             ::aidl::android::hardware::radio::messaging::IRadioMessagingIndication,
41             ::aidl::android::hardware::radio::messaging::IRadioMessagingIndicationDefault, true>
42             mMessagingCb;
43     GuaranteedCallback<  //
44             ::aidl::android::hardware::radio::modem::IRadioModemIndication,
45             ::aidl::android::hardware::radio::modem::IRadioModemIndicationDefault, true>
46             mModemCb;
47     GuaranteedCallback<  //
48             ::aidl::android::hardware::radio::network::IRadioNetworkIndication,
49             ::aidl::android::hardware::radio::network::IRadioNetworkIndicationDefault, true>
50             mNetworkCb;
51     GuaranteedCallback<  //
52             ::aidl::android::hardware::radio::sim::IRadioSimIndication,
53             ::aidl::android::hardware::radio::sim::IRadioSimIndicationDefault, true>
54             mSimCb;
55     GuaranteedCallback<  //
56             ::aidl::android::hardware::radio::voice::IRadioVoiceIndication,
57             ::aidl::android::hardware::radio::voice::IRadioVoiceIndicationDefault, true>
58             mVoiceCb;
59     GuaranteedCallback<  //
60             ::aidl::android::hardware::radio::ims::IRadioImsIndication,
61             ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true>
62             mImsCb;
63 
64     // IRadioIndication @ 1.0
65     Return<void> radioStateChanged(V1_0::RadioIndicationType type,
66                                    V1_0::RadioState radioState) override;
67     Return<void> callStateChanged(V1_0::RadioIndicationType type) override;
68     Return<void> networkStateChanged(V1_0::RadioIndicationType type) override;
69     Return<void> newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) override;
70     Return<void> newSmsStatusReport(V1_0::RadioIndicationType type,
71                                     const hidl_vec<uint8_t>& pdu) override;
72     Return<void> newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) override;
73     Return<void> onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
74                         const hidl_string& msg) override;
75     Return<void> nitzTimeReceived(V1_0::RadioIndicationType type, const hidl_string& nitzTime,
76                                   uint64_t receivedTime) override;
77     Return<void> currentSignalStrength(V1_0::RadioIndicationType type,
78                                        const V1_0::SignalStrength& signalStrength) override;
79     Return<void> dataCallListChanged(V1_0::RadioIndicationType type,
80                                      const hidl_vec<V1_0::SetupDataCallResult>& dcList) override;
81     Return<void> suppSvcNotify(V1_0::RadioIndicationType type,
82                                const V1_0::SuppSvcNotification& suppSvc) override;
83     Return<void> stkSessionEnd(V1_0::RadioIndicationType type) override;
84     Return<void> stkProactiveCommand(V1_0::RadioIndicationType type,
85                                      const hidl_string& cmd) override;
86     Return<void> stkEventNotify(V1_0::RadioIndicationType type, const hidl_string& cmd) override;
87     Return<void> stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) override;
88     Return<void> simSmsStorageFull(V1_0::RadioIndicationType type) override;
89     Return<void> simRefresh(V1_0::RadioIndicationType type,
90                             const V1_0::SimRefreshResult& refreshResult) override;
91     Return<void> callRing(V1_0::RadioIndicationType type, bool isGsm,
92                           const V1_0::CdmaSignalInfoRecord& record) override;
93     Return<void> simStatusChanged(V1_0::RadioIndicationType type) override;
94     Return<void> cdmaNewSms(V1_0::RadioIndicationType type,
95                             const V1_0::CdmaSmsMessage& msg) override;
96     Return<void> newBroadcastSms(V1_0::RadioIndicationType type,
97                                  const hidl_vec<uint8_t>& data) override;
98     Return<void> cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) override;
99     Return<void> restrictedStateChanged(V1_0::RadioIndicationType type,
100                                         V1_0::PhoneRestrictedState state) override;
101     Return<void> enterEmergencyCallbackMode(V1_0::RadioIndicationType type) override;
102     Return<void> cdmaCallWaiting(V1_0::RadioIndicationType type,
103                                  const V1_0::CdmaCallWaiting& callWaitingRecord) override;
104     Return<void> cdmaOtaProvisionStatus(V1_0::RadioIndicationType type,
105                                         V1_0::CdmaOtaProvisionStatus status) override;
106     Return<void> cdmaInfoRec(V1_0::RadioIndicationType type,
107                              const V1_0::CdmaInformationRecords& records) override;
108     Return<void> indicateRingbackTone(V1_0::RadioIndicationType type, bool start) override;
109     Return<void> resendIncallMute(V1_0::RadioIndicationType type) override;
110     Return<void> cdmaSubscriptionSourceChanged(V1_0::RadioIndicationType type,
111                                                V1_0::CdmaSubscriptionSource cdmaSource) override;
112     Return<void> cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) override;
113     Return<void> exitEmergencyCallbackMode(V1_0::RadioIndicationType type) override;
114     Return<void> rilConnected(V1_0::RadioIndicationType type) override;
115     Return<void> voiceRadioTechChanged(V1_0::RadioIndicationType type,
116                                        V1_0::RadioTechnology rat) override;
117     Return<void> cellInfoList(V1_0::RadioIndicationType type,
118                               const hidl_vec<V1_0::CellInfo>& records) override;
119     Return<void> imsNetworkStateChanged(V1_0::RadioIndicationType type) override;
120     Return<void> subscriptionStatusChanged(V1_0::RadioIndicationType type, bool activate) override;
121     Return<void> srvccStateNotify(V1_0::RadioIndicationType type, V1_0::SrvccState state) override;
122     Return<void> hardwareConfigChanged(V1_0::RadioIndicationType type,
123                                        const hidl_vec<V1_0::HardwareConfig>& configs) override;
124     Return<void> radioCapabilityIndication(V1_0::RadioIndicationType type,
125                                            const V1_0::RadioCapability& rc) override;
126     Return<void> onSupplementaryServiceIndication(V1_0::RadioIndicationType type,
127                                                   const V1_0::StkCcUnsolSsResult& ss) override;
128     Return<void> stkCallControlAlphaNotify(V1_0::RadioIndicationType type,
129                                            const hidl_string& alpha) override;
130     Return<void> lceData(V1_0::RadioIndicationType type, const V1_0::LceDataInfo& lce) override;
131     Return<void> pcoData(V1_0::RadioIndicationType type, const V1_0::PcoDataInfo& pco) override;
132     Return<void> modemReset(V1_0::RadioIndicationType type, const hidl_string& reason) override;
133 
134     // IRadioIndication @ 1.1
135     Return<void> carrierInfoForImsiEncryption(V1_0::RadioIndicationType info) override;
136     Return<void> networkScanResult(V1_0::RadioIndicationType type,
137                                    const V1_1::NetworkScanResult& result) override;
138     Return<void> keepaliveStatus(V1_0::RadioIndicationType type,
139                                  const V1_1::KeepaliveStatus& status) override;
140 
141     // IRadioIndication @ 1.2
142     Return<void> networkScanResult_1_2(V1_0::RadioIndicationType type,
143                                        const V1_2::NetworkScanResult& result) override;
144     Return<void> cellInfoList_1_2(V1_0::RadioIndicationType type,
145                                   const hidl_vec<V1_2::CellInfo>& records) override;
146     Return<void> currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
147                                              const V1_2::LinkCapacityEstimate& lce) override;
148     Return<void> currentPhysicalChannelConfigs(
149             V1_0::RadioIndicationType type,
150             const hidl_vec<V1_2::PhysicalChannelConfig>& configs) override;
151     Return<void> currentSignalStrength_1_2(V1_0::RadioIndicationType type,
152                                            const V1_2::SignalStrength& signalStrength) override;
153 
154     // IRadioIndication @ 1.4
155     Return<void> currentEmergencyNumberList(
156             V1_0::RadioIndicationType type,
157             const hidl_vec<V1_4::EmergencyNumber>& emergencyNumberList) override;
158     Return<void> cellInfoList_1_4(V1_0::RadioIndicationType type,
159                                   const hidl_vec<V1_4::CellInfo>& records) override;
160     Return<void> networkScanResult_1_4(V1_0::RadioIndicationType type,
161                                        const V1_4::NetworkScanResult& result) override;
162     Return<void> currentPhysicalChannelConfigs_1_4(
163             V1_0::RadioIndicationType type,
164             const hidl_vec<V1_4::PhysicalChannelConfig>& configs) override;
165     Return<void> dataCallListChanged_1_4(
166             V1_0::RadioIndicationType type,
167             const hidl_vec<V1_4::SetupDataCallResult>& dcList) override;
168     Return<void> currentSignalStrength_1_4(V1_0::RadioIndicationType type,
169                                            const V1_4::SignalStrength& signalStrength) override;
170 
171     // IRadioIndication @ 1.5
172     Return<void> uiccApplicationsEnablementChanged(V1_0::RadioIndicationType type,
173                                                    bool enabled) override;
174     Return<void> registrationFailed(  //
175             V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
176             const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
177             int32_t additionalCauseCode) override;
178     Return<void> barringInfoChanged(  //
179             V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
180             const hidl_vec<V1_5::BarringInfo>& barringInfos) override;
181     Return<void> cellInfoList_1_5(V1_0::RadioIndicationType type,
182                                   const hidl_vec<V1_5::CellInfo>& records) override;
183     Return<void> networkScanResult_1_5(V1_0::RadioIndicationType type,
184                                        const V1_5::NetworkScanResult& result) override;
185     Return<void> dataCallListChanged_1_5(
186             V1_0::RadioIndicationType type,
187             const hidl_vec<V1_5::SetupDataCallResult>& dcList) override;
188 
189     // IRadioIndication @ 1.6
190     Return<void> dataCallListChanged_1_6(
191             V1_0::RadioIndicationType type,
192             const hidl_vec<V1_6::SetupDataCallResult>& dcList) override;
193     Return<void> unthrottleApn(V1_0::RadioIndicationType type, const hidl_string& apn) override;
194     Return<void> slicingConfigChanged(V1_0::RadioIndicationType type,
195                                       const V1_6::SlicingConfig& slicingConfig);
196     Return<void> currentLinkCapacityEstimate_1_6(V1_0::RadioIndicationType type,
197                                                  const V1_6::LinkCapacityEstimate& lce) override;
198     Return<void> currentSignalStrength_1_6(V1_0::RadioIndicationType type,
199                                            const V1_6::SignalStrength& signalStrength) override;
200     Return<void> cellInfoList_1_6(V1_0::RadioIndicationType type,
201                                   const hidl_vec<V1_6::CellInfo>& records) override;
202     Return<void> networkScanResult_1_6(V1_0::RadioIndicationType type,
203                                        const V1_6::NetworkScanResult& result) override;
204     Return<void> currentPhysicalChannelConfigs_1_6(
205             V1_0::RadioIndicationType type,
206             const hidl_vec<V1_6::PhysicalChannelConfig>& configs) override;
207     Return<void> simPhonebookChanged(V1_0::RadioIndicationType type) override;
208     Return<void> simPhonebookRecordsReceived(
209             V1_0::RadioIndicationType type, V1_6::PbReceivedStatus status,
210             const hidl_vec<V1_6::PhonebookRecordInfo>& records) override;
211 
212   public:
213     RadioIndication(std::shared_ptr<DriverContext> context);
214 
215     void setResponseFunction(
216             std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb);
217     void setResponseFunction(
218             std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
219                     radioMessagingIndication);
220     void setResponseFunction(
221             std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication> modmCb);
222     void setResponseFunction(
223             std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> ni);
224     void setResponseFunction(
225             std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb);
226     void setResponseFunction(
227             std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb);
228     void setResponseFunction(
229             std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb);
230 
231     std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb();
232     std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
233     messagingCb();
234     std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication> modemCb();
235     std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> networkCb();
236     std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb();
237     std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb();
238     std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb();
239 };
240 
241 }  // namespace android::hardware::radio::compat
242