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/RadioResponse.h> |
| 18 | |
| 19 | #include "commonStructs.h" |
| 20 | #include "debug.h" |
| 21 | #include "structs.h" |
| 22 | |
| 23 | #include "collections.h" |
| 24 | |
| 25 | #define RADIO_MODULE "DataResponse" |
| 26 | |
| 27 | namespace android::hardware::radio::compat { |
| 28 | |
| 29 | namespace aidl = ::aidl::android::hardware::radio::data; |
| 30 | |
| 31 | void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioDataResponse> dataCb) { |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 32 | mDataCb = dataCb; |
| 33 | } |
| 34 | |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 35 | std::shared_ptr<aidl::IRadioDataResponse> RadioResponse::dataCb() { |
| 36 | return mDataCb.get(); |
| 37 | } |
| 38 | |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 39 | Return<void> RadioResponse::allocatePduSessionIdResponse(const V1_6::RadioResponseInfo& info, |
| 40 | int32_t id) { |
| 41 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 42 | dataCb()->allocatePduSessionIdResponse(toAidl(info), id); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 43 | return {}; |
| 44 | } |
| 45 | |
| 46 | Return<void> RadioResponse::cancelHandoverResponse(const V1_6::RadioResponseInfo& info) { |
| 47 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 48 | dataCb()->cancelHandoverResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 49 | return {}; |
| 50 | } |
| 51 | |
| 52 | Return<void> RadioResponse::deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) { |
| 53 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 54 | dataCb()->deactivateDataCallResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 55 | return {}; |
| 56 | } |
| 57 | |
| 58 | Return<void> RadioResponse::getDataCallListResponse(const V1_0::RadioResponseInfo& info, |
| 59 | const hidl_vec<V1_0::SetupDataCallResult>&) { |
| 60 | LOG_CALL << info.serial; |
| 61 | LOG(ERROR) << "IRadio HAL 1.0 not supported"; |
| 62 | return {}; |
| 63 | } |
| 64 | |
| 65 | Return<void> RadioResponse::getDataCallListResponse_1_4( |
| 66 | const V1_0::RadioResponseInfo& info, const hidl_vec<V1_4::SetupDataCallResult>&) { |
| 67 | LOG_CALL << info.serial; |
| 68 | LOG(ERROR) << "IRadio HAL 1.4 not supported"; |
| 69 | return {}; |
| 70 | } |
| 71 | |
| 72 | Return<void> RadioResponse::getDataCallListResponse_1_5( |
| 73 | const V1_0::RadioResponseInfo& info, |
| 74 | const hidl_vec<V1_5::SetupDataCallResult>& dcResponse) { |
| 75 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 76 | dataCb()->getDataCallListResponse(toAidl(info), toAidl(dcResponse)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 77 | return {}; |
| 78 | } |
| 79 | |
| 80 | Return<void> RadioResponse::getDataCallListResponse_1_6( |
| 81 | const V1_6::RadioResponseInfo& info, |
| 82 | const hidl_vec<V1_6::SetupDataCallResult>& dcResponse) { |
| 83 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 84 | dataCb()->getDataCallListResponse(toAidl(info), toAidl(dcResponse)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 85 | return {}; |
| 86 | } |
| 87 | |
| 88 | Return<void> RadioResponse::getSlicingConfigResponse(const V1_6::RadioResponseInfo& info, |
| 89 | const V1_6::SlicingConfig& slicingConfig) { |
| 90 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 91 | dataCb()->getSlicingConfigResponse(toAidl(info), toAidl(slicingConfig)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 92 | return {}; |
| 93 | } |
| 94 | |
| 95 | Return<void> RadioResponse::releasePduSessionIdResponse(const V1_6::RadioResponseInfo& info) { |
| 96 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 97 | dataCb()->releasePduSessionIdResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 98 | return {}; |
| 99 | } |
| 100 | |
| 101 | Return<void> RadioResponse::setDataAllowedResponse(const V1_0::RadioResponseInfo& info) { |
| 102 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 103 | dataCb()->setDataAllowedResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 104 | return {}; |
| 105 | } |
| 106 | |
| 107 | Return<void> RadioResponse::setDataProfileResponse(const V1_0::RadioResponseInfo& info) { |
| 108 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 109 | dataCb()->setDataProfileResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 110 | return {}; |
| 111 | } |
| 112 | |
| 113 | Return<void> RadioResponse::setDataProfileResponse_1_5(const V1_0::RadioResponseInfo& info) { |
| 114 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 115 | dataCb()->setDataProfileResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 116 | return {}; |
| 117 | } |
| 118 | |
| 119 | Return<void> RadioResponse::setDataThrottlingResponse(const V1_6::RadioResponseInfo& info) { |
| 120 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 121 | dataCb()->setDataThrottlingResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 122 | return {}; |
| 123 | } |
| 124 | |
| 125 | Return<void> RadioResponse::setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) { |
| 126 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 127 | dataCb()->setInitialAttachApnResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 128 | return {}; |
| 129 | } |
| 130 | |
| 131 | Return<void> RadioResponse::setInitialAttachApnResponse_1_5(const V1_0::RadioResponseInfo& info) { |
| 132 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 133 | dataCb()->setInitialAttachApnResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 134 | return {}; |
| 135 | } |
| 136 | |
| 137 | Return<void> RadioResponse::setupDataCallResponse(const V1_0::RadioResponseInfo& info, |
| 138 | const V1_0::SetupDataCallResult&) { |
| 139 | LOG_CALL << info.serial; |
| 140 | LOG(ERROR) << "IRadio HAL 1.0 not supported"; |
| 141 | return {}; |
| 142 | } |
| 143 | |
| 144 | Return<void> RadioResponse::setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info, |
| 145 | const V1_4::SetupDataCallResult&) { |
| 146 | LOG_CALL << info.serial; |
| 147 | LOG(ERROR) << "IRadio HAL 1.0 not supported"; |
| 148 | return {}; |
| 149 | } |
| 150 | |
| 151 | Return<void> RadioResponse::setupDataCallResponse_1_5(const V1_0::RadioResponseInfo& info, |
| 152 | const V1_5::SetupDataCallResult& dcResponse) { |
| 153 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 154 | dataCb()->setupDataCallResponse(toAidl(info), toAidl(dcResponse)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 155 | return {}; |
| 156 | } |
| 157 | |
| 158 | Return<void> RadioResponse::setupDataCallResponse_1_6(const V1_6::RadioResponseInfo& info, |
| 159 | const V1_6::SetupDataCallResult& dcResponse) { |
| 160 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 161 | dataCb()->setupDataCallResponse(toAidl(info), toAidl(dcResponse)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 162 | return {}; |
| 163 | } |
| 164 | |
| 165 | Return<void> RadioResponse::startHandoverResponse(const V1_6::RadioResponseInfo& info) { |
| 166 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 167 | dataCb()->startHandoverResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 168 | return {}; |
| 169 | } |
| 170 | |
| 171 | Return<void> RadioResponse::startKeepaliveResponse(const V1_0::RadioResponseInfo& info, |
| 172 | const V1_1::KeepaliveStatus& status) { |
| 173 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 174 | dataCb()->startKeepaliveResponse(toAidl(info), toAidl(status)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 175 | return {}; |
| 176 | } |
| 177 | |
| 178 | Return<void> RadioResponse::stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) { |
| 179 | LOG_CALL << info.serial; |
Tomasz Wasilczyk | 6063857 | 2021-12-13 17:13:48 -0800 | [diff] [blame] | 180 | dataCb()->stopKeepaliveResponse(toAidl(info)); |
Tomasz Wasilczyk | 0716169 | 2021-11-02 12:14:52 -0700 | [diff] [blame] | 181 | return {}; |
| 182 | } |
| 183 | |
| 184 | } // namespace android::hardware::radio::compat |