• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "hril_data.h"
17 
18 #include "hril_notification.h"
19 #include "hril_request.h"
20 
21 namespace OHOS {
22 namespace Telephony {
HRilData(int32_t slotId,IHRilReporter & hrilReporter)23 HRilData::HRilData(int32_t slotId, IHRilReporter &hrilReporter) : HRilBase(slotId, hrilReporter)
24 {
25     AddHandlerToMap();
26 }
27 
~HRilData()28 HRilData::~HRilData()
29 {
30     dataFuncs_ = nullptr;
31 }
32 
IsDataResponse(uint32_t code)33 bool HRilData::IsDataResponse(uint32_t code)
34 {
35     return ((code >= HREQ_DATA_BASE) && (code < HREQ_NETWORK_BASE));
36 }
37 
IsDataNotification(uint32_t code)38 bool HRilData::IsDataNotification(uint32_t code)
39 {
40     return ((code >= HNOTI_DATA_BASE) && (code < HNOTI_NETWORK_BASE));
41 }
42 
IsDataRespOrNotify(uint32_t code)43 bool HRilData::IsDataRespOrNotify(uint32_t code)
44 {
45     return IsDataResponse(code) || IsDataNotification(code);
46 }
47 
AddHandlerToMap()48 void HRilData::AddHandlerToMap()
49 {
50     // Notification
51     notiMemberFuncMap_[HNOTI_DATA_PDP_CONTEXT_LIST_UPDATED] = &HRilData::PdpContextListUpdated;
52     notiMemberFuncMap_[HNOTI_DATA_LINK_CAPABILITY_UPDATED] = &HRilData::DataLinkCapabilityUpdated;
53     // response
54     respMemberFuncMap_[HREQ_DATA_SET_INIT_APN_INFO] = &HRilData::SetInitApnInfoResponse;
55     respMemberFuncMap_[HREQ_DATA_SET_DATA_PROFILE_INFO] = &HRilData::SetDataProfileInfoResponse;
56     respMemberFuncMap_[HREQ_DATA_ACTIVATE_PDP_CONTEXT] = &HRilData::ActivatePdpContextResponse;
57     respMemberFuncMap_[HREQ_DATA_DEACTIVATE_PDP_CONTEXT] = &HRilData::DeactivatePdpContextResponse;
58     respMemberFuncMap_[HREQ_DATA_GET_PDP_CONTEXT_LIST] = &HRilData::GetPdpContextListResponse;
59     respMemberFuncMap_[HREQ_DATA_GET_LINK_BANDWIDTH_INFO] = &HRilData::GetLinkBandwidthInfoResponse;
60     respMemberFuncMap_[HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE] = &HRilData::SetLinkBandwidthReportingRuleResponse;
61     respMemberFuncMap_[HREQ_DATA_SET_DATA_PERMITTED] = &HRilData::SetDataPermittedResponse;
62     respMemberFuncMap_[HREQ_DATA_GET_LINK_CAPABILITY] = &HRilData::GetLinkCapabilityResponse;
63 }
64 
SwitchRilDataToHal(const HRilDataCallResponse * response,HDI::Ril::V1_1::SetupDataCallResultInfo & result)65 void HRilData::SwitchRilDataToHal(const HRilDataCallResponse *response, HDI::Ril::V1_1::SetupDataCallResultInfo &result)
66 {
67     if (response == nullptr) {
68         TELEPHONY_LOGE("SwitchRilDataToHal response is null!!!");
69         return;
70     }
71     result.active = response->active;
72     result.reason = response->reason;
73     result.retryTime = response->retryTime;
74     result.cid = response->cid;
75     result.pduSessionId = response->pduSessionId;
76     result.maxTransferUnit = response->maxTransferUnit;
77     result.address = (response->address == nullptr) ? "" : response->address;
78     result.type = (response->type == nullptr) ? "" : response->type;
79     result.dns = (response->dns == nullptr) ? "" : response->dns;
80     result.dnsSec = (response->dnsSec == nullptr) ? "" : response->dnsSec;
81     result.netPortName = (response->netPortName == nullptr) ? "" : response->netPortName;
82     result.gateway = (response->gateway == nullptr) ? "" : response->gateway;
83     result.pCscfPrimAddr = (response->pCscfPrimAddr == nullptr) ? "" : response->pCscfPrimAddr;
84     result.pCscfSecAddr = (response->pCscfSecAddr == nullptr) ? "" : response->pCscfSecAddr;
85 }
86 
SwitchHRilDataListToHal(const void * response,size_t responseLen,std::vector<HDI::Ril::V1_1::SetupDataCallResultInfo> & dcResultList)87 void HRilData::SwitchHRilDataListToHal(
88     const void *response, size_t responseLen, std::vector<HDI::Ril::V1_1::SetupDataCallResultInfo> &dcResultList)
89 {
90     if (response == nullptr) {
91         TELEPHONY_LOGE("SwitchHRilDataListToHal response is null!!!");
92         return;
93     }
94     size_t dataNum = responseLen / sizeof(HRilDataCallResponse);
95     const HRilDataCallResponse *dataCallResponse = (const HRilDataCallResponse *)response;
96     dcResultList.resize(dataNum);
97 
98     size_t i = 0;
99     while (i < dataNum) {
100         SwitchRilDataToHal(&dataCallResponse[i], dcResultList[i]);
101         i++;
102     }
103 }
104 
DeactivatePdpContext(int32_t serialId,const OHOS::HDI::Ril::V1_1::UniInfo & uniInfo)105 int32_t HRilData::DeactivatePdpContext(int32_t serialId, const OHOS::HDI::Ril::V1_1::UniInfo &uniInfo)
106 {
107     HRilDataInfo dataInfo = {};
108     dataInfo.cid = uniInfo.gsmIndex;
109     dataInfo.reason = uniInfo.arg1;
110     return RequestVendor(
111         serialId, HREQ_DATA_DEACTIVATE_PDP_CONTEXT, dataFuncs_, &HRilDataReq::DeactivatePdpContext, &dataInfo);
112 }
113 
ActivatePdpContext(int32_t serialId,const OHOS::HDI::Ril::V1_1::DataCallInfo & dataCallInfo)114 int32_t HRilData::ActivatePdpContext(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataCallInfo &dataCallInfo)
115 {
116     HRilDataInfo dataInfo;
117     dataInfo.apn = StringToCString(dataCallInfo.dataProfileInfo.apn);
118     dataInfo.type = StringToCString(dataCallInfo.dataProfileInfo.protocol);
119     dataInfo.roamingType = StringToCString(dataCallInfo.dataProfileInfo.roamingProtocol);
120     dataInfo.userName = StringToCString(dataCallInfo.dataProfileInfo.userName);
121     dataInfo.password = StringToCString(dataCallInfo.dataProfileInfo.password);
122     dataInfo.verType = dataCallInfo.dataProfileInfo.authenticationType;
123     dataInfo.rat = dataCallInfo.radioTechnology;
124     dataInfo.roamingEnable = dataCallInfo.roamingAllowed ? 1 : 0;
125     return RequestVendor(
126         serialId, HREQ_DATA_ACTIVATE_PDP_CONTEXT, dataFuncs_, &HRilDataReq::ActivatePdpContext, &dataInfo);
127 }
128 
GetPdpContextList(int32_t serialId,const OHOS::HDI::Ril::V1_1::UniInfo & uniInfo)129 int32_t HRilData::GetPdpContextList(int32_t serialId, const OHOS::HDI::Ril::V1_1::UniInfo &uniInfo)
130 {
131     TELEPHONY_LOGD("serial %{public}d on %{public}d", uniInfo.serial, uniInfo.flag);
132     return RequestVendor(serialId, HREQ_DATA_GET_PDP_CONTEXT_LIST, dataFuncs_, &HRilDataReq::GetPdpContextList);
133 }
134 
SetInitApnInfo(int32_t serialId,const OHOS::HDI::Ril::V1_1::DataProfileDataInfo & dataProfileDataInfo)135 int32_t HRilData::SetInitApnInfo(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataProfileDataInfo &dataProfileDataInfo)
136 {
137     HRilDataInfo dataInfo = BuildDataInfo(dataProfileDataInfo);
138     return RequestVendor(serialId, HREQ_DATA_SET_INIT_APN_INFO, dataFuncs_, &HRilDataReq::SetInitApnInfo, &dataInfo);
139 }
140 
SendDataPerformanceMode(int32_t serialId,const OHOS::HDI::Ril::V1_1::DataPerformanceInfo & dataPerformanceInfo)141 int32_t HRilData::SendDataPerformanceMode(
142     int32_t serialId, const OHOS::HDI::Ril::V1_1::DataPerformanceInfo &dataPerformanceInfo)
143 {
144     HRilDataPerformanceInfo hrilDataPerformanceInfo;
145     hrilDataPerformanceInfo.performanceEnable = dataPerformanceInfo.performanceEnable;
146     hrilDataPerformanceInfo.enforce = dataPerformanceInfo.enforce;
147     TELEPHONY_LOGI("SendDataPerformanceMode: performanceEnable=%{public}d enforce=%{public}d",
148         hrilDataPerformanceInfo.performanceEnable, hrilDataPerformanceInfo.enforce);
149     return RequestVendor(serialId, HREQ_DATA_SEND_DATA_PERFORMANCE_MODE, dataFuncs_,
150         &HRilDataReq::SendDataPerformanceMode, &hrilDataPerformanceInfo);
151 }
152 
SendDataSleepMode(int32_t serialId,const OHOS::HDI::Ril::V1_1::DataSleepInfo & dataSleepInfo)153 int32_t HRilData::SendDataSleepMode(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataSleepInfo &dataSleepInfo)
154 {
155     HRilDataSleepInfo hrilDataSleepInfo;
156     hrilDataSleepInfo.sleepEnable = dataSleepInfo.sleepEnable;
157     TELEPHONY_LOGI("SendDataSleepMode: sleepEnable=%{public}d", hrilDataSleepInfo.sleepEnable);
158     return RequestVendor(
159         serialId, HREQ_DATA_SEND_DATA_SLEEP_MODE, dataFuncs_, &HRilDataReq::SendDataSleepMode, &hrilDataSleepInfo);
160 }
161 
SetDataProfileInfo(int32_t serialId,const OHOS::HDI::Ril::V1_1::DataProfilesInfo & dataProfilesInfo)162 int32_t HRilData::SetDataProfileInfo(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataProfilesInfo &dataProfilesInfo)
163 {
164     int32_t size = dataProfilesInfo.profilesSize;
165     if (size <= 0 || size != static_cast<int32_t>(dataProfilesInfo.profiles.size())) {
166         TELEPHONY_LOGE("RilAdapter failed to do ReadFromParcel!");
167         return HRIL_ERR_INVALID_PARAMETER;
168     }
169     std::unique_ptr<HRilDataInfo[]> dataInfos = std::make_unique<HRilDataInfo[]>(size);
170     for (int32_t i = 0; i < size; i++) {
171         dataInfos[i] = BuildDataInfo(dataProfilesInfo.profiles[i]);
172     }
173     return RequestVendor(
174         serialId, HREQ_DATA_SET_DATA_PROFILE_INFO, dataFuncs_, &HRilDataReq::SetDataProfileInfo, dataInfos.get(), size);
175 }
176 
BuildDataInfo(const OHOS::HDI::Ril::V1_1::DataProfileDataInfo & dataProfileInfo)177 HRilDataInfo HRilData::BuildDataInfo(const OHOS::HDI::Ril::V1_1::DataProfileDataInfo &dataProfileInfo)
178 {
179     HRilDataInfo dataInfo;
180     dataInfo.cid = dataProfileInfo.profileId;
181     dataInfo.apn = StringToCString(dataProfileInfo.apn);
182     dataInfo.type = StringToCString(dataProfileInfo.protocol);
183     dataInfo.roamingType = StringToCString(dataProfileInfo.roamingProtocol);
184     dataInfo.userName = StringToCString(dataProfileInfo.userName);
185     dataInfo.password = StringToCString(dataProfileInfo.password);
186     dataInfo.verType = dataProfileInfo.authenticationType;
187     return dataInfo;
188 }
189 
GetLinkCapability(int32_t serialId)190 int32_t HRilData::GetLinkCapability(int32_t serialId)
191 {
192     return RequestVendor(serialId, HREQ_DATA_GET_LINK_CAPABILITY, dataFuncs_, &HRilDataReq::GetLinkCapability);
193 }
194 
GetLinkBandwidthInfo(int32_t serialId,int32_t cid)195 int32_t HRilData::GetLinkBandwidthInfo(int32_t serialId, int32_t cid)
196 {
197     return RequestVendor(
198         serialId, HREQ_DATA_GET_LINK_BANDWIDTH_INFO, dataFuncs_, &HRilDataReq::GetLinkBandwidthInfo, cid);
199 }
200 
SetLinkBandwidthReportingRule(int32_t serialId,const OHOS::HDI::Ril::V1_1::DataLinkBandwidthReportingRule & linkBandwidthRule)201 int32_t HRilData::SetLinkBandwidthReportingRule(
202     int32_t serialId, const OHOS::HDI::Ril::V1_1::DataLinkBandwidthReportingRule &linkBandwidthRule)
203 {
204     HRilLinkBandwidthReportingRule hLinkBandwidthRule;
205     hLinkBandwidthRule.rat = (RatType)linkBandwidthRule.rat;
206     hLinkBandwidthRule.delayMs = linkBandwidthRule.delayMs;
207     hLinkBandwidthRule.delayUplinkKbps = linkBandwidthRule.delayUplinkKbps;
208     hLinkBandwidthRule.delayDownlinkKbps = linkBandwidthRule.delayDownlinkKbps;
209     hLinkBandwidthRule.maximumUplinkKbpsSize = linkBandwidthRule.maximumUplinkKbpsSize;
210     hLinkBandwidthRule.maximumDownlinkKbpsSize = linkBandwidthRule.maximumDownlinkKbpsSize;
211     hLinkBandwidthRule.maximumUplinkKbps = new int32_t[linkBandwidthRule.maximumUplinkKbpsSize];
212     hLinkBandwidthRule.maximumDownlinkKbps = new int32_t[linkBandwidthRule.maximumDownlinkKbpsSize];
213     TELEPHONY_LOGI("maximumUplinkKbpsSize:%{public}d, maximumDownlinkKbpsSize:%{public}d",
214         linkBandwidthRule.maximumUplinkKbpsSize, linkBandwidthRule.maximumDownlinkKbpsSize);
215     for (int32_t i = 0; i < hLinkBandwidthRule.maximumUplinkKbpsSize; i++) {
216         hLinkBandwidthRule.maximumUplinkKbps[i] = linkBandwidthRule.maximumUplinkKbps[i];
217     }
218     for (int32_t i = 0; i < hLinkBandwidthRule.maximumDownlinkKbpsSize; i++) {
219         hLinkBandwidthRule.maximumDownlinkKbps[i] = linkBandwidthRule.maximumDownlinkKbps[i];
220     }
221     int32_t resutlt = RequestVendor(serialId, HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE, dataFuncs_,
222         &HRilDataReq::SetLinkBandwidthReportingRule, &hLinkBandwidthRule);
223     delete[] hLinkBandwidthRule.maximumUplinkKbps;
224     delete[] hLinkBandwidthRule.maximumDownlinkKbps;
225     return resutlt;
226 }
227 
SetDataPermitted(int32_t serialId,int32_t dataPermitted)228 int32_t HRilData::SetDataPermitted(int32_t serialId, int32_t dataPermitted)
229 {
230     return RequestVendor(
231         serialId, HREQ_DATA_SET_DATA_PERMITTED, dataFuncs_, &HRilDataReq::SetDataPermitted, dataPermitted);
232 }
233 
DeactivatePdpContextResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)234 int32_t HRilData::DeactivatePdpContextResponse(
235     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
236 {
237     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::DeactivatePdpContextResponse);
238 }
239 
ActivatePdpContextResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)240 int32_t HRilData::ActivatePdpContextResponse(
241     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
242 {
243     if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(HRilDataCallResponse)) != 0) {
244         TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen);
245         return HRIL_ERR_INVALID_PARAMETER;
246     }
247     HDI::Ril::V1_1::SetupDataCallResultInfo result = {};
248     result.reason = HRIL_ERROR_UNSPECIFIED_RSN;
249     result.cid = -1;
250     if (response != nullptr) {
251         SwitchRilDataToHal((HRilDataCallResponse *)response, result);
252     }
253     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::ActivatePdpContextResponse, result);
254 }
255 
GetPdpContextListResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)256 int32_t HRilData::GetPdpContextListResponse(
257     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
258 {
259     if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(HRilDataCallResponse)) != 0) {
260         TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen);
261         return HRIL_ERR_INVALID_PARAMETER;
262     }
263     HDI::Ril::V1_1::DataCallResultList dataCallResultList = {};
264     if (response != nullptr) {
265         SwitchHRilDataListToHal(response, responseLen, dataCallResultList.dcList);
266     }
267     dataCallResultList.size = dataCallResultList.dcList.size();
268     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetPdpContextListResponse, dataCallResultList);
269 }
270 
SetInitApnInfoResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)271 int32_t HRilData::SetInitApnInfoResponse(
272     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
273 {
274     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetInitApnInfoResponse);
275 }
276 
SetDataProfileInfoResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)277 int32_t HRilData::SetDataProfileInfoResponse(
278     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
279 {
280     return HRIL_ERR_SUCCESS;
281 }
282 
SetLinkBandwidthReportingRuleResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)283 int32_t HRilData::SetLinkBandwidthReportingRuleResponse(
284     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
285 {
286     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetLinkBandwidthReportingRuleResponse);
287 }
288 
PdpContextListUpdated(int32_t notifyType,const HRilErrNumber error,const void * response,size_t responseLen)289 int32_t HRilData::PdpContextListUpdated(
290     int32_t notifyType, const HRilErrNumber error, const void *response, size_t responseLen)
291 {
292     if ((response == nullptr) || (responseLen % sizeof(HRilDataCallResponse)) != 0) {
293         TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen);
294         return HRIL_ERR_INVALID_PARAMETER;
295     }
296     HDI::Ril::V1_1::DataCallResultList dataCallResultList = {};
297     if (response != nullptr) {
298         SwitchHRilDataListToHal(response, responseLen, dataCallResultList.dcList);
299     }
300     dataCallResultList.size = dataCallResultList.dcList.size();
301     return Notify(notifyType, error, &HDI::Ril::V1_1::IRilCallback::PdpContextListUpdated, dataCallResultList);
302 }
303 
DataLinkCapabilityUpdated(int32_t notifyType,const HRilErrNumber error,const void * response,size_t responseLen)304 int32_t HRilData::DataLinkCapabilityUpdated(
305     int32_t notifyType, const HRilErrNumber error, const void *response, size_t responseLen)
306 {
307     if ((response == nullptr) || (responseLen % sizeof(HRilDataLinkCapability)) != 0) {
308         TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen);
309         return HRIL_ERR_INVALID_PARAMETER;
310     }
311     HDI::Ril::V1_1::DataLinkCapability dataLinkCapability = { 0 };
312     if (response != nullptr) {
313         const HRilDataLinkCapability *result = static_cast<const HRilDataLinkCapability *>(response);
314         dataLinkCapability.primaryDownlinkKbps = result->primaryDownlinkKbps;
315         dataLinkCapability.primaryUplinkKbps = result->primaryUplinkKbps;
316         dataLinkCapability.secondaryDownlinkKbps = result->secondaryDownlinkKbps;
317         dataLinkCapability.secondaryUplinkKbps = result->secondaryUplinkKbps;
318     }
319     return Notify(notifyType, error, &HDI::Ril::V1_1::IRilCallback::DataLinkCapabilityUpdated, dataLinkCapability);
320 }
321 
GetLinkCapabilityResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)322 int32_t HRilData::GetLinkCapabilityResponse(
323     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
324 {
325     if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(HRilDataLinkCapability)) != 0) {
326         TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen);
327         return HRIL_ERR_INVALID_PARAMETER;
328     }
329     HDI::Ril::V1_1::DataLinkCapability dataLinkCapability = { 0 };
330     if (response != nullptr) {
331         const HRilDataLinkCapability *result = static_cast<const HRilDataLinkCapability *>(response);
332         dataLinkCapability.primaryDownlinkKbps = result->primaryDownlinkKbps;
333         dataLinkCapability.primaryUplinkKbps = result->primaryUplinkKbps;
334         dataLinkCapability.secondaryDownlinkKbps = result->secondaryDownlinkKbps;
335         dataLinkCapability.secondaryUplinkKbps = result->secondaryUplinkKbps;
336     }
337     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::GetLinkCapabilityResponse, dataLinkCapability);
338 }
339 
GetLinkBandwidthInfoResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)340 int32_t HRilData::GetLinkBandwidthInfoResponse(
341     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
342 {
343     if ((response == nullptr && responseLen != 0) || (responseLen % sizeof(HRilLinkBandwidthInfo)) != 0) {
344         TELEPHONY_LOGE("Invalid parameter, responseLen:%{public}zu", responseLen);
345         return HRIL_ERR_INVALID_PARAMETER;
346     }
347     HDI::Ril::V1_1::DataLinkBandwidthInfo uplinkAndDownlinkBandwidthInfo = {};
348     if (response != nullptr) {
349         const HRilLinkBandwidthInfo *result = static_cast<const HRilLinkBandwidthInfo *>(response);
350         uplinkAndDownlinkBandwidthInfo.cid = result->cid;
351         uplinkAndDownlinkBandwidthInfo.qi = result->qi;
352         uplinkAndDownlinkBandwidthInfo.dlGfbr = result->dlGfbr;
353         uplinkAndDownlinkBandwidthInfo.ulGfbr = result->ulGfbr;
354         uplinkAndDownlinkBandwidthInfo.dlMfbr = result->dlMfbr;
355         uplinkAndDownlinkBandwidthInfo.ulMfbr = result->ulMfbr;
356         uplinkAndDownlinkBandwidthInfo.ulSambr = result->ulSambr;
357         uplinkAndDownlinkBandwidthInfo.dlSambr = result->dlSambr;
358         uplinkAndDownlinkBandwidthInfo.averagingWindow = result->averagingWindow;
359     }
360     return Response(
361         responseInfo, &HDI::Ril::V1_1::IRilCallback::GetLinkBandwidthInfoResponse, uplinkAndDownlinkBandwidthInfo);
362 }
363 
SetDataPermittedResponse(int32_t requestNum,HRilRadioResponseInfo & responseInfo,const void * response,size_t responseLen)364 int32_t HRilData::SetDataPermittedResponse(
365     int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen)
366 {
367     return Response(responseInfo, &HDI::Ril::V1_1::IRilCallback::SetDataPermittedResponse);
368 }
369 
RegisterDataFuncs(const HRilDataReq * dataFuncs)370 void HRilData::RegisterDataFuncs(const HRilDataReq *dataFuncs)
371 {
372     dataFuncs_ = dataFuncs;
373 }
374 } // namespace Telephony
375 } // namespace OHOS
376