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 #define RADIO_MODULE "MessagingIndication"
24
25 namespace android::hardware::radio::compat {
26
27 namespace aidl = ::aidl::android::hardware::radio::messaging;
28
setResponseFunction(std::shared_ptr<aidl::IRadioMessagingIndication> rmiCb)29 void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingIndication> rmiCb) {
30 mMessagingCb = rmiCb;
31 }
32
messagingCb()33 std::shared_ptr<aidl::IRadioMessagingIndication> RadioIndication::messagingCb() {
34 return mMessagingCb.get();
35 }
36
cdmaNewSms(V1_0::RadioIndicationType type,const V1_0::CdmaSmsMessage & msg)37 Return<void> RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type,
38 const V1_0::CdmaSmsMessage& msg) {
39 LOG_CALL << type;
40 messagingCb()->cdmaNewSms(toAidl(type), toAidl(msg));
41 return {};
42 }
43
cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type)44 Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) {
45 LOG_CALL << type;
46 messagingCb()->cdmaRuimSmsStorageFull(toAidl(type));
47 return {};
48 }
49
newBroadcastSms(V1_0::RadioIndicationType type,const hidl_vec<uint8_t> & data)50 Return<void> RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type,
51 const hidl_vec<uint8_t>& data) {
52 LOG_CALL << type;
53 messagingCb()->newBroadcastSms(toAidl(type), data);
54 return {};
55 }
56
newSms(V1_0::RadioIndicationType type,const hidl_vec<uint8_t> & pdu)57 Return<void> RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) {
58 LOG_CALL << type;
59 messagingCb()->newSms(toAidl(type), pdu);
60 return {};
61 }
62
newSmsOnSim(V1_0::RadioIndicationType type,int32_t recordNumber)63 Return<void> RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) {
64 LOG_CALL << type;
65 messagingCb()->newSmsOnSim(toAidl(type), recordNumber);
66 return {};
67 }
68
newSmsStatusReport(V1_0::RadioIndicationType type,const hidl_vec<uint8_t> & pdu)69 Return<void> RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type,
70 const hidl_vec<uint8_t>& pdu) {
71 LOG_CALL << type;
72 messagingCb()->newSmsStatusReport(toAidl(type), pdu);
73 return {};
74 }
75
simSmsStorageFull(V1_0::RadioIndicationType type)76 Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) {
77 LOG_CALL << type;
78 messagingCb()->simSmsStorageFull(toAidl(type));
79 return {};
80 }
81
82 } // namespace android::hardware::radio::compat
83