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 /** 28 * @brief Defines the GSM received signal strength indicator. 29 * 30 * From 3GPP TS 27.007 8.5 31 */ 32 typedef struct { 33 /** 34 * Integer type, received signal strength level (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 35 * 0~99 36 */ 37 int32_t rxlev; 38 /** 39 * Bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max 40 */ 41 int32_t ber; 42 } HRilGsmRssi; 43 44 /** 45 * @brief Defines the WCDMA received signal strength indicator. 46 * 47 * From 3GPP TS 27.007 8.5 48 */ 49 typedef struct { 50 /** 51 * Integer type, received signal strength level (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 52 * 0~99 53 */ 54 int32_t rxlev; 55 /** 56 * Integer type, ratio of the received energy per PN chip to the total received power 57 * spectral density (see 3GPP TS 25.133 [95] sub-clause). 58 */ 59 int32_t ecio; 60 /** 61 * Integer type, received signal code power (see 3GPP TS 25.133 [95] sub-clause 9.1.1.3 and 62 * 3GPP TS 25.123 [96] sub-clause 9.1.1.1.3). 63 * range value 0 ~ 96, 255 not known or not detectable 64 */ 65 int32_t rscp; 66 /** 67 * Bit error rate, value range 0 ~ 7, max is 99, if unknown then set to max 68 */ 69 int32_t ber; 70 } HRilWcdmaRssi; 71 72 /** 73 * @brief Defines the CDMA received signal strength indicator. 74 * 75 * From 3GPP TS 27.007 8.69 76 */ 77 typedef struct { 78 /** 79 * Absolute value of signal strength. This value is the actual Rssi value 80 * multiplied by -1. 81 * e.g: Rssi is -75, then this response value will be 75 82 */ 83 int32_t absoluteRssi; 84 /** 85 * Ratio of the received energy per PN chip to the total received power spectral density, 86 * e.g: If the actual Ec/Io is -12.5 dB, then this response value will be 125. 87 * from 3GPP TS 25.133[95] 88 */ 89 int32_t ecno; 90 } HRilCdmaRssi; 91 92 /** 93 * @brief Defines the LTE signal strength. 94 */ 95 typedef struct { 96 /** 97 * Integer type, received signal strength level (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 98 * 0~99 99 */ 100 int32_t rxlev; 101 /** 102 * Integer type, reference signal received quality (see 3GPP TS 36.133 [96] sub-clause 9.1.7) 103 * value range 0~33, 255 not known or not detectable 104 */ 105 int32_t rsrq; 106 /** 107 * Integer type, reference signal received power (see 3GPP TS 36.133 [96] sub-clause 9.1.4) 108 * value range 0~97, 255 not known or not detectable 109 */ 110 int32_t rsrp; 111 /** 112 * Integer type, representing the signal-to-interference plus noise ratio, suitable for LTE mode 113 * value range 0~251, 255 not known or not detectable 114 */ 115 int32_t snr; 116 } HRilLteRssi; 117 118 /** 119 * @brief Defines the TD-SCDMA signal strength. 120 */ 121 typedef struct { 122 /** 123 * Received signal code power 124 */ 125 int32_t rscp; 126 } HRilTdScdmaRssi; 127 128 /** 129 * @brief Defines the NR signal strength. 130 */ 131 typedef struct { 132 /** 133 * Reference signal received power 134 */ 135 int32_t rsrp; 136 /** 137 * Received signal quality 138 */ 139 int32_t rsrq; 140 /** 141 * Signal to interference plus noise ratio 142 */ 143 int32_t sinr; 144 } HRilNrRssi; 145 146 /** 147 * @brief Defines the received signal strength information. 148 */ 149 typedef struct { 150 /** 151 * GSM received signal strength indicator 152 */ 153 HRilGsmRssi gsmRssi; 154 /** 155 * CDMA received signal strength indicator 156 */ 157 HRilCdmaRssi cdmaRssi; 158 /** 159 * WCDMA received signal strength indicator 160 */ 161 HRilWcdmaRssi wcdmaRssi; 162 /** 163 * LTE received signal strength indicator 164 */ 165 HRilLteRssi lteRssi; 166 /** 167 * TD-SCDMA received signal strength indicator 168 */ 169 HRilTdScdmaRssi tdScdmaRssi; 170 /** 171 * NR received signal strength indicator 172 */ 173 HRilNrRssi nrRssi; 174 } HRilRssi; 175 176 /** 177 * @brief Defines the network mode information. 178 */ 179 typedef struct { 180 /** 181 * Request SN 182 */ 183 int32_t serial; 184 /** 185 * Network mode 186 */ 187 int32_t selectMode; 188 /** 189 * Carrier 190 */ 191 char *oper; 192 } HRilSetNetworkModeInfo; 193 194 /** 195 * @brief Defines the registration type 196 */ 197 typedef enum { 198 /** 199 * Corresponds to AT command: AT+CREG 200 */ 201 CS_REG_TYPE = 1, 202 /** 203 * Corresponds to AT command: AT+CGREG 204 */ 205 PS_REG_TYPE, 206 } HRilRegType; 207 208 /** 209 * @brief Defines the registration position index in response 210 */ 211 typedef enum { 212 /** 213 * AT command: +CREG,+CGREG,regState field position index in response 214 */ 215 REG_STAT_POS = 0, 216 /** 217 * Lac field position index in response 218 */ 219 REG_LAC_POS, 220 /** 221 * CellId field position index in response 222 */ 223 REG_CELL_ID_POS, 224 /** 225 * ActType field position index in response 226 */ 227 REG_ACT_POS, 228 /** 229 * AT command: +C5GREG,isNrAvailable field position index in response 230 */ 231 REG_NR_AVAILABLE_POS, 232 /** 233 * AT command: +C5GREG,isEnDcAvailable field position index in response 234 */ 235 REG_EN_DC_AVAILABLE_POS, 236 /** 237 * AT command: +C5GREG,isDcNrAvailable field position index in response 238 */ 239 REG_DC_NR_RESTRICTED_POS, 240 } HRilRegPosIndex; 241 242 /** 243 * @brief Defines the registration message type 244 */ 245 typedef enum { 246 /** 247 * AT command: +CREG,+CGREG data Message notify type 248 */ 249 REG_NOTIFY_TYPE = 0, 250 /** 251 * AT command: +CREG,+CGREG data Message response type 252 */ 253 REG_RESPONSE_TYPE, 254 } HRilRegMsgType; 255 256 /** 257 * @brief Defines the registration status information. 258 */ 259 typedef struct { 260 /** 261 * registration type 262 */ 263 HRilRegType regType; 264 /** 265 * registration message type 266 */ 267 HRilRegMsgType regMsgType; 268 /** 269 * Notification type 270 */ 271 HRilRegNotifyMode notifyMode; 272 /** 273 * Registration status 274 */ 275 HRilRegStatus regStatus; 276 /** 277 * Location area code 278 */ 279 int32_t lacCode; 280 /** 281 * Cell ID 282 */ 283 int32_t cellId; 284 /** 285 * Radio access technology type 286 */ 287 HRilRadioTech actType; 288 /** 289 * Whether the NR mode is available 290 */ 291 int32_t isNrAvailable; 292 /** 293 * Whether ENDC is available 294 */ 295 int32_t isEnDcAvailable; 296 /** 297 * Whether DCNR is restricted 298 */ 299 int32_t isDcNrRestricted; 300 } HRilRegStatusInfo; 301 302 /** 303 * @brief Defines the physical channel configuration. 304 */ 305 typedef struct { 306 /** 307 * Connection status 308 */ 309 HRilCellConnectionStatus cellConnStatus; 310 /** 311 * Radio access technology type 312 */ 313 HRilRadioTech ratType; 314 /** 315 * Downlink bandwidth in kHz 316 */ 317 int32_t cellBandwidthDownlinkKhz; 318 /** 319 * Uplink bandwidth in kHz. 320 */ 321 int32_t cellBandwidthUplinkKhz; 322 /** 323 * Frequency range 324 */ 325 int32_t freqRange; 326 /** 327 * Downlink channel ID 328 */ 329 int32_t downlinkChannelNum; 330 /** 331 * Uplink channel ID 332 */ 333 int32_t uplinkChannelNum; 334 /** 335 * Physical cell ID 336 */ 337 int32_t physicalCellId; 338 /** 339 * Logical device ID 340 */ 341 int32_t contextIdNum; 342 /** 343 * Uplink channel ID 344 */ 345 int32_t *contextIds; 346 } HRilPhyChannelConfig; 347 348 /** 349 * @brief Defines the channel configuration information list. 350 */ 351 typedef struct { 352 /** 353 * Number 354 */ 355 int32_t itemNum; 356 /** 357 * Physical channel configuration 358 */ 359 HRilPhyChannelConfig *channelConfigs; 360 } HRilChannelConfigList; 361 362 /** 363 * @brief Defines the registration status information of the IMS. 364 */ 365 typedef struct { 366 /** 367 * Notification type 368 */ 369 int32_t notifyType; 370 /** 371 * Registration information 372 */ 373 int32_t regInfo; 374 /** 375 * Extension information 376 */ 377 int32_t extInfo; 378 } HRilImsRegStatusInfo; 379 380 /** 381 * @brief Defines the available network information. 382 */ 383 typedef struct { 384 /** 385 * Long name of the registered network in alphanumeric format 386 */ 387 char *longName; 388 /** 389 * Short name of the registered network in alphanumeric format 390 */ 391 char *shortName; 392 /** 393 * Available network ID 394 */ 395 char *numeric; 396 /** 397 * Network status 398 */ 399 int32_t status; 400 /** 401 * Radio access technology type 402 */ 403 int32_t rat; 404 } AvailableOperInfo; 405 406 /** 407 * @brief Defines the CDMA cellular information. 408 */ 409 typedef struct { 410 /** 411 * System ID range is 0-65535 412 */ 413 int32_t systemId; 414 /** 415 * Network ID range is 0-65535 416 */ 417 int32_t networkId; 418 /** 419 * Basic ID range is 0-65535 420 */ 421 int32_t baseId; 422 /** 423 * Zone ID range is 0-65535 424 */ 425 int32_t zoneId; 426 /** 427 * PN pilot sequence range is 0-65535 428 */ 429 int32_t pilotPn; 430 /** 431 * Pilot signal strength range is 0-65535 432 */ 433 int32_t pilotStrength; 434 /** 435 * Channel range is 0-65535 436 */ 437 int32_t channel; 438 /** 439 * Longitude range is -648000 -- 648000, unit: second 440 */ 441 int32_t longitude; 442 /** 443 * Latitude range is -648000 -- 648000, unit: second 444 */ 445 int32_t latitude; 446 } CellRatCdma; 447 448 /** 449 * @brief Defines the GSM cell information. 450 */ 451 typedef struct { 452 /** 453 * Cell band information, value:0~3 0:GSM850 1:GSM900 0:GSM1800 0:GSM1900 454 */ 455 int32_t band; 456 /** 457 * Absolute RF channel number of the broadcast control channel (BCCH) carrier, which ranges from 0 to 1023 458 */ 459 int32_t arfcn; 460 /** 461 * Base transceiver station identity code 0~63 462 */ 463 int32_t bsic; 464 /** 465 * Cell information ID 466 */ 467 int32_t cellId; 468 /** 469 * Location area code, which ranges from 0 to 0xFFFF 470 */ 471 int32_t lac; 472 /** 473 * Signal received strength, which ranges from -120 to 37 474 */ 475 int32_t rxlev; 476 } CellListRatGsm; 477 478 /** 479 * @brief Defines the LTE cell information. 480 */ 481 typedef struct { 482 /** 483 * Absolute RF channel number of the BCCH carrier, which ranges from 0 to 1023 484 */ 485 int32_t arfcn; 486 /** 487 * Physical cell ID. 0~503 488 */ 489 int32_t pci; 490 /** 491 * Signal received power, which ranges from -140 to -44 492 */ 493 int32_t rsrp; 494 /** 495 * Signal received quality, which ranges from -19 to -3 496 */ 497 int32_t rsrq; 498 /** 499 * Signal received strength, which ranges from -120 to 37 500 */ 501 int32_t rxlev; 502 } CellListRatLte; 503 504 /** 505 * @brief Defines the WCDMA cell information. 506 */ 507 typedef struct { 508 /** 509 * Absolute RF channel number of the BCCH carrier, which ranges from 0 to 16383 510 */ 511 int32_t arfcn; 512 /** 513 * Primary Scrambling Code. 0~511 514 */ 515 int32_t psc; 516 /** 517 * Received Signal Code Power in dBm -120~25, dBm 518 */ 519 int32_t rscp; 520 /** 521 * The ratio of power per modulation bit to noise spectral density. -25~0 522 */ 523 int32_t ecno; 524 } CellListRatWcdma; 525 526 /** 527 * @brief Defines the TD-SCDMA cellular information. 528 */ 529 typedef struct { 530 /** 531 * Absolute RF channel number of the BCCH carrier 532 */ 533 int32_t arfcn; 534 /** 535 * Synchronization flag 536 */ 537 int32_t syncId; 538 /** 539 * Super cell 540 */ 541 int32_t sc; 542 /** 543 * Cell ID 544 */ 545 int32_t cellId; 546 /** 547 * Location area code 548 */ 549 int32_t lac; 550 /** 551 * Received signal code power 552 */ 553 int32_t rscp; 554 /** 555 * Discontinuous reception cycle 556 */ 557 int32_t drx; 558 /** 559 * Routing area code 560 */ 561 int32_t rac; 562 /** 563 * Super cell ID 564 */ 565 int32_t cpid; 566 } CellRatTdscdma; 567 568 /** 569 * @brief Defines the NR cellular information. 570 */ 571 typedef struct { 572 /** 573 * Absolute RF channel number of the BCCH carrier 574 */ 575 int32_t nrArfcn; 576 /** 577 * Physical cell ID 578 */ 579 int32_t pci; 580 /** 581 * Type allocation code 582 */ 583 int32_t tac; 584 /** 585 * NR cell ID 586 */ 587 int64_t nci; 588 /** 589 * Signal received power, which ranges from -140 to -44 590 */ 591 int32_t rsrp; 592 /** 593 * Signal received quality, which ranges from -19 to -3 594 */ 595 int32_t rsrq; 596 } CellRatNr; 597 598 /** 599 * @brief Defines the cell information. 600 */ 601 typedef struct { 602 /** 603 * Radio access technology type 604 */ 605 int32_t ratType; 606 607 union { 608 /** 609 * GSM cellular information 610 */ 611 CellListRatGsm gsm; 612 /** 613 * LTE cellular information 614 */ 615 CellListRatLte lte; 616 /** 617 * WCDMA signal strength 618 */ 619 CellListRatWcdma wcdma; 620 /** 621 * CDMA signal strength 622 */ 623 CellRatCdma cdma; 624 /** 625 * TD-SCDMA signal strength 626 */ 627 CellRatTdscdma tdscdma; 628 /** 629 * NR signal strength 630 */ 631 CellRatNr nr; 632 } ServiceCellParas; 633 } CellInfo; 634 635 /** 636 * @brief Defines the cell information list. 637 */ 638 typedef struct { 639 /** 640 * Number 641 */ 642 int32_t itemNum; 643 /** 644 * Neighboring cell list 645 */ 646 CellInfo *cellNearbyInfo; 647 } CellInfoList; 648 649 /** 650 * @brief Defines the GSM cellular information. 651 */ 652 typedef struct { 653 /** 654 * Cell band information value:0~3 0:GSM850 1:GSM900 0:GSM1800 0:GSM1900 655 */ 656 int32_t band; 657 /** 658 * Absolute RF channel number of the BCCH carrier, which ranges from 0 to 1023 659 */ 660 int32_t arfcn; 661 /** 662 * Base transceiver station identity code 663 */ 664 int32_t bsic; 665 /** 666 * Cell ID 667 */ 668 int32_t cellId; 669 /** 670 * Location area code, which ranges from 0 to 0xFFFF 671 */ 672 int32_t lac; 673 /** 674 * Signal received strength, which ranges from -120 to 37 675 */ 676 int32_t rxlev; 677 /** 678 * Signal received quality, which ranges from 0 to 7 679 */ 680 int32_t rxQuality; 681 /** 682 * Timing advance, which ranges from 0 to 63 683 */ 684 int32_t ta; 685 } CellRatGsm; 686 687 /** 688 * @brief Defines the LTE cellular information. 689 */ 690 typedef struct { 691 /** 692 * Absolute Radio Frequency Channel Number of the BCCH carrier 0~1023 693 */ 694 int32_t arfcn; 695 /** 696 * Cell ID 697 */ 698 int32_t cellId; 699 /** 700 * Physical cell ID. 0~503 701 */ 702 int32_t pci; 703 /** 704 * Tracking Area Code 0~FFFF 705 */ 706 int32_t tac; 707 /** 708 * Reference Signal Received Power -140~-44, dBm 709 */ 710 int32_t rsrp; 711 /** 712 * Reference Signal Received Quality -19.5~-3 713 */ 714 int32_t rsrq; 715 /** 716 * Receiving signal strength in dbm 90~-25 717 */ 718 int32_t rssi; 719 } CellRatLte; 720 721 /** 722 * @brief Defines the WCDMA cellular information. 723 */ 724 typedef struct { 725 /** 726 * Absolute RF channel number of the BCCH carrier, which ranges from 0 to 16383 727 */ 728 int32_t arfcn; 729 /** 730 * Primary Scrambling Code. 0~511 731 */ 732 int32_t psc; 733 /** 734 * Cell ID 735 */ 736 int32_t cellId; 737 /** 738 * Location area code, which ranges from 0 to 0xFFFF 739 */ 740 int32_t lac; 741 /** 742 * Reference Signal Received Power -140~-44, dBm 743 */ 744 int32_t rscp; 745 /** 746 * Signal received strength, which ranges from -19 to -3 747 */ 748 int32_t rxlev; 749 /** 750 * Received signal strength in dbm, which ranges from -90 to -25 751 */ 752 int32_t ecno; 753 /** 754 * Discontinuous reception cycle, which ranges from 6 to 9 755 */ 756 int32_t drx; 757 /** 758 * UMTS Terrestrial Radio Access Network (UTRAN) registration zone ID 759 */ 760 int32_t ura; 761 } CellRatWcdma; 762 763 /** 764 * @brief Defines the current cell information vendor 765 */ 766 typedef struct { 767 /** 768 * Radio access technology type 769 */ 770 int32_t ratType; 771 /** 772 * Mobile country code (MCC) 773 */ 774 int32_t mcc; 775 /** 776 * Mobile network code (MNC) 777 */ 778 int32_t mnc; 779 780 union { 781 /** 782 * GSM cellular information 783 */ 784 CellRatGsm gsm; 785 /** 786 * LTE cellular information 787 */ 788 CellRatLte lte; 789 /** 790 * WCDMA cellular information 791 */ 792 CellRatWcdma wcdma; 793 /** 794 * CDMA cellular information 795 */ 796 CellRatCdma cdma; 797 /** 798 * TD-SCDMA cellular information 799 */ 800 CellRatTdscdma tdscdma; 801 /** 802 * NR cellular information 803 */ 804 CellRatNr nr; 805 } ServiceCellParas; 806 } CurrentCellInfoVendor; 807 808 /** 809 * @brief Defines the current cell information list 810 */ 811 typedef struct { 812 /** 813 * Number of cells 814 */ 815 int32_t itemNum; 816 /** 817 * Current cell information 818 */ 819 CurrentCellInfoVendor *currentCellInfo; 820 } CurrentCellInfoList; 821 822 typedef struct { 823 void (*GetImsRegStatus)(const ReqDataInfo *requestInfo); 824 void (*GetSignalStrength)(const ReqDataInfo *requestInfo); 825 void (*GetCsRegStatus)(const ReqDataInfo *requestInfo); 826 void (*GetPsRegStatus)(const ReqDataInfo *requestInfo); 827 void (*GetOperatorInfo)(const ReqDataInfo *requestInfo); 828 void (*GetNeighboringCellInfoList)(const ReqDataInfo *requestInfo); 829 void (*GetCurrentCellInfo)(const ReqDataInfo *requestInfo); 830 void (*GetNetworkSearchInformation)(const ReqDataInfo *requestInfo); 831 void (*GetNetworkSelectionMode)(const ReqDataInfo *requestInfo); 832 void (*SetNetworkSelectionMode)(const ReqDataInfo *requestInfo, const HRilSetNetworkModeInfo *data); 833 void (*GetPreferredNetwork)(const ReqDataInfo *requestInfo); 834 void (*SetPreferredNetwork)(const ReqDataInfo *requestInfo, const int32_t *data); 835 void (*GetPhysicalChannelConfig)(const ReqDataInfo *requestInfo); 836 void (*SetLocateUpdates)(const ReqDataInfo *requestInfo, HRilRegNotifyMode mode); 837 void (*SetNotificationFilter)(const ReqDataInfo *requestInfo, const int32_t *newFilter); 838 void (*SetDeviceState)(const ReqDataInfo *requestInfo, const int32_t *deviceStateType, const int32_t *deviceState); 839 void (*GetRrcConnectionState)(const ReqDataInfo *requestInfo); 840 void (*SetNrOptionMode)(const ReqDataInfo *requestInfo, const int32_t *data); 841 void (*GetNrOptionMode)(const ReqDataInfo *requestInfo); 842 void (*GetNrSsbId)(const ReqDataInfo *requestInfo); 843 } HRilNetworkReq; 844 #ifdef __cplusplus 845 } 846 #endif 847 #endif // OHOS_RIL_VENDOR_NETWORK_DEFS_H 848