1/* 2 * Copyright (C) 2021-2023 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 16import {Callback} from "./basic"; 17import radio from "./@ohos.telephony.radio"; 18import data from "./@ohos.telephony.data"; 19import call from "./@ohos.telephony.call"; 20import sim from "./@ohos.telephony.sim"; 21 22/** 23 * Monitors telephony state updates of a device, including updates of the network state, 24 * signal strength, call state, the data link connection state and others. 25 * 26 * @namespace observer 27 * @syscap SystemCapability.Telephony.StateRegistry 28 * @since 6 29 */ 30declare namespace observer { 31 type NetworkState = radio.NetworkState; 32 type SignalInformation = radio.SignalInformation; 33 /** 34 * @systemapi Hide this for inner system use. 35 */ 36 type CellInformation = radio.CellInformation; 37 type DataConnectState = data.DataConnectState; 38 type RatType = radio.RadioTechnology; 39 type DataFlowType = data.DataFlowType; 40 type CallState = call.CallState; 41 type CardType = sim.CardType; 42 type SimState = sim.SimState; 43 44 /** 45 * Callback when the network state corresponding to the default sim card is updated. 46 * 47 * @permission ohos.permission.GET_NETWORK_INFO 48 * @param { string } type - networkStateChange. 49 * @param { Callback<NetworkState> } callback - Indicates the callback for 50 * getting an instance of the {@code NetworkState} class. 51 * @throws { BusinessError } 201 - Permission denied. 52 * @throws { BusinessError } 401 - Parameter error. 53 * @throws { BusinessError } 8300001 - Invalid parameter value. 54 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 55 * @throws { BusinessError } 8300003 - System internal error. 56 * @throws { BusinessError } 8300999 - Unknown error code. 57 * @syscap SystemCapability.Telephony.StateRegistry 58 * @since 6 59 */ 60 function on(type: 'networkStateChange', callback: Callback<NetworkState>): void; 61 62 /** 63 * Callback when the network state corresponding to the monitored {@code slotId} is updated. 64 * 65 * @permission ohos.permission.GET_NETWORK_INFO 66 * @param { string } type - networkStateChange. 67 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 68 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 69 * @param { Callback<NetworkState> } callback - Indicates the callback for getting 70 * an instance of the {@code NetworkState} class. 71 * @throws { BusinessError } 201 - Permission denied. 72 * @throws { BusinessError } 401 - Parameter error. 73 * @throws { BusinessError } 8300001 - Invalid parameter value. 74 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 75 * @throws { BusinessError } 8300003 - System internal error. 76 * @throws { BusinessError } 8300999 - Unknown error code. 77 * @syscap SystemCapability.Telephony.StateRegistry 78 * @since 6 79 */ 80 function on(type: 'networkStateChange', options: { slotId: number }, callback: Callback<NetworkState>): void; 81 82 /** 83 * Cancel callback when the network state is updated. 84 * 85 * @param { string } type - networkStateChange. 86 * @param { Callback<NetworkState> } callback - Indicates the callback to unsubscribe from the networkStateChange event. 87 * @throws { BusinessError } 401 - Parameter error. 88 * @throws { BusinessError } 8300001 - Invalid parameter value. 89 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 90 * @throws { BusinessError } 8300003 - System internal error. 91 * @throws { BusinessError } 8300999 - Unknown error code. 92 * @syscap SystemCapability.Telephony.StateRegistry 93 * @since 6 94 */ 95 function off(type: 'networkStateChange', callback?: Callback<NetworkState>): void; 96 97 /** 98 * Callback when the signal strength corresponding to the default sim card is updated. 99 * 100 * @param { string } type - signalInfoChange. 101 * @param { Callback<Array<SignalInformation>> } callback - Indicates the callback for getting 102 * an array of instances of the classes derived from {@link SignalInformation}. 103 * @throws { BusinessError } 401 - Parameter error. 104 * @throws { BusinessError } 8300001 - Invalid parameter value. 105 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 106 * @throws { BusinessError } 8300003 - System internal error. 107 * @throws { BusinessError } 8300999 - Unknown error code. 108 * @syscap SystemCapability.Telephony.StateRegistry 109 * @since 6 110 */ 111 function on(type: 'signalInfoChange', callback: Callback<Array<SignalInformation>>): void; 112 113 /** 114 * Callback when the signal strength corresponding to a monitored {@code slotId} is updated. 115 * 116 * @param { string } type - signalInfoChange. 117 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 118 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 119 * @param { Callback<Array<SignalInformation>> } callback - Indicates the callback for getting 120 * an array of instances of the classes derived from {@link SignalInformation}. 121 * @throws { BusinessError } 401 - Parameter error. 122 * @throws { BusinessError } 8300001 - Invalid parameter value. 123 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 124 * @throws { BusinessError } 8300003 - System internal error. 125 * @throws { BusinessError } 8300999 - Unknown error code. 126 * @syscap SystemCapability.Telephony.StateRegistry 127 * @since 6 128 */ 129 function on(type: 'signalInfoChange', options: { slotId: number }, callback: Callback<Array<SignalInformation>>): void; 130 131 /** 132 * Cancel callback when the signal strength is updated. 133 * 134 * @param { string } type - signalInfoChange. 135 * @param { Callback<NetworkState> } callback - Indicates the callback to unsubscribe from the signalInfoChange event. 136 * @throws { BusinessError } 401 - Parameter error. 137 * @throws { BusinessError } 8300001 - Invalid parameter value. 138 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 139 * @throws { BusinessError } 8300003 - System internal error. 140 * @throws { BusinessError } 8300999 - Unknown error code. 141 * @syscap SystemCapability.Telephony.StateRegistry 142 * @since 6 143 */ 144 function off(type: 'signalInfoChange', callback?: Callback<Array<SignalInformation>>): void; 145 146 /** 147 * Callback when the cell information corresponding to the default sim card is updated. 148 * 149 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 150 * @param { string } type - cellInfoChange. 151 * @param { Callback<Array<CellInformation>> } callback - Indicates the callback for getting 152 * an array of instances of the classes derived from {@link CellInformation}. 153 * @throws { BusinessError } 201 - Permission denied. 154 * @throws { BusinessError } 202 - Non-system applications use system APIs. 155 * @throws { BusinessError } 401 - Parameter error. 156 * @throws { BusinessError } 8300001 - Invalid parameter value. 157 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 158 * @throws { BusinessError } 8300003 - System internal error. 159 * @throws { BusinessError } 8300999 - Unknown error code. 160 * @syscap SystemCapability.Telephony.StateRegistry 161 * @systemapi Hide this for inner system use. 162 * @since 8 163 */ 164 function on(type: 'cellInfoChange', callback: Callback<Array<CellInformation>>): void; 165 166 /** 167 * Callback when the cell information corresponding to a monitored {@code slotId} is updated. 168 * 169 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 170 * @param { string } type - cellInfoChange. 171 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 172 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 173 * @param { Callback<Array<CellInformation>> } callback - Indicates the callback for getting 174 * an array of instances of the classes derived from {@link CellInformation}. 175 * @throws { BusinessError } 201 - Permission denied. 176 * @throws { BusinessError } 202 - Non-system applications use system APIs. 177 * @throws { BusinessError } 401 - Parameter error. 178 * @throws { BusinessError } 8300001 - Invalid parameter value. 179 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 180 * @throws { BusinessError } 8300003 - System internal error. 181 * @throws { BusinessError } 8300999 - Unknown error code. 182 * @syscap SystemCapability.Telephony.StateRegistry 183 * @systemapi Hide this for inner system use. 184 * @since 8 185 */ 186 function on(type: 'cellInfoChange', options: { slotId: number }, callback: Callback<Array<CellInformation>>): void; 187 188 /** 189 * Cancel callback when the cell information is updated. 190 * 191 * @param { string } type - cellInfoChange. 192 * @param { Callback<Array<CellInformation>> } callback - Indicates the callback to unsubscribe from 193 * the cellInfoChange event. 194 * @throws { BusinessError } 202 - Non-system applications use system APIs. 195 * @throws { BusinessError } 401 - Parameter error. 196 * @throws { BusinessError } 8300001 - Invalid parameter value. 197 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 198 * @throws { BusinessError } 8300003 - System internal error. 199 * @throws { BusinessError } 8300999 - Unknown error code. 200 * @syscap SystemCapability.Telephony.StateRegistry 201 * @systemapi Hide this for inner system use. 202 * @since 8 203 */ 204 function off(type: 'cellInfoChange', callback?: Callback<Array<CellInformation>>): void; 205 206 /** 207 * Callback when the cellular data link connection state corresponding to the default sim card is updated. 208 * 209 * @param { string } type - cellularDataConnectionStateChange. 210 * @param { Callback<{ state: DataConnectState, network: RatType }> } callback - Indicates the callback for 211 * getting the cellular data link connection state, and networkType Indicates the radio access technology 212 * for cellular data services. 213 * @throws { BusinessError } 401 - Parameter error. 214 * @throws { BusinessError } 8300001 - Invalid parameter value. 215 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 216 * @throws { BusinessError } 8300003 - System internal error. 217 * @throws { BusinessError } 8300999 - Unknown error code. 218 * @syscap SystemCapability.Telephony.StateRegistry 219 * @since 7 220 */ 221 function on(type: 'cellularDataConnectionStateChange', 222 callback: Callback<{ state: DataConnectState, network: RatType }>): void; 223 224 /** 225 * Callback when the cellular data link connection state corresponding to the monitored {@code slotId} is updated. 226 * 227 * @param { string } type - cellularDataConnectionStateChange. 228 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 229 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 230 * @param { Callback<{ state: DataConnectState, network: RatType }> } callback - Indicates the callback for 231 * getting the cellular data link connection state, and networkType Indicates the radio access technology for 232 * cellular data services. 233 * @throws { BusinessError } 401 - Parameter error. 234 * @throws { BusinessError } 8300001 - Invalid parameter value. 235 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 236 * @throws { BusinessError } 8300003 - System internal error. 237 * @throws { BusinessError } 8300999 - Unknown error code. 238 * @syscap SystemCapability.Telephony.StateRegistry 239 * @since 7 240 */ 241 function on(type: 'cellularDataConnectionStateChange', options: { slotId: number }, 242 callback: Callback<{ state: DataConnectState, network: RatType }>): void; 243 244 /** 245 * Cancel callback when the cellular data link connection state is updated. 246 * 247 * @param { string } type - cellularDataConnectionStateChange. 248 * @param { Callback<{ state: DataConnectState, network: RatType }> } callback - Indicates the callback to unsubscribe 249 * from the cellularDataConnectionStateChange event. 250 * @throws { BusinessError } 401 - Parameter error. 251 * @throws { BusinessError } 8300001 - Invalid parameter value. 252 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 253 * @throws { BusinessError } 8300003 - System internal error. 254 * @throws { BusinessError } 8300999 - Unknown error code. 255 * @syscap SystemCapability.Telephony.StateRegistry 256 * @since 7 257 */ 258 function off(type: 'cellularDataConnectionStateChange', 259 callback?: Callback<{ state: DataConnectState, network: RatType }>): void; 260 261 /** 262 * Callback when the uplink and downlink data flow state of cellular data services 263 * corresponding to the default sim card is updated. 264 * 265 * @param { string } type - cellularDataFlowChange. 266 * @param { Callback<DataFlowType> } callback - Indicates the callback for getting the cellular data flow state. 267 * @throws { BusinessError } 401 - Parameter error. 268 * @throws { BusinessError } 8300001 - Invalid parameter value. 269 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 270 * @throws { BusinessError } 8300003 - System internal error. 271 * @throws { BusinessError } 8300999 - Unknown error code. 272 * @syscap SystemCapability.Telephony.StateRegistry 273 * @since 7 274 */ 275 function on(type: 'cellularDataFlowChange', callback: Callback<DataFlowType>): void; 276 277 /** 278 * Callback when the uplink and downlink data flow state of cellular data services 279 * corresponding to the monitored {@code slotId} is updated. 280 * 281 * @param { string } type - cellularDataFlowChange. 282 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 283 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 284 * @param { Callback<DataFlowType> } callback - Indicates the callback for getting the cellular data flow state. 285 * @throws { BusinessError } 401 - Parameter error. 286 * @throws { BusinessError } 8300001 - Invalid parameter value. 287 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 288 * @throws { BusinessError } 8300003 - System internal error. 289 * @throws { BusinessError } 8300999 - Unknown error code. 290 * @syscap SystemCapability.Telephony.StateRegistry 291 * @since 7 292 */ 293 function on(type: 'cellularDataFlowChange', options: { slotId: number }, callback: Callback<DataFlowType>): void; 294 295 /** 296 * Cancel callback when the uplink and downlink data flow state of cellular data services is updated. 297 * 298 * @param { string } type - cellularDataFlowChange. 299 * @param { Callback<DataFlowType> } callback - Indicates the callback to unsubscribe from 300 * the cellularDataFlowChange event. 301 * @throws { BusinessError } 401 - Parameter error. 302 * @throws { BusinessError } 8300001 - Invalid parameter value. 303 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 304 * @throws { BusinessError } 8300003 - System internal error. 305 * @throws { BusinessError } 8300999 - Unknown error code. 306 * @syscap SystemCapability.Telephony.StateRegistry 307 * @since 7 308 */ 309 function off(type: 'cellularDataFlowChange', callback?: Callback<DataFlowType>): void; 310 311 /** 312 * Callback when the call state corresponding to the default sim card is updated. 313 * 314 * @param { string } type - callStateChange. 315 * @param { Callback<{ state: CallState, number: string }> } callback - Indicates the callback for 316 * getting the call state and the called number. 317 * @throws { BusinessError } 401 - Parameter error. 318 * @throws { BusinessError } 8300001 - Invalid parameter value. 319 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 320 * @throws { BusinessError } 8300003 - System internal error. 321 * @throws { BusinessError } 8300999 - Unknown error code. 322 * @syscap SystemCapability.Telephony.StateRegistry 323 * @since 6 324 */ 325 function on(type: 'callStateChange', callback: Callback<{ state: CallState, number: string }>): void; 326 327 /** 328 * Callback when the call state corresponding to the monitored {@code slotId} is updated. 329 * 330 * @param { string } type - callStateChange. 331 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 332 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 333 * @param { Callback<{ state: CallState, number: string }> } callback - Indicates the callback for 334 * getting the call state and the called number. 335 * @throws { BusinessError } 401 - Parameter error. 336 * @throws { BusinessError } 8300001 - Invalid parameter value. 337 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 338 * @throws { BusinessError } 8300003 - System internal error. 339 * @throws { BusinessError } 8300999 - Unknown error code. 340 * @syscap SystemCapability.Telephony.StateRegistry 341 * @since 6 342 */ 343 function on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ state: CallState, number: string }>): void; 344 345 /** 346 * Cancel callback when the call state is updated. 347 * 348 * @param { string } type - callStateChange. 349 * @param { Callback<{ state: CallState, number: string }> } callback - Indicates the callback to 350 * unsubscribe from the callStateChange event. 351 * @throws { BusinessError } 401 - Parameter error. 352 * @throws { BusinessError } 8300001 - Invalid parameter value. 353 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 354 * @throws { BusinessError } 8300003 - System internal error. 355 * @throws { BusinessError } 8300999 - Unknown error code. 356 * @syscap SystemCapability.Telephony.StateRegistry 357 * @since 6 358 */ 359 function off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: string }>): void; 360 361 /** 362 * If type is 'cfuIndicatorChange', Receives a CFU setting update. This callback is invoked when the CFU setting 363 * of a specified card updates and the observer is added to monitor the updates. 364 * 365 * If type is 'voiceMailMsgIndicatorChange', Receives a voice mailbox state change. This callback is invoked when 366 * the voice mailbox state of a specified card updates and the observer is added to monitor the updates. 367 * 368 * @permission ohos.permission.GET_TELEPHONY_STATE 369 * @param { string } type - cfuIndicatorChange or voiceMailMsgIndicatorChange. 370 * @param { Callback<boolean> } callback - If type is 'cfuIndicatorChange', specifies whether the CFU function is 371 * enabled. If type is 'voiceMailMsgIndicatorChange', specifies whether a voice mailbox message exists. 372 * @throws { BusinessError } 202 - Non-system applications use system APIs. 373 * @throws { BusinessError } 401 - Parameter error. 374 * @throws { BusinessError } 8300001 - Invalid parameter value. 375 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 376 * @throws { BusinessError } 8300003 - System internal error. 377 * @throws { BusinessError } 8300999 - Unknown error code. 378 * @syscap SystemCapability.Telephony.StateRegistry 379 * @systemapi Hide this for inner system use. 380 * @since 10 381 */ 382 function on(type: 'cfuIndicatorChange' | 'voiceMailMsgIndicatorChange', callback: Callback<boolean>): void; 383 384 /** 385 * If type is 'cfuIndicatorChange', Receives a CFU setting update. This callback is invoked when the CFU setting 386 * of a specified card updates and the observer is added to monitor the updates. 387 * 388 * If type is 'voiceMailMsgIndicatorChange', Receives a voice mailbox state change. This callback is invoked when 389 * the voice mailbox state of a specified card updates and the observer is added to monitor the updates. 390 * 391 * @permission ohos.permission.GET_TELEPHONY_STATE 392 * @param { string } type - cfuIndicatorChange or voiceMailMsgIndicatorChange. 393 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 394 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 395 * @param { Callback<boolean> } callback - If type is 'cfuIndicatorChange', specifies whether the CFU function is 396 * enabled. If type is 'voiceMailMsgIndicatorChange', specifies whether a voice mailbox message exists. 397 * @throws { BusinessError } 202 - Non-system applications use system APIs. 398 * @throws { BusinessError } 401 - Parameter error. 399 * @throws { BusinessError } 8300001 - Invalid parameter value. 400 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 401 * @throws { BusinessError } 8300003 - System internal error. 402 * @throws { BusinessError } 8300999 - Unknown error code. 403 * @syscap SystemCapability.Telephony.StateRegistry 404 * @systemapi Hide this for inner system use. 405 * @since 10 406 */ 407 function on(type: 'cfuIndicatorChange' | 'voiceMailMsgIndicatorChange', options: { slotId: number }, 408 callback: Callback<boolean>): void; 409 410 /** 411 * If type is 'cfuIndicatorChange', Receives a CFU setting update. This callback is invoked when the CFU setting 412 * of a specified card updates and the observer is delete. 413 * 414 * If type is 'voiceMailMsgIndicatorChange', Receives a voice mailbox state change. This callback is invoked when 415 * the voice mailbox state of a specified card updates and the observer is delete. 416 * 417 * @param { string } type - cfuIndicatorChange or voiceMailMsgIndicatorChange. 418 * @param { Callback<boolean> } callback - If type is 'cfuIndicatorChange', specifies whether the CFU function is 419 * enabled. If type is 'voiceMailMsgIndicatorChange', specifies whether a voice mailbox message exists. 420 * @throws { BusinessError } 202 - Non-system applications use system APIs. 421 * @throws { BusinessError } 401 - Parameter error. 422 * @throws { BusinessError } 8300001 - Invalid parameter value. 423 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 424 * @throws { BusinessError } 8300003 - System internal error. 425 * @throws { BusinessError } 8300999 - Unknown error code. 426 * @syscap SystemCapability.Telephony.StateRegistry 427 * @systemapi Hide this for inner system use. 428 * @since 10 429 */ 430 function off(type: 'cfuIndicatorChange' | 'voiceMailMsgIndicatorChange', callback?: Callback<boolean>): void; 431 432 /** 433 * Callback when the sim state corresponding to the default sim card is updated. 434 * 435 * @param { string } type - simStateChange. 436 * @param { Callback<SimStateData> } callback - Indicates the callback for getting the SimStateData object. 437 * including state Indicates the sim state, and reason Indicates the cause of the change. 438 * @throws { BusinessError } 401 - Parameter error. 439 * @throws { BusinessError } 8300001 - Invalid parameter value. 440 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 441 * @throws { BusinessError } 8300003 - System internal error. 442 * @throws { BusinessError } 8300999 - Unknown error code. 443 * @syscap SystemCapability.Telephony.StateRegistry 444 * @since 7 445 */ 446 function on(type: 'simStateChange', callback: Callback<SimStateData>): void; 447 448 /** 449 * Callback when the sim state corresponding to the monitored {@code slotId} is updated. 450 * 451 * @param { string } type - simStateChange. 452 * @param { { slotId: number } } options - Indicates the ID of the target card slot. 453 * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 454 * @param { Callback<SimStateData> } callback - Indicates the callback for getting the SimStateData object. 455 * @throws { BusinessError } 401 - Parameter error. 456 * @throws { BusinessError } 8300001 - Invalid parameter value. 457 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 458 * @throws { BusinessError } 8300003 - System internal error. 459 * @throws { BusinessError } 8300999 - Unknown error code. 460 * @syscap SystemCapability.Telephony.StateRegistry 461 * @since 7 462 */ 463 function on(type: 'simStateChange', options: { slotId: number }, callback: Callback<SimStateData>): void; 464 465 /** 466 * Cancel callback when the sim state is updated. 467 * 468 * @param { string } type - simStateChange. 469 * @param { Callback<SimStateData> } callback - Indicates the callback to unsubscribe from the simStateChange event. 470 * @throws { BusinessError } 401 - Parameter error. 471 * @throws { BusinessError } 8300001 - Invalid parameter value. 472 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 473 * @throws { BusinessError } 8300003 - System internal error. 474 * @throws { BusinessError } 8300999 - Unknown error code. 475 * @syscap SystemCapability.Telephony.StateRegistry 476 * @since 7 477 */ 478 function off(type: 'simStateChange', callback?: Callback<SimStateData>): void; 479 480 /** 481 * Receives an ICC account change. This callback is invoked when the ICC account updates 482 * and the observer is added to monitor the updates. 483 * 484 * @param { 'iccAccountInfoChange' } type - iccAccountInfoChange 485 * @param { Callback<void> } callback - including state Indicates the ICC account information, 486 * and reason Indicates the cause of the change. 487 * @throws { BusinessError } 401 - Parameter error. 488 * @throws { BusinessError } 8300001 - Invalid parameter value. 489 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 490 * @throws { BusinessError } 8300003 - System internal error. 491 * @throws { BusinessError } 8300999 - Unknown error code. 492 * @syscap SystemCapability.Telephony.StateRegistry 493 * @since 10 494 */ 495 function on(type: 'iccAccountInfoChange', callback: Callback<void>): void; 496 497 /** 498 * Cancel to receive an ICC account change. 499 * 500 * @param { 'iccAccountInfoChange' } type - iccAccountInfoChange 501 * @param { Callback<void> } callback - including state Indicates the ICC account information, 502 * and reason Indicates the cause of the change. 503 * @throws { BusinessError } 401 - Parameter error. 504 * @throws { BusinessError } 8300001 - Invalid parameter value. 505 * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service. 506 * @throws { BusinessError } 8300003 - System internal error. 507 * @throws { BusinessError } 8300999 - Unknown error code. 508 * @syscap SystemCapability.Telephony.StateRegistry 509 * @since 10 510 */ 511 function off(type: 'iccAccountInfoChange', callback?: Callback<void>): void; 512 513 /** 514 * Indicates SIM card type and status. 515 * 516 * @interface SimStateData 517 * @syscap SystemCapability.Telephony.StateRegistry 518 * @since 7 519 */ 520 export interface SimStateData { 521 /** 522 * Indicates the SIM card type. 523 * 524 * @type { CardType } 525 * @syscap SystemCapability.Telephony.StateRegistry 526 * @since 7 527 */ 528 type: CardType; 529 530 /** 531 * Indicates the SIM card states. 532 * 533 * @type { SimState } 534 * @syscap SystemCapability.Telephony.StateRegistry 535 * @since 7 536 */ 537 state: SimState; 538 539 /** 540 * Indicates the SIM card lock type. 541 * 542 * @type { LockReason } 543 * @syscap SystemCapability.Telephony.StateRegistry 544 * @since 8 545 */ 546 reason: LockReason; 547 } 548 549 /** 550 * Enum for SIM card lock type. 551 * 552 * @enum { number } 553 * @syscap SystemCapability.Telephony.StateRegistry 554 * @since 8 555 */ 556 export enum LockReason { 557 /** 558 * Indicates no SIM lock. 559 * 560 * @syscap SystemCapability.Telephony.StateRegistry 561 * @since 8 562 */ 563 SIM_NONE, 564 565 /** 566 * Indicates the PIN lock. 567 * 568 * @syscap SystemCapability.Telephony.StateRegistry 569 * @since 8 570 */ 571 SIM_PIN, 572 573 /** 574 * Indicates the PUK lock. 575 * 576 * @syscap SystemCapability.Telephony.StateRegistry 577 * @since 8 578 */ 579 SIM_PUK, 580 581 /** 582 * Indicates network personalization of PIN lock(refer 3GPP TS 22.022 [33]). 583 * 584 * @syscap SystemCapability.Telephony.StateRegistry 585 * @since 8 586 */ 587 SIM_PN_PIN, 588 589 /** 590 * Indicates network personalization of PUK lock(refer 3GPP TS 22.022 [33]). 591 * 592 * @syscap SystemCapability.Telephony.StateRegistry 593 * @since 8 594 */ 595 SIM_PN_PUK, 596 597 /** 598 * Indicates network subset personalization of PIN lock(refer 3GPP TS 22.022 [33]). 599 * 600 * @syscap SystemCapability.Telephony.StateRegistry 601 * @since 8 602 */ 603 SIM_PU_PIN, 604 605 /** 606 * Indicates network subset personalization of PUK lock(refer 3GPP TS 22.022 [33]). 607 * 608 * @syscap SystemCapability.Telephony.StateRegistry 609 * @since 8 610 */ 611 SIM_PU_PUK, 612 613 /** 614 * Indicates service provider personalization of PIN lock(refer 3GPP TS 22.022 [33]). 615 * 616 * @syscap SystemCapability.Telephony.StateRegistry 617 * @since 8 618 */ 619 SIM_PP_PIN, 620 621 /** 622 * Indicates service provider personalization of PUK lock(refer 3GPP TS 22.022 [33]). 623 * 624 * @syscap SystemCapability.Telephony.StateRegistry 625 * @since 8 626 */ 627 SIM_PP_PUK, 628 629 /** 630 * Indicates corporate personalization of PIN lock(refer 3GPP TS 22.022 [33]). 631 * 632 * @syscap SystemCapability.Telephony.StateRegistry 633 * @since 8 634 */ 635 SIM_PC_PIN, 636 637 /** 638 * Indicates corporate personalization of PUK lock(refer 3GPP TS 22.022 [33]). 639 * 640 * @syscap SystemCapability.Telephony.StateRegistry 641 * @since 8 642 */ 643 SIM_PC_PUK, 644 645 /** 646 * Indicates SIM/USIM personalization of PIN lock(refer 3GPP TS 22.022 [33]). 647 * 648 * @syscap SystemCapability.Telephony.StateRegistry 649 * @since 8 650 */ 651 SIM_SIM_PIN, 652 653 /** 654 * Indicates SIM/USIM personalization of PUK lock(refer 3GPP TS 22.022 [33]). 655 * 656 * @syscap SystemCapability.Telephony.StateRegistry 657 * @since 8 658 */ 659 SIM_SIM_PUK, 660 } 661} 662 663export default observer; 664