• 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(struct HdfSBuf *data);
31     int32_t ActivatePdpContext(struct HdfSBuf *data);
32     int32_t GetPdpContextList(struct HdfSBuf *data);
33     int32_t SetInitApnInfo(struct HdfSBuf *data);
34     int32_t ActivatePdpContextResponse(
35         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
36     int32_t DeactivatePdpContextResponse(
37         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
38     int32_t GetPdpContextListResponse(
39         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
40     int32_t SetInitApnInfoResponse(
41         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
42     int32_t PdpContextListUpdated(int32_t notifyType, const HRilErrNumber e, const void *response, size_t responseLen);
43     int32_t ProcessDataResponse(
44         int32_t code, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
45     int32_t ProcessDataRequest(int32_t code, struct HdfSBuf *data);
46     int32_t ProcessDataNotify(const struct ReportInfo *reportInfo, const void *response, size_t responseLen);
47     int32_t GetLinkBandwidthInfo(struct HdfSBuf *data);
48     int32_t GetLinkBandwidthInfoResponse(
49         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
50     int32_t SetLinkBandwidthReportingRule(struct HdfSBuf *data);
51     int32_t SetLinkBandwidthReportingRuleResponse(
52         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
53 
54     bool IsDataRespOrNotify(uint32_t code);
55 
56     bool IsDataResponse(uint32_t code);
57 
58     bool IsDataNotification(uint32_t code);
59     void AddHandlerToMap();
60     void RegisterDataFuncs(const HRilDataReq *dataFuncs);
61 
62 private:
63     static constexpr uint32_t HRIL_ERROR_UNSPECIFIED_RSN = 0xffff;
64     void SwitchHRilDataListToHal(
65         const void *response, size_t responseLen, std::vector<SetupDataCallResultInfo> &dcResultList);
66     void SwitchRilDataToHal(const HRilDataCallResponse *response, SetupDataCallResultInfo &result);
67     static void RilDataCallCharToString(const char *src, std::string dst);
68 
69     const HRilDataReq *dataFuncs_ = nullptr;
70 };
71 } // namespace Telephony
72 } // namespace OHOS
73 #endif // OHOS_HRIL_DATA_H
74