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 #ifndef TEL_RIL_DATA_H 17 #define TEL_RIL_DATA_H 18 19 #include "tel_ril_data_parcel.h" 20 #include "tel_ril_base.h" 21 #include "telephony_types.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 class TelRilData : public TelRilBase { 26 public: 27 TelRilData(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface, 28 std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler); 29 ~TelRilData() = default; 30 31 HDI::Ril::V1_1::DataProfileDataInfo ChangeDPToHalDataProfile(DataProfile dataProfile); 32 int32_t DeactivatePdpContext(int32_t cid, int32_t reason, const AppExecFwk::InnerEvent::Pointer &response); 33 int32_t DeactivatePdpContextResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo); 34 int32_t SetInitApnInfo(const DataProfile &dataProfile, const AppExecFwk::InnerEvent::Pointer &response); 35 int32_t SetInitApnInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo); 36 int32_t ActivatePdpContext(int32_t radioTechnology, DataProfile dataProfile, bool isRoaming, bool allowRoaming, 37 const AppExecFwk::InnerEvent::Pointer &response); 38 int32_t ActivatePdpContextResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 39 const HDI::Ril::V1_1::SetupDataCallResultInfo &iSetupDataCallResultInfo); 40 int32_t GetPdpContextList(const AppExecFwk::InnerEvent::Pointer &response); 41 int32_t GetPdpContextListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 42 const HDI::Ril::V1_1::DataCallResultList &iDataCallResultList); 43 int32_t PdpContextListUpdated(const HDI::Ril::V1_1::DataCallResultList &iDataCallResultList); 44 int32_t DataLinkCapabilityUpdated(const HDI::Ril::V1_1::DataLinkCapability &dataLinkCapability); 45 bool IsDataRespOrNotify(uint32_t code); 46 int32_t GetLinkBandwidthInfo(const int32_t cid, const AppExecFwk::InnerEvent::Pointer &response); 47 int32_t GetLinkBandwidthInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 48 const HDI::Ril::V1_1::DataLinkBandwidthInfo &iDataLinkBandwidthInfo); 49 int32_t SetLinkBandwidthReportingRule( 50 LinkBandwidthRule linkBandwidth, const AppExecFwk::InnerEvent::Pointer &response); 51 int32_t SetLinkBandwidthReportingRuleResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo); 52 int32_t SetDataPermitted(const int32_t dataPermitted, const AppExecFwk::InnerEvent::Pointer &response); 53 int32_t SetDataPermittedResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo); 54 int32_t GetLinkCapability(const AppExecFwk::InnerEvent::Pointer &response); 55 int32_t GetLinkCapabilityResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 56 const HDI::Ril::V1_1::DataLinkCapability &dataLinkCapability); 57 int32_t CleanAllConnections(const AppExecFwk::InnerEvent::Pointer &response); 58 int32_t CleanAllConnectionsResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo); 59 60 private: 61 bool IsDataResponse(uint32_t code); 62 bool IsDataNotification(uint32_t code); 63 void BuildDataCallResultList(std::shared_ptr<DataCallResultList> dataCallResultList, 64 const HDI::Ril::V1_1::DataCallResultList &iDataCallResultList); 65 void BuildDataCallResultInfo(std::shared_ptr<SetupDataCallResultInfo> dataCallResult, 66 const HDI::Ril::V1_1::SetupDataCallResultInfo &iSetupDataCallResultInfo); 67 void BuildDataLinkBandwidthInfo(std::shared_ptr<DataLinkBandwidthInfo> dataLinkBandwidthInfo, 68 const HDI::Ril::V1_1::DataLinkBandwidthInfo &iDataLinkBandwidthInfo); 69 70 private: 71 std::mutex responseErrorLock_; 72 }; 73 } // namespace Telephony 74 } // namespace OHOS 75 #endif // TEL_RIL_DATA_H 76