• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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_NETWORK_H
17 #define OHOS_HRIL_NETWORK_H
18 
19 #include "hril_base.h"
20 #include "hril_network_parcel.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 class HRilNetwork : public HRilBase {
25 public:
26     HRilNetwork(int32_t slotId, IHRilReporter &hrilReporter);
27     virtual ~HRilNetwork() = default;
28 
29     int32_t GetSignalStrength(int32_t serialId);
30     int32_t GetCsRegStatus(int32_t serialId);
31     int32_t GetPsRegStatus(int32_t serialId);
32     int32_t GetOperatorInfo(int32_t serialId);
33     int32_t GetNeighboringCellInfoList(int32_t serialId);
34     int32_t GetCurrentCellInfo(int32_t serialId);
35     int32_t GetNetworkSearchInformation(int32_t serialId);
36     int32_t GetNetworkSelectionMode(int32_t serialId);
37     int32_t SetNetworkSelectionMode(int32_t serialId, const HDI::Ril::V1_1::SetNetworkModeInfo &networkModeInfo);
38     int32_t SetPreferredNetwork(int32_t serialId, int32_t preferredNetworkType);
39     int32_t GetPreferredNetwork(int32_t serialId);
40     int32_t GetPhysicalChannelConfig(int32_t serialId);
41     int32_t SetLocateUpdates(int32_t serialId, const HDI::Ril::V1_1::RilRegNotifyMode mode);
42     int32_t SetNotificationFilter(int32_t serialId, int32_t newFilter);
43     int32_t SetDeviceState(int32_t serialId, int32_t deviceStateType, int32_t deviceStateOn);
44     int32_t SetNrOptionMode(int32_t serialId, int32_t mode);
45     int32_t GetNrOptionMode(int32_t serialId);
46     int32_t GetRrcConnectionState(int32_t serialId);
47 
48     int32_t GetSignalStrengthResponse(
49         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
50     int32_t GetCsRegStatusResponse(
51         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
52     int32_t GetPsRegStatusResponse(
53         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
54     int32_t GetOperatorInfoResponse(
55         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
56     int32_t GetNetworkSearchInformationResponse(
57         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
58     int32_t GetNetworkSelectionModeResponse(
59         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
60     int32_t SetNetworkSelectionModeResponse(
61         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
62     int32_t SetPreferredNetworkResponse(
63         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
64     int32_t GetPreferredNetworkResponse(
65         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
66     int32_t GetNeighboringCellInfoListResponse(
67         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
68     int32_t GetCurrentCellInfoResponse(
69         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
70     int32_t GetCurrentCellInfoResponse_1_1(
71         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
72     int32_t GetPhysicalChannelConfigResponse(
73         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
74     int32_t SetLocateUpdatesResponse(
75         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
76     int32_t SetNotificationFilterResponse(
77         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
78     int32_t SetDeviceStateResponse(
79         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
80     int32_t SetNrOptionModeResponse(
81         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
82     int32_t GetNrOptionModeResponse(
83         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
84     int32_t GetRrcConnectionStateResponse(
85         int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen);
86 
87     int32_t NetworkCsRegStatusUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen);
88     int32_t NetworkPsRegStatusUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen);
89     int32_t SignalStrengthUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen);
90     int32_t NetworkTimeUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen);
91     int32_t NetworkTimeZoneUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen);
92     int32_t NetworkPhyChnlCfgUpdated(
93         int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen);
94     int32_t NetworkCurrentCellUpdated(
95         int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen);
96     int32_t GetRrcConnectionStateUpdated(
97         int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen);
98     int32_t NetworkCurrentCellUpdated_1_1(
99         int32_t indType, const HRilErrNumber error, const void *response, size_t responseLen);
100     void RegisterNetworkFuncs(const HRilNetworkReq *networkFuncs);
101     bool IsNetworkRespOrNotify(uint32_t code);
102 
103 private:
104     void AddHandlerToMap();
105     void ExchangeRilRssiToHdf(const void *response, HDI::Ril::V1_1::Rssi &rssi);
106     void BuildOperatorList(
107         HDI::Ril::V1_1::AvailableNetworkList &availableNetworkList, const void *response, size_t responseLen);
108     void FillCellNearbyInfo(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *cellPtr);
109     void FillCellNearbyInfoTdscdma(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr);
110     void FillCellNearbyInfoCdma(HDI::Ril::V1_1::CellNearbyInfo &cellInfo, const CellInfo *hrilCellPtr);
111     int32_t BuildNeighboringCellList(HDI::Ril::V1_1::CellListNearbyInfo &cellInfoList,
112         const void *response, size_t responseLen);
113     void FillCellInfoType(HDI::Ril::V1_1::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor);
114     void FillCellInformationType(
115         HDI::Ril::V1_1::CurrentCellInfo_1_1 &cellInfo, const CurrentCellInfoVendor *hrilCellInfoVendor);
116     void FillCurrentCellInfo(HDI::Ril::V1_1::CurrentCellInfo &cellInfo, const CurrentCellInfoVendor *cellInfoVendor);
117     void FillCurrentCellInformation(
118         HDI::Ril::V1_1::CurrentCellInfo_1_1 &cellInfo, const CurrentCellInfoVendor *cellInfoVendor);
119     int32_t BuildCurrentCellList(
120         HDI::Ril::V1_1::CellListCurrentInfo &cellInfoList, const void *response, size_t responseLen);
121     int32_t BuildCurrentCellInfoList(
122         HDI::Ril::V1_1::CellListCurrentInfo_1_1 &cellInfoList, const void *response, size_t responseLen);
123     bool IsNetworkResponse(uint32_t code);
124     bool IsNetworkNotification(uint32_t code);
125 
126 private:
127     const HRilNetworkReq *networkFuncs_ = nullptr;
128 };
129 } // namespace Telephony
130 } // namespace OHOS
131 #endif // OHOS_HRIL_NETWORK_H
132