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_TYPES_H 17 #define OHOS_TEL_RIL_TYPES_H 18 19 #include <locale> 20 21 namespace OHOS { 22 namespace Telephony { 23 enum class ErrType : int32_t { 24 /** No error */ 25 NONE = 0, 26 27 /** An error that not included in bellow items */ 28 ERR_GENERIC_FAILURE, 29 30 /** Invalid parameter */ 31 ERR_INVALID_PARAMETER, 32 33 /** Full memory */ 34 ERR_MEMORY_FULL, 35 36 /** Send command failed */ 37 ERR_CMD_SEND_FAILURE, 38 39 /** NO CARRIER response returned */ 40 ERR_CMD_NO_CARRIER, 41 42 /** The response is invalid */ 43 ERR_INVALID_RESPONSE, 44 45 /** The new status of radio to set is same with previous */ 46 ERR_REPEAT_STATUS, 47 48 /** Network search error */ 49 ERR_NETWORK_SEARCHING, 50 51 /** Network search interrupted */ 52 ERR_NETWORK_SEARCHING_INTERRUPTED, 53 54 /** The AT channel is closed */ 55 ERR_MODEM_DEVICE_CLOSE, 56 57 /** No sim card error */ 58 ERR_NO_SIMCARD_INSERTED, 59 60 /** Need pin code */ 61 ERR_NEED_PIN_CODE, 62 63 /** Need puk code */ 64 ERR_NEED_PUK_CODE, 65 66 /** Network search timeout */ 67 ERR_NETWORK_SEARCH_TIMEOUT, 68 69 /** Pin or puk password is not correct */ 70 ERR_PINPUK_PASSWORD_NOCORRECT, 71 72 /** Invalid modem parameter */ 73 ERR_INVALID_MODEM_PARAMETER = 50, 74 75 /** IPC failure */ 76 ERR_HDF_IPC_FAILURE = 300, 77 78 /** Null point error */ 79 ERR_NULL_POINT, 80 81 /** Vendor not implement error. */ 82 ERR_VENDOR_NOT_IMPLEMENT 83 }; 84 85 /** 86 * @brief Indicates the response type. 87 */ 88 enum ResponseTypes { 89 RESPONSE_REQUEST, 90 RESPONSE_NOTICE, 91 RESPONSE_REQUEST_ACK, 92 RESPONSE_REQUEST_MUST_ACK, 93 RESPONSE_NOTICE_MUST_ACK, 94 }; 95 96 /** 97 * @brief From 3GPP TS 27.007 V4.3.0 (2001-12) 8.5, AT + CSQ. 98 */ 99 struct GsmRssi { 100 /** 101 * Received Signal Strength Indication, value range 0 ~ 31, max is 99, 102 * if unknown then set to max 103 */ 104 int32_t rxlev = 0; 105 106 /** 107 * Bit error rate, value range 0 ~ 7, max is 99, if unknown then set to 108 * max as RXQUAL values in the table in TS 45.008 [20] subclauses 8.2.4. 109 */ 110 int32_t ber = 0; 111 }; 112 113 /** 114 * @brief From 3GPP TS 27.007 V17.1.0 (2021-03) 8.69. 115 */ 116 struct CdmaRssi { 117 /** 118 * Absolute value of signal strength. This value is the actual Rssi value 119 * multiplied by -1. e.g: Rssi is -75, then this response value will be 75. 120 */ 121 int32_t absoluteRssi = 0; 122 123 /** 124 * integer type, ratio of the received energy per PN chip to the total 125 * received power spectral density (see 3GPP TS 25.133 [95] subclauses) 126 */ 127 int32_t ecno = 0; 128 }; 129 130 /** 131 * @brief Indicates some parameters which can reflect the strength of WCDMA signal. 132 */ 133 struct WCdmaRssi { 134 /** 135 * integer type, received signal strength level (see 3GPP TS 45.008 [20] 136 * sub-clause 8.1.4) value 0~99. 137 */ 138 int32_t rxlev = 0; 139 140 /** 141 * integer type, ratio of the received energy per PN chip to the total 142 * received power spectral density (see 3GPP TS 25.133 [95] sub-clause). 143 */ 144 int32_t ecio = 0; 145 146 /** 147 * integer type, received signal code power (see 3GPP TS 25.133 [95] 148 * sub-clause 9.1.1.3 and 3GPP TS 25.123 [96] sub-clause 9.1.1.1.3). 149 * range value 0 ~ 96, 255 not known or not detectable. 150 */ 151 int32_t rscp = 0; 152 153 /** 154 * Bit error rate, value range 0 ~ 7, max is 99, if unknown then set to 155 * max 156 */ 157 int32_t ber = 0; 158 }; 159 160 /** 161 * @brief Indicates some parameters which can reflect the strength of LTE signal. 162 */ 163 struct LteRssi { 164 /** 165 * integer type, received signal strength level 166 * (see 3GPP TS 45.008 [20] sub-clause 8.1.4) value 0~99. 167 */ 168 int32_t rxlev = 0; 169 170 /** 171 * integer type, reference signal received quality (see 3GPP TS 36.133 [96] sub-clause 9.1.7) 172 * value range 0~33, 255 not known or not detectable. 173 */ 174 int32_t rsrq = 0; 175 176 /** 177 * integer type, reference signal received power (see 3GPP TS 36.133 [96] sub-clause 9.1.4) 178 * value range 0~97, 255 not known or not detectable. 179 */ 180 int32_t rsrp = 0; 181 182 /** 183 * integer type, representing the signal-to-interference plus noise ratio, suitable for LTE mode 184 * value range 0~251, 255 not known or not detectable. 185 */ 186 int32_t snr = 0; 187 }; 188 189 /** 190 * @brief Indicates some parameters which can reflect the strength of TD-SCDMA signal. 191 */ 192 struct TdScdmaRssi { 193 int32_t rscp = 0; 194 }; 195 196 /** 197 * @brief Indicates some parameters which can reflect the strength of NR signal. 198 */ 199 struct NrRssi { 200 int32_t rsrp = 0; 201 int32_t rsrq = 0; 202 int32_t sinr = 0; 203 }; 204 205 /** 206 * @brief Indicates signal level of some RATs. 207 */ 208 struct Rssi { 209 GsmRssi gw; 210 CdmaRssi cdma; 211 WCdmaRssi wcdma; 212 LteRssi lte; 213 TdScdmaRssi tdScdma; 214 NrRssi nr; 215 }; 216 217 struct ResponseHeadInfo { 218 int32_t slotId = 0; 219 ResponseTypes type = ResponseTypes::RESPONSE_REQUEST; 220 }; 221 222 /** 223 * @brief Indicates the response information, for example whether the 224 * request is success, serial number, response type etc. 225 */ 226 struct RadioResponseInfo { 227 int32_t flag = -1; 228 int32_t serial = -1; 229 ErrType error = ErrType::NONE; 230 ResponseTypes type = ResponseTypes::RESPONSE_REQUEST; 231 }; 232 233 struct RadioStateInfo { 234 int64_t flag = 0; 235 int32_t state = 0; 236 }; 237 238 enum CommonNumber { 239 DEC = 10, 240 INVALID_HEX_CHAR = 16, 241 UPPER_CASE_LETTERS_OFFSET = 32, 242 RIL_ADAPTER_RADIO_INDICATION = 2001, 243 RIL_ADAPTER_RADIO_RESPONSE = 2002, 244 RIL_ADAPTER_RADIO_SEND_ACK, 245 }; 246 } // namespace Telephony 247 } // namespace OHOS 248 #endif // OHOS_TEL_RIL_TYPES_H 249