blob: c7342b1146bb5b8d51e38edbf4524cce6998609a [file] [log] [blame]
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -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#define RADIO_MODULE "MessagingIndication"
24
25namespace android::hardware::radio::compat {
26
27namespace aidl = ::aidl::android::hardware::radio::messaging;
28
29void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingIndication> rmiCb) {
30 CHECK(rmiCb);
31 mMessagingCb = rmiCb;
32}
33
34Return<void> RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type,
35 const V1_0::CdmaSmsMessage& msg) {
36 LOG_CALL << type;
37 CHECK_CB(mMessagingCb);
38 mMessagingCb->cdmaNewSms(toAidl(type), toAidl(msg));
39 return {};
40}
41
42Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) {
43 LOG_CALL << type;
44 CHECK_CB(mMessagingCb);
45 mMessagingCb->cdmaRuimSmsStorageFull(toAidl(type));
46 return {};
47}
48
49Return<void> RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type,
50 const hidl_vec<uint8_t>& data) {
51 LOG_CALL << type;
52 CHECK_CB(mMessagingCb);
53 mMessagingCb->newBroadcastSms(toAidl(type), data);
54 return {};
55}
56
57Return<void> RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) {
58 LOG_CALL << type;
59 CHECK_CB(mMessagingCb);
60 mMessagingCb->newSms(toAidl(type), pdu);
61 return {};
62}
63
64Return<void> RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) {
65 LOG_CALL << type;
66 CHECK_CB(mMessagingCb);
67 mMessagingCb->newSmsOnSim(toAidl(type), recordNumber);
68 return {};
69}
70
71Return<void> RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type,
72 const hidl_vec<uint8_t>& pdu) {
73 LOG_CALL << type;
74 CHECK_CB(mMessagingCb);
75 mMessagingCb->newSmsStatusReport(toAidl(type), pdu);
76 return {};
77}
78
79Return<void> RadioIndication::onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
80 const hidl_string& msg) {
81 LOG_CALL << type;
82 CHECK_CB(mMessagingCb);
83 mMessagingCb->onUssd(toAidl(type), aidl::UssdModeType(modeType), msg);
84 return {};
85}
86
87Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) {
88 LOG_CALL << type;
89 CHECK_CB(mMessagingCb);
90 mMessagingCb->simSmsStorageFull(toAidl(type));
91 return {};
92}
93
94} // namespace android::hardware::radio::compat