blob: eb87828dde2eea320ea3b34affbe64d98a4f2221 [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) {
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070030 mMessagingCb = rmiCb;
31}
32
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080033std::shared_ptr<aidl::IRadioMessagingIndication> RadioIndication::messagingCb() {
34 return mMessagingCb.get();
35}
36
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070037Return<void> RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type,
38 const V1_0::CdmaSmsMessage& msg) {
39 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080040 messagingCb()->cdmaNewSms(toAidl(type), toAidl(msg));
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070041 return {};
42}
43
44Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) {
45 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080046 messagingCb()->cdmaRuimSmsStorageFull(toAidl(type));
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070047 return {};
48}
49
50Return<void> RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type,
51 const hidl_vec<uint8_t>& data) {
52 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080053 messagingCb()->newBroadcastSms(toAidl(type), data);
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070054 return {};
55}
56
57Return<void> RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) {
58 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080059 messagingCb()->newSms(toAidl(type), pdu);
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070060 return {};
61}
62
63Return<void> RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) {
64 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080065 messagingCb()->newSmsOnSim(toAidl(type), recordNumber);
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070066 return {};
67}
68
69Return<void> RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type,
70 const hidl_vec<uint8_t>& pdu) {
71 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080072 messagingCb()->newSmsStatusReport(toAidl(type), pdu);
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070073 return {};
74}
75
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070076Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) {
77 LOG_CALL << type;
Tomasz Wasilczyk6902a752021-12-13 17:13:48 -080078 messagingCb()->simSmsStorageFull(toAidl(type));
Tomasz Wasilczyk1f16d3a2021-10-25 20:20:49 -070079 return {};
80}
81
82} // namespace android::hardware::radio::compat