Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 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 | |
| 29 | void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingIndication> rmiCb) { |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 30 | mMessagingCb = rmiCb; |
| 31 | } |
| 32 | |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 33 | std::shared_ptr<aidl::IRadioMessagingIndication> RadioIndication::messagingCb() { |
| 34 | return mMessagingCb.get(); |
| 35 | } |
| 36 | |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 37 | Return<void> RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type, |
| 38 | const V1_0::CdmaSmsMessage& msg) { |
| 39 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 40 | messagingCb()->cdmaNewSms(toAidl(type), toAidl(msg)); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 41 | return {}; |
| 42 | } |
| 43 | |
| 44 | Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) { |
| 45 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 46 | messagingCb()->cdmaRuimSmsStorageFull(toAidl(type)); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 47 | return {}; |
| 48 | } |
| 49 | |
| 50 | Return<void> RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type, |
| 51 | const hidl_vec<uint8_t>& data) { |
| 52 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 53 | messagingCb()->newBroadcastSms(toAidl(type), data); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 54 | return {}; |
| 55 | } |
| 56 | |
| 57 | Return<void> RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) { |
| 58 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 59 | messagingCb()->newSms(toAidl(type), pdu); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 60 | return {}; |
| 61 | } |
| 62 | |
| 63 | Return<void> RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) { |
| 64 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 65 | messagingCb()->newSmsOnSim(toAidl(type), recordNumber); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 66 | return {}; |
| 67 | } |
| 68 | |
| 69 | Return<void> RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type, |
| 70 | const hidl_vec<uint8_t>& pdu) { |
| 71 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 72 | messagingCb()->newSmsStatusReport(toAidl(type), pdu); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 73 | return {}; |
| 74 | } |
| 75 | |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 76 | Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) { |
| 77 | LOG_CALL << type; |
Tomasz Wasilczyk | 6902a75 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 78 | messagingCb()->simSmsStorageFull(toAidl(type)); |
Tomasz Wasilczyk | 1f16d3a | 2021-10-25 20:20:49 -0700 | [diff] [blame] | 79 | return {}; |
| 80 | } |
| 81 | |
| 82 | } // namespace android::hardware::radio::compat |