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 "SimIndication"
26
27 namespace android::hardware::radio::compat {
28
29 namespace aidl = ::aidl::android::hardware::radio::sim;
30
setResponseFunction(std::shared_ptr<aidl::IRadioSimIndication> simCb)31 void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioSimIndication> simCb) {
32 mSimCb = simCb;
33 }
34
simCb()35 std::shared_ptr<aidl::IRadioSimIndication> RadioIndication::simCb() {
36 return mSimCb.get();
37 }
38
carrierInfoForImsiEncryption(V1_0::RadioIndicationType type)39 Return<void> RadioIndication::carrierInfoForImsiEncryption(V1_0::RadioIndicationType type) {
40 LOG_CALL << type;
41 simCb()->carrierInfoForImsiEncryption(toAidl(type));
42 return {};
43 }
44
cdmaSubscriptionSourceChanged(V1_0::RadioIndicationType type,V1_0::CdmaSubscriptionSource cdmaSource)45 Return<void> RadioIndication::cdmaSubscriptionSourceChanged(
46 V1_0::RadioIndicationType type, V1_0::CdmaSubscriptionSource cdmaSource) {
47 LOG_CALL << type;
48 simCb()->cdmaSubscriptionSourceChanged(toAidl(type), aidl::CdmaSubscriptionSource(cdmaSource));
49 return {};
50 }
51
simPhonebookChanged(V1_0::RadioIndicationType type)52 Return<void> RadioIndication::simPhonebookChanged(V1_0::RadioIndicationType type) {
53 LOG_CALL << type;
54 simCb()->simPhonebookChanged(toAidl(type));
55 return {};
56 }
57
simPhonebookRecordsReceived(V1_0::RadioIndicationType type,V1_6::PbReceivedStatus status,const hidl_vec<V1_6::PhonebookRecordInfo> & rec)58 Return<void> RadioIndication::simPhonebookRecordsReceived(
59 V1_0::RadioIndicationType type, V1_6::PbReceivedStatus status,
60 const hidl_vec<V1_6::PhonebookRecordInfo>& rec) {
61 LOG_CALL << type;
62 simCb()->simPhonebookRecordsReceived(toAidl(type), aidl::PbReceivedStatus(status), toAidl(rec));
63 return {};
64 }
65
simRefresh(V1_0::RadioIndicationType type,const V1_0::SimRefreshResult & refreshResult)66 Return<void> RadioIndication::simRefresh(V1_0::RadioIndicationType type,
67 const V1_0::SimRefreshResult& refreshResult) {
68 LOG_CALL << type;
69 simCb()->simRefresh(toAidl(type), toAidl(refreshResult));
70 return {};
71 }
72
simStatusChanged(V1_0::RadioIndicationType type)73 Return<void> RadioIndication::simStatusChanged(V1_0::RadioIndicationType type) {
74 LOG_CALL << type;
75 simCb()->simStatusChanged(toAidl(type));
76 return {};
77 }
78
stkEventNotify(V1_0::RadioIndicationType type,const hidl_string & cmd)79 Return<void> RadioIndication::stkEventNotify(V1_0::RadioIndicationType type,
80 const hidl_string& cmd) {
81 LOG_CALL << type;
82 simCb()->stkEventNotify(toAidl(type), cmd);
83 return {};
84 }
85
stkProactiveCommand(V1_0::RadioIndicationType type,const hidl_string & cmd)86 Return<void> RadioIndication::stkProactiveCommand(V1_0::RadioIndicationType type,
87 const hidl_string& cmd) {
88 LOG_CALL << type;
89 simCb()->stkProactiveCommand(toAidl(type), cmd);
90 return {};
91 }
92
stkSessionEnd(V1_0::RadioIndicationType type)93 Return<void> RadioIndication::stkSessionEnd(V1_0::RadioIndicationType type) {
94 LOG_CALL << type;
95 simCb()->stkSessionEnd(toAidl(type));
96 return {};
97 }
98
subscriptionStatusChanged(V1_0::RadioIndicationType type,bool activate)99 Return<void> RadioIndication::subscriptionStatusChanged(V1_0::RadioIndicationType type,
100 bool activate) {
101 LOG_CALL << type;
102 simCb()->subscriptionStatusChanged(toAidl(type), activate);
103 return {};
104 }
105
uiccApplicationsEnablementChanged(V1_0::RadioIndicationType type,bool enabled)106 Return<void> RadioIndication::uiccApplicationsEnablementChanged(V1_0::RadioIndicationType type,
107 bool enabled) {
108 LOG_CALL << type;
109 simCb()->uiccApplicationsEnablementChanged(toAidl(type), enabled);
110 return {};
111 }
112
113 } // namespace android::hardware::radio::compat
114