1 /*
2  * Copyright (C) 2024 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_TEL_RIL_NETWORK_PARCEL_H
17 #define OHOS_TEL_RIL_NETWORK_PARCEL_H
18 
19 #include "tel_ril_base_parcel.h"
20 #include "tel_ril_enum.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 /**
25  * @brief Defines the carrier information.
26  */
27 struct OperatorInfoResult {
28     /** Long carrier name of the registered network. */
29     std::string longName = "";
30 
31     /** Short carrier name of the registered network. */
32     std::string shortName = "";
33 
34     /** MCC+MNC of the registered network. */
35     std::string numeric = "";
36 
37     /** flag, Used by search network manager in response. */
38     int64_t flag = 0;
39 };
40 
41 /**
42  * @brief Defines the available network information.
43  */
44 struct AvailableNetworkInfo {
45     /** Long name of the registered network in alphanumeric format. */
46     std::string longName = "";
47 
48     /** Short name of the registered network in alphanumeric format. */
49     std::string shortName = "";
50 
51     /** Available network ID(MCC+MNC). */
52     std::string numeric = "";
53 
54     /** Network status. For details, see {@link RilRegStatus}. */
55     int32_t status = 0;
56 
57     /** Radio access technology type. For details, see {@link RilRadioTech}. */
58     int32_t rat = 0;
59 };
60 
61 /**
62  * @brief Defines the available network list.
63  */
64 struct AvailableNetworkList {
65     /** The size of available network list. */
66     int32_t itemNum = 0;
67 
68     /** Available network list. */
69     std::vector<AvailableNetworkInfo> availableNetworkInfo {};
70 
71     /** Network list flag */
72     int64_t flag = 0;
73 };
74 
75 /**
76  * @brief Defines the network mode information.
77  */
78 struct SetNetworkModeInfo {
79     /** Network mode. For details, see {@link PreferredNetworkTypeInfo}. */
80     int32_t selectMode = 0;
81 
82     /** Operator information */
83     std::string oper = "";
84 
85     /** flag, Used by search network manager in response. */
86     int64_t flag = 0;
87 };
88 
89 /**
90  * @brief Voice registration status results
91  */
92 struct CsRegStatusInfo {
93     /** The notifyType,Indicate the content of the notification. */
94     int32_t notifyType = 0;
95 
96     /**
97      * The corresponding valid registration states are
98      * NOT_REG_MT_NOT_SEARCHING_OP, "REG_MT_HOME, NOT_REG_MT_SEARCHING_OP,
99      * REG_DENIED,  UNKNOWN, REG_ROAMING".
100      */
101     TelRilRegStatus regStatus =
102         TelRilRegStatus::NO_REG_MT_NO_SEARCH;
103 
104     /** Location area code. */
105     int32_t lacCode = 0;
106 
107     /** Cell ID. */
108     int32_t cellId = 0;
109 
110     /** Available voice radio technology, RMS defined by radio technology. */
111     TelRilRadioTech radioTechnology =
112         TelRilRadioTech::RADIO_TECHNOLOGY_UNKNOWN;
113 
114     /** flag, Used by search network manager in response. */
115     int64_t flag = 0;
116 };
117 
118 /**
119  * @brief Defines the registration status information of the PS domain.
120  */
121 struct PsRegStatusResultInfo {
122     /** The notifyType,Indicate the content of the notification. */
123     int32_t notifyType = 0;
124 
125     /**
126      * Valid when are is ITE UNKNOWN REG = REG, otherwise it defined in
127      * RegStatus.
128      */
129     TelRilRegStatus regStatus = TelRilRegStatus::NO_REG_MT_NO_SEARCH;
130 
131     /** Location area code. */
132     int32_t lacCode = 0;
133 
134     /** Cell ID. */
135     int32_t cellId = 0;
136 
137     /** Radio access technology type. For details, see {@link RilRadioTech}. */
138     TelRilRadioTech radioTechnology = TelRilRadioTech::RADIO_TECHNOLOGY_UNKNOWN;
139 
140     /** Whether the NR mode is available.*/
141     bool isNrAvailable = false;
142 
143     /** Whether ENDC is available. */
144     bool isEnDcAvailable = false;
145 
146     /** Whether DCNR is restricted. */
147     bool isDcNrRestricted = false;
148 
149     /** flag, Used by search network manager in response. */
150     int64_t flag = 0;
151 };
152 
153 /**
154  * @brief Defines the physical channel configuration.
155  */
156 struct PhysicalChannelConfig {
157     /** Connection status. */
158     CellConnectionStatus cellConnStatus = CellConnectionStatus::SERVING_CELL_UNKNOWN;
159 
160     /** Radio access technology type. For details, see {@link RilRadioTech}. */
161     TelRilRadioTech ratType = TelRilRadioTech::RADIO_TECHNOLOGY_UNKNOWN;
162 
163     /** Downlink bandwidth in kHz. */
164     int32_t cellBandwidthDownlinkKhz = 0;
165 
166     /** Uplink bandwidth in kHz. */
167     int32_t cellBandwidthUplinkKhz = 0;
168 
169     /** Frequency range. */
170     int32_t freqRange = 0;
171 
172     /** Downlink channel ID. */
173     int32_t downlinkChannelNum = 0;
174 
175     /** Uplink channel ID. */
176     int32_t uplinkChannelNum = 0;
177 
178     /** Physical cell ID. */
179     int32_t physicalCellId = 0;
180 
181     /** Logical device ID. */
182     int32_t contextIdNum = 0;
183 
184     /**
185      * A list of data calls mapped to this physical channel. An empty list
186      * means the physical channel has no data call mapped to it.
187      */
188     std::vector<int32_t> contextIds {};
189 };
190 
191 /**
192  * @brief Defines the channel configuration information list.
193  */
194 struct ChannelConfigInfoList {
195     /** The size of ChannelConfigInfoList. */
196     int32_t itemNum = 0;
197 
198     /** Physical channel configuration list. */
199     std::vector<PhysicalChannelConfig> channelConfigInfos {};
200 
201     /** flag, Used by search network manager in response */
202     int64_t flag = 0;
203 };
204 
205 /**
206  * @brief Defines the GSM cellular information.
207  */
208 typedef struct {
209     /** value:0~3 0:GSM850 1:GSM900 0:GSM1800 0:GSM1900 */
210     int32_t band;
211 
212     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
213     int32_t arfcn;
214 
215     /** cell sit code 0~63 */
216     int32_t bsic;
217 
218     /** Cell ID. */
219     int32_t cellId;
220 
221     /** Location area code, which ranges from 0 to 0xFFFF. */
222     int32_t lac;
223 
224     /** Signal received strength, which ranges from -120 to 37. */
225     int32_t rxlev;
226 
227     /** Signal received quality, which ranges from 0 to 7. */
228     int32_t rxQuality;
229 
230     /** Timing advance, which ranges from 0 to 63. */
231     int32_t ta;
232 } CellRatGsm;
233 
234 /**
235  * @brief Defines the LTE cellular information.
236  */
237 typedef struct {
238     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
239     int32_t arfcn;
240 
241     /** Cell ID. */
242     int32_t cellId;
243 
244     /** Physical cell ID. */
245     int32_t pci;
246 
247     /** Tracking Area Code 0~FFFF */
248     int32_t tac;
249 
250     /** Reference Signal Received Power -140~-44, dBm */
251     int32_t rsrp;
252 
253     /** Reference Signal Received Quality -19.5~-3 */
254     int32_t rsrq;
255 
256     /** Receiving signal strength in dbm 90~-25 */
257     int32_t rssi;
258 } CellRatLte;
259 
260 /**
261  * @brief Defines the WCDMA cellular information.
262  */
263 typedef struct {
264     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
265     int32_t arfcn;
266 
267     /** Primary Scrambling Code. 0~511 */
268     int32_t psc;
269 
270     /** Cell ID. */
271     int32_t cellId;
272 
273     /** Tracking Area Code 0~FFFF. */
274     int32_t lac;
275 
276     /** Reference Signal Received Power -140~-44, dBm */
277     int32_t rscp;
278 
279     /** Reference Signal Received Quality -19.5~-3 */
280     int32_t rxlev;
281 
282     /** Receiving signal strength in dbm 90~-25 */
283     int32_t ecno;
284 
285     /** Discontinuous reception cycle length. 6~9 */
286     int32_t drx;
287 
288     /** UTRAN Registration Area Identity. 0~65535 */
289     int32_t ura;
290 } CellRatWcdma;
291 
292 /**
293  * @brief Defines the CDMA cellular information.
294  */
295 typedef struct {
296     /** integer type and range is 0-65535 */
297     int32_t systemId;
298 
299     /** integer type and range is 0-65535 */
300     int32_t networkId;
301 
302     /** integer type and range is 0-65535 */
303     int32_t baseId;
304 
305     /** integer type and range is 0-65535 */
306     int32_t zoneId;
307 
308     /** integer type and range is 0-65535 */
309     int32_t pilotPn;
310 
311     /** integer type and range is 0-65535 */
312     int32_t pilotStrength;
313 
314     /** integer type and range is 0-65535 */
315     int32_t channel;
316 
317     /** integer type and range is -648000 -- 648000, unit: second */
318     int32_t longitude;
319 
320     /** integer type and range is -648000 -- 648000, unit: second */
321     int32_t latitude;
322 } CellRatCdma;
323 
324 /**
325  * @brief Defines the TD-SCDMA cellular information.
326  */
327 typedef struct {
328     /** Absolute RF channel number of the BCCH carrier. */
329     int32_t arfcn;
330 
331     /** Synchronization flag. */
332     int32_t syncId;
333 
334     /** Super cell. */
335     int32_t sc;
336 
337     /** Cell ID. */
338     int32_t cellId;
339 
340     /** Location area code. */
341     int32_t lac;
342 
343     /** Received signal code power. */
344     int32_t rscp;
345 
346     /** Discontinuous reception cycle. */
347     int32_t drx;
348 
349     /** Routing area code. */
350     int32_t rac;
351 
352     /** Super cell ID. */
353     int32_t cpid;
354 } CellRatTdscdma;
355 
356 /**
357  * @brief Defines the NR cellular information.
358  */
359 typedef struct {
360     /** Absolute RF channel number of the BCCH carrier. */
361     int32_t nrArfcn;
362 
363     /** Physical cell ID. */
364     int32_t pci;
365 
366     /** Tracking Area Code, which ranges from 0 to FFFF. */
367     int32_t tac;
368 
369     /** NR cell ID. */
370     int64_t nci;
371 } CellRatNr;
372 
373 /**
374  * @brief Defines the current cell information.
375  */
376 struct CurrentCellInfo {
377     /** Radio access technology type. */
378     int32_t ratType = 0;
379 
380     /** Mobile country code (MCC). */
381     int32_t mcc = 0;
382 
383     /** Mobile network code (MNC). */
384     int32_t mnc = 0;
385 
386     /** Cell information parameters. */
387     union {
388         CellRatGsm gsm;
389         CellRatLte lte;
390         CellRatWcdma wcdma;
391         CellRatCdma cdma;
392         CellRatTdscdma tdscdma;
393         CellRatNr nr;
394     } ServiceCellParas;
395 };
396 
397 /**
398  * @brief Defines the current cell information list.
399  */
400 struct CellListCurrentInfo {
401     /** The size of current cell information list. */
402     int32_t itemNum = 0;
403 
404     /** Current cell information. */
405     std::vector<CurrentCellInfo> cellCurrentInfo {};
406 };
407 
408 /**
409  * @brief Defines the NR cellular information.
410  */
411 typedef struct {
412     /** Absolute RF channel number of the BCCH carrier. */
413     int32_t nrArfcn;
414 
415     /** Physical cell ID. */
416     int32_t pci;
417 
418     /** Tracking Area Code, which ranges from 0 to FFFF. */
419     int32_t tac;
420 
421     /** NR cell ID. */
422     int64_t nci;
423 
424     /** Reference Signal Received Power. */
425     int32_t rsrp;
426 
427     /** Reference Signal Received Quality. */
428     int32_t rsrq;
429 } CellRatNrExt;
430 
431 /**
432  * @brief Defines the current cell information.
433  */
434 struct CurrentCellInformation {
435     /** Radio access technology type. */
436     int32_t ratType = 0;
437 
438     /** Mobile country code (MCC). */
439     int32_t mcc = 0;
440 
441     /** Mobile network code (MNC). */
442     int32_t mnc = 0;
443 
444     /** Cell information parameters. */
445     union {
446         CellRatGsm gsm;
447         CellRatLte lte;
448         CellRatWcdma wcdma;
449         CellRatCdma cdma;
450         CellRatTdscdma tdscdma;
451         CellRatNrExt nr;
452     } ServiceCellParas;
453 };
454 
455 /**
456  * @brief Defines the current cell information list.
457  */
458 struct CellListCurrentInformation {
459     /** The size of current cell information list. */
460     int32_t itemNum = 0;
461 
462     /** Current cell information. */
463     std::vector<CurrentCellInformation> cellCurrentInfo {};
464 };
465 
466 /**
467  * @brief Defines the GSM cell information.
468  */
469 typedef struct {
470     /** value:0~3 0:GSM850 1:GSM900 0:GSM1800 0:GSM1900 */
471     int32_t band;
472 
473     /** Absolute Radio Frequency Channel Number of the BCCHcarrier 0~1023 */
474     int32_t arfcn;
475 
476     /** cell sit code 0~63 */
477     int32_t bsic;
478 
479     /** Cell information ID */
480     int32_t cellId;
481 
482     /** Location area code 0~FFFF */
483     int32_t lac;
484 
485     /** <RXLEV> dbm -120~37 */
486     int32_t rxlev;
487 } CellListRatGsm;
488 
489 /**
490  * @brief Defines the LTE cell information.
491  */
492 typedef struct {
493     /** Absolute Radio FreListquency Channel Number of the BCCHcarrier 0~1023
494      */
495     int32_t arfcn;
496 
497     /** Physical cell ID. */
498     int32_t pci;
499 
500     /** Reference Signal Received Power -140~-44, dBm */
501     int32_t rsrp;
502 
503     /** Reference Signal Received Quality -19.5~-3 */
504     int32_t rsrq;
505 
506     /** <RXLEV> dbm -120~37 */
507     int32_t rxlev;
508 } CellListRatLte;
509 
510 /**
511  * @brief Defines the WCDMA cell information.
512  */
513 typedef struct {
514     /** Absolute Radio Frequency Channel Number of the BCCHcarrier 0~16383 */
515     int32_t arfcn;
516 
517     /** Primary Scrambling Code. 0~511 */
518     int32_t psc;
519 
520     /** Received Signal Code Power in dBm -120~25, dBm */
521     int32_t rscp;
522 
523     /** The ratio of power per modulation bit to noise spectral density. -25~0
524      */
525     int32_t ecno;
526 } CellListRatWcdma;
527 
528 /**
529  * @brief Defines the CDMA cell information.
530  */
531 typedef struct {
532     /** integer type and range is 0-65535 */
533     int32_t systemId;
534 
535     /** integer type and range is 0-65535 */
536     int32_t networkId;
537 
538     /** integer type and range is 0-65535 */
539     int32_t baseId;
540 
541     /** integer type and range is 0-65535 */
542     int32_t zoneId;
543 
544     /** integer type and range is 0-65535 */
545     int32_t pilotPn;
546 
547     /** integer type and range is 0-65535 */
548     int32_t pilotStrength;
549 
550     /** integer type and range is 0-65535 */
551     int32_t channel;
552 
553     /** integer type and range is -648000 -- 648000, unit: second */
554     int32_t longitude;
555 
556     /** integer type and range is -648000 -- 648000, unit: second */
557     int32_t latitude;
558 } CellListRatCdma;
559 
560 /**
561  * @brief Defines the TD-SCDMA cell information.
562  */
563 typedef struct {
564     /** Absolute RF channel number of the BCCH carrier. */
565     int32_t arfcn;
566 
567     /** Synchronization flag. */
568     int32_t syncId;
569 
570     /** Super cell. */
571     int32_t sc;
572 
573     /** Cell ID. */
574     int32_t cellId;
575 
576     /** Location area code, which ranges from 0 to 0xFFFF. */
577     int32_t lac;
578 
579     /** Received signal code power. */
580     int32_t rscp;
581 
582     /** Discontinuous reception cycle. */
583     int32_t drx;
584 
585     /** Routing area code. */
586     int32_t rac;
587 
588     /** 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if
589      * unknown */
590     int32_t cpid;
591 } CellListRatTdscdma;
592 
593 /**
594  * @brief Defines the NR cell information.
595  */
596 typedef struct {
597     /** Absolute RF channel number of the BCCH carrier. */
598     int32_t nrArfcn;
599 
600     /** Physical cell ID. */
601     int32_t pci;
602 
603     /** Tracking Area Code, which ranges from 0 to FFFF. */
604     int32_t tac;
605 
606     /** NR cell ID. */
607     int64_t nci;
608 } CellListRatNr;
609 
610 /**
611  * @brief Defines the neighboring cell information.
612  */
613 struct CellNearbyInfo {
614     /**
615      * Access technology type:
616      * 0: unknown
617      * 1: GSM
618      * 2: CDMA
619      * 3: WCDMA
620      * 4: TD-SCDMA
621      * 5: LTE
622      * 6: NR
623      */
624     int32_t ratType = 0;
625 
626     /** Cell information for different network modes. */
627     union {
628         CellListRatGsm gsm;
629         CellListRatLte lte;
630         CellListRatWcdma wcdma;
631         CellListRatCdma cdma;
632         CellListRatTdscdma tdscdma;
633         CellListRatNr nr;
634     } ServiceCellParas;
635 };
636 
637 /**
638  * @brief Defines the neighboring cell list.
639  */
640 struct CellListNearbyInfo {
641     /** The size of nearby info of cell list. */
642     int32_t itemNum = 0;
643 
644     /** Neighboring cell list. */
645     std::vector<CellNearbyInfo> cellNearbyInfo {};
646 };
647 
648 /**
649  * @brief Defines the preferred network type.
650  */
651 struct PreferredNetworkTypeInfo {
652     /**
653      * Network type
654      * 0: automatic
655      * 1: GSM
656      * 2: WCDMA.
657      * 3: LTE.
658      * 4: LTE and WCDMA
659      * 5: LTE, WCDMA, and GSM
660      * 6: WCDMA and GSM
661      * 7: CDMA
662      * 8: EV-DO
663      * 9: EV-DO and CDMA
664      * 10: WCDMA, GSM, EV-DO, and CDMA
665      * 11: LTE, EV-DO, and CDMA
666      * 12: LTE, WCDMA, GSM, EV-DO, and CDMA
667      * 13: TD-SCDMA
668      * 14: TD-SCDMA and GSM
669      * 15: TD-SCDMA and WCDMA
670      * 16: TD-SCDMA, WCDMA, and GSM
671      * 17: LTE and TD-SCDMA
672      * 18: LTE, TDSCDMA, and GSM
673      * 19: LTE, TD-SCDMA, and WCDMA
674      * 20: LTE, TDSCDMA, WCDMA, and GSM
675      * 21: TD-SCDMA, WCDMA, GSM, EV-DO, and CDMA
676      * 22: LTE, TD-SCDMA, WCDMA, GSM, EV-DO, and CDMA
677      * 31: NR
678      * 32: NR and LTE
679      * 33: NR, LTE, and WCDMA
680      * 34: NR, LTE, WCDMA, and GSM
681      * 35: NR, LTE, EV-DO, and CDMA
682      * 36: NR, LTE, WCDMA, GSM, EV-DO, and CDMA
683      * 37: NR, LTE, and TD-SCDMA.
684      * 38: NR, LTE, TDSCDMA, and GSM
685      * 39: NR, LTE, TD-SCDMA, and WCDMA
686      * 40: NR, LTE, TD-SCDMA, WCDMA, and GSM
687      * 41: NR, LTE, TD-SCDMA, WCDMA, GSM, EV-DO, and CDMA
688      */
689     int32_t preferredNetworkType = 0;
690 
691     /** Network ID */
692     int64_t flag = 0;
693 };
694 
695 struct NrModeInfo {
696     int32_t nrMode = 0;
697     int64_t flag = 0;
698 };
699 
700 struct SsbIdInfo {
701     /** SSB index. */
702     int32_t ssbId;
703 
704     /** Reference Signal Received Power -140~-44, dBm */
705     int32_t rsrp;
706 };
707 
708 struct NeighboringCellSsbInfo {
709     /** Physical cell ID. */
710     int32_t pci;
711 
712     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
713     int32_t arfcn;
714 
715     /** Reference Signal Received Power -140~-44, dBm */
716     int32_t rsrp;
717 
718     /** Signal To Interference Plus Noise Ratio. */
719     int32_t sinr;
720 
721     /** Neighboring cell ssbId list, always size is 4 */
722     std::vector<SsbIdInfo> ssbIdList;
723 };
724 
725 struct NrCellSsbIds {
726     /** Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 */
727     int32_t arfcn;
728 
729     /** cid */
730     int64_t cid;
731 
732     /** pic */
733     int32_t pic;
734 
735     /** Reference Signal Received Power -140~-44, dBm */
736     int32_t rsrp;
737 
738     /** Signal To Interference Plus Noise Ratio. */
739     int32_t sinr;
740 
741     /** Time advance. */
742     int32_t timeAdvance;
743 
744     /** Service cell ssbId list, always size is 8 */
745     std::vector<SsbIdInfo> sCellSsbList;
746 
747     /** Neighboring cell ssb list count, mas size is 4 */
748     int32_t nbCellCount;
749 
750     /** Neighboring cell ssb info list, mas size is 4 */
751     std::vector<NeighboringCellSsbInfo> nbCellSsbList;
752 };
753 } // namespace Telephony
754 } // namespace OHOS
755 #endif // OHOS_TEL_RIL_NETWORK_PARCEL_H
756