Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -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 | #include "collections.h" |
| 24 | |
| 25 | #define RADIO_MODULE "DataIndication" |
| 26 | |
| 27 | namespace android::hardware::radio::compat { |
| 28 | |
| 29 | namespace aidl = ::aidl::android::hardware::radio::data; |
| 30 | |
| 31 | void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioDataIndication> dataCb) { |
| 32 | CHECK(dataCb); |
| 33 | mDataCb = dataCb; |
| 34 | } |
| 35 | |
| 36 | Return<void> RadioIndication::dataCallListChanged(V1_0::RadioIndicationType type, |
| 37 | const hidl_vec<V1_0::SetupDataCallResult>&) { |
| 38 | LOG_CALL << type; |
| 39 | LOG(ERROR) << "IRadio HAL 1.0 not supported"; |
| 40 | return {}; |
| 41 | } |
| 42 | |
| 43 | Return<void> RadioIndication::dataCallListChanged_1_4(V1_0::RadioIndicationType type, |
| 44 | const hidl_vec<V1_4::SetupDataCallResult>&) { |
| 45 | LOG_CALL << type; |
| 46 | LOG(ERROR) << "IRadio HAL 1.4 not supported"; |
| 47 | return {}; |
| 48 | } |
| 49 | |
| 50 | Return<void> RadioIndication::dataCallListChanged_1_5( |
| 51 | V1_0::RadioIndicationType type, const hidl_vec<V1_5::SetupDataCallResult>& dcList) { |
| 52 | LOG_CALL << type; |
| 53 | CHECK_CB(mDataCb); |
| 54 | mDataCb->dataCallListChanged(toAidl(type), toAidl(dcList)); |
| 55 | return {}; |
| 56 | } |
| 57 | |
| 58 | Return<void> RadioIndication::dataCallListChanged_1_6( |
| 59 | V1_0::RadioIndicationType type, const hidl_vec<V1_6::SetupDataCallResult>& dcList) { |
| 60 | LOG_CALL << type; |
| 61 | CHECK_CB(mDataCb); |
| 62 | mDataCb->dataCallListChanged(toAidl(type), toAidl(dcList)); |
| 63 | return {}; |
| 64 | } |
| 65 | |
| 66 | Return<void> RadioIndication::keepaliveStatus(V1_0::RadioIndicationType type, |
| 67 | const V1_1::KeepaliveStatus& status) { |
| 68 | LOG_CALL << type; |
| 69 | CHECK_CB(mDataCb); |
| 70 | mDataCb->keepaliveStatus(toAidl(type), toAidl(status)); |
| 71 | return {}; |
| 72 | } |
| 73 | |
| 74 | Return<void> RadioIndication::pcoData(V1_0::RadioIndicationType type, |
| 75 | const V1_0::PcoDataInfo& pco) { |
| 76 | LOG_CALL << type; |
| 77 | CHECK_CB(mDataCb); |
| 78 | mDataCb->pcoData(toAidl(type), toAidl(pco)); |
| 79 | return {}; |
| 80 | } |
| 81 | |
| 82 | Return<void> RadioIndication::unthrottleApn(V1_0::RadioIndicationType type, |
| 83 | const hidl_string& apn) { |
| 84 | LOG_CALL << type; |
| 85 | CHECK_CB(mDataCb); |
| 86 | mDataCb->unthrottleApn(toAidl(type), apn); |
| 87 | return {}; |
| 88 | } |
| 89 | |
| 90 | } // namespace android::hardware::radio::compat |