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 OHOS_HRIL_DATA_H 17 #define OHOS_HRIL_DATA_H 18 19 #include "hril_base.h" 20 #include "hril_data_parcel.h" 21 #include "hril_modem_parcel.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 class HRilData : public HRilBase { 26 public: 27 HRilData(int32_t slotId, IHRilReporter &hrilReporter); 28 virtual ~HRilData(); 29 30 int32_t DeactivatePdpContext(int32_t serialId, const OHOS::HDI::Ril::V1_0::UniInfo &uniInfo); 31 int32_t ActivatePdpContext(int32_t serialId, const OHOS::HDI::Ril::V1_0::DataCallInfo &dataCallInfo); 32 int32_t GetPdpContextList(int32_t serialId, const OHOS::HDI::Ril::V1_0::UniInfo &uniInfo); 33 int32_t SetInitApnInfo(int32_t serialId, const OHOS::HDI::Ril::V1_0::DataProfileDataInfo &dataProfileDataInfo); 34 int32_t SendDataPerformanceMode( 35 int32_t serialId, const OHOS::HDI::Ril::V1_0::DataPerformanceInfo &dataPerformanceInfo); 36 int32_t SendDataSleepMode(int32_t serialId, const OHOS::HDI::Ril::V1_0::DataSleepInfo &dataSleepInfo); 37 int32_t ActivatePdpContextResponse( 38 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 39 int32_t DeactivatePdpContextResponse( 40 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 41 int32_t GetPdpContextListResponse( 42 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 43 int32_t SetInitApnInfoResponse( 44 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 45 int32_t PdpContextListUpdated( 46 int32_t notifyType, const HRilErrNumber error, const void *response, size_t responseLen); 47 int32_t ProcessDataResponse( 48 int32_t code, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 49 int32_t ProcessDataRequest(int32_t code, struct HdfSBuf *data); 50 int32_t ProcessDataNotify(const struct ReportInfo *reportInfo, const void *response, size_t responseLen); 51 int32_t GetLinkBandwidthInfo(int32_t serialId, int32_t cid); 52 int32_t GetLinkBandwidthInfoResponse( 53 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 54 int32_t SetLinkBandwidthReportingRule( 55 int32_t serialId, const OHOS::HDI::Ril::V1_0::DataLinkBandwidthReportingRule &linkBandwidthRule); 56 int32_t SetLinkBandwidthReportingRuleResponse( 57 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 58 int32_t SetDataProfileInfo(int32_t serialId, const OHOS::HDI::Ril::V1_0::DataProfilesInfo &dataProfilesInfo); 59 int32_t SetDataProfileInfoResponse( 60 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 61 int32_t SetDataPermitted(int32_t serialId, int32_t dataPermitted); 62 int32_t SetDataPermittedResponse( 63 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 64 bool IsDataRespOrNotify(uint32_t code); 65 66 bool IsDataResponse(uint32_t code); 67 68 bool IsDataNotification(uint32_t code); 69 void AddHandlerToMap(); 70 void RegisterDataFuncs(const HRilDataReq *dataFuncs); 71 72 private: 73 void SwitchHRilDataListToHal( 74 const void *response, size_t responseLen, std::vector<HDI::Ril::V1_0::SetupDataCallResultInfo> &dcResultList); 75 void SwitchRilDataToHal(const HRilDataCallResponse *response, HDI::Ril::V1_0::SetupDataCallResultInfo &result); 76 static void RilDataCallCharToString(const char *src, std::string dst); 77 HRilDataInfo BuildDataInfo(const OHOS::HDI::Ril::V1_0::DataProfileDataInfo &dataProfileInfo); 78 79 private: 80 static constexpr uint32_t HRIL_ERROR_UNSPECIFIED_RSN = 0xffff; 81 const HRilDataReq *dataFuncs_ = nullptr; 82 }; 83 } // namespace Telephony 84 } // namespace OHOS 85 #endif // OHOS_HRIL_DATA_H 86