161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (C) 2021-2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit TelephonyKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { Callback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type radio from './@ohos.telephony.radio'; 2361847f8eSopenharmony_ciimport type data from './@ohos.telephony.data'; 2461847f8eSopenharmony_ciimport type call from './@ohos.telephony.call'; 2561847f8eSopenharmony_ciimport type sim from './@ohos.telephony.sim'; 2661847f8eSopenharmony_ci 2761847f8eSopenharmony_ci/** 2861847f8eSopenharmony_ci * Monitors telephony state updates of a device, including updates of the network state, 2961847f8eSopenharmony_ci * signal strength, call state, the data link connection state and others. 3061847f8eSopenharmony_ci * 3161847f8eSopenharmony_ci * @namespace observer 3261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 3361847f8eSopenharmony_ci * @since 6 3461847f8eSopenharmony_ci */ 3561847f8eSopenharmony_cideclare namespace observer { 3661847f8eSopenharmony_ci /** 3761847f8eSopenharmony_ci * Describes the network registration state. 3861847f8eSopenharmony_ci * 3961847f8eSopenharmony_ci * @typedef { radio.NetworkState } 4061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 4161847f8eSopenharmony_ci * @since 6 4261847f8eSopenharmony_ci */ 4361847f8eSopenharmony_ci type NetworkState = radio.NetworkState; 4461847f8eSopenharmony_ci 4561847f8eSopenharmony_ci /** 4661847f8eSopenharmony_ci * Describes the signal strength information. 4761847f8eSopenharmony_ci * 4861847f8eSopenharmony_ci * @typedef { radio.SignalInformation } 4961847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 5061847f8eSopenharmony_ci * @since 6 5161847f8eSopenharmony_ci */ 5261847f8eSopenharmony_ci type SignalInformation = radio.SignalInformation; 5361847f8eSopenharmony_ci 5461847f8eSopenharmony_ci /** 5561847f8eSopenharmony_ci * Describes current cell information. 5661847f8eSopenharmony_ci * 5761847f8eSopenharmony_ci * @typedef { radio.CellInformation } 5861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 5961847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 6061847f8eSopenharmony_ci * @since 6 6161847f8eSopenharmony_ci */ 6261847f8eSopenharmony_ci type CellInformation = radio.CellInformation; 6361847f8eSopenharmony_ci 6461847f8eSopenharmony_ci /** 6561847f8eSopenharmony_ci * Describes the cellular data link connection state. 6661847f8eSopenharmony_ci * 6761847f8eSopenharmony_ci * @typedef { data.DataConnectState } 6861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 6961847f8eSopenharmony_ci * @since 6 7061847f8eSopenharmony_ci */ 7161847f8eSopenharmony_ci type DataConnectState = data.DataConnectState; 7261847f8eSopenharmony_ci 7361847f8eSopenharmony_ci /** 7461847f8eSopenharmony_ci * Describes the radio access technology. 7561847f8eSopenharmony_ci * 7661847f8eSopenharmony_ci * @typedef { radio.RadioTechnology } 7761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 7861847f8eSopenharmony_ci * @since 6 7961847f8eSopenharmony_ci */ 8061847f8eSopenharmony_ci type RatType = radio.RadioTechnology; 8161847f8eSopenharmony_ci 8261847f8eSopenharmony_ci /** 8361847f8eSopenharmony_ci * Describes the cellular data flow type. 8461847f8eSopenharmony_ci * 8561847f8eSopenharmony_ci * @typedef { data.DataFlowType } 8661847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 8761847f8eSopenharmony_ci * @since 6 8861847f8eSopenharmony_ci */ 8961847f8eSopenharmony_ci type DataFlowType = data.DataFlowType; 9061847f8eSopenharmony_ci 9161847f8eSopenharmony_ci /** 9261847f8eSopenharmony_ci * Indicates the states of call. 9361847f8eSopenharmony_ci * 9461847f8eSopenharmony_ci * @typedef { call.CallState } 9561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 9661847f8eSopenharmony_ci * @since 6 9761847f8eSopenharmony_ci */ 9861847f8eSopenharmony_ci type CallState = call.CallState; 9961847f8eSopenharmony_ci 10061847f8eSopenharmony_ci /** 10161847f8eSopenharmony_ci * Indicates the SIM card types. 10261847f8eSopenharmony_ci * 10361847f8eSopenharmony_ci * @typedef { sim.CardType } 10461847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 10561847f8eSopenharmony_ci * @since 6 10661847f8eSopenharmony_ci */ 10761847f8eSopenharmony_ci type CardType = sim.CardType; 10861847f8eSopenharmony_ci 10961847f8eSopenharmony_ci /** 11061847f8eSopenharmony_ci * Indicates the SIM card states. 11161847f8eSopenharmony_ci * 11261847f8eSopenharmony_ci * @typedef { sim.SimState } 11361847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 11461847f8eSopenharmony_ci * @since 6 11561847f8eSopenharmony_ci */ 11661847f8eSopenharmony_ci type SimState = sim.SimState; 11761847f8eSopenharmony_ci 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * Callback when the network state corresponding to the default sim card is updated. 12061847f8eSopenharmony_ci * 12161847f8eSopenharmony_ci * @permission ohos.permission.GET_NETWORK_INFO 12261847f8eSopenharmony_ci * @param { 'networkStateChange' } type - Event type. Indicates the networkStateChange event to be subscribed to. 12361847f8eSopenharmony_ci * @param { Callback<NetworkState> } callback - Indicates the callback for 12461847f8eSopenharmony_ci * getting an instance of the {@code NetworkState} class. 12561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 12661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 12761847f8eSopenharmony_ci * 2. Incorrect parameter types. 12861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 12961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 13061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 13161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 13261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 13361847f8eSopenharmony_ci * @since 6 13461847f8eSopenharmony_ci */ 13561847f8eSopenharmony_ci function on(type: 'networkStateChange', callback: Callback<NetworkState>): void; 13661847f8eSopenharmony_ci 13761847f8eSopenharmony_ci /** 13861847f8eSopenharmony_ci * Callback when the network state corresponding to the monitored {@code slotId} is updated. 13961847f8eSopenharmony_ci * 14061847f8eSopenharmony_ci * @permission ohos.permission.GET_NETWORK_INFO 14161847f8eSopenharmony_ci * @param { 'networkStateChange' } type - Event type. Indicates the networkStateChange event to be subscribed to. 14261847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 14361847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 14461847f8eSopenharmony_ci * @param { Callback<NetworkState> } callback - Indicates the callback for getting 14561847f8eSopenharmony_ci * an instance of the {@code NetworkState} class. 14661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 14761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 14861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 14961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 15061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 15161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 15261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 15361847f8eSopenharmony_ci * @since 6 15461847f8eSopenharmony_ci */ 15561847f8eSopenharmony_ci /** 15661847f8eSopenharmony_ci * Callback when the network state corresponding to the monitored {@code slotId} is updated. 15761847f8eSopenharmony_ci * 15861847f8eSopenharmony_ci * @permission ohos.permission.GET_NETWORK_INFO 15961847f8eSopenharmony_ci * @param { 'networkStateChange' } type - Event type. Indicates the networkStateChange event to be subscribed to. 16061847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 16161847f8eSopenharmony_ci * @param { Callback<NetworkState> } callback - Indicates the callback for getting 16261847f8eSopenharmony_ci * an instance of the {@code NetworkState} class. 16361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 16461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 16561847f8eSopenharmony_ci * 2. Incorrect parameter types. 16661847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 16761847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 16861847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 16961847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 17061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 17161847f8eSopenharmony_ci * @since 11 17261847f8eSopenharmony_ci */ 17361847f8eSopenharmony_ci function on(type: 'networkStateChange', options: ObserverOptions, callback: Callback<NetworkState>): void; 17461847f8eSopenharmony_ci 17561847f8eSopenharmony_ci /** 17661847f8eSopenharmony_ci * Cancel callback when the network state is updated. 17761847f8eSopenharmony_ci * 17861847f8eSopenharmony_ci * @param { 'networkStateChange' } type - Event type. Indicates the networkStateChange event to unsubscribe from. 17961847f8eSopenharmony_ci * @param { Callback<NetworkState> } callback - Indicates the callback for getting 18061847f8eSopenharmony_ci * an instance of the {@code NetworkState} class. 18161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 18261847f8eSopenharmony_ci * 2. Incorrect parameter types. 18361847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 18461847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 18561847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 18661847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 18761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 18861847f8eSopenharmony_ci * @since 6 18961847f8eSopenharmony_ci */ 19061847f8eSopenharmony_ci function off(type: 'networkStateChange', callback?: Callback<NetworkState>): void; 19161847f8eSopenharmony_ci 19261847f8eSopenharmony_ci /** 19361847f8eSopenharmony_ci * Callback when the signal strength corresponding to the default sim card is updated. 19461847f8eSopenharmony_ci * 19561847f8eSopenharmony_ci * @param { 'signalInfoChange' } type - Event type. Indicates the signalInfoChange event to be subscribed to. 19661847f8eSopenharmony_ci * @param { Callback<Array<SignalInformation>> } callback - Indicates the callback for getting 19761847f8eSopenharmony_ci * an array of instances of the classes derived from {@link SignalInformation}. 19861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 19961847f8eSopenharmony_ci * 2. Incorrect parameter types. 20061847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 20161847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 20261847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 20361847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 20461847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 20561847f8eSopenharmony_ci * @since 6 20661847f8eSopenharmony_ci */ 20761847f8eSopenharmony_ci function on(type: 'signalInfoChange', callback: Callback<Array<SignalInformation>>): void; 20861847f8eSopenharmony_ci 20961847f8eSopenharmony_ci /** 21061847f8eSopenharmony_ci * Callback when the signal strength corresponding to a monitored {@code slotId} is updated. 21161847f8eSopenharmony_ci * 21261847f8eSopenharmony_ci * @param { 'signalInfoChange' } type - Event type. Indicates the signalInfoChange event to be subscribed to. 21361847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 21461847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 21561847f8eSopenharmony_ci * @param { Callback<Array<SignalInformation>> } callback - Indicates the callback for getting 21661847f8eSopenharmony_ci * an array of instances of the classes derived from {@link SignalInformation}. 21761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 21861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 21961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 22061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 22161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 22261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 22361847f8eSopenharmony_ci * @since 6 22461847f8eSopenharmony_ci */ 22561847f8eSopenharmony_ci /** 22661847f8eSopenharmony_ci * Callback when the signal strength corresponding to a monitored {@code slotId} is updated. 22761847f8eSopenharmony_ci * 22861847f8eSopenharmony_ci * @param { 'signalInfoChange' } type - Event type. Indicates the signalInfoChange event to be subscribed to. 22961847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 23061847f8eSopenharmony_ci * @param { Callback<Array<SignalInformation>> } callback - Indicates the callback for getting 23161847f8eSopenharmony_ci * an array of instances of the classes derived from {@link SignalInformation}. 23261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 23361847f8eSopenharmony_ci * 2. Incorrect parameter types. 23461847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 23561847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 23661847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 23761847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 23861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 23961847f8eSopenharmony_ci * @since 11 24061847f8eSopenharmony_ci */ 24161847f8eSopenharmony_ci function on(type: 'signalInfoChange', options: ObserverOptions, callback: Callback<Array<SignalInformation>>): void; 24261847f8eSopenharmony_ci 24361847f8eSopenharmony_ci /** 24461847f8eSopenharmony_ci * Cancel callback when the signal strength is updated. 24561847f8eSopenharmony_ci * 24661847f8eSopenharmony_ci * @param { 'signalInfoChange' } type - Event type. Indicates the signalInfoChange event to unsubscribe from. 24761847f8eSopenharmony_ci * @param { Callback<Array<SignalInformation>> } callback - Indicates the callback to unsubscribe from 24861847f8eSopenharmony_ci * the signalInfoChange event. 24961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 25061847f8eSopenharmony_ci * 2. Incorrect parameter types. 25161847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 25261847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 25361847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 25461847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 25561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 25661847f8eSopenharmony_ci * @since 6 25761847f8eSopenharmony_ci */ 25861847f8eSopenharmony_ci function off(type: 'signalInfoChange', callback?: Callback<Array<SignalInformation>>): void; 25961847f8eSopenharmony_ci 26061847f8eSopenharmony_ci /** 26161847f8eSopenharmony_ci * Callback when the cell information corresponding to the default sim card is updated. 26261847f8eSopenharmony_ci * 26361847f8eSopenharmony_ci * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 26461847f8eSopenharmony_ci * @param { 'cellInfoChange' } type - Event type. Indicates the cellInfoChange event to be subscribed to. 26561847f8eSopenharmony_ci * @param { Callback<Array<CellInformation>> } callback - Indicates the callback for getting 26661847f8eSopenharmony_ci * an array of instances of the classes derived from {@link CellInformation}. 26761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 26861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications use system APIs. 26961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 27061847f8eSopenharmony_ci * 2. Incorrect parameter types. 27161847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 27261847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 27361847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 27461847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 27561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 27661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 27761847f8eSopenharmony_ci * @since 8 27861847f8eSopenharmony_ci */ 27961847f8eSopenharmony_ci function on(type: 'cellInfoChange', callback: Callback<Array<CellInformation>>): void; 28061847f8eSopenharmony_ci 28161847f8eSopenharmony_ci /** 28261847f8eSopenharmony_ci * Callback when the cell information corresponding to a monitored {@code slotId} is updated. 28361847f8eSopenharmony_ci * 28461847f8eSopenharmony_ci * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 28561847f8eSopenharmony_ci * @param { 'cellInfoChange' } type - Event type. Indicates the cellInfoChange event to be subscribed to. 28661847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 28761847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 28861847f8eSopenharmony_ci * @param { Callback<Array<CellInformation>> } callback - Indicates the callback for getting 28961847f8eSopenharmony_ci * an array of instances of the classes derived from {@link CellInformation}. 29061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 29161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications use system APIs. 29261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 29361847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 29461847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 29561847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 29661847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 29761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 29861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 29961847f8eSopenharmony_ci * @since 8 30061847f8eSopenharmony_ci */ 30161847f8eSopenharmony_ci /** 30261847f8eSopenharmony_ci * Callback when the cell information corresponding to a monitored {@code slotId} is updated. 30361847f8eSopenharmony_ci * 30461847f8eSopenharmony_ci * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 30561847f8eSopenharmony_ci * @param { 'cellInfoChange' } type - Event type. Indicates the cellInfoChange event to be subscribed to. 30661847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 30761847f8eSopenharmony_ci * @param { Callback<Array<CellInformation>> } callback - Indicates the callback for getting 30861847f8eSopenharmony_ci * an array of instances of the classes derived from {@link CellInformation}. 30961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 31061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications use system APIs. 31161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 31261847f8eSopenharmony_ci * 2. Incorrect parameter types. 31361847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 31461847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 31561847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 31661847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 31761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 31861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 31961847f8eSopenharmony_ci * @since 11 32061847f8eSopenharmony_ci */ 32161847f8eSopenharmony_ci function on(type: 'cellInfoChange', options: ObserverOptions, callback: Callback<Array<CellInformation>>): void; 32261847f8eSopenharmony_ci 32361847f8eSopenharmony_ci /** 32461847f8eSopenharmony_ci * Cancel callback when the cell information is updated. 32561847f8eSopenharmony_ci * 32661847f8eSopenharmony_ci * @param { 'cellInfoChange' } type - Event type. Indicates the cellInfoChange event to unsubscribe from. 32761847f8eSopenharmony_ci * @param { Callback<Array<CellInformation>> } callback - Indicates the callback to unsubscribe from 32861847f8eSopenharmony_ci * the cellInfoChange event. 32961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications use system APIs. 33061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 33161847f8eSopenharmony_ci * 2. Incorrect parameter types. 33261847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 33361847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 33461847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 33561847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 33661847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 33761847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 33861847f8eSopenharmony_ci * @since 8 33961847f8eSopenharmony_ci */ 34061847f8eSopenharmony_ci function off(type: 'cellInfoChange', callback?: Callback<Array<CellInformation>>): void; 34161847f8eSopenharmony_ci 34261847f8eSopenharmony_ci /** 34361847f8eSopenharmony_ci * Callback when the cellular data link connection state corresponding to the default sim card is updated. 34461847f8eSopenharmony_ci * 34561847f8eSopenharmony_ci * @param { 'cellularDataConnectionStateChange' } type - Event type. Indicates the cellularDataConnectionStateChange 34661847f8eSopenharmony_ci * event to be subscribed to. 34761847f8eSopenharmony_ci * @param { Callback<{ state: DataConnectState, network: RatType }> } callback - Indicates the callback for 34861847f8eSopenharmony_ci * getting the cellular data link connection state, and networkType Indicates the radio access technology 34961847f8eSopenharmony_ci * for cellular data services. 35061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 35161847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 35261847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 35361847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 35461847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 35561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 35661847f8eSopenharmony_ci * @since 7 35761847f8eSopenharmony_ci */ 35861847f8eSopenharmony_ci /** 35961847f8eSopenharmony_ci * Callback when the cellular data link connection state corresponding to the default sim card is updated. 36061847f8eSopenharmony_ci * 36161847f8eSopenharmony_ci * @param { 'cellularDataConnectionStateChange' } type - Event type. Indicates the cellularDataConnectionStateChange 36261847f8eSopenharmony_ci * event to be subscribed to. 36361847f8eSopenharmony_ci * @param { Callback<DataConnectionStateInfo> } callback - Indicates the callback for 36461847f8eSopenharmony_ci * getting the cellular data link connection state, and networkType Indicates the radio access technology 36561847f8eSopenharmony_ci * for cellular data services. 36661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 36761847f8eSopenharmony_ci * 2. Incorrect parameter types. 36861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 36961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 37061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 37161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 37261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 37361847f8eSopenharmony_ci * @since 11 37461847f8eSopenharmony_ci */ 37561847f8eSopenharmony_ci function on(type: 'cellularDataConnectionStateChange', callback: Callback<DataConnectionStateInfo>): void; 37661847f8eSopenharmony_ci 37761847f8eSopenharmony_ci /** 37861847f8eSopenharmony_ci * Callback when the cellular data link connection state corresponding to the monitored {@code slotId} is updated. 37961847f8eSopenharmony_ci * 38061847f8eSopenharmony_ci * @param { 'cellularDataConnectionStateChange' } type - Event type. Indicates the cellularDataConnectionStateChange 38161847f8eSopenharmony_ci * event to be subscribed to. 38261847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 38361847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 38461847f8eSopenharmony_ci * @param { Callback<{ state: DataConnectState, network: RatType }> } callback - Indicates the callback for 38561847f8eSopenharmony_ci * getting the cellular data link connection state, and networkType Indicates the radio access technology for 38661847f8eSopenharmony_ci * cellular data services. 38761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 38861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 38961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 39061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 39161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 39261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 39361847f8eSopenharmony_ci * @since 7 39461847f8eSopenharmony_ci */ 39561847f8eSopenharmony_ci /** 39661847f8eSopenharmony_ci * Callback when the cellular data link connection state corresponding to the monitored {@code slotId} is updated. 39761847f8eSopenharmony_ci * 39861847f8eSopenharmony_ci * @param { 'cellularDataConnectionStateChange' } type - Event type. Indicates the cellularDataConnectionStateChange 39961847f8eSopenharmony_ci * event to be subscribed to. 40061847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 40161847f8eSopenharmony_ci * @param { Callback<DataConnectionStateInfo> } callback - Indicates the callback for 40261847f8eSopenharmony_ci * getting the cellular data link connection state, and networkType Indicates the radio access technology for 40361847f8eSopenharmony_ci * cellular data services. 40461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 40561847f8eSopenharmony_ci * 2. Incorrect parameter types. 40661847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 40761847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 40861847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 40961847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 41061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 41161847f8eSopenharmony_ci * @since 11 41261847f8eSopenharmony_ci */ 41361847f8eSopenharmony_ci function on(type: 'cellularDataConnectionStateChange', options: ObserverOptions, 41461847f8eSopenharmony_ci callback: Callback<DataConnectionStateInfo>): void; 41561847f8eSopenharmony_ci 41661847f8eSopenharmony_ci /** 41761847f8eSopenharmony_ci * Cancel callback when the cellular data link connection state is updated. 41861847f8eSopenharmony_ci * 41961847f8eSopenharmony_ci * @param { 'cellularDataConnectionStateChange' } type - Event type. Indicates the cellularDataConnectionStateChange 42061847f8eSopenharmony_ci * event to unsubscribe from. 42161847f8eSopenharmony_ci * @param { Callback<{ state: DataConnectState, network: RatType }> } callback - Indicates the callback to unsubscribe 42261847f8eSopenharmony_ci * from the cellularDataConnectionStateChange event. 42361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 42461847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 42561847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 42661847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 42761847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 42861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 42961847f8eSopenharmony_ci * @since 7 43061847f8eSopenharmony_ci */ 43161847f8eSopenharmony_ci /** 43261847f8eSopenharmony_ci * Cancel callback when the cellular data link connection state is updated. 43361847f8eSopenharmony_ci * 43461847f8eSopenharmony_ci * @param { 'cellularDataConnectionStateChange' } type - Event type. Indicates the cellularDataConnectionStateChange 43561847f8eSopenharmony_ci * event to unsubscribe from. 43661847f8eSopenharmony_ci * @param { Callback<DataConnectionStateInfo> } callback - Indicates the callback to unsubscribe 43761847f8eSopenharmony_ci * from the cellularDataConnectionStateChange event. 43861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 43961847f8eSopenharmony_ci * 2. Incorrect parameter types. 44061847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 44161847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 44261847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 44361847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 44461847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 44561847f8eSopenharmony_ci * @since 11 44661847f8eSopenharmony_ci */ 44761847f8eSopenharmony_ci function off(type: 'cellularDataConnectionStateChange', callback?: Callback<DataConnectionStateInfo>): void; 44861847f8eSopenharmony_ci 44961847f8eSopenharmony_ci /** 45061847f8eSopenharmony_ci * Callback when the uplink and downlink data flow state of cellular data services 45161847f8eSopenharmony_ci * corresponding to the default sim card is updated. 45261847f8eSopenharmony_ci * 45361847f8eSopenharmony_ci * @param { 'cellularDataFlowChange' } type - Event type. Indicates the cellularDataFlowChange event to be subscribed to. 45461847f8eSopenharmony_ci * @param { Callback<DataFlowType> } callback - Indicates the callback for getting the cellular data flow state. 45561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 45661847f8eSopenharmony_ci * 2. Incorrect parameter types. 45761847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 45861847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 45961847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 46061847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 46161847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 46261847f8eSopenharmony_ci * @since 7 46361847f8eSopenharmony_ci */ 46461847f8eSopenharmony_ci function on(type: 'cellularDataFlowChange', callback: Callback<DataFlowType>): void; 46561847f8eSopenharmony_ci 46661847f8eSopenharmony_ci /** 46761847f8eSopenharmony_ci * Callback when the uplink and downlink data flow state of cellular data services 46861847f8eSopenharmony_ci * corresponding to the monitored {@code slotId} is updated. 46961847f8eSopenharmony_ci * 47061847f8eSopenharmony_ci * @param { 'cellularDataFlowChange' } type - Event type. Indicates the cellularDataFlowChange event to be subscribed to. 47161847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 47261847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 47361847f8eSopenharmony_ci * @param { Callback<DataFlowType> } callback - Indicates the callback for getting the cellular data flow state. 47461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 47561847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 47661847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 47761847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 47861847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 47961847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 48061847f8eSopenharmony_ci * @since 7 48161847f8eSopenharmony_ci */ 48261847f8eSopenharmony_ci /** 48361847f8eSopenharmony_ci * Callback when the uplink and downlink data flow state of cellular data services 48461847f8eSopenharmony_ci * corresponding to the monitored {@code slotId} is updated. 48561847f8eSopenharmony_ci * 48661847f8eSopenharmony_ci * @param { 'cellularDataFlowChange' } type - Event type. Indicates the cellularDataFlowChange event to be subscribed to. 48761847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 48861847f8eSopenharmony_ci * @param { Callback<DataFlowType> } callback - Indicates the callback for getting the cellular data flow state. 48961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 49061847f8eSopenharmony_ci * 2. Incorrect parameter types. 49161847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 49261847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 49361847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 49461847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 49561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 49661847f8eSopenharmony_ci * @since 11 49761847f8eSopenharmony_ci */ 49861847f8eSopenharmony_ci function on(type: 'cellularDataFlowChange', options: ObserverOptions, callback: Callback<DataFlowType>): void; 49961847f8eSopenharmony_ci 50061847f8eSopenharmony_ci /** 50161847f8eSopenharmony_ci * Cancel callback when the uplink and downlink data flow state of cellular data services is updated. 50261847f8eSopenharmony_ci * 50361847f8eSopenharmony_ci * @param { 'cellularDataFlowChange' } type - Event type. Indicates the cellularDataFlowChange event to unsubscribe from. 50461847f8eSopenharmony_ci * @param { Callback<DataFlowType> } callback - Indicates the callback to unsubscribe from 50561847f8eSopenharmony_ci * the cellularDataFlowChange event. 50661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 50761847f8eSopenharmony_ci * 2. Incorrect parameter types. 50861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 50961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 51061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 51161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 51261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 51361847f8eSopenharmony_ci * @since 7 51461847f8eSopenharmony_ci */ 51561847f8eSopenharmony_ci function off(type: 'cellularDataFlowChange', callback?: Callback<DataFlowType>): void; 51661847f8eSopenharmony_ci 51761847f8eSopenharmony_ci /** 51861847f8eSopenharmony_ci * Callback when the call state corresponding to the default sim card is updated. 51961847f8eSopenharmony_ci * 52061847f8eSopenharmony_ci * @param { 'callStateChange' } type - Event type. Indicates the callStateChange event to be subscribed to. 52161847f8eSopenharmony_ci * @param { Callback<{ state: CallState, number: string }> } callback - Indicates the callback for 52261847f8eSopenharmony_ci * getting the call state and the called number. 52361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 52461847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 52561847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 52661847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 52761847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 52861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 52961847f8eSopenharmony_ci * @since 6 53061847f8eSopenharmony_ci */ 53161847f8eSopenharmony_ci /** 53261847f8eSopenharmony_ci * Callback when the call state corresponding to the default sim card is updated. 53361847f8eSopenharmony_ci * 53461847f8eSopenharmony_ci * @param { 'callStateChange' } type - Event type. Indicates the callStateChange event to be subscribed to. 53561847f8eSopenharmony_ci * @param { Callback<CallStateInfo> } callback - Indicates the callback for 53661847f8eSopenharmony_ci * getting the call state and the called number. 53761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 53861847f8eSopenharmony_ci * 2. Incorrect parameter types. 53961847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 54061847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 54161847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 54261847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 54361847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 54461847f8eSopenharmony_ci * @since 11 54561847f8eSopenharmony_ci */ 54661847f8eSopenharmony_ci function on(type: 'callStateChange', callback: Callback<CallStateInfo>): void; 54761847f8eSopenharmony_ci 54861847f8eSopenharmony_ci /** 54961847f8eSopenharmony_ci * Callback when the call state corresponding to the monitored {@code slotId} is updated. 55061847f8eSopenharmony_ci * 55161847f8eSopenharmony_ci * @param { 'callStateChange' } type - Event type. Indicates the callStateChange event to be subscribed to. 55261847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 55361847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 55461847f8eSopenharmony_ci * @param { Callback<{ state: CallState, number: string }> } callback - Indicates the callback for 55561847f8eSopenharmony_ci * getting the call state and the called number. 55661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 55761847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 55861847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 55961847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 56061847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 56161847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 56261847f8eSopenharmony_ci * @since 6 56361847f8eSopenharmony_ci */ 56461847f8eSopenharmony_ci /** 56561847f8eSopenharmony_ci * Callback when the call state corresponding to the monitored {@code slotId} is updated. 56661847f8eSopenharmony_ci * 56761847f8eSopenharmony_ci * @param { 'callStateChange' } type - Event type. Indicates the callStateChange event to be subscribed to. 56861847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 56961847f8eSopenharmony_ci * @param { Callback<CallStateInfo> } callback - Indicates the callback for 57061847f8eSopenharmony_ci * getting the call state and the called number. 57161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 57261847f8eSopenharmony_ci * 2. Incorrect parameter types. 57361847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 57461847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 57561847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 57661847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 57761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 57861847f8eSopenharmony_ci * @since 11 57961847f8eSopenharmony_ci */ 58061847f8eSopenharmony_ci function on(type: 'callStateChange', options: ObserverOptions, callback: Callback<CallStateInfo>): void; 58161847f8eSopenharmony_ci 58261847f8eSopenharmony_ci /** 58361847f8eSopenharmony_ci * Cancel callback when the call state is updated. 58461847f8eSopenharmony_ci * 58561847f8eSopenharmony_ci * @param { 'callStateChange' } type - Event type. Indicates the callStateChange event to unsubscribe from. 58661847f8eSopenharmony_ci * @param { Callback<{ state: CallState, number: string }> } callback - Indicates the callback to 58761847f8eSopenharmony_ci * unsubscribe from the callStateChange event. 58861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 58961847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 59061847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 59161847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 59261847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 59361847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 59461847f8eSopenharmony_ci * @since 6 59561847f8eSopenharmony_ci */ 59661847f8eSopenharmony_ci /** 59761847f8eSopenharmony_ci * Cancel callback when the call state is updated. 59861847f8eSopenharmony_ci * 59961847f8eSopenharmony_ci * @param { 'callStateChange' } type - Event type. Indicates the callStateChange event to unsubscribe from. 60061847f8eSopenharmony_ci * @param { Callback<CallStateInfo> } callback - Indicates the callback to 60161847f8eSopenharmony_ci * unsubscribe from the callStateChange event. 60261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 60361847f8eSopenharmony_ci * 2. Incorrect parameter types. 60461847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 60561847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 60661847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 60761847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 60861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 60961847f8eSopenharmony_ci * @since 11 61061847f8eSopenharmony_ci */ 61161847f8eSopenharmony_ci function off(type: 'callStateChange', callback?: Callback<CallStateInfo>): void; 61261847f8eSopenharmony_ci 61361847f8eSopenharmony_ci /** 61461847f8eSopenharmony_ci * Callback when the sim state corresponding to the default sim card is updated. 61561847f8eSopenharmony_ci * 61661847f8eSopenharmony_ci * @param { 'simStateChange' } type - Event type. Indicates the simStateChange event to be subscribed to. 61761847f8eSopenharmony_ci * @param { Callback<SimStateData> } callback - Indicates the callback for getting the SimStateData object. 61861847f8eSopenharmony_ci * including state Indicates the sim state, and reason Indicates the cause of the change. 61961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 62061847f8eSopenharmony_ci * 2. Incorrect parameter types. 62161847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 62261847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 62361847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 62461847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 62561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 62661847f8eSopenharmony_ci * @since 7 62761847f8eSopenharmony_ci */ 62861847f8eSopenharmony_ci function on(type: 'simStateChange', callback: Callback<SimStateData>): void; 62961847f8eSopenharmony_ci 63061847f8eSopenharmony_ci /** 63161847f8eSopenharmony_ci * Callback when the sim state corresponding to the monitored {@code slotId} is updated. 63261847f8eSopenharmony_ci * 63361847f8eSopenharmony_ci * @param { 'simStateChange' } type - Event type. Indicates the simStateChange event to be subscribed to. 63461847f8eSopenharmony_ci * @param { object } options - Indicates the ID of the target card slot. 63561847f8eSopenharmony_ci * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. 63661847f8eSopenharmony_ci * @param { Callback<SimStateData> } callback - Indicates the callback for getting the SimStateData object. 63761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. 63861847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 63961847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 64061847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 64161847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 64261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 64361847f8eSopenharmony_ci * @since 7 64461847f8eSopenharmony_ci */ 64561847f8eSopenharmony_ci /** 64661847f8eSopenharmony_ci * Callback when the sim state corresponding to the monitored {@code slotId} is updated. 64761847f8eSopenharmony_ci * 64861847f8eSopenharmony_ci * @param { 'simStateChange' } type - Event type. Indicates the simStateChange event to be subscribed to. 64961847f8eSopenharmony_ci * @param { ObserverOptions } options - Indicates the options for observer. 65061847f8eSopenharmony_ci * @param { Callback<SimStateData> } callback - Indicates the callback for getting the SimStateData object. 65161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 65261847f8eSopenharmony_ci * 2. Incorrect parameter types. 65361847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 65461847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 65561847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 65661847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 65761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 65861847f8eSopenharmony_ci * @since 11 65961847f8eSopenharmony_ci */ 66061847f8eSopenharmony_ci function on(type: 'simStateChange', options: ObserverOptions, callback: Callback<SimStateData>): void; 66161847f8eSopenharmony_ci 66261847f8eSopenharmony_ci /** 66361847f8eSopenharmony_ci * Cancel callback when the sim state is updated. 66461847f8eSopenharmony_ci * 66561847f8eSopenharmony_ci * @param { 'simStateChange' } type - Event type. Indicates the simStateChange event to unsubscribe from. 66661847f8eSopenharmony_ci * @param { Callback<SimStateData> } callback - Indicates the callback to unsubscribe from the simStateChange event. 66761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 66861847f8eSopenharmony_ci * 2. Incorrect parameter types. 66961847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 67061847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 67161847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 67261847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 67361847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 67461847f8eSopenharmony_ci * @since 7 67561847f8eSopenharmony_ci */ 67661847f8eSopenharmony_ci function off(type: 'simStateChange', callback?: Callback<SimStateData>): void; 67761847f8eSopenharmony_ci 67861847f8eSopenharmony_ci /** 67961847f8eSopenharmony_ci * Receives an ICC account change. This callback is invoked when the ICC account updates 68061847f8eSopenharmony_ci * and the observer is added to monitor the updates. 68161847f8eSopenharmony_ci * 68261847f8eSopenharmony_ci * @param { 'iccAccountInfoChange' } type - iccAccountInfoChange 68361847f8eSopenharmony_ci * @param { Callback<void> } callback - including state Indicates the ICC account information, 68461847f8eSopenharmony_ci * and reason Indicates the cause of the change. 68561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 68661847f8eSopenharmony_ci * 2. Incorrect parameter types. 68761847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 68861847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 68961847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 69061847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 69161847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 69261847f8eSopenharmony_ci * @since 10 69361847f8eSopenharmony_ci */ 69461847f8eSopenharmony_ci function on(type: 'iccAccountInfoChange', callback: Callback<void>): void; 69561847f8eSopenharmony_ci 69661847f8eSopenharmony_ci /** 69761847f8eSopenharmony_ci * Cancel to receive an ICC account change. 69861847f8eSopenharmony_ci * 69961847f8eSopenharmony_ci * @param { 'iccAccountInfoChange' } type - iccAccountInfoChange 70061847f8eSopenharmony_ci * @param { Callback<void> } callback - including state Indicates the ICC account information, 70161847f8eSopenharmony_ci * and reason Indicates the cause of the change. 70261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 70361847f8eSopenharmony_ci * 2. Incorrect parameter types. 70461847f8eSopenharmony_ci * @throws { BusinessError } 8300001 - Invalid parameter value. 70561847f8eSopenharmony_ci * @throws { BusinessError } 8300002 - Service connection failed. 70661847f8eSopenharmony_ci * @throws { BusinessError } 8300003 - System internal error. 70761847f8eSopenharmony_ci * @throws { BusinessError } 8300999 - Unknown error. 70861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 70961847f8eSopenharmony_ci * @since 10 71061847f8eSopenharmony_ci */ 71161847f8eSopenharmony_ci function off(type: 'iccAccountInfoChange', callback?: Callback<void>): void; 71261847f8eSopenharmony_ci 71361847f8eSopenharmony_ci /** 71461847f8eSopenharmony_ci * Indicates SIM card type and status. 71561847f8eSopenharmony_ci * 71661847f8eSopenharmony_ci * @interface SimStateData 71761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 71861847f8eSopenharmony_ci * @since 7 71961847f8eSopenharmony_ci */ 72061847f8eSopenharmony_ci export interface SimStateData { 72161847f8eSopenharmony_ci /** 72261847f8eSopenharmony_ci * Indicates the SIM card type. 72361847f8eSopenharmony_ci * 72461847f8eSopenharmony_ci * @type { CardType } 72561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 72661847f8eSopenharmony_ci * @since 7 72761847f8eSopenharmony_ci */ 72861847f8eSopenharmony_ci type: CardType; 72961847f8eSopenharmony_ci 73061847f8eSopenharmony_ci /** 73161847f8eSopenharmony_ci * Indicates the SIM card states. 73261847f8eSopenharmony_ci * 73361847f8eSopenharmony_ci * @type { SimState } 73461847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 73561847f8eSopenharmony_ci * @since 7 73661847f8eSopenharmony_ci */ 73761847f8eSopenharmony_ci state: SimState; 73861847f8eSopenharmony_ci 73961847f8eSopenharmony_ci /** 74061847f8eSopenharmony_ci * Indicates the SIM card lock type. 74161847f8eSopenharmony_ci * 74261847f8eSopenharmony_ci * @type { LockReason } 74361847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 74461847f8eSopenharmony_ci * @since 8 74561847f8eSopenharmony_ci */ 74661847f8eSopenharmony_ci reason: LockReason; 74761847f8eSopenharmony_ci } 74861847f8eSopenharmony_ci 74961847f8eSopenharmony_ci /** 75061847f8eSopenharmony_ci * Indicates call state and number. 75161847f8eSopenharmony_ci * 75261847f8eSopenharmony_ci * @interface CallStateInfo 75361847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 75461847f8eSopenharmony_ci * @since 11 75561847f8eSopenharmony_ci */ 75661847f8eSopenharmony_ci export interface CallStateInfo { 75761847f8eSopenharmony_ci /** 75861847f8eSopenharmony_ci * Indicates call state. 75961847f8eSopenharmony_ci * 76061847f8eSopenharmony_ci * @type { CallState } 76161847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 76261847f8eSopenharmony_ci * @since 11 76361847f8eSopenharmony_ci */ 76461847f8eSopenharmony_ci state: CallState; 76561847f8eSopenharmony_ci 76661847f8eSopenharmony_ci /** 76761847f8eSopenharmony_ci * Indicates call number. 76861847f8eSopenharmony_ci * 76961847f8eSopenharmony_ci * @type { string } 77061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 77161847f8eSopenharmony_ci * @since 11 77261847f8eSopenharmony_ci */ 77361847f8eSopenharmony_ci number: string; 77461847f8eSopenharmony_ci } 77561847f8eSopenharmony_ci 77661847f8eSopenharmony_ci /** 77761847f8eSopenharmony_ci * Indicates cellular data connect state and technology type. 77861847f8eSopenharmony_ci * 77961847f8eSopenharmony_ci * @interface DataConnectionStateInfo 78061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 78161847f8eSopenharmony_ci * @since 11 78261847f8eSopenharmony_ci */ 78361847f8eSopenharmony_ci export interface DataConnectionStateInfo { 78461847f8eSopenharmony_ci /** 78561847f8eSopenharmony_ci * Indicates cellular data connect state. 78661847f8eSopenharmony_ci * 78761847f8eSopenharmony_ci * @type { DataConnectState } 78861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 78961847f8eSopenharmony_ci * @since 11 79061847f8eSopenharmony_ci */ 79161847f8eSopenharmony_ci state: DataConnectState; 79261847f8eSopenharmony_ci 79361847f8eSopenharmony_ci /** 79461847f8eSopenharmony_ci * Indicates technology type. 79561847f8eSopenharmony_ci * 79661847f8eSopenharmony_ci * @type { RatType } 79761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 79861847f8eSopenharmony_ci * @since 11 79961847f8eSopenharmony_ci */ 80061847f8eSopenharmony_ci network: RatType; 80161847f8eSopenharmony_ci } 80261847f8eSopenharmony_ci 80361847f8eSopenharmony_ci /** 80461847f8eSopenharmony_ci * Indicates observer options. 80561847f8eSopenharmony_ci * 80661847f8eSopenharmony_ci * @interface ObserverOptions 80761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 80861847f8eSopenharmony_ci * @since 11 80961847f8eSopenharmony_ci */ 81061847f8eSopenharmony_ci export interface ObserverOptions { 81161847f8eSopenharmony_ci /** 81261847f8eSopenharmony_ci * Indicates the ID of the target card slot. 81361847f8eSopenharmony_ci * 81461847f8eSopenharmony_ci * @type { number } 81561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 81661847f8eSopenharmony_ci * @since 11 81761847f8eSopenharmony_ci */ 81861847f8eSopenharmony_ci slotId: number; 81961847f8eSopenharmony_ci } 82061847f8eSopenharmony_ci 82161847f8eSopenharmony_ci /** 82261847f8eSopenharmony_ci * Enum for SIM card lock type. 82361847f8eSopenharmony_ci * 82461847f8eSopenharmony_ci * @enum { number } 82561847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 82661847f8eSopenharmony_ci * @since 8 82761847f8eSopenharmony_ci */ 82861847f8eSopenharmony_ci export enum LockReason { 82961847f8eSopenharmony_ci /** 83061847f8eSopenharmony_ci * Indicates no SIM lock. 83161847f8eSopenharmony_ci * 83261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 83361847f8eSopenharmony_ci * @since 8 83461847f8eSopenharmony_ci */ 83561847f8eSopenharmony_ci SIM_NONE, 83661847f8eSopenharmony_ci 83761847f8eSopenharmony_ci /** 83861847f8eSopenharmony_ci * Indicates the PIN lock. 83961847f8eSopenharmony_ci * 84061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 84161847f8eSopenharmony_ci * @since 8 84261847f8eSopenharmony_ci */ 84361847f8eSopenharmony_ci SIM_PIN, 84461847f8eSopenharmony_ci 84561847f8eSopenharmony_ci /** 84661847f8eSopenharmony_ci * Indicates the PUK lock. 84761847f8eSopenharmony_ci * 84861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 84961847f8eSopenharmony_ci * @since 8 85061847f8eSopenharmony_ci */ 85161847f8eSopenharmony_ci SIM_PUK, 85261847f8eSopenharmony_ci 85361847f8eSopenharmony_ci /** 85461847f8eSopenharmony_ci * Indicates network personalization of PIN lock(refer 3GPP TS 22.022 [33]). 85561847f8eSopenharmony_ci * 85661847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 85761847f8eSopenharmony_ci * @since 8 85861847f8eSopenharmony_ci */ 85961847f8eSopenharmony_ci SIM_PN_PIN, 86061847f8eSopenharmony_ci 86161847f8eSopenharmony_ci /** 86261847f8eSopenharmony_ci * Indicates network personalization of PUK lock(refer 3GPP TS 22.022 [33]). 86361847f8eSopenharmony_ci * 86461847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 86561847f8eSopenharmony_ci * @since 8 86661847f8eSopenharmony_ci */ 86761847f8eSopenharmony_ci SIM_PN_PUK, 86861847f8eSopenharmony_ci 86961847f8eSopenharmony_ci /** 87061847f8eSopenharmony_ci * Indicates network subset personalization of PIN lock(refer 3GPP TS 22.022 [33]). 87161847f8eSopenharmony_ci * 87261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 87361847f8eSopenharmony_ci * @since 8 87461847f8eSopenharmony_ci */ 87561847f8eSopenharmony_ci SIM_PU_PIN, 87661847f8eSopenharmony_ci 87761847f8eSopenharmony_ci /** 87861847f8eSopenharmony_ci * Indicates network subset personalization of PUK lock(refer 3GPP TS 22.022 [33]). 87961847f8eSopenharmony_ci * 88061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 88161847f8eSopenharmony_ci * @since 8 88261847f8eSopenharmony_ci */ 88361847f8eSopenharmony_ci SIM_PU_PUK, 88461847f8eSopenharmony_ci 88561847f8eSopenharmony_ci /** 88661847f8eSopenharmony_ci * Indicates service provider personalization of PIN lock(refer 3GPP TS 22.022 [33]). 88761847f8eSopenharmony_ci * 88861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 88961847f8eSopenharmony_ci * @since 8 89061847f8eSopenharmony_ci */ 89161847f8eSopenharmony_ci SIM_PP_PIN, 89261847f8eSopenharmony_ci 89361847f8eSopenharmony_ci /** 89461847f8eSopenharmony_ci * Indicates service provider personalization of PUK lock(refer 3GPP TS 22.022 [33]). 89561847f8eSopenharmony_ci * 89661847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 89761847f8eSopenharmony_ci * @since 8 89861847f8eSopenharmony_ci */ 89961847f8eSopenharmony_ci SIM_PP_PUK, 90061847f8eSopenharmony_ci 90161847f8eSopenharmony_ci /** 90261847f8eSopenharmony_ci * Indicates corporate personalization of PIN lock(refer 3GPP TS 22.022 [33]). 90361847f8eSopenharmony_ci * 90461847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 90561847f8eSopenharmony_ci * @since 8 90661847f8eSopenharmony_ci */ 90761847f8eSopenharmony_ci SIM_PC_PIN, 90861847f8eSopenharmony_ci 90961847f8eSopenharmony_ci /** 91061847f8eSopenharmony_ci * Indicates corporate personalization of PUK lock(refer 3GPP TS 22.022 [33]). 91161847f8eSopenharmony_ci * 91261847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 91361847f8eSopenharmony_ci * @since 8 91461847f8eSopenharmony_ci */ 91561847f8eSopenharmony_ci SIM_PC_PUK, 91661847f8eSopenharmony_ci 91761847f8eSopenharmony_ci /** 91861847f8eSopenharmony_ci * Indicates SIM/USIM personalization of PIN lock(refer 3GPP TS 22.022 [33]). 91961847f8eSopenharmony_ci * 92061847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 92161847f8eSopenharmony_ci * @since 8 92261847f8eSopenharmony_ci */ 92361847f8eSopenharmony_ci SIM_SIM_PIN, 92461847f8eSopenharmony_ci 92561847f8eSopenharmony_ci /** 92661847f8eSopenharmony_ci * Indicates SIM/USIM personalization of PUK lock(refer 3GPP TS 22.022 [33]). 92761847f8eSopenharmony_ci * 92861847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.StateRegistry 92961847f8eSopenharmony_ci * @since 8 93061847f8eSopenharmony_ci */ 93161847f8eSopenharmony_ci SIM_SIM_PUK, 93261847f8eSopenharmony_ci } 93361847f8eSopenharmony_ci} 93461847f8eSopenharmony_ci 93561847f8eSopenharmony_ciexport default observer; 936