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_SIM_PARCEL_H 17 #define OHOS_TEL_RIL_SIM_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 SIM card status information. 26 */ 27 struct CardStatusInfo { 28 /** SIM card index. */ 29 int32_t index = 0; 30 31 /** 32 * SIM card type: 33 * 0: unknown. 34 * 1: common SIM card. 35 * 2: USIM, supporting 4G. 36 */ 37 int32_t simType = 0; 38 39 /** 40 * SIM card status: 41 * 1: unknown 42 * 0: SIM card not inserted 43 * 1: SIM card detected normally 44 * 2: PIN required 45 * 3: PUK required 46 * 4: PIN2 required 47 * 5: PUK2 required 48 */ 49 int32_t simState = 0; 50 }; 51 52 /** 53 * @brief Defines the SIM card status information. 54 */ 55 struct SimCardStatusInfo { 56 /** SIM card index. */ 57 int32_t index = 0; 58 59 /** 60 * SIM card type: 61 * 0: unknown. 62 * 1: common SIM card. 63 * 2: USIM, supporting 4G. 64 */ 65 int32_t simType = 0; 66 67 /** 68 * SIM card status: 69 * 1: unknown 70 * 0: SIM card not inserted 71 * 1: SIM card detected normally 72 * 2: PIN required 73 * 3: PUK required 74 * 4: PIN2 required 75 * 5: PUK2 required 76 */ 77 int32_t simState = 0; 78 79 /** 80 * SIM card iccid: 81 */ 82 std::string iccid = ""; 83 }; 84 85 /** 86 * @brief Defines the SIM data request information in 3GPP TS 27.007 V4.3.0 87 * (2001-12) 8.18, + CRSM. 88 */ 89 struct SimIoRequestInfo { 90 /** Command passed on by the ME to the SIM; refer GSM 51.011 [28] */ 91 int32_t command = 0; 92 93 /** 94 * This is the identifier of an elementary datafile on SIM. 95 * Mandatory for every command except STATUS 96 */ 97 int32_t fileId = 0; 98 99 /** 100 * Parameters passed on by the MT to the SIM. 101 * These parameters are mandatory for every command, 102 * except GET RESPONSE and STATUS. 103 * The values are described in 3GPP TS 51.011 [28] 104 */ 105 int32_t p1 = 0; 106 int32_t p2 = 0; 107 int32_t p3 = 0; 108 109 /** 110 * Information which shall be written to the SIM(hexadecimal character 111 * format; refer +CSCS). 112 */ 113 std::string data = ""; 114 115 /** 116 * Contains the path of an elementary file on the SIM/UICC in hexadecimal 117 * format as defined in ETSI TS 102 221 [60] (e.g. "7F205F70" in SIM and 118 * UICC case). The <pathid> shall only be used in the mode "select by path 119 * from MF" as defined in ETSI TS 102 221 [60]. 120 */ 121 std::string path = ""; 122 123 /** Request serial number. */ 124 int32_t serial = 0; 125 126 /** PIN2 */ 127 std::string pin2 = ""; 128 129 /** App ID. */ 130 std::string aid = ""; 131 }; 132 133 /** 134 * @brief Defines the response to the SIM data request in 3GPP TS 27.007 V4.3.0 135 * (2001-12) 8.18, + CRSM. 136 */ 137 struct IccIoResultInfo { 138 /** 139 * Information from the SIM about the execution of the actual command. 140 * These parameters are delivered to the TE in both cases, on successful or 141 * failed execution of the command 142 */ 143 int32_t sw1 = 0; 144 int32_t sw2 = 0; 145 146 /** Response information */ 147 std::string response = ""; 148 }; 149 150 /** 151 * @brief Defines the SIM card lock information. 152 */ 153 struct SimLockInfo { 154 /** Request serial number. */ 155 int32_t serial = 0; 156 157 /** 158 * String type, which specifies the object operated by this command. 159 * "SC": SIM PIN1; 160 * "AO": prohibit all outgoing calls; 161 * "OI": All international outgoing calls are prohibited; 162 * "OX": All international outgoing calls are prohibited, except for the country of origin; 163 * "AI": All incoming calls are prohibited; 164 * "IR": When roaming outside the home area, all incoming calls are prohibited; 165 * "AB": prohibit all services (applicable only when <mode>=0); 166 * "AG": Outgoing call is prohibited (applicable only when <mode>=0); 167 * "AC": Incoming calls are prohibited (applicable only when <mode>=0); 168 * "FD": FDN; 169 * "PN": lock the network; 170 * "PU": lock subnet; 171 * "PP": Lock SP. 172 */ 173 std::string fac = ""; 174 175 /** 176 * Mode: 177 * 0: deactivation (When fac is set to PN, PU, or PP, the operation is equivalent to unlocking.) 178 * 1: activation (When fac is set to PN, PU, or PP, activation is not supported.) 179 * 2: query 180 */ 181 int32_t mode = 0; 182 183 /** 184 * SIM card lock status. 185 * It indicates the activation status of the first three layers of locks when fac is set to PN, PU, or PP. 186 * 0: not activated 187 * 1: activated 188 */ 189 int32_t status = 0; 190 191 /** Password text */ 192 std::string passwd = ""; 193 194 /** 195 * Service type. The value is the sum of integers that represent the service type. The default value is 255. 196 * 1: telephony service 197 * 2: data service 198 * 4: fax service 199 * 8: SMS service 200 * 16: data circuit sync 201 * 32: data circuit async 202 * 64: dedicated packet access 203 * 128: dedicated portable device (PAD) access 204 */ 205 int32_t classx = 0; 206 }; 207 208 /** 209 * @brief Defines the SIM card password information. 210 */ 211 struct SimPasswordInfo { 212 /** Request serial number. */ 213 int32_t serial = 0; 214 215 /** 216 * String type, which specifies the object operated by this command. 217 * “SC”:SIM PIN1; 218 * “P2”:SIM PIN2; 219 * "OI": All international outgoing calls are prohibited; 220 * "OX": All international outgoing calls are prohibited, except for the country of origin; 221 * "AI": All incoming calls are prohibited; 222 * "IR": When roaming outside the home area, all incoming calls are prohibited; 223 * "AB": prohibit all services (applicable only when <mode>=0); 224 * "AG": Outgoing call is prohibited (applicable only when <mode>=0); 225 * "AC": Incoming call service is prohibited (applicable only when <mode>=0). 226 */ 227 std::string fac = ""; 228 229 /** Old password text */ 230 std::string oldPassword = ""; 231 232 /** New password text */ 233 std::string newPassword = ""; 234 235 /** Max length of oldPassword or newPassword */ 236 int32_t passwordLength = 0; 237 }; 238 239 /** 240 * @brief Defines the maximum number of SIM password attempts. 241 */ 242 struct SimPinInputTimes { 243 /** Request serial number. */ 244 int32_t serial = 0; 245 246 /** 247 * Param of string. 248 * SIM PIN2 is mean that SIM PIN2 request. SIM PUK2 is mean that SIM PUK2 249 * request. 250 */ 251 std::string code = ""; 252 253 /** 254 * The remaining number of entries, for PIN2, the maximum number of entries is 3 times; 255 * for PUK2, the maximum number of entries is 10 times. 256 */ 257 int32_t times = 0; 258 259 /** 260 * The remaining number of PUK, the maximum number of entries is 10 times. 261 */ 262 int32_t pukTimes = 0; 263 264 /** 265 * The remaining number of PIN, the maximum number of entries is 3 times. 266 */ 267 int32_t pinTimes = 0; 268 269 /** 270 * The remaining number of PUK2, the maximum number of entries is 10 271 * times. 272 */ 273 int32_t puk2Times = 0; 274 275 /** 276 * The remaining number of PIN2, the maximum number of entries is 3 times. 277 */ 278 int32_t pin2Times = 0; 279 }; 280 281 /** 282 * @brief Defines the APDU data transmission request information. 283 */ 284 struct ApduSimIORequestInfo { 285 /** Request serial number. */ 286 int32_t serial = 0; 287 288 /** Channel ID */ 289 int32_t channelId = 0; 290 291 /** APDU instruction type. For details, see ETSI 102 221 [55]. */ 292 int32_t type = 0; 293 294 /** APDU instruction. For details, see ETSI 102 221 [55]. */ 295 int32_t instruction = 0; 296 297 /** 298 * Command parameter 1 of the SIM data request. For details, see 3GPP 299 * TS 51.011[28]. 300 */ 301 int32_t p1 = 0; 302 303 /** 304 * Command parameter 2 of the SIM data request. For details, see 3GPP 305 * TS 51.011[28]. 306 */ 307 int32_t p2 = 0; 308 309 /** 310 * Command parameter 3 of the SIM data request. For details, see 3GPP 311 * TS 51.011[28]. If p3 is a negative value, a 4-byte APDU is sent to the 312 * SIM card. 313 */ 314 int32_t p3 = 0; 315 316 /** Data to be transmitted */ 317 std::string data = ""; 318 }; 319 320 /** 321 * @brief Defines the SIM card authentication request information. 322 */ 323 struct SimAuthenticationRequestInfo { 324 /** Request serial number. */ 325 int32_t serial = 0; 326 327 /** App ID */ 328 std::string aid = ""; 329 330 /** Authentication data */ 331 std::string authData = ""; 332 }; 333 334 /** 335 * @brief Defines the Send SIM matched operator info request information. 336 */ 337 struct NcfgOperatorInfo { 338 /** Operator Name Matched with SIM card */ 339 std::string operName = ""; 340 341 /** Operator Key Matched with SIM card */ 342 std::string operKey = ""; 343 344 /** Current SIM State */ 345 int32_t state = 0; 346 347 /** Reserved Field */ 348 std::string reserve = ""; 349 }; 350 351 /** 352 * @brief Defines the response to the request for enabling the logical channel of the APDU. 353 */ 354 struct OpenLogicalChannelResponse { 355 /** 356 * Information from the SIM about the execution of the actual command. 357 * These parameters are delivered to the TE in both cases, on successful or 358 * failed execution of the command 359 */ 360 int32_t sw1 = 0; 361 362 /** 363 * Status word 2 of the SIM card, which is returned by the SIM card after 364 * command execution. 365 */ 366 int32_t sw2 = 0; 367 368 /** ID of the opened logical channel */ 369 int32_t channelId = 0; 370 371 /** Response information */ 372 std::string response = ""; 373 }; 374 375 /** 376 * @brief Defines the response to the request for unlocking the SIM card. 377 */ 378 struct LockStatusResp { 379 /** Query result. For details, see {@link RilErrType}. */ 380 int32_t result = 0; 381 382 /** Number of remaining attempts */ 383 int32_t remain = 0; 384 }; 385 } // namespace Telephony 386 } // namespace OHOS 387 #endif // OHOS_TEL_RIL_SIM_PARCEL_H 388