blob: 3938e004d366bf42f30fcb71dc03fc9b4c06cf8d [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) {
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070032 mSimCb = simCb;
33}
34
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080035std::shared_ptr<aidl::IRadioSimIndication> RadioIndication::simCb() {
36 return mSimCb.get();
37}
38
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070039Return<void> RadioIndication::carrierInfoForImsiEncryption(V1_0::RadioIndicationType type) {
40 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080041 simCb()->carrierInfoForImsiEncryption(toAidl(type));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070042 return {};
43}
44
45Return<void> RadioIndication::cdmaSubscriptionSourceChanged(
46 V1_0::RadioIndicationType type, V1_0::CdmaSubscriptionSource cdmaSource) {
47 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080048 simCb()->cdmaSubscriptionSourceChanged(toAidl(type), aidl::CdmaSubscriptionSource(cdmaSource));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070049 return {};
50}
51
52Return<void> RadioIndication::simPhonebookChanged(V1_0::RadioIndicationType type) {
53 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080054 simCb()->simPhonebookChanged(toAidl(type));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070055 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;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080062 simCb()->simPhonebookRecordsReceived(toAidl(type), aidl::PbReceivedStatus(status), toAidl(rec));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070063 return {};
64}
65
66Return<void> RadioIndication::simRefresh(V1_0::RadioIndicationType type,
67 const V1_0::SimRefreshResult& refreshResult) {
68 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080069 simCb()->simRefresh(toAidl(type), toAidl(refreshResult));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070070 return {};
71}
72
73Return<void> RadioIndication::simStatusChanged(V1_0::RadioIndicationType type) {
74 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080075 simCb()->simStatusChanged(toAidl(type));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070076 return {};
77}
78
79Return<void> RadioIndication::stkEventNotify(V1_0::RadioIndicationType type,
80 const hidl_string& cmd) {
81 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080082 simCb()->stkEventNotify(toAidl(type), cmd);
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070083 return {};
84}
85
86Return<void> RadioIndication::stkProactiveCommand(V1_0::RadioIndicationType type,
87 const hidl_string& cmd) {
88 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080089 simCb()->stkProactiveCommand(toAidl(type), cmd);
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070090 return {};
91}
92
93Return<void> RadioIndication::stkSessionEnd(V1_0::RadioIndicationType type) {
94 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080095 simCb()->stkSessionEnd(toAidl(type));
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -070096 return {};
97}
98
99Return<void> RadioIndication::subscriptionStatusChanged(V1_0::RadioIndicationType type,
100 bool activate) {
101 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800102 simCb()->subscriptionStatusChanged(toAidl(type), activate);
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -0700103 return {};
104}
105
106Return<void> RadioIndication::uiccApplicationsEnablementChanged(V1_0::RadioIndicationType type,
107 bool enabled) {
108 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -0800109 simCb()->uiccApplicationsEnablementChanged(toAidl(type), enabled);
Tomasz Wasilczyk7f51a9a2021-10-28 13:22:47 -0700110 return {};
111}
112
113} // namespace android::hardware::radio::compat