• 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_RIL_VENDOR_NETWORK_DEFS_H
17 #define OHOS_RIL_VENDOR_NETWORK_DEFS_H
18 
19 #define MAX_CHAR_LEN 100
20 
21 #include "hril_public_struct.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* From 3GPP TS 27.007 8.5 */
28 typedef struct {
29     int32_t rxlev; /* integer type, received signal strength level (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value
30                       0~99 */
31     int32_t ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max */
32 } HRilGsmRssi;
33 
34 /* From 3GPP TS 27.007 8.5 */
35 typedef struct {
36     int32_t rxlev; /* integer type, received signal strength level (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value
37                       0~99 */
38     int32_t ecio; /* integer type, ratio of the received energy per PN chip to the total received power
39                    * spectral density (see 3GPP TS 25.133 [95] sub-clause). */
40     int32_t rscp; /* integer type, received signal code power (see 3GPP TS 25.133 [95] sub-clause 9.1.1.3 and
41                    * 3GPP TS 25.123 [96] sub-clause 9.1.1.1.3).
42                    * range  value 0 ~ 96, 255 not known or not detectable */
43     int32_t ber; /* bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max */
44 } HRilWcdmaRssi;
45 
46 /* From 3GPP TS 27.007 8.69 */
47 typedef struct {
48     int32_t absoluteRssi; /* Absolute value of signal strength.  This value is the actual Rssi value
49                            * multiplied by -1.
50                            * e.g: Rssi is -75, then this response value will be 75 */
51     int32_t ecno; /* ratio of the received energy per PN chip to the total received power spectral density,
52                    * e.g: If the actual Ec/Io is -12.5 dB, then this response value will be 125.
53                    * from 3GPP TS 25.133[95] */
54 } HRilCdmaRssi;
55 
56 typedef struct {
57     int32_t rxlev; /* integer type, received signal strength level (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value
58                       0~99 */
59     int32_t rsrq; /* integer type, reference signal received quality (see 3GPP TS 36.133 [96] sub-clause 9.1.7)
60                    * value range 0~33, 255 not known or not detectable */
61     int32_t rsrp; /* integer type, reference signal received power (see 3GPP TS 36.133 [96] sub-clause 9.1.4)
62                    * value range 0~97, 255 not known or not detectable */
63     int32_t snr; /* integer type, representing the signal-to-interference plus noise ratio, suitable for LTE mode
64                   * value range 0~251, 255 not known or not detectable */
65 } HRilLteRssi;
66 
67 typedef struct {
68     int32_t rscp;
69 } HRilTdScdmaRssi;
70 
71 typedef struct {
72     int32_t rsrp;
73     int32_t rsrq;
74     int32_t sinr;
75 } HRilNrRssi;
76 
77 typedef struct {
78     HRilGsmRssi gsmRssi;
79     HRilCdmaRssi cdmaRssi;
80     HRilWcdmaRssi wcdmaRssi;
81     HRilLteRssi lteRssi;
82     HRilTdScdmaRssi tdScdmaRssi;
83     HRilNrRssi nrRssi;
84 } HRilRssi;
85 
86 typedef struct {
87     int32_t serial;
88     int32_t selectMode;
89     char *oper;
90 } HRilSetNetworkModeInfo;
91 
92 typedef enum {
93     CS_REG_TYPE = 1, /* Corresponds to AT command: AT+CREG */
94     PS_REG_TYPE, /* Corresponds to AT command: AT+CGREG */
95 } HRilRegType;
96 
97 typedef enum {
98     REG_STAT_POS = 0, /* AT command: +CREG,+CGREG,regState field position index in response */
99     REG_LAC_POS, /* Lac field position index in response */
100     REG_CELL_ID_POS, /* CellId field position index in response */
101     REG_ACT_POS, /* ActType field position index in response */
102     REG_NR_AVAILABLE_POS, /* AT command: +C5GREG,isNrAvailable field position index in response */
103     REG_EN_DC_AVAILABLE_POS, /* AT command: +C5GREG,isEnDcAvailable field position index in response */
104     REG_DC_NR_RESTRICTED_POS, /* AT command: +C5GREG,isDcNrAvailable field position index in response */
105 } HRilRegPosIndex;
106 
107 typedef enum {
108     REG_NOTIFY_TYPE = 0, /* AT command: +CREG,+CGREG data Message notify type */
109     REG_RESPONSE_TYPE, /* AT command: +CREG,+CGREG data Message response type */
110 } HRilRegMsgType;
111 
112 typedef struct {
113     HRilRegType regType;
114     HRilRegMsgType regMsgType;
115     HRilRegNotifyMode notifyMode;
116     HRilRegStatus regStatus;
117     int32_t lacCode;
118     int32_t cellId;
119     HRilRadioTech actType;
120     int32_t isNrAvailable;
121     int32_t isEnDcAvailable;
122     int32_t isDcNrRestricted;
123 } HRilRegStatusInfo;
124 
125 typedef struct {
126     HRilCellConnectionStatus cellConnStatus;
127     HRilRadioTech ratType;
128     int32_t cellBandwidthDownlinkKhz;
129     int32_t cellBandwidthUplinkKhz;
130     int32_t freqRange;
131     int32_t downlinkChannelNum;
132     int32_t uplinkChannelNum;
133     int32_t physicalCellId;
134     int32_t contextIdNum;
135     int32_t *contextIds;
136 } HRilPhyChannelConfig;
137 
138 typedef struct {
139     int32_t itemNum;
140     HRilPhyChannelConfig *channelConfigs;
141 } HRilChannelConfigList;
142 
143 typedef struct {
144     int32_t notifyType;
145     int32_t regInfo;
146     int32_t extInfo;
147 } HRilImsRegStatusInfo;
148 
149 typedef struct {
150     char *longName;
151     char *shortName;
152     char *numeric;
153     int32_t status;
154     int32_t rat;
155 } AvailableOperInfo;
156 
157 typedef struct {
158     int32_t systemId; /* integer type and range is 0-65535 */
159     int32_t networkId; /* integer type and range is 0-65535 */
160     int32_t baseId; /* integer type and range is 0-65535 */
161     int32_t zoneId; /* integer type and range is 0-65535 */
162     int32_t pilotPn; /* integer type and range is 0-65535 */
163     int32_t pilotStrength; /* integer type and range is 0-65535 */
164     int32_t channel; /* integer type and range is 0-65535 */
165     int32_t longitude; /* integer type and range is -648000 -- 648000, unit: second */
166     int32_t latitude; /* integer type and range is -648000 -- 648000, unit: second */
167 } CellRatCdma;
168 
169 // cellList
170 typedef struct {
171     int32_t band; /* value:0~3 0:GSM850 1:GSM900 0:GSM1800 0:GSM1900 */
172     int32_t arfcn; /* Absolute Radio Frequency Channel Number of the BCCHcarrier 0~1023 */
173     int32_t bsic; /* cell sit code 0~63 */
174     int32_t cellId;
175     int32_t lac; /* Location area code 0~FFFF */
176     int32_t rxlev; /* <RXLEV> dbm -120~37 */
177 } CellListRatGsm;
178 
179 typedef struct {
180     int32_t arfcn; /* Absolute Radio Frequency Channel Number of the BCCHcarrier 0~39649 */
181     int32_t pci; /* Physical cell ID. 0~503 */
182     int32_t rsrp; /* Reference Signal Received Power -140~-44, dBm */
183     int32_t rsrq; /* Reference Signal Received Quality -19.5~-3 */
184     int32_t rxlev; /* <RXLEV> dbm -120~37 */
185 } CellListRatLte;
186 
187 typedef struct {
188     int32_t arfcn; /* Absolute Radio Frequency Channel Number of the BCCHcarrier 0~16383 */
189     int32_t psc; /* Primary Scrambling Code. 0~511 */
190     int32_t rscp; /* Received Signal Code Power in dBm -120~25, dBm */
191     int32_t ecno; /* The ratio of power per modulation bit to noise spectral density. -25~0 */
192 } CellListRatWcdma;
193 
194 typedef struct {
195     int32_t arfcn;
196     int32_t syncId;
197     int32_t sc;
198     int32_t cellId;
199     int32_t lac;
200     int32_t rscp;
201     int32_t drx;
202     int32_t rac;
203     int32_t cpid;
204 } CellRatTdscdma;
205 
206 typedef struct {
207     int32_t nrArfcn;
208     int32_t pci;
209     int32_t tac;
210     int64_t nci;
211 } CellRatNr;
212 
213 typedef struct {
214     int32_t ratType;
215 
216     union {
217         CellListRatGsm gsm;
218         CellListRatLte lte;
219         CellListRatWcdma wcdma;
220         CellRatCdma cdma;
221         CellRatTdscdma tdscdma;
222         CellRatNr nr;
223     } ServiceCellParas;
224 } CellInfo;
225 
226 typedef struct {
227     int32_t itemNum;
228     CellInfo *cellNearbyInfo;
229 } CellInfoList;
230 
231 typedef struct {
232     int32_t band; /* value:0~3 0:GSM850 1:GSM900 0:GSM1800 0:GSM1900 */
233     int32_t arfcn; /* Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
234     int32_t bsic; /* cell sit code 0~63 */
235     int32_t cellId;
236     int32_t lac; /* Location area code 0~FFFF */
237     int32_t rxlev; /* <RXLEV> dbm -120~37 */
238     int32_t rxQuality; /* 0~7 */
239     int32_t ta; /* 0~63 */
240 } CellRatGsm;
241 
242 typedef struct {
243     int32_t arfcn; /* Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
244     int32_t cellId;
245     int32_t pci; /* Physical cell ID. 0~503 */
246     int32_t tac; /* Tracking Area Code 0~FFFF */
247     int32_t rsrp; /* Reference Signal Received Power -140~-44, dBm */
248     int32_t rsrq; /* Reference Signal Received Quality -19.5~-3 */
249     int32_t rssi; /* Receiving signal strength in dbm 90~-25 */
250 } CellRatLte;
251 
252 typedef struct {
253     int32_t arfcn; /* Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
254     int32_t psc; /* Primary Scrambling Code. 0~511 */
255     int32_t cellId;
256     int32_t lac; /* Tracking Area Code 0~FFFF */
257     int32_t rscp; /* Reference Signal Received Power -140~-44, dBm */
258     int32_t rxlev; /* Reference Signal Received Quality -19.5~-3 */
259     int32_t ecno; /* Receiving signal strength in dbm 90~-25 */
260     int32_t drx; /* Discontinuous reception cycle length. 6~9 */
261     int32_t ura; /* UTRAN Registration Area Identity. 0~65535 */
262 } CellRatWcdma;
263 
264 typedef struct {
265     int32_t ratType;
266     int32_t mcc;
267     int32_t mnc;
268 
269     union {
270         CellRatGsm gsm;
271         CellRatLte lte;
272         CellRatWcdma wcdma;
273         CellRatCdma cdma;
274         CellRatTdscdma tdscdma;
275         CellRatNr nr;
276     } ServiceCellParas;
277 } CurrentCellInfoVendor;
278 
279 typedef struct {
280     int32_t itemNum;
281     CurrentCellInfoVendor *currentCellInfo;
282 } CurrentCellInfoList;
283 
284 typedef struct {
285     void (*GetImsRegStatus)(const ReqDataInfo *requestInfo);
286     void (*GetSignalStrength)(const ReqDataInfo *requestInfo);
287     void (*GetCsRegStatus)(const ReqDataInfo *requestInfo);
288     void (*GetPsRegStatus)(const ReqDataInfo *requestInfo);
289     void (*GetOperatorInfo)(const ReqDataInfo *requestInfo);
290     void (*GetNeighboringCellInfoList)(const ReqDataInfo *requestInfo);
291     void (*GetCurrentCellInfo)(const ReqDataInfo *requestInfo);
292     void (*GetNetworkSearchInformation)(const ReqDataInfo *requestInfo);
293     void (*GetNetworkSelectionMode)(const ReqDataInfo *requestInfo);
294     void (*SetNetworkSelectionMode)(const ReqDataInfo *requestInfo, const HRilSetNetworkModeInfo *data);
295     void (*GetPreferredNetwork)(const ReqDataInfo *requestInfo);
296     void (*SetPreferredNetwork)(const ReqDataInfo *requestInfo, const int32_t *data);
297     void (*GetPhysicalChannelConfig)(const ReqDataInfo *requestInfo);
298     void (*SetLocateUpdates)(const ReqDataInfo *requestInfo, HRilRegNotifyMode mode);
299     void (*SetNotificationFilter)(const ReqDataInfo *requestInfo, const int32_t *newFilter);
300     void (*SetDeviceState)(const ReqDataInfo *requestInfo, const int32_t *deviceStateType, const int32_t *deviceState);
301 } HRilNetworkReq;
302 #ifdef __cplusplus
303 }
304 #endif
305 #endif // OHOS_RIL_VENDOR_NETWORK_DEFS_H
306