From d4314c8a7c613c6233eaeb3ee9443d9cadabd737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 03:15:28 +0000 Subject: [PATCH 1/7] update sim.d.ts --- api/@ohos.telephony.sim.d.ts | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/api/@ohos.telephony.sim.d.ts b/api/@ohos.telephony.sim.d.ts index ed9652a51a..3f4956b3b6 100644 --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -105,6 +105,21 @@ declare namespace sim { function getSimIccId(slotId: number, callback: AsyncCallback): void; function getSimIccId(slotId: number): Promise; + /** + * Obtains the MSISDN of the SIM card in a specified slot. + * The MSISDN is recorded in the EFMSISDN file of the SIM card. + * + *

Requires Permission: {@code ohos.permission.GET_TELEPHONY_STATE}. + * + * @param slotId Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param callback Returns the MSISDN; returns an empty string if no SIM card is inserted or + * no MSISDN is recorded in the EFMSISDN file. + * @permission ohos.permission.GET_TELEPHONY_STATE + */ + function getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void; + function getSimTelephoneNumber(slotId: number): Promise; + /** * Obtains the Group Identifier Level 1 (GID1) of the SIM card in a specified slot. * The GID1 is recorded in the EFGID1 file of the SIM card. @@ -127,6 +142,16 @@ declare namespace sim { function getIMSI(slotId: number, callback: AsyncCallback): void; function getIMSI(slotId: number): Promise; + /** + * Checks whether a SIM card is inserted in a specified slot. + * + * @param slotId Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param callback Returns true if a SIM card is inserted; return false otherwise. + */ + function hasSimCard(slotId: number, callback: AsyncCallback): void; + function hasSimCard(slotId: number): Promise; + /** * @permission ohos.permission.GET_TELEPHONY_STATE * @systemapi Hide this for inner system use. @@ -174,6 +199,30 @@ declare namespace sim { */ function setLockState(slotId: number, pin: string, enable: number, callback: AsyncCallback): void; function setLockState(slotId: number, pin: string, enable: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function queryIccDiallingNumbers(slotId: number, type: number, callback: AsyncCallback>): void; + function queryIccDiallingNumbers(slotId: number, type: number): Promise>; + + /** + * @systemapi Hide this for inner system use. + */ + function addIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void; + function addIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function delIccDiallingNumbers(slotId: number, type: number, index: number, callback :AsyncCallback): void; + function delIccDiallingNumbers(slotId: number, type: number, index: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function updateIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, index: number, callback: AsyncCallback): void; + function updateIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, index: number): Promise; /** * @systemapi Hide this for inner system use. @@ -194,6 +243,15 @@ declare namespace sim { remain?: number, /* Operations remaining */ } + /** + * @systemapi Hide this for inner system use. + */ + export interface DiallingNumbersInfo { + recordNumber: number, + alphaTag: string, + number: string, + } + export enum SimState { /** * Indicates unknown SIM card state, that is, the accurate status cannot be obtained. -- Gitee From 0ddf8d51549d5c706db46fc5d8fd2ea4de233423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 03:17:47 +0000 Subject: [PATCH 2/7] update radio.d.ts --- api/@ohos.telephony.radio.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts index bbc4dcfc71..3da618d79b 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -142,6 +142,13 @@ declare namespace radio { function turnOffRadio(callback: AsyncCallback): void; function turnOffRadio(): Promise; + /** + * @permission ohos.permission.GET_TELEPHONY_STATE + */ + function getIMEI(callback: AsyncCallback): void; + function getIMEI(slotId: number, callback: AsyncCallback): void; + function getIMEI(slotId?: number): Promise; + /** * Describes the radio access technology. */ -- Gitee From 2a7bc7ee4468c6990cc26f6296f8717e9974119e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 03:37:37 +0000 Subject: [PATCH 3/7] update observer.d.ts --- api/@ohos.telephony.observer.d.ts | 71 ++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index d1c0fe0b18..caa0d0555c 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -13,9 +13,11 @@ * limitations under the License. */ -import {AsyncCallback} from "./basic"; +import { Callback } from "./basic"; import radio from "./@ohos.telephony.radio"; +import data from "./@ohos.telephony.data"; import call from "./@ohos.telephony.call"; +import { SimState } from "./@ohos.telephony.sim"; /** * Monitors telephony state updates of a device, including updates of the network state, @@ -24,9 +26,13 @@ import call from "./@ohos.telephony.call"; * @since 6 */ declare namespace observer { - type NetworkState = radio.NetworkState; - type SignalInformation = radio.SignalInformation; - type CallState = call.CallState; + export import NetworkState = radio.NetworkState; + export import SignalInformation = radio.SignalInformation; + export import CellInformation = radio.CellInformation; + export import DataConnectState = data.DataConnectState; + export import RatType = radio.RatType; + export import DataFlowType = data.DataFlowType; + export import CallState = call.CallState; /** * Called when the network state corresponding to a monitored {@code slotId} updates. @@ -39,13 +45,13 @@ declare namespace observer { * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. * @param callback including an instance of the {@code NetworkState} class. */ - function on(type: 'networkStateChange', callback: AsyncCallback): void; - function on(type: 'networkStateChange', options: { slotId: number }, callback: AsyncCallback): void; + function on(type: 'networkStateChange', callback: Callback): void; + function on(type: 'networkStateChange', options: { slotId: number }, callback: Callback): void; - function once(type: 'networkStateChange', callback: AsyncCallback): void; - function once(type: 'networkStateChange', options: { slotId: number }, callback: AsyncCallback): void; + function once(type: 'networkStateChange', callback: Callback): void; + function once(type: 'networkStateChange', options: { slotId: number }, callback: Callback): void; - function off(type: 'networkStateChange', callback?: AsyncCallback): void; + function off(type: 'networkStateChange', callback?: Callback): void; /** * Called when the signal strength corresponding to a monitored {@code slotId} updates. @@ -55,15 +61,15 @@ declare namespace observer { * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. * @param callback including an array of instances of the classes derived from {@link SignalInformation}. */ - function on(type: 'signalInfoChange', callback: AsyncCallback>): void; + function on(type: 'signalInfoChange', callback: Callback>): void; function on(type: 'signalInfoChange', options: { slotId: number }, - callback: AsyncCallback>): void; + callback: Callback>): void; - function once(type: 'signalInfoChange', callback: AsyncCallback>): void; + function once(type: 'signalInfoChange', callback: Callback>): void; function once(type: 'signalInfoChange', options: { slotId: number }, - callback: AsyncCallback>): void; + callback: Callback>): void; - function off(type: 'signalInfoChange', callback?: AsyncCallback>): void; + function off(type: 'signalInfoChange', callback?: Callback>): void; /** * Receives a call state change. This callback is invoked when the call state of a specified card updates @@ -76,15 +82,42 @@ declare namespace observer { * The value of number is an empty string if the application does not have * the {@code ohos.permission#READ_CALL_LOG READ_CALL_LOG} permission. */ - function on(type: 'callStateChange', callback: AsyncCallback<{ state: CallState, number: String }>): void; + function on(type: 'callStateChange', callback: Callback<{ state: CallState, number: String }>): void; function on(type: 'callStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: CallState, number: String }>): void; + callback: Callback<{ state: CallState, number: String }>): void; - function once(type: 'callStateChange', callback: AsyncCallback<{ state: CallState, number: String }>): void; + function once(type: 'callStateChange', callback: Callback<{ state: CallState, number: String }>): void; function once(type: 'callStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: CallState, number: String }>): void; + callback: Callback<{ state: CallState, number: String }>): void; - function off(type: 'callStateChange', callback?: AsyncCallback<{ state: CallState, number: String }>): void; + function off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: String }>): void; } + /** + * Receives a sim state change. This callback is invoked when the sim state of a specified card updates + * and the observer is added to monitor the updates. + * + * @param type simStateChange + * @param options including slotId Indicates the ID of the target card slot. + * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. + * @param callback including state Indicates the sim state, and reason Indicates the cause of the change. + * The value of reason is an empty string if the application does not have + */ + function on(type: 'simStateChange', callback: Callback): void; + function on(type: 'simStateChange', options: { slotId: number }, + callback: Callback): void; + function once(type: 'simStateChange', callback: Callback): void; + function once(type: 'simStateChange', options: { slotId: number }, + callback: Callback): void; + function off(type: 'simStateChange', callback?: Callback): void; + + export interface SimStateData { + state: SimState, + reason: LockReason + } + export enum LockReason { + SIM_NONE, + SIM_PIN, + SIM_PUK, + } export default observer; \ No newline at end of file -- Gitee From d0cafd542d2c9c767c7d62f788bce91e68834e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 04:13:46 +0000 Subject: [PATCH 4/7] update observer.d.ts --- api/@ohos.telephony.observer.d.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index caa0d0555c..46bb48cf71 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -13,11 +13,10 @@ * limitations under the License. */ -import { Callback } from "./basic"; +import {Callback} from "./basic"; import radio from "./@ohos.telephony.radio"; -import data from "./@ohos.telephony.data"; import call from "./@ohos.telephony.call"; -import { SimState } from "./@ohos.telephony.sim"; +import {SimState} from "./@ohos.telephony.sim"; /** * Monitors telephony state updates of a device, including updates of the network state, @@ -28,10 +27,6 @@ import { SimState } from "./@ohos.telephony.sim"; declare namespace observer { export import NetworkState = radio.NetworkState; export import SignalInformation = radio.SignalInformation; - export import CellInformation = radio.CellInformation; - export import DataConnectState = data.DataConnectState; - export import RatType = radio.RatType; - export import DataFlowType = data.DataFlowType; export import CallState = call.CallState; /** @@ -91,7 +86,6 @@ declare namespace observer { callback: Callback<{ state: CallState, number: String }>): void; function off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: String }>): void; -} /** * Receives a sim state change. This callback is invoked when the sim state of a specified card updates @@ -115,9 +109,12 @@ declare namespace observer { state: SimState, reason: LockReason } + export enum LockReason { SIM_NONE, SIM_PIN, SIM_PUK, } +} + export default observer; \ No newline at end of file -- Gitee From c64bfe1c3f52f2920b2cbac19613a940536de944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 06:08:50 +0000 Subject: [PATCH 5/7] update sim.d.ts --- api/@ohos.telephony.sim.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/@ohos.telephony.sim.d.ts b/api/@ohos.telephony.sim.d.ts index 3f4956b3b6..2ac522bab3 100644 --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -116,6 +116,7 @@ declare namespace sim { * @param callback Returns the MSISDN; returns an empty string if no SIM card is inserted or * no MSISDN is recorded in the EFMSISDN file. * @permission ohos.permission.GET_TELEPHONY_STATE + * @since 8 */ function getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void; function getSimTelephoneNumber(slotId: number): Promise; @@ -148,6 +149,7 @@ declare namespace sim { * @param slotId Indicates the card slot index number, * ranging from 0 to the maximum card slot index number supported by the device. * @param callback Returns true if a SIM card is inserted; return false otherwise. + * @since 8 */ function hasSimCard(slotId: number, callback: AsyncCallback): void; function hasSimCard(slotId: number): Promise; @@ -202,24 +204,28 @@ declare namespace sim { /** * @systemapi Hide this for inner system use. + * @since 8 */ function queryIccDiallingNumbers(slotId: number, type: number, callback: AsyncCallback>): void; function queryIccDiallingNumbers(slotId: number, type: number): Promise>; /** * @systemapi Hide this for inner system use. + * @since 8 */ function addIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void; function addIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo): Promise; /** * @systemapi Hide this for inner system use. + * @since 8 */ function delIccDiallingNumbers(slotId: number, type: number, index: number, callback :AsyncCallback): void; function delIccDiallingNumbers(slotId: number, type: number, index: number): Promise; /** * @systemapi Hide this for inner system use. + * @since 8 */ function updateIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, index: number, callback: AsyncCallback): void; function updateIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, index: number): Promise; @@ -245,6 +251,7 @@ declare namespace sim { /** * @systemapi Hide this for inner system use. + * @since 8 */ export interface DiallingNumbersInfo { recordNumber: number, -- Gitee From 1919b2ec324c66c53144e6f788bc363db49fa33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 06:13:54 +0000 Subject: [PATCH 6/7] update oberver.d.ts --- api/@ohos.telephony.observer.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index 46bb48cf71..cf04f008b3 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -96,6 +96,7 @@ declare namespace observer { * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. * @param callback including state Indicates the sim state, and reason Indicates the cause of the change. * The value of reason is an empty string if the application does not have + * @since 8 */ function on(type: 'simStateChange', callback: Callback): void; function on(type: 'simStateChange', options: { slotId: number }, -- Gitee From 04c624194e397ef9cbeb7f1326be5048fbe90732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=BB=94?= Date: Thu, 4 Nov 2021 06:15:33 +0000 Subject: [PATCH 7/7] update radio.d.ts --- api/@ohos.telephony.radio.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts index 3da618d79b..63e5e49992 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -144,6 +144,7 @@ declare namespace radio { /** * @permission ohos.permission.GET_TELEPHONY_STATE + * @since 8 */ function getIMEI(callback: AsyncCallback): void; function getIMEI(slotId: number, callback: AsyncCallback): void; -- Gitee