• 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 #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_1::UniInfo &uniInfo);
31     int32_t ActivatePdpContext(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataCallInfo &dataCallInfo);
32     int32_t GetPdpContextList(int32_t serialId, const OHOS::HDI::Ril::V1_1::UniInfo &uniInfo);
33     int32_t SetInitApnInfo(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataProfileDataInfo &dataProfileDataInfo);
34     int32_t SendDataPerformanceMode(
35         int32_t serialId, const OHOS::HDI::Ril::V1_1::DataPerformanceInfo &dataPerformanceInfo);
36     int32_t SendDataSleepMode(int32_t serialId, const OHOS::HDI::Ril::V1_1::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 DataLinkCapabilityUpdated(
48         int32_t notifyType, const HRilErrNumber error, const void *response, size_t responseLen);
49     int32_t ProcessDataResponse(
50         int32_t code, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
51     int32_t ProcessDataRequest(int32_t code, struct HdfSBuf *data);
52     int32_t ProcessDataNotify(const struct ReportInfo *reportInfo, const void *response, size_t responseLen);
53     int32_t GetLinkCapability(int32_t serialId);
54     int32_t GetLinkCapabilityResponse(
55         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
56     int32_t GetLinkBandwidthInfo(int32_t serialId, int32_t cid);
57     int32_t GetLinkBandwidthInfoResponse(
58         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
59     int32_t SetLinkBandwidthReportingRule(
60         int32_t serialId, const OHOS::HDI::Ril::V1_1::DataLinkBandwidthReportingRule &linkBandwidthRule);
61     int32_t SetLinkBandwidthReportingRuleResponse(
62         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
63     int32_t SetDataProfileInfo(int32_t serialId, const OHOS::HDI::Ril::V1_1::DataProfilesInfo &dataProfilesInfo);
64     int32_t SetDataProfileInfoResponse(
65         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
66     int32_t SetDataPermitted(int32_t serialId, int32_t dataPermitted);
67     int32_t SetDataPermittedResponse(
68         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
69     bool IsDataRespOrNotify(uint32_t code);
70 
71     bool IsDataResponse(uint32_t code);
72 
73     bool IsDataNotification(uint32_t code);
74     void AddHandlerToMap();
75     void RegisterDataFuncs(const HRilDataReq *dataFuncs);
76 
77 private:
78     void SwitchHRilDataListToHal(
79         const void *response, size_t responseLen, std::vector<HDI::Ril::V1_1::SetupDataCallResultInfo> &dcResultList);
80     void SwitchRilDataToHal(const HRilDataCallResponse *response, HDI::Ril::V1_1::SetupDataCallResultInfo &result);
81     static void RilDataCallCharToString(const char *src, std::string dst);
82     HRilDataInfo BuildDataInfo(const OHOS::HDI::Ril::V1_1::DataProfileDataInfo &dataProfileInfo);
83 
84 private:
85     static constexpr uint32_t HRIL_ERROR_UNSPECIFIED_RSN = 0xffff;
86     const HRilDataReq *dataFuncs_ = nullptr;
87 };
88 } // namespace Telephony
89 } // namespace OHOS
90 #endif // OHOS_HRIL_DATA_H
91