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