1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.1 (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.1
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#ifndef ANDROID_HARDWARE_RADIO_V1_2_RADIO_H
17#define ANDROID_HARDWARE_RADIO_V1_2_RADIO_H
18
19#include <android/hardware/radio/1.2/IRadio.h>
20#include <android/hardware/radio/1.2/IRadioIndication.h>
21#include <android/hardware/radio/1.2/IRadioResponse.h>
22#include <hidl/MQDescriptor.h>
23#include <hidl/Status.h>
24#include <log/log.h>
25
26namespace android {
27namespace hardware {
28namespace radio {
29namespace V1_2 {
30namespace implementation {
31
32using ::android::hardware::hidl_array;
33using ::android::hardware::hidl_memory;
34using ::android::hardware::hidl_string;
35using ::android::hardware::hidl_vec;
36using ::android::hardware::Return;
37using ::android::hardware::Void;
38using ::android::sp;
39
40struct Radio : public IRadio {
41    sp<::android::hardware::radio::V1_0::IRadioResponse> mRadioResponse;
42    sp<::android::hardware::radio::V1_0::IRadioIndication> mRadioIndication;
43    sp<::android::hardware::radio::V1_1::IRadioResponse> mRadioResponseV1_1;
44    sp<::android::hardware::radio::V1_1::IRadioIndication> mRadioIndicationV1_1;
45    sp<::android::hardware::radio::V1_2::IRadioResponse> mRadioResponseV1_2;
46    sp<::android::hardware::radio::V1_2::IRadioIndication> mRadioIndicationV1_2;
47
48    // Methods from ::android::hardware::radio::V1_0::IRadio follow.
49    Return<void> setResponseFunctions(
50        const sp<::android::hardware::radio::V1_0::IRadioResponse>& radioResponse,
51        const sp<::android::hardware::radio::V1_0::IRadioIndication>& radioIndication) override;
52    Return<void> getIccCardStatus(int32_t serial) override;
53    Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin,
54                                    const hidl_string& aid) override;
55    Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin,
56                                    const hidl_string& aid) override;
57    Return<void> supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2,
58                                     const hidl_string& aid) override;
59    Return<void> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2,
60                                     const hidl_string& pin2, const hidl_string& aid) override;
61    Return<void> changeIccPinForApp(int32_t serial, const hidl_string& oldPin,
62                                    const hidl_string& newPin, const hidl_string& aid) override;
63    Return<void> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2,
64                                     const hidl_string& newPin2, const hidl_string& aid) override;
65    Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) override;
66    Return<void> getCurrentCalls(int32_t serial) override;
67    Return<void> dial(int32_t serial,
68                      const ::android::hardware::radio::V1_0::Dial& dialInfo) override;
69    Return<void> getImsiForApp(int32_t serial, const hidl_string& aid) override;
70    Return<void> hangup(int32_t serial, int32_t gsmIndex) override;
71    Return<void> hangupWaitingOrBackground(int32_t serial) override;
72    Return<void> hangupForegroundResumeBackground(int32_t serial) override;
73    Return<void> switchWaitingOrHoldingAndActive(int32_t serial) override;
74    Return<void> conference(int32_t serial) override;
75    Return<void> rejectCall(int32_t serial) override;
76    Return<void> getLastCallFailCause(int32_t serial) override;
77    Return<void> getSignalStrength(int32_t serial) override;
78    Return<void> getVoiceRegistrationState(int32_t serial) override;
79    Return<void> getDataRegistrationState(int32_t serial) override;
80    Return<void> getOperator(int32_t serial) override;
81    Return<void> setRadioPower(int32_t serial, bool on) override;
82    Return<void> sendDtmf(int32_t serial, const hidl_string& s) override;
83    Return<void> sendSms(int32_t serial,
84                         const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override;
85    Return<void> sendSMSExpectMore(
86        int32_t serial, const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override;
87    Return<void> setupDataCall(
88        int32_t serial, ::android::hardware::radio::V1_0::RadioTechnology radioTechnology,
89        const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo,
90        bool modemCognitive, bool roamingAllowed, bool isRoaming) override;
91    Return<void> iccIOForApp(int32_t serial,
92                             const ::android::hardware::radio::V1_0::IccIo& iccIo) override;
93    Return<void> sendUssd(int32_t serial, const hidl_string& ussd) override;
94    Return<void> cancelPendingUssd(int32_t serial) override;
95    Return<void> getClir(int32_t serial) override;
96    Return<void> setClir(int32_t serial, int32_t status) override;
97    Return<void> getCallForwardStatus(
98        int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override;
99    Return<void> setCallForward(
100        int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override;
101    Return<void> getCallWaiting(int32_t serial, int32_t serviceClass) override;
102    Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override;
103    Return<void> acknowledgeLastIncomingGsmSms(
104        int32_t serial, bool success,
105        ::android::hardware::radio::V1_0::SmsAcknowledgeFailCause cause) override;
106    Return<void> acceptCall(int32_t serial) override;
107    Return<void> deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) override;
108    Return<void> getFacilityLockForApp(int32_t serial, const hidl_string& facility,
109                                       const hidl_string& password, int32_t serviceClass,
110                                       const hidl_string& appId) override;
111    Return<void> setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState,
112                                       const hidl_string& password, int32_t serviceClass,
113                                       const hidl_string& appId) override;
114    Return<void> setBarringPassword(int32_t serial, const hidl_string& facility,
115                                    const hidl_string& oldPassword,
116                                    const hidl_string& newPassword) override;
117    Return<void> getNetworkSelectionMode(int32_t serial) override;
118    Return<void> setNetworkSelectionModeAutomatic(int32_t serial) override;
119    Return<void> setNetworkSelectionModeManual(int32_t serial,
120                                               const hidl_string& operatorNumeric) override;
121    Return<void> getAvailableNetworks(int32_t serial) override;
122    Return<void> startDtmf(int32_t serial, const hidl_string& s) override;
123    Return<void> stopDtmf(int32_t serial) override;
124    Return<void> getBasebandVersion(int32_t serial) override;
125    Return<void> separateConnection(int32_t serial, int32_t gsmIndex) override;
126    Return<void> setMute(int32_t serial, bool enable) override;
127    Return<void> getMute(int32_t serial) override;
128    Return<void> getClip(int32_t serial) override;
129    Return<void> getDataCallList(int32_t serial) override;
130    Return<void> setSuppServiceNotifications(int32_t serial, bool enable) override;
131    Return<void> writeSmsToSim(
132        int32_t serial,
133        const ::android::hardware::radio::V1_0::SmsWriteArgs& smsWriteArgs) override;
134    Return<void> deleteSmsOnSim(int32_t serial, int32_t index) override;
135    Return<void> setBandMode(int32_t serial,
136                             ::android::hardware::radio::V1_0::RadioBandMode mode) override;
137    Return<void> getAvailableBandModes(int32_t serial) override;
138    Return<void> sendEnvelope(int32_t serial, const hidl_string& command) override;
139    Return<void> sendTerminalResponseToSim(int32_t serial,
140                                           const hidl_string& commandResponse) override;
141    Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override;
142    Return<void> explicitCallTransfer(int32_t serial) override;
143    Return<void> setPreferredNetworkType(
144        int32_t serial, ::android::hardware::radio::V1_0::PreferredNetworkType nwType) override;
145    Return<void> getPreferredNetworkType(int32_t serial) override;
146    Return<void> getNeighboringCids(int32_t serial) override;
147    Return<void> setLocationUpdates(int32_t serial, bool enable) override;
148    Return<void> setCdmaSubscriptionSource(
149        int32_t serial, ::android::hardware::radio::V1_0::CdmaSubscriptionSource cdmaSub) override;
150    Return<void> setCdmaRoamingPreference(
151        int32_t serial, ::android::hardware::radio::V1_0::CdmaRoamingType type) override;
152    Return<void> getCdmaRoamingPreference(int32_t serial) override;
153    Return<void> setTTYMode(int32_t serial,
154                            ::android::hardware::radio::V1_0::TtyMode mode) override;
155    Return<void> getTTYMode(int32_t serial) override;
156    Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable) override;
157    Return<void> getPreferredVoicePrivacy(int32_t serial) override;
158    Return<void> sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) override;
159    Return<void> sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on,
160                               int32_t off) override;
161    Return<void> sendCdmaSms(int32_t serial,
162                             const ::android::hardware::radio::V1_0::CdmaSmsMessage& sms) override;
163    Return<void> acknowledgeLastIncomingCdmaSms(
164        int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsAck& smsAck) override;
165    Return<void> getGsmBroadcastConfig(int32_t serial) override;
166    Return<void> setGsmBroadcastConfig(
167        int32_t serial,
168        const hidl_vec<::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo>& configInfo)
169        override;
170    Return<void> setGsmBroadcastActivation(int32_t serial, bool activate) override;
171    Return<void> getCdmaBroadcastConfig(int32_t serial) override;
172    Return<void> setCdmaBroadcastConfig(
173        int32_t serial,
174        const hidl_vec<::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo>& configInfo)
175        override;
176    Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate) override;
177    Return<void> getCDMASubscription(int32_t serial) override;
178    Return<void> writeSmsToRuim(
179        int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsWriteArgs& cdmaSms) override;
180    Return<void> deleteSmsOnRuim(int32_t serial, int32_t index) override;
181    Return<void> getDeviceIdentity(int32_t serial) override;
182    Return<void> exitEmergencyCallbackMode(int32_t serial) override;
183    Return<void> getSmscAddress(int32_t serial) override;
184    Return<void> setSmscAddress(int32_t serial, const hidl_string& smsc) override;
185    Return<void> reportSmsMemoryStatus(int32_t serial, bool available) override;
186    Return<void> reportStkServiceIsRunning(int32_t serial) override;
187    Return<void> getCdmaSubscriptionSource(int32_t serial) override;
188    Return<void> requestIsimAuthentication(int32_t serial, const hidl_string& challenge) override;
189    Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
190                                                  const hidl_string& ackPdu) override;
191    Return<void> sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) override;
192    Return<void> getVoiceRadioTechnology(int32_t serial) override;
193    Return<void> getCellInfoList(int32_t serial) override;
194    Return<void> setCellInfoListRate(int32_t serial, int32_t rate) override;
195    Return<void> setInitialAttachApn(
196        int32_t serial, const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo,
197        bool modemCognitive, bool isRoaming) override;
198    Return<void> getImsRegistrationState(int32_t serial) override;
199    Return<void> sendImsSms(
200        int32_t serial, const ::android::hardware::radio::V1_0::ImsSmsMessage& message) override;
201    Return<void> iccTransmitApduBasicChannel(
202        int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override;
203    Return<void> iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) override;
204    Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId) override;
205    Return<void> iccTransmitApduLogicalChannel(
206        int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override;
207    Return<void> nvReadItem(int32_t serial,
208                            ::android::hardware::radio::V1_0::NvItem itemId) override;
209    Return<void> nvWriteItem(int32_t serial,
210                             const ::android::hardware::radio::V1_0::NvWriteItem& item) override;
211    Return<void> nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) override;
212    Return<void> nvResetConfig(int32_t serial,
213                               ::android::hardware::radio::V1_0::ResetNvType resetType) override;
214    Return<void> setUiccSubscription(
215        int32_t serial, const ::android::hardware::radio::V1_0::SelectUiccSub& uiccSub) override;
216    Return<void> setDataAllowed(int32_t serial, bool allow) override;
217    Return<void> getHardwareConfig(int32_t serial) override;
218    Return<void> requestIccSimAuthentication(int32_t serial, int32_t authContext,
219                                             const hidl_string& authData,
220                                             const hidl_string& aid) override;
221    Return<void> setDataProfile(
222        int32_t serial, const hidl_vec<::android::hardware::radio::V1_0::DataProfileInfo>& profiles,
223        bool isRoaming) override;
224    Return<void> requestShutdown(int32_t serial) override;
225    Return<void> getRadioCapability(int32_t serial) override;
226    Return<void> setRadioCapability(
227        int32_t serial, const ::android::hardware::radio::V1_0::RadioCapability& rc) override;
228    Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode) override;
229    Return<void> stopLceService(int32_t serial) override;
230    Return<void> pullLceData(int32_t serial) override;
231    Return<void> getModemActivityInfo(int32_t serial) override;
232    Return<void> setAllowedCarriers(
233        int32_t serial, bool allAllowed,
234        const ::android::hardware::radio::V1_0::CarrierRestrictions& carriers) override;
235    Return<void> getAllowedCarriers(int32_t serial) override;
236    Return<void> sendDeviceState(int32_t serial,
237                                 ::android::hardware::radio::V1_0::DeviceStateType deviceStateType,
238                                 bool state) override;
239    Return<void> setIndicationFilter(int32_t serial,
240                                     hidl_bitfield<IndicationFilter> indicationFilter) override;
241    Return<void> setSimCardPower(int32_t serial, bool powerUp) override;
242    Return<void> responseAcknowledgement() override;
243
244    // Methods from ::android::hardware::radio::V1_1::IRadio follow.
245    Return<void> setCarrierInfoForImsiEncryption(
246        int32_t serial,
247        const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) override;
248    Return<void> setSimCardPower_1_1(
249        int32_t serial, ::android::hardware::radio::V1_1::CardPowerState powerUp) override;
250    Return<void> startNetworkScan(
251        int32_t serial,
252        const ::android::hardware::radio::V1_1::NetworkScanRequest& request) override;
253    Return<void> stopNetworkScan(int32_t serial) override;
254    Return<void> startKeepalive(
255        int32_t serial,
256        const ::android::hardware::radio::V1_1::KeepaliveRequest& keepalive) override;
257    Return<void> stopKeepalive(int32_t serial, int32_t sessionHandle) override;
258
259    // Methods from ::android::hardware::radio::V1_2::IRadio follow.
260    Return<void> startNetworkScan_1_2(
261        int32_t serial,
262        const ::android::hardware::radio::V1_2::NetworkScanRequest& request) override;
263    Return<void> setIndicationFilter_1_2(int32_t serial,
264                                         hidl_bitfield<IndicationFilter> indicationFilter) override;
265    Return<void> setSignalStrengthReportingCriteria(
266        int32_t serial, int32_t hysteresisMs, int32_t hysteresisDb,
267        const hidl_vec<int32_t>& thresholdsDbm,
268        ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override;
269    Return<void> setLinkCapacityReportingCriteria(
270        int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps,
271        const hidl_vec<int32_t>& thresholdsDownlinkKbps,
272        const hidl_vec<int32_t>& thresholdsUplinkKbps,
273        ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override;
274    Return<void> setupDataCall_1_2(
275        int32_t serial, ::android::hardware::radio::V1_2::AccessNetwork accessNetwork,
276        const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo,
277        bool modemCognitive, bool roamingAllowed, bool isRoaming,
278        ::android::hardware::radio::V1_2::DataRequestReason reason,
279        const hidl_vec<hidl_string>& addresses, const hidl_vec<hidl_string>& dnses) override;
280    Return<void> deactivateDataCall_1_2(
281        int32_t serial, int32_t cid,
282        ::android::hardware::radio::V1_2::DataRequestReason reason) override;
283};
284
285}  // namespace implementation
286}  // namespace V1_2
287}  // namespace radio
288}  // namespace hardware
289}  // namespace android
290
291#endif  // ANDROID_HARDWARE_RADIO_V1_2_RADIO_H
292