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) { |
| 32 | CHECK(dataCb); |
| 33 | mDataCb = dataCb; |
| 34 | } |
| 35 | |
| 36 | Return<void> RadioResponse::allocatePduSessionIdResponse(const V1_6::RadioResponseInfo& info, |
| 37 | int32_t id) { |
| 38 | LOG_CALL << info.serial; |
| 39 | CHECK_CB(mDataCb); |
| 40 | mDataCb->allocatePduSessionIdResponse(toAidl(info), id); |
| 41 | return {}; |
| 42 | } |
| 43 | |
| 44 | Return<void> RadioResponse::cancelHandoverResponse(const V1_6::RadioResponseInfo& info) { |
| 45 | LOG_CALL << info.serial; |
| 46 | CHECK_CB(mDataCb); |
| 47 | mDataCb->cancelHandoverResponse(toAidl(info)); |
| 48 | return {}; |
| 49 | } |
| 50 | |
| 51 | Return<void> RadioResponse::deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) { |
| 52 | LOG_CALL << info.serial; |
| 53 | CHECK_CB(mDataCb); |
| 54 | mDataCb->deactivateDataCallResponse(toAidl(info)); |
| 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; |
| 76 | CHECK_CB(mDataCb); |
| 77 | mDataCb->getDataCallListResponse(toAidl(info), toAidl(dcResponse)); |
| 78 | return {}; |
| 79 | } |
| 80 | |
| 81 | Return<void> RadioResponse::getDataCallListResponse_1_6( |
| 82 | const V1_6::RadioResponseInfo& info, |
| 83 | const hidl_vec<V1_6::SetupDataCallResult>& dcResponse) { |
| 84 | LOG_CALL << info.serial; |
| 85 | CHECK_CB(mDataCb); |
| 86 | mDataCb->getDataCallListResponse(toAidl(info), toAidl(dcResponse)); |
| 87 | return {}; |
| 88 | } |
| 89 | |
| 90 | Return<void> RadioResponse::getSlicingConfigResponse(const V1_6::RadioResponseInfo& info, |
| 91 | const V1_6::SlicingConfig& slicingConfig) { |
| 92 | LOG_CALL << info.serial; |
| 93 | CHECK_CB(mDataCb); |
| 94 | mDataCb->getSlicingConfigResponse(toAidl(info), toAidl(slicingConfig)); |
| 95 | return {}; |
| 96 | } |
| 97 | |
| 98 | Return<void> RadioResponse::releasePduSessionIdResponse(const V1_6::RadioResponseInfo& info) { |
| 99 | LOG_CALL << info.serial; |
| 100 | CHECK_CB(mDataCb); |
| 101 | mDataCb->releasePduSessionIdResponse(toAidl(info)); |
| 102 | return {}; |
| 103 | } |
| 104 | |
| 105 | Return<void> RadioResponse::setDataAllowedResponse(const V1_0::RadioResponseInfo& info) { |
| 106 | LOG_CALL << info.serial; |
| 107 | CHECK_CB(mDataCb); |
| 108 | mDataCb->setDataAllowedResponse(toAidl(info)); |
| 109 | return {}; |
| 110 | } |
| 111 | |
| 112 | Return<void> RadioResponse::setDataProfileResponse(const V1_0::RadioResponseInfo& info) { |
| 113 | LOG_CALL << info.serial; |
| 114 | CHECK_CB(mDataCb); |
| 115 | mDataCb->setDataProfileResponse(toAidl(info)); |
| 116 | return {}; |
| 117 | } |
| 118 | |
| 119 | Return<void> RadioResponse::setDataProfileResponse_1_5(const V1_0::RadioResponseInfo& info) { |
| 120 | LOG_CALL << info.serial; |
| 121 | CHECK_CB(mDataCb); |
| 122 | mDataCb->setDataProfileResponse(toAidl(info)); |
| 123 | return {}; |
| 124 | } |
| 125 | |
| 126 | Return<void> RadioResponse::setDataThrottlingResponse(const V1_6::RadioResponseInfo& info) { |
| 127 | LOG_CALL << info.serial; |
| 128 | CHECK_CB(mDataCb); |
| 129 | mDataCb->setDataThrottlingResponse(toAidl(info)); |
| 130 | return {}; |
| 131 | } |
| 132 | |
| 133 | Return<void> RadioResponse::setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) { |
| 134 | LOG_CALL << info.serial; |
| 135 | CHECK_CB(mDataCb); |
| 136 | mDataCb->setInitialAttachApnResponse(toAidl(info)); |
| 137 | return {}; |
| 138 | } |
| 139 | |
| 140 | Return<void> RadioResponse::setInitialAttachApnResponse_1_5(const V1_0::RadioResponseInfo& info) { |
| 141 | LOG_CALL << info.serial; |
| 142 | CHECK_CB(mDataCb); |
| 143 | mDataCb->setInitialAttachApnResponse(toAidl(info)); |
| 144 | return {}; |
| 145 | } |
| 146 | |
| 147 | Return<void> RadioResponse::setupDataCallResponse(const V1_0::RadioResponseInfo& info, |
| 148 | const V1_0::SetupDataCallResult&) { |
| 149 | LOG_CALL << info.serial; |
| 150 | LOG(ERROR) << "IRadio HAL 1.0 not supported"; |
| 151 | return {}; |
| 152 | } |
| 153 | |
| 154 | Return<void> RadioResponse::setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info, |
| 155 | const V1_4::SetupDataCallResult&) { |
| 156 | LOG_CALL << info.serial; |
| 157 | LOG(ERROR) << "IRadio HAL 1.0 not supported"; |
| 158 | return {}; |
| 159 | } |
| 160 | |
| 161 | Return<void> RadioResponse::setupDataCallResponse_1_5(const V1_0::RadioResponseInfo& info, |
| 162 | const V1_5::SetupDataCallResult& dcResponse) { |
| 163 | LOG_CALL << info.serial; |
| 164 | CHECK_CB(mDataCb); |
| 165 | mDataCb->setupDataCallResponse(toAidl(info), toAidl(dcResponse)); |
| 166 | return {}; |
| 167 | } |
| 168 | |
| 169 | Return<void> RadioResponse::setupDataCallResponse_1_6(const V1_6::RadioResponseInfo& info, |
| 170 | const V1_6::SetupDataCallResult& dcResponse) { |
| 171 | LOG_CALL << info.serial; |
| 172 | CHECK_CB(mDataCb); |
| 173 | mDataCb->setupDataCallResponse(toAidl(info), toAidl(dcResponse)); |
| 174 | return {}; |
| 175 | } |
| 176 | |
| 177 | Return<void> RadioResponse::startHandoverResponse(const V1_6::RadioResponseInfo& info) { |
| 178 | LOG_CALL << info.serial; |
| 179 | CHECK_CB(mDataCb); |
| 180 | mDataCb->startHandoverResponse(toAidl(info)); |
| 181 | return {}; |
| 182 | } |
| 183 | |
| 184 | Return<void> RadioResponse::startKeepaliveResponse(const V1_0::RadioResponseInfo& info, |
| 185 | const V1_1::KeepaliveStatus& status) { |
| 186 | LOG_CALL << info.serial; |
| 187 | CHECK_CB(mDataCb); |
| 188 | mDataCb->startKeepaliveResponse(toAidl(info), toAidl(status)); |
| 189 | return {}; |
| 190 | } |
| 191 | |
| 192 | Return<void> RadioResponse::stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) { |
| 193 | LOG_CALL << info.serial; |
| 194 | CHECK_CB(mDataCb); |
| 195 | mDataCb->stopKeepaliveResponse(toAidl(info)); |
| 196 | return {}; |
| 197 | } |
| 198 | |
| 199 | } // namespace android::hardware::radio::compat |