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
setResponseFunction(std::shared_ptr<aidl::IRadioDataResponse> dataCb)31 void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioDataResponse> dataCb) {
32 mDataCb = dataCb;
33 }
34
dataCb()35 std::shared_ptr<aidl::IRadioDataResponse> RadioResponse::dataCb() {
36 return mDataCb.get();
37 }
38
allocatePduSessionIdResponse(const V1_6::RadioResponseInfo & info,int32_t id)39 Return<void> RadioResponse::allocatePduSessionIdResponse(const V1_6::RadioResponseInfo& info,
40 int32_t id) {
41 LOG_CALL << info.serial;
42 dataCb()->allocatePduSessionIdResponse(toAidl(info), id);
43 return {};
44 }
45
cancelHandoverResponse(const V1_6::RadioResponseInfo & info)46 Return<void> RadioResponse::cancelHandoverResponse(const V1_6::RadioResponseInfo& info) {
47 LOG_CALL << info.serial;
48 dataCb()->cancelHandoverResponse(toAidl(info));
49 return {};
50 }
51
deactivateDataCallResponse(const V1_0::RadioResponseInfo & info)52 Return<void> RadioResponse::deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) {
53 LOG_CALL << info.serial;
54 dataCb()->deactivateDataCallResponse(toAidl(info));
55 return {};
56 }
57
getDataCallListResponse(const V1_0::RadioResponseInfo & info,const hidl_vec<V1_0::SetupDataCallResult> &)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
getDataCallListResponse_1_4(const V1_0::RadioResponseInfo & info,const hidl_vec<V1_4::SetupDataCallResult> &)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
getDataCallListResponse_1_5(const V1_0::RadioResponseInfo & info,const hidl_vec<V1_5::SetupDataCallResult> & dcResponse)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 dataCb()->getDataCallListResponse(toAidl(info), toAidl(dcResponse));
77 return {};
78 }
79
getDataCallListResponse_1_6(const V1_6::RadioResponseInfo & info,const hidl_vec<V1_6::SetupDataCallResult> & dcResponse)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;
84 dataCb()->getDataCallListResponse(toAidl(info), toAidl(dcResponse));
85 return {};
86 }
87
getSlicingConfigResponse(const V1_6::RadioResponseInfo & info,const V1_6::SlicingConfig & slicingConfig)88 Return<void> RadioResponse::getSlicingConfigResponse(const V1_6::RadioResponseInfo& info,
89 const V1_6::SlicingConfig& slicingConfig) {
90 LOG_CALL << info.serial;
91 dataCb()->getSlicingConfigResponse(toAidl(info), toAidl(slicingConfig));
92 return {};
93 }
94
releasePduSessionIdResponse(const V1_6::RadioResponseInfo & info)95 Return<void> RadioResponse::releasePduSessionIdResponse(const V1_6::RadioResponseInfo& info) {
96 LOG_CALL << info.serial;
97 dataCb()->releasePduSessionIdResponse(toAidl(info));
98 return {};
99 }
100
setDataAllowedResponse(const V1_0::RadioResponseInfo & info)101 Return<void> RadioResponse::setDataAllowedResponse(const V1_0::RadioResponseInfo& info) {
102 LOG_CALL << info.serial;
103 dataCb()->setDataAllowedResponse(toAidl(info));
104 return {};
105 }
106
setDataProfileResponse(const V1_0::RadioResponseInfo & info)107 Return<void> RadioResponse::setDataProfileResponse(const V1_0::RadioResponseInfo& info) {
108 LOG_CALL << info.serial;
109 dataCb()->setDataProfileResponse(toAidl(info));
110 return {};
111 }
112
setDataProfileResponse_1_5(const V1_0::RadioResponseInfo & info)113 Return<void> RadioResponse::setDataProfileResponse_1_5(const V1_0::RadioResponseInfo& info) {
114 LOG_CALL << info.serial;
115 dataCb()->setDataProfileResponse(toAidl(info));
116 return {};
117 }
118
setDataThrottlingResponse(const V1_6::RadioResponseInfo & info)119 Return<void> RadioResponse::setDataThrottlingResponse(const V1_6::RadioResponseInfo& info) {
120 LOG_CALL << info.serial;
121 dataCb()->setDataThrottlingResponse(toAidl(info));
122 return {};
123 }
124
setInitialAttachApnResponse(const V1_0::RadioResponseInfo & info)125 Return<void> RadioResponse::setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) {
126 LOG_CALL << info.serial;
127 dataCb()->setInitialAttachApnResponse(toAidl(info));
128 return {};
129 }
130
setInitialAttachApnResponse_1_5(const V1_0::RadioResponseInfo & info)131 Return<void> RadioResponse::setInitialAttachApnResponse_1_5(const V1_0::RadioResponseInfo& info) {
132 LOG_CALL << info.serial;
133 dataCb()->setInitialAttachApnResponse(toAidl(info));
134 return {};
135 }
136
setupDataCallResponse(const V1_0::RadioResponseInfo & info,const V1_0::SetupDataCallResult &)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
setupDataCallResponse_1_4(const V1_0::RadioResponseInfo & info,const V1_4::SetupDataCallResult &)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
setupDataCallResponse_1_5(const V1_0::RadioResponseInfo & info,const V1_5::SetupDataCallResult & dcResponse)151 Return<void> RadioResponse::setupDataCallResponse_1_5(const V1_0::RadioResponseInfo& info,
152 const V1_5::SetupDataCallResult& dcResponse) {
153 LOG_CALL << info.serial;
154 dataCb()->setupDataCallResponse(toAidl(info), toAidl(dcResponse));
155 return {};
156 }
157
setupDataCallResponse_1_6(const V1_6::RadioResponseInfo & info,const V1_6::SetupDataCallResult & dcResponse)158 Return<void> RadioResponse::setupDataCallResponse_1_6(const V1_6::RadioResponseInfo& info,
159 const V1_6::SetupDataCallResult& dcResponse) {
160 LOG_CALL << info.serial;
161 dataCb()->setupDataCallResponse(toAidl(info), toAidl(dcResponse));
162 return {};
163 }
164
startHandoverResponse(const V1_6::RadioResponseInfo & info)165 Return<void> RadioResponse::startHandoverResponse(const V1_6::RadioResponseInfo& info) {
166 LOG_CALL << info.serial;
167 dataCb()->startHandoverResponse(toAidl(info));
168 return {};
169 }
170
startKeepaliveResponse(const V1_0::RadioResponseInfo & info,const V1_1::KeepaliveStatus & status)171 Return<void> RadioResponse::startKeepaliveResponse(const V1_0::RadioResponseInfo& info,
172 const V1_1::KeepaliveStatus& status) {
173 LOG_CALL << info.serial;
174 dataCb()->startKeepaliveResponse(toAidl(info), toAidl(status));
175 return {};
176 }
177
stopKeepaliveResponse(const V1_0::RadioResponseInfo & info)178 Return<void> RadioResponse::stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) {
179 LOG_CALL << info.serial;
180 dataCb()->stopKeepaliveResponse(toAidl(info));
181 return {};
182 }
183
184 } // namespace android::hardware::radio::compat
185