From 1aa982db9c90b2297019c665a835a341e2a099af Mon Sep 17 00:00:00 2001 From: y00576111 Date: Mon, 27 Sep 2021 22:32:25 +0800 Subject: [PATCH 0001/1181] add worker.d.ts comment Signed-off-by: y00576111 Change-Id: I534215e05964e0a3388742d593cc093569e25cc3 --- api/@ohos.worker.d.ts | 316 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 288 insertions(+), 28 deletions(-) diff --git a/api/@ohos.worker.d.ts b/api/@ohos.worker.d.ts index d7b9ca8..1ae39b2 100644 --- a/api/@ohos.worker.d.ts +++ b/api/@ohos.worker.d.ts @@ -13,104 +13,364 @@ * limitations under the License. */ +/** +* Provides options that can be set for the worker to create. +* @devices phone, tablet, wearable +* @since 7 +*/ export interface WorkerOptions { + /** + * Mode in which the worker executes the script. + * @devices phone, tablet, wearable + * @since 7 + */ type?: "classic" | "module"; + + /** + * Name of the worker. + * @devices phone, tablet, wearable + * @since 7 + */ name?: string; + + /** + * Whether the worker is shared. + * @devices phone, tablet, wearable + * @since 7 + */ shared?: boolean; } +/** + * Defines the event. + * @devices phone, tablet, wearable + * @since 7 + */ export interface Event { + /** + * Type of the Event. + * @devices phone, tablet, wearable + * @since 7 + */ readonly type: string; + + /** + * Timestamp(accurate to millisecond) when the event is created. + * @devices phone, tablet, wearable + * @since 7 + */ readonly timeStamp: number; } +/** + * Provides detailed information about the exception occurred during worker execution. + * @devices phone, tablet, wearable + * @since 7 + */ interface ErrorEvent extends Event { + /** + * Information about the exception. + * @devices phone, tablet, wearable + * @since 7 + */ readonly message: string; + + /** + * File where the exception is located. + * @devices phone, tablet, wearable + * @since 7 + */ readonly filename: string; + + /** + * Number of the line where the exception is located. + * @devices phone, tablet, wearable + * @since 7 + */ readonly lineno: number; + + /** + * Number of the column where the exception is located. + * @devices phone, tablet, wearable + * @since 7 + */ readonly colno: number; + + /** + * Type of the exception. + * @devices phone, tablet, wearable + * @since 7 + */ readonly error: Object; } +/** + * Holds the data transferred between worker threads. + * @devices phone, tablet, wearable + * @since 7 + */ declare interface MessageEvent extends Event { - // the data of the message. + /** + * Data transferred when an exception occurs. + * @devices phone, tablet, wearable + * @since 7 + */ readonly data: T; } +/** + * Specifies the object whose ownership need to be transferred during data transfer. + * The object must be ArrayBuffer. + * @devices phone, tablet, wearable + * @since 7 + */ export interface PostMessageOptions { + /** + * ArrayBuffer array used to transfer the ownership. + * @devices phone, tablet, wearable + * @since 7 + */ transfer?: Object[]; } +/** + * Implements evemt listening. + * @devices phone, tablet, wearable + * @since 7 + */ export interface EventListener { - (evt: Event): void | Promise; + /** + * Specifies the callback to invoke. + * @param evt Event class for the callback to invoke. + * @devices phone, tablet, wearable + * @since 7 + */ + (evt: Event): void | Promise; } +/** + * Type of message, only "message" and "messageerror". + * @devices phone, tablet, wearable + * @since 7 + */ type MessageType = "message" | "messageerror"; +/** + * Specific event features. + * @devices phone, tablet, wearable + * @since 7 + */ declare interface EventTarget { + /** + * Adds an event listener to the worker. + * @param type Type of the event to listen for. + * @param listener Callback to invoke when an event of the specified type occurs. + * @devices phone, tablet, wearable + * @since 7 + */ addEventListener( type: string, listener: EventListener ): void; + /** + * Dispatches the event defined for the worker. + * @param event Event to dispatch. + * @devices phone, tablet, wearable + * @since 7 + */ dispatchEvent(event: Event): boolean; + /** + * Removes an event defined for the worker. + * @param type Type of the event for which the event listener is removed. + * @param callback Callback of the event listener to remove. + * @devices phone, tablet, wearable + * @since 7 + */ removeEventListener( type: string, callback?: EventListener ): void; + /** + * Removes all event listeners for the worker. + * @devices phone, tablet, wearable + * @since 7 + */ removeAllListener(): void; } -/* woker sider interface */ +/** + * Specifies the worker thread running environment, which is isolated from the host thread environment. + * @devices phone, tablet, wearable + * @since 7 + */ declare interface WorkerGlobalScope extends EventTarget { - // worker name. + /** + * Worker name specified when there is a new worker. + * @devices phone, tablet, wearable + * @since 7 + */ readonly name: string; + /** + * The onerror attribute of parentPort specifies + * the event handler to be called when an exception occurs during worker execution. + * The event handler is executed in the worker thread. + * @param ev Error data. + * @devices phone, tablet, wearable + * @since 7 + */ onerror?: (ev: ErrorEvent) => void; - onoffline?: (ev: Event) => void; - ononline?: (ev: Event) => void; - readonly self: WorkerGlobalScope & typeof globalThis; } +/** + * Specifies the worker thread running environment, which is isolated from the host thread environment + * @devices phone, tablet, wearable + * @since 7 + */ declare interface DedicatedWorkerGlobalScope extends WorkerGlobalScope { + /** + * The onmessage attribute of parentPort specifies the event handler + * to be called then the worker thread receives a message sent by + * the host thread through worker postMessage. + * The event handler is executed in the worker thread. + * @param ev Message received. + * @devices phone, tablet, wearable + * @since 7 + */ onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void; + + /** + * The onmessage attribute of parentPort specifies the event handler + * to be called then the worker receives a message that cannot be deserialized. + * The event handler is executed in the worker thread. + * @param ev Error data. + * @devices phone, tablet, wearable + * @since 7 + */ onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void; + /** + * Close the worker thread to stop the worker from receiving messages + * @devices phone, tablet, wearable + * @since 7 + */ close(): void; + /** - * Clones message and transmits it to the Worker object associated with dedicatedWorkerGlobal. - * transfer can be passed as a list of objects that are to be transferred rather than cloned. + * Send a message to be host thread from the worker + * @param messageObject Data to be sent to the worker + * @param transfer array cannot contain null. + * @devices phone, tablet, wearable + * @since 7 */ postMessage(messageObject: Object, transfer: Transferable[]): void; postMessage(messageObject: Object, options?: PostMessageOptions): void; } /** - * @devices phone, tablet + * JS cross-thread communication tool + * @devices phone, tablet, wearable + * @since 7 */ declare namespace worker { class Worker extends EventTarget { - constructor(scriptURL: string, options?: WorkerOptions); - onexit?: (code: number) => void; - // error callback. - onerror?: (err: ErrorEvent) => void; - // type = "message". - onmessage?: (event: MessageEvent) => void; - onmessageerror?: (event: MessageEvent) => void; - // use structured clone algorithm to transfor object. - postMessage(message: Object, transfer: ArrayBuffer[]): void; - // support transfor list type: - // all primitive types, Boolean, String, Date, RegExp, Map, Set, Array, Object(can represet literal). - postMessage(message: Object, options?: PostMessageOptions): void; - - on(type: string, listener: EventListener): void; - once(type: string, listener: EventListener): void; - off(type: string, listener?: EventListener): void; - - terminate(): void; + /** + * Creates a worker instance + * @param scriptURL URL of the script to be executed by the worker + * @param options Options that can be set for the worker + * @devices phone, tablet, wearable + * @since 7 + */ + constructor(scriptURL: string, options?: WorkerOptions); + + /** + * The onexit attribute of the worker specifies the event handler to be called + * when the worker exits. The handler is executed in the host thread. + * @param code Code indicating the worker exit state + * @devices phone, tablet, wearable + * @since 7 + */ + onexit?: (code: number) => void; + + /** + * The onerror attribute of the worker specifies the event handler to be called + * when an exception occurs during worker execution. + * The event handler is executed in the host thread. + * @devices phone, tablet, wearable + * @since 7 + */ + onerror?: (err: ErrorEvent) => void; + + /** + * The onmessage attribute of the worker specifies the event handler + * to be called then the host thread receives a message created by itself + * and sent by the worker through the parentPort.postMessage. + * The event handler is executed in the host thread. + * @param event Message received. + * @devices phone, tablet, wearable + * @since 7 + */ + onmessage?: (event: MessageEvent) => void; + + /** + * The onmessage attribute of the worker specifies the event handler + * when the worker receives a message that cannot be serialized. + * The event handler is executed in the host thread. + * @devices phone, tablet, wearable + * @since 7 + */ + onmessageerror?: (event: MessageEvent) => void; + + /** + * Sends a message to the worker thread. + * The data is transferred using the structured clone algorithm. + * @param message Data to be sent to the worker + * @param transfer ArrayBuffer instance that can be transferred. + * The transferList array cannot contain null. + * @devices phone, tablet, wearable + * @since 7 + */ + postMessage(message: Object, transfer: ArrayBuffer[]): void; + postMessage(message: Object, options?: PostMessageOptions): void; + + /** + * Adds an event listener to the worker. + * @param type Adds an event listener to the worker. + * @param listener Callback to invoke when an event of the specified type occurs. + * @devices phone, tablet, wearable + * @since 7 + */ + on(type: string, listener: EventListener): void; + + /** + * Adds an event listener to the worker + * and removes the event listener automically after it is invoked once. + * @param type Type of the event to listen for + * @param listener Callback to invoke when an event of the specified type occurs + * @devices phone, tablet, wearable + * @since 7 + */ + once(type: string, listener: EventListener): void; + + /** + * Removes an event listener to the worker. + * @param type Type of the event for which the event listener is removed. + * @param listener Callback of the event listener to remove. + * @devices phone, tablet, wearable + * @since 7 + */ + off(type: string, listener?: EventListener): void; + + /** + * Terminates the worker thread to stop the worker from receiving messages + * @devices phone, tablet, wearable + * @since 7 + */ + terminate(): void; } const parentPort: DedicatedWorkerGlobalScope; } -- Gitee From d35e38fc46fc6f7e11df5657e7b4f235c82832bb Mon Sep 17 00:00:00 2001 From: clevercong Date: Mon, 11 Oct 2021 15:18:39 +0800 Subject: [PATCH 0002/1181] update telephony js api in version 7. Signed-off-by: clevercong --- api/@ohos.telephony.call.d.ts | 419 ++++++++++++---- api/@ohos.telephony.data.d.ts | 98 ---- api/@ohos.telephony.observer.d.ts | 33 +- api/@ohos.telephony.radio.d.ts | 781 +++++++++++++++++------------- api/@ohos.telephony.sim.d.ts | 351 +++++++++----- api/@ohos.telephony.sms.d.ts | 458 ++++++++++++------ 6 files changed, 1329 insertions(+), 811 deletions(-) mode change 100755 => 100644 api/@ohos.telephony.call.d.ts delete mode 100755 api/@ohos.telephony.data.d.ts mode change 100755 => 100644 api/@ohos.telephony.radio.d.ts mode change 100755 => 100644 api/@ohos.telephony.sim.d.ts mode change 100755 => 100644 api/@ohos.telephony.sms.d.ts diff --git a/api/@ohos.telephony.call.d.ts b/api/@ohos.telephony.call.d.ts old mode 100755 new mode 100644 index a6d8fe5..25680a7 --- a/api/@ohos.telephony.call.d.ts +++ b/api/@ohos.telephony.call.d.ts @@ -1,83 +1,338 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides methods related to call management. - * - * @since 6 - */ -declare namespace call { - /** - * Makes a call. - * - *

Applications must have the {@code ohos.permission.PLACE_CALL} permission to call this method. - * - * @param phoneNumber Indicates the called number. - * @param options Indicates additional information carried in the call. - * @param callback Returns {@code true} if the call request is successful; returns {@code false} otherwise. - * Note that the value {@code true} indicates only the successful processing of the request; it does not mean - * that the call is or can be connected. - */ - function dial(phoneNumber: string, callback: AsyncCallback): void; - function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; - function dial(phoneNumber: string, options?: DialOptions): Promise; - - /** - * Obtains the call state. - * - *

If an incoming call is ringing or waiting, the system returns {@code CallState#CALL_STATE_RINGING}. - * If at least one call is in the active, hold, or dialing state, the system returns - * {@code CallState#CALL_STATE_OFFHOOK}. - * In other cases, the system returns {@code CallState#CALL_STATE_IDLE}. - * - * @param callback Returns the call state. - */ - function getCallState(callback: AsyncCallback): void; - function getCallState(): Promise; - - export enum CallState { - /** - * Indicates an invalid state, which is used when the call state fails to be obtained. - */ - CALL_STATE_UNKNOWN = -1, - - /** - * Indicates that there is no ongoing call. - */ - CALL_STATE_IDLE = 0, - - /** - * Indicates that an incoming call is ringing or waiting. - */ - CALL_STATE_RINGING = 1, - - /** - * Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call - * ringing or waiting. - */ - CALL_STATE_OFFHOOK = 2 - } - - export interface DialOptions { - /** - * boolean means whether the call to be made is a video call. The value {@code false} indicates a voice call. - */ - extras?: boolean; - } -} - +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback, Callback} from "./basic"; + +/** + * Provides methods related to call management. + * + * @since 6 + * @sysCap SystemCapability.Telephony.DCall + */ +declare namespace call { + /** + * Makes a call. + * + *

Applications must have the {@code ohos.permission.PLACE_CALL} permission to call this method. + * + * @param phoneNumber Indicates the called number. + * @param options Indicates additional information carried in the call. + * @param callback Returns {@code true} if the call request is successful; returns {@code false} otherwise. + * Note that the value {@code true} indicates only the successful processing of the request; it does not mean + * that the call is or can be connected. + * @permission ohos.permission.PLACE_CALL + */ + function dial(phoneNumber: string, callback: AsyncCallback): void; + function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; + function dial(phoneNumber: string, options?: DialOptions): Promise; + + /** + * Checks whether a call is ongoing. + * + * @param callback Returns {@code true} if at least one call is not in the {@link CallState#CALL_STATE_IDLE} + * state; returns {@code false} otherwise. + */ + function hasCall(callback: AsyncCallback): void; + function hasCall(): Promise; + + /** + * Obtains the call state. + * + *

If an incoming call is ringing or waiting, the system returns {@code CallState#CALL_STATE_RINGING}. + * If at least one call is in the active, hold, or dialing state, the system returns + * {@code CallState#CALL_STATE_OFFHOOK}. + * In other cases, the system returns {@code CallState#CALL_STATE_IDLE}. + * + * @param callback Returns the call state. + */ + function getCallState(callback: AsyncCallback): void; + function getCallState(): Promise; + + /** + * Checks whether a phone number is on the emergency number list. + * + * @param phoneNumber Indicates the phone number to check. + * @param callback Returns {@code true} if the phone number is on the emergency number list; + * returns {@code false} otherwise. + * @since 7 + */ + function isEmergencyPhoneNumber(phoneNumber: string, callback: AsyncCallback): void; + function isEmergencyPhoneNumber(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback): void; + function isEmergencyPhoneNumber(phoneNumber: string, options?: EmergencyNumberOptions): Promise; + + /** + * Formats a phone number according to the Chinese Telephone Code Plan. Before the formatting, + * a phone number is in the format of country code (if any) + 3-digit service provider code + * + 4-digit area code + 4-digit subscriber number. After the formatting, + * each part is separated by a space. + * + * @param phoneNumber Indicates the phone number to format. + * @param callback Returns the phone number after being formatted; returns an empty string + * if the input phone number is invalid. + * @since 7 + */ + function formatPhoneNumber(phoneNumber: string, callback: AsyncCallback): void; + function formatPhoneNumber(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback): void; + function formatPhoneNumber(phoneNumber: string, options?: NumberFormatOptions): Promise; + + /** + * Formats a phone number into an E.164 representation. + * + * @param phoneNumber Indicates the phone number to format. + * @param countryCode Indicates a two-digit country code defined in ISO 3166-1. + * @param callback Returns an E.164 number; returns an empty string if the input phone number is invalid. + * @since 7 + */ + function formatPhoneNumberToE164(phoneNumber: string, countryCode: string, callback: AsyncCallback): void; + function formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId: number, options?: RejectMessageOptions): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function holdCall(callId: number, callback: AsyncCallback): void; + function holdCall(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function unHoldCall(callId: number, callback: AsyncCallback): void; + function unHoldCall(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function switchCall(callId: number, callback: AsyncCallback): void; + function switchCall(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function combineConference(callId: number, callback: AsyncCallback): void; + function combineConference(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getMainCallId(callId: number, callback: AsyncCallback): void; + function getMainCallId(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getSubCallIdList(callId: number, callback: AsyncCallback>): void; + function getSubCallIdList(callId: number): Promise>; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getCallIdListForConference(callId: number, callback: AsyncCallback>): void; + function getCallIdListForConference(callId: number): Promise>; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getCallWaitingStatus(slotId: number, callback: AsyncCallback): void; + function getCallWaitingStatus(slotId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback): void; + function setCallWaiting(slotId: number, activate: boolean): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function startDTMF(callId: number, character: string, callback: AsyncCallback): void; + function startDTMF(callId: number, character: string): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function stopDTMF(callId: number, callback: AsyncCallback): void; + function stopDTMF(callId: number): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function isInEmergencyCall(callback: AsyncCallback): void; + function isInEmergencyCall(): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function on(type: 'callDetailsChange', callback: Callback): void; + function off(type: 'callDetailsChange', callback?: Callback): void; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface CallAttributeOptions { + accountNumber: string, + speakerphoneOn: boolean, + accountId: number, + videoState: VideoStateType, + startTime: number, + isEcc: boolean, + callType: CallType, + callId: number, + callState: DetailedCallState, + conferenceState: ConferenceState, + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum ConferenceState { + TEL_CONFERENCE_IDLE = 0, + TEL_CONFERENCE_ACTIVE, + TEL_CONFERENCE_DISCONNECTING, + TEL_CONFERENCE_DISCONNECTED, + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum CallType { + TYPE_CS = 0, // CS + TYPE_IMS = 1, // IMS + TYPE_OTT = 2, // OTT + TYPE_ERR_CALL = 3, // OTHER + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum VideoStateType { + TYPE_VOICE = 0, // Voice + TYPE_VIDEO, // Video + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum DetailedCallState { + CALL_STATUS_ACTIVE = 0, + CALL_STATUS_HOLDING, + CALL_STATUS_DIALING, + CALL_STATUS_ALERTING, + CALL_STATUS_INCOMING, + CALL_STATUS_WAITING, + CALL_STATUS_DISCONNECTED, + CALL_STATUS_DISCONNECTING, + CALL_STATUS_IDLE, + } + + export enum CallState { + /** + * Indicates an invalid state, which is used when the call state fails to be obtained. + */ + CALL_STATE_UNKNOWN = -1, + + /** + * Indicates that there is no ongoing call. + */ + CALL_STATE_IDLE = 0, + + /** + * Indicates that an incoming call is ringing or waiting. + */ + CALL_STATE_RINGING = 1, + + /** + * Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call + * ringing or waiting. + */ + CALL_STATE_OFFHOOK = 2 + } + + export interface DialOptions { + /** + * boolean means whether the call to be made is a video call. The value {@code false} indicates a voice call. + */ + extras?: boolean; + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface RejectMessageOptions { + messageContent: string, + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum CallWaitingStatus { + CALL_WAITING_DISABLE = 0, + CALL_WAITING_ENABLE = 1 + } + + /** + * @since 7 + */ + export interface EmergencyNumberOptions { + slotId?: number; + } + + /** + * @since 7 + */ + export interface NumberFormatOptions { + countryCode?: string; + } +} + export default call; \ No newline at end of file diff --git a/api/@ohos.telephony.data.d.ts b/api/@ohos.telephony.data.d.ts deleted file mode 100755 index ffa1a3f..0000000 --- a/api/@ohos.telephony.data.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides methods related to cellular data services. - * - * @since 6 - */ -declare namespace data { - /** - * Obtains the connection state of the PS domain. - * - * @param slotId Indicates the ID of a card slot. - * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. - * @param callback Returns the connection state, which can be any of the following: - *

    - *
  • {@code DataConnectState#DATA_STATE_UNKNOWN} - *
  • {@code DataConnectState#DATA_STATE_DISCONNECTED} - *
  • {@code DataConnectState#DATA_STATE_CONNECTING} - *
  • {@code DataConnectState#DATA_STATE_CONNECTED} - *
  • {@code DataConnectState#DATA_STATE_SUSPENDED} - *
- */ - function getCellularDataState(callback: AsyncCallback): void; - function getCellularDataState(): Promise; - - /** - * Checks whether cellular data services are enabled. - * - *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * - * @param callback Returns {@code true} if cellular data services are enabled; returns {@code false} otherwise. - */ - function isCellularDataEnabled(callback: AsyncCallback): void; - function isCellularDataEnabled(): Promise; - - /** - * Enables cellular data services. - * - * @hide Used for system app. - */ - function enableCellularData(callback: AsyncCallback): void; - function enableCellularData(): Promise; - - /** - * Diables cellular data services. - * - * @hide Used for system app. - */ - function disableCellularData(callback: AsyncCallback): void; - function disableCellularData(): Promise; - - /** - * Describes the cellular data link connection state. - */ - export enum DataConnectState { - /** - * Indicates that a cellular data link is unknown. - */ - DATA_STATE_UNKNOWN = -1, - - /** - * Indicates that a cellular data link is disconnected. - */ - DATA_STATE_DISCONNECTED = 0, - - /** - * Indicates that a cellular data link is being connected. - */ - DATA_STATE_CONNECTING = 1, - - /** - * Indicates that a cellular data link is connected. - */ - DATA_STATE_CONNECTED = 2, - - /** - * Indicates that a cellular data link is suspended. - */ - DATA_STATE_SUSPENDED = 3 - } -} - -export default data; \ No newline at end of file diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index 2e07a4b..d1c0fe0 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -15,7 +15,6 @@ import {AsyncCallback} from "./basic"; import radio from "./@ohos.telephony.radio"; -import data from "./@ohos.telephony.data"; import call from "./@ohos.telephony.call"; /** @@ -25,13 +24,9 @@ import call from "./@ohos.telephony.call"; * @since 6 */ 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; + type NetworkState = radio.NetworkState; + type SignalInformation = radio.SignalInformation; + type CallState = call.CallState; /** * Called when the network state corresponding to a monitored {@code slotId} updates. @@ -70,28 +65,6 @@ declare namespace observer { function off(type: 'signalInfoChange', callback?: AsyncCallback>): void; - /** - * Called when the cellular data link connection state updates. - * - * @param type cellularDataConnectionStateChange - * @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 cellular data link connection state, - * and networkType Indicates the radio access technology for cellular data services. - */ - function on(type: 'cellularDataConnectionStateChange', - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - function on(type: 'cellularDataConnectionStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - - function once(type: 'cellularDataConnectionStateChange', - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - function once(type: 'cellularDataConnectionStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - - function off(type: 'cellularDataConnectionStateChange', - callback?: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - /** * Receives a call state change. This callback is invoked when the call state of a specified card updates * and the observer is added to monitor the updates. diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts old mode 100755 new mode 100644 index 139ae0b..bbc4dcf --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -1,330 +1,453 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides interfaces for applications to obtain the radio access technology (RAT), network state, - * and signal information of the wireless cellular network (WCN). - * - * @since 6 - */ -declare namespace radio { - /** - * Obtains radio access technology (RAT) of the registered network. The system preferentially - * returns RAT of the packet service (PS) domain. If the device has not registered with the - * PS domain, the system returns RAT of the circuit service (CS) domain. - * - *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * - * @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 an integer indicating the RAT in use. The values are as follows: - *

    - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_UNKNOWN} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_GSM} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_1XRTT} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_WCDMA} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_HSPA} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_HSPAP} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_TD_SCDMA} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_EVDO} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_EHRPD} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_LTE} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_LTE_CA} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_IWLAN} - *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_NR} - *
- */ - function getRadioTech(slotId: number, - callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void; - function getRadioTech(slotId: number): Promise<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>; - - /** - * Obtains the network state of the registered network. - * - *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * - * @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 a {@code NetworkState} object. - */ - function getNetworkState(callback: AsyncCallback): void; - function getNetworkState(slotId: number, callback: AsyncCallback): void; - function getNetworkState(slotId?: number): Promise; - - /** - * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. - * - * @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 instance list of the child classes derived from {@link SignalInformation}. - */ - function getSignalInformation(slotId: number, callback: AsyncCallback>): void; - function getSignalInformation(slotId: number): Promise>; - - /** - * Describes the radio access technology. - */ - export enum RadioTechnology { - /** - * Indicates unknown radio access technology (RAT). - */ - RADIO_TECHNOLOGY_UNKNOWN = 0, - - /** - * Indicates that RAT is global system for mobile communications (GSM), including GSM, general packet - * radio system (GPRS), and enhanced data rates for GSM evolution (EDGE). - */ - RADIO_TECHNOLOGY_GSM = 1, - - /** - * Indicates that RAT is code division multiple access (CDMA), including Interim Standard 95 (IS95) and - * Single-Carrier Radio Transmission Technology (1xRTT). - */ - RADIO_TECHNOLOGY_1XRTT = 2, - - /** - * Indicates that RAT is wideband code division multiple address (WCDMA). - */ - RADIO_TECHNOLOGY_WCDMA = 3, - - /** - * Indicates that RAT is high-speed packet access (HSPA), including HSPA, high-speed downlink packet - * access (HSDPA), and high-speed uplink packet access (HSUPA). - */ - RADIO_TECHNOLOGY_HSPA = 4, - - /** - * Indicates that RAT is evolved high-speed packet access (HSPA+), including HSPA+ and dual-carrier - * HSPA+ (DC-HSPA+). - */ - RADIO_TECHNOLOGY_HSPAP = 5, - - /** - * Indicates that RAT is time division-synchronous code division multiple access (TD-SCDMA). - */ - RADIO_TECHNOLOGY_TD_SCDMA = 6, - - /** - * Indicates that RAT is evolution data only (EVDO), including EVDO Rev.0, EVDO Rev.A, and EVDO Rev.B. - */ - RADIO_TECHNOLOGY_EVDO = 7, - - /** - * Indicates that RAT is evolved high rate packet data (EHRPD). - */ - RADIO_TECHNOLOGY_EHRPD = 8, - - /** - * Indicates that RAT is long term evolution (LTE). - */ - RADIO_TECHNOLOGY_LTE = 9, - - /** - * Indicates that RAT is LTE carrier aggregation (LTE-CA). - */ - RADIO_TECHNOLOGY_LTE_CA = 10, - - /** - * Indicates that RAT is interworking WLAN (I-WLAN). - */ - RADIO_TECHNOLOGY_IWLAN = 11, - - /** - * Indicates that RAT is 5G new radio (NR). - */ - RADIO_TECHNOLOGY_NR = 12 - } - - export interface SignalInformation { - /** - * Obtains the network type corresponding to the signal. - */ - signalType: NetworkType; - - /** - * Obtains the signal level of the current network. - */ - signalLevel: number; - } - - /** - * Describes the network type. - */ - export enum NetworkType { - /** - * Indicates unknown network type. - */ - NETWORK_TYPE_UNKNOWN, - - /** - * Indicates that the network type is GSM. - */ - NETWORK_TYPE_GSM, - - /** - * Indicates that the network type is CDMA. - */ - NETWORK_TYPE_CDMA, - - /** - * Indicates that the network type is WCDMA. - */ - NETWORK_TYPE_WCDMA, - - /** - * Indicates that the network type is TD-SCDMA. - */ - NETWORK_TYPE_TDSCDMA, - - /** - * Indicates that the network type is LTE. - */ - NETWORK_TYPE_LTE, - - /** - * Indicates that the network type is 5G NR. - */ - NETWORK_TYPE_NR - } - - /** - * Describes the network registration state. - */ - export interface NetworkState { - /** - * Obtains the operator name in the long alphanumeric format of the registered network. - * - * @return Returns the operator name in the long alphanumeric format as a string; - * returns an empty string if no operator name is obtained. - */ - longOperatorName: string; - - /** - * Obtains the operator name in the short alphanumeric format of the registered network. - * - * @return Returns the operator name in the short alphanumeric format as a string; - * returns an empty string if no operator name is obtained. - */ - shortOperatorName: string; - - /** - * Obtains the PLMN code of the registered network. - * - * @return Returns the PLMN code as a string; returns an empty string if no operator name is obtained. - */ - plmnNumeric: string; - - /** - * Checks whether the device is roaming. - * - * @return Returns {@code true} if the device is roaming; returns {@code false} otherwise. - */ - isRoaming: boolean; - - /** - * Obtains the network registration status of the device. - * - * @return Returns the network registration status {@code RegState}. - */ - regState: RegState; - - /** - * Obtains the NSA network registration status of the device. - * - * @return Returns the NSA network registration status {@code NsaState}. - */ - nsaState: NsaState; - - /** - * Obtains the status of CA. - * - * @return Returns {@code true} if CA is actived; returns {@code false} otherwise. - */ - isCaActive: boolean; - - /** - * Checks whether this device is allowed to make emergency calls only. - * - * @return Returns {@code true} if this device is allowed to make emergency calls only; - * returns {@code false} otherwise. - */ - isEmergency: boolean; - } - - /** - * Describes the network registration state. - */ - export enum RegState { - /** - * Indicates a state in which a device cannot use any service. - */ - REG_STATE_NO_SERVICE = 0, - - /** - * Indicates a state in which a device can use services properly. - */ - REG_STATE_IN_SERVICE = 1, - - /** - * Indicates a state in which a device can use only the emergency call service. - */ - REG_STATE_EMERGENCY_CALL_ONLY = 2, - - /** - * Indicates that the cellular radio is powered off. - */ - REG_STATE_POWER_OFF = 3 - } - - /** - * Describes the nsa state. - */ - export enum NsaState { - /** - * Indicates that a device is idle under or is connected to an LTE cell that does not support NSA. - */ - NSA_STATE_NOT_SUPPORT = 1, - - /** - * Indicates that a device is idle under an LTE cell supporting NSA but not NR coverage detection. - */ - NSA_STATE_NO_DETECT = 2, - - /** - * Indicates that a device is connected to an LTE network under an LTE cell - * that supports NSA and NR coverage detection. - */ - NSA_STATE_CONNECTED_DETECT = 3, - - /** - * Indicates that a device is idle under an LTE cell supporting NSA and NR coverage detection. - */ - NSA_STATE_IDLE_DETECT = 4, - - /** - * Indicates that a device is connected to an LTE + NR network under an LTE cell that supports NSA. - */ - NSA_STATE_DUAL_CONNECTED = 5, - - /** - * Indicates that a device is idle under or is connected to an NG-RAN cell while being attached to 5GC. - */ - NSA_STATE_SA_ATTACHED = 6 - } -} - +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback} from "./basic"; + +/** + * Provides interfaces for applications to obtain the network state, cell information, signal information, + * and device ID of the wireless cellular network (WCN), and provides a callback registration mechanism to + * listen for changes of the network, cell, and signal status of the WCN. + * + * @since 6 + * @sysCap SystemCapability.Telephony.Telephony + */ +declare namespace radio { + /** + * Obtains radio access technology (RAT) of the registered network. The system + * returns RAT of the packet service (PS) and circuit service (CS) domain. + * + *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. + * + * @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 an integer indicating the RAT in use. The values are as follows: + *

    + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_UNKNOWN} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_GSM} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_1XRTT} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_WCDMA} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_HSPA} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_HSPAP} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_TD_SCDMA} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_EVDO} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_EHRPD} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_LTE} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_LTE_CA} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_IWLAN} + *
  • {@code RadioTechnology#RADIO_TECHNOLOGY_NR} + *
+ * @permission ohos.permission.GET_NETWORK_INFO + */ + function getRadioTech(slotId: number, + callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void; + function getRadioTech(slotId: number): Promise<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>; + + /** + * Obtains the network state of the registered network. + * + *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. + * + * @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 a {@code NetworkState} object. + * @permission ohos.permission.GET_NETWORK_INFO + */ + function getNetworkState(callback: AsyncCallback): void; + function getNetworkState(slotId: number, callback: AsyncCallback): void; + function getNetworkState(slotId?: number): Promise; + + /** + * Obtains the network search mode of the SIM card in a specified slot. + * + * @param slotId Indicates the ID of the SIM card slot. + * @param callback Returns the network search mode of the SIM card. Available values are as follows: + *

    + *
  • {@link NetworkSelectionMode#NETWORK_SELECTION_UNKNOWN} + *
  • {@link NetworkSelectionMode#NETWORK_SELECTION_AUTOMATIC} + *
  • {@link NetworkSelectionMode#NETWORK_SELECTION_MANUAL} + *
      + */ + function getNetworkSelectionMode(slotId: number, callback: AsyncCallback): void; + function getNetworkSelectionMode(slotId: number): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + */ + function setNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback): void; + function setNetworkSelectionMode(options: NetworkSelectionModeOptions): Promise; + + /** + * @permission ohos.permission.GET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + */ + function getNetworkSearchInformation(slotId: number, callback: AsyncCallback): void; + function getNetworkSearchInformation(slotId: number): Promise; + + /** + * Obtains the ISO-defined country code of the country where the registered network is deployed. + * + * @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 country code defined in ISO 3166-2; + * returns an empty string if the device is not registered with any network. + * @since 7 + */ + function getISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback): void; + function getISOCountryCodeForNetwork(slotId: number): Promise; + + /** + * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. + * + * @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 instance list of the child classes derived from {@link SignalInformation}. + * @since 7 + */ + function getSignalInformation(slotId: number, callback: AsyncCallback>): void; + function getSignalInformation(slotId: number): Promise>; + + /** + * @permission ohos.permission.GET_NETWORK_INFO + * @since 7 + */ + function isRadioOn(callback: AsyncCallback): void; + function isRadioOn(): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function turnOnRadio(callback: AsyncCallback): void; + function turnOnRadio(): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function turnOffRadio(callback: AsyncCallback): void; + function turnOffRadio(): Promise; + + /** + * Describes the radio access technology. + */ + export enum RadioTechnology { + /** + * Indicates unknown radio access technology (RAT). + */ + RADIO_TECHNOLOGY_UNKNOWN = 0, + + /** + * Indicates that RAT is global system for mobile communications (GSM), including GSM, general packet + * radio system (GPRS), and enhanced data rates for GSM evolution (EDGE). + */ + RADIO_TECHNOLOGY_GSM = 1, + + /** + * Indicates that RAT is code division multiple access (CDMA), including Interim Standard 95 (IS95) and + * Single-Carrier Radio Transmission Technology (1xRTT). + */ + RADIO_TECHNOLOGY_1XRTT = 2, + + /** + * Indicates that RAT is wideband code division multiple address (WCDMA). + */ + RADIO_TECHNOLOGY_WCDMA = 3, + + /** + * Indicates that RAT is high-speed packet access (HSPA), including HSPA, high-speed downlink packet + * access (HSDPA), and high-speed uplink packet access (HSUPA). + */ + RADIO_TECHNOLOGY_HSPA = 4, + + /** + * Indicates that RAT is evolved high-speed packet access (HSPA+), including HSPA+ and dual-carrier + * HSPA+ (DC-HSPA+). + */ + RADIO_TECHNOLOGY_HSPAP = 5, + + /** + * Indicates that RAT is time division-synchronous code division multiple access (TD-SCDMA). + */ + RADIO_TECHNOLOGY_TD_SCDMA = 6, + + /** + * Indicates that RAT is evolution data only (EVDO), including EVDO Rev.0, EVDO Rev.A, and EVDO Rev.B. + */ + RADIO_TECHNOLOGY_EVDO = 7, + + /** + * Indicates that RAT is evolved high rate packet data (EHRPD). + */ + RADIO_TECHNOLOGY_EHRPD = 8, + + /** + * Indicates that RAT is long term evolution (LTE). + */ + RADIO_TECHNOLOGY_LTE = 9, + + /** + * Indicates that RAT is LTE carrier aggregation (LTE-CA). + */ + RADIO_TECHNOLOGY_LTE_CA = 10, + + /** + * Indicates that RAT is interworking WLAN (I-WLAN). + */ + RADIO_TECHNOLOGY_IWLAN = 11, + + /** + * Indicates that RAT is 5G new radio (NR). + */ + RADIO_TECHNOLOGY_NR = 12 + } + + export interface SignalInformation { + /** + * Obtains the network type corresponding to the signal. + */ + signalType: NetworkType; + + /** + * Obtains the signal level of the current network. + */ + signalLevel: number; + } + + /** + * Describes the network type. + */ + export enum NetworkType { + /** + * Indicates unknown network type. + */ + NETWORK_TYPE_UNKNOWN, + + /** + * Indicates that the network type is GSM. + */ + NETWORK_TYPE_GSM, + + /** + * Indicates that the network type is CDMA. + */ + NETWORK_TYPE_CDMA, + + /** + * Indicates that the network type is WCDMA. + */ + NETWORK_TYPE_WCDMA, + + /** + * Indicates that the network type is TD-SCDMA. + */ + NETWORK_TYPE_TDSCDMA, + + /** + * Indicates that the network type is LTE. + */ + NETWORK_TYPE_LTE, + + /** + * Indicates that the network type is 5G NR. + */ + NETWORK_TYPE_NR + } + + /** + * Describes the network registration state. + */ + export interface NetworkState { + /** + * Obtains the operator name in the long alphanumeric format of the registered network. + * + * @return Returns the operator name in the long alphanumeric format as a string; + * returns an empty string if no operator name is obtained. + */ + longOperatorName: string; + + /** + * Obtains the operator name in the short alphanumeric format of the registered network. + * + * @return Returns the operator name in the short alphanumeric format as a string; + * returns an empty string if no operator name is obtained. + */ + shortOperatorName: string; + + /** + * Obtains the PLMN code of the registered network. + * + * @return Returns the PLMN code as a string; returns an empty string if no operator name is obtained. + */ + plmnNumeric: string; + + /** + * Checks whether the device is roaming. + * + * @return Returns {@code true} if the device is roaming; returns {@code false} otherwise. + */ + isRoaming: boolean; + + /** + * Obtains the network registration status of the device. + * + * @return Returns the network registration status {@code RegState}. + */ + regState: RegState; + + /** + * Obtains the NSA network registration status of the device. + * + * @return Returns the NSA network registration status {@code NsaState}. + */ + nsaState: NsaState; + + /** + * Obtains the status of CA. + * + * @return Returns {@code true} if CA is actived; returns {@code false} otherwise. + */ + isCaActive: boolean; + + /** + * Checks whether this device is allowed to make emergency calls only. + * + * @return Returns {@code true} if this device is allowed to make emergency calls only; + * returns {@code false} otherwise. + */ + isEmergency: boolean; + } + + /** + * Describes the network registration state. + */ + export enum RegState { + /** + * Indicates a state in which a device cannot use any service. + */ + REG_STATE_NO_SERVICE = 0, + + /** + * Indicates a state in which a device can use services properly. + */ + REG_STATE_IN_SERVICE = 1, + + /** + * Indicates a state in which a device can use only the emergency call service. + */ + REG_STATE_EMERGENCY_CALL_ONLY = 2, + + /** + * Indicates that the cellular radio is powered off. + */ + REG_STATE_POWER_OFF = 3 + } + + /** + * Describes the nsa state. + */ + export enum NsaState { + /** + * Indicates that a device is idle under or is connected to an LTE cell that does not support NSA. + */ + NSA_STATE_NOT_SUPPORT = 1, + + /** + * Indicates that a device is idle under an LTE cell supporting NSA but not NR coverage detection. + */ + NSA_STATE_NO_DETECT = 2, + + /** + * Indicates that a device is connected to an LTE network under an LTE cell + * that supports NSA and NR coverage detection. + */ + NSA_STATE_CONNECTED_DETECT = 3, + + /** + * Indicates that a device is idle under an LTE cell supporting NSA and NR coverage detection. + */ + NSA_STATE_IDLE_DETECT = 4, + + /** + * Indicates that a device is connected to an LTE + NR network under an LTE cell that supports NSA. + */ + NSA_STATE_DUAL_CONNECTED = 5, + + /** + * Indicates that a device is idle under or is connected to an NG-RAN cell while being attached to 5GC. + */ + NSA_STATE_SA_ATTACHED = 6 + } + + /** + * @systemapi Hide this for inner system use. + */ + export interface NetworkSearchResult { + isNetworkSearchSuccess: boolean; + networkSearchResult: Array; + } + + /** + * @systemapi Hide this for inner system use. + */ + export interface NetworkInformation { + operatorName: string; + operatorNumeric: string; + state: NetworkInformationState; + radioTech: string; + } + + /** + * @systemapi Hide this for inner system use. + */ + export enum NetworkInformationState { + /** Indicates that the network state is unknown. */ + NETWORK_UNKNOWN, + + /** Indicates that the network is available for registration. */ + NETWORK_AVAILABLE, + + /** Indicates that you have already registered with the network. */ + NETWORK_CURRENT, + + /** Indicates that the network is unavailable for registration. */ + NETWORK_FORBIDDEN + } + + /** + * @systemapi Hide this for inner system use. + */ + export interface NetworkSelectionModeOptions { + slotId: number; + selectMode: NetworkSelectionMode; + networkInformation: NetworkInformation; + resumeSelection: boolean; + } + + export enum NetworkSelectionMode { + /** Unknown network selection modes. */ + NETWORK_SELECTION_UNKNOWN, + + /** Automatic network selection modes. */ + NETWORK_SELECTION_AUTOMATIC, + + /** Manual network selection modes. */ + NETWORK_SELECTION_MANUAL + } +} + export default radio; \ No newline at end of file diff --git a/api/@ohos.telephony.sim.d.ts b/api/@ohos.telephony.sim.d.ts old mode 100755 new mode 100644 index e586e47..ed9652a --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -1,118 +1,235 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides applications with APIs for obtaining SIM card status, card file information, and card specifications. - * SIM cards include SIM, USIM, and CSIM cards. - * - * @since 6 - */ -declare namespace sim { - /** - * Obtains the ISO country code of the SIM card 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 the country code defined in ISO 3166-2; returns an empty string if no SIM card is inserted. - */ - function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback): void; - function getISOCountryCodeForSim(slotId: number): Promise; - - /** - * Obtains the home PLMN number of the SIM card in a specified slot. - * - *

      The value is recorded in the SIM card and is irrelevant to the network - * with which the SIM card is currently registered. - * - * @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 PLMN number; returns an empty string if no SIM card is inserted. - */ - function getSimOperatorNumeric(slotId: number, callback: AsyncCallback): void; - function getSimOperatorNumeric(slotId: number): Promise; - - /** - * Obtains the service provider name (SPN) of the SIM card in a specified slot. - * - *

      The value is recorded in the EFSPN file of the SIM card and is irrelevant to the network - * with which the SIM card is currently registered. - * - * @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 SPN; returns an empty string if no SIM card is inserted or - * no EFSPN file in the SIM card. - */ - function getSimSpn(slotId: number, callback: AsyncCallback): void; - function getSimSpn(slotId: number): Promise; - - /** - * Obtains the state of the SIM card in a specified slot. - * - * @param slotId Indicates the card slot index number, - * ranging from {@code 0} to the maximum card slot index number supported by the device. - * @param callback Returns one of the following SIM card states: - *

        - *
      • {@code SimState#SIM_STATE_UNKNOWN} - *
      • {@code SimState#SIM_STATE_NOT_PRESENT} - *
      • {@code SimState#SIM_STATE_LOCKED} - *
      • {@code SimState#SIM_STATE_NOT_READY} - *
      • {@code SimState#SIM_STATE_READY} - *
      • {@code SimState#SIM_STATE_LOADED} - *
      - */ - function getSimState(slotId: number, callback: AsyncCallback): void; - function getSimState(slotId: number): Promise; - - export enum SimState { - /** - * Indicates unknown SIM card state, that is, the accurate status cannot be obtained. - */ - SIM_STATE_UNKNOWN, - - /** - * Indicates that the SIM card is in the not present state, that is, no SIM card is inserted - * into the card slot. - */ - SIM_STATE_NOT_PRESENT, - - /** - * Indicates that the SIM card is in the locked state, that is, the SIM card is locked by the - * personal identification number (PIN)/PIN unblocking key (PUK) or network. - */ - SIM_STATE_LOCKED, - - /** - * Indicates that the SIM card is in the not ready state, that is, the SIM card is in position - * but cannot work properly. - */ - SIM_STATE_NOT_READY, - - /** - * Indicates that the SIM card is in the ready state, that is, the SIM card is in position and - * is working properly. - */ - SIM_STATE_READY, - - /** - * Indicates that the SIM card is in the loaded state, that is, the SIM card is in position and - * is working properly. - */ - SIM_STATE_LOADED - } -} - +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback} from "./basic"; + +/** + * Provides applications with APIs for obtaining SIM card status, card file information, and card specifications. + * SIM cards include SIM, USIM, and CSIM cards. + * + * @since 6 + * @sysCap SystemCapability.Telephony.Telephony + */ +declare namespace sim { + /** + * Obtains the default card slot for the voice service. + * + * @param callback Returns {@code 0} if card 1 is used as the default card slot for the voice service; + * returns {@code 1} if card 2 is used as the default card slot for the voice service; + * returns {@code -1} if no card is available for the voice service. + * @since 7 + */ + function getDefaultVoiceSlotId(callback: AsyncCallback): void; + function getDefaultVoiceSlotId(): Promise; + + /** + * Obtains the ISO country code of the SIM card 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 the country code defined in ISO 3166-2; returns an empty string if no SIM card is inserted. + */ + function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback): void; + function getISOCountryCodeForSim(slotId: number): Promise; + + /** + * Obtains the home PLMN number of the SIM card in a specified slot. + * + *

      The value is recorded in the SIM card and is irrelevant to the network + * with which the SIM card is currently registered. + * + * @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 PLMN number; returns an empty string if no SIM card is inserted. + */ + function getSimOperatorNumeric(slotId: number, callback: AsyncCallback): void; + function getSimOperatorNumeric(slotId: number): Promise; + + /** + * Obtains the service provider name (SPN) of the SIM card in a specified slot. + * + *

      The value is recorded in the EFSPN file of the SIM card and is irrelevant to the network + * with which the SIM card is currently registered. + * + * @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 SPN; returns an empty string if no SIM card is inserted or + * no EFSPN file in the SIM card. + */ + function getSimSpn(slotId: number, callback: AsyncCallback): void; + function getSimSpn(slotId: number): Promise; + + /** + * Obtains the state of the SIM card in a specified slot. + * + * @param slotId Indicates the card slot index number, + * ranging from {@code 0} to the maximum card slot index number supported by the device. + * @param callback Returns one of the following SIM card states: + *

        + *
      • {@code SimState#SIM_STATE_UNKNOWN} + *
      • {@code SimState#SIM_STATE_NOT_PRESENT} + *
      • {@code SimState#SIM_STATE_LOCKED} + *
      • {@code SimState#SIM_STATE_NOT_READY} + *
      • {@code SimState#SIM_STATE_READY} + *
      • {@code SimState#SIM_STATE_LOADED} + *
      + */ + function getSimState(slotId: number, callback: AsyncCallback): void; + function getSimState(slotId: number): Promise; + + /** + * Obtains the ICCID of the SIM card in a specified slot. + * + *

      The ICCID is a unique identifier of a SIM card. It consists of 20 digits + * and is recorded in the EFICCID 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 ICCID; returns an empty string if no SIM card is inserted. + * @permission ohos.permission.GET_TELEPHONY_STATE + */ + function getSimIccId(slotId: number, callback: AsyncCallback): void; + function getSimIccId(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. + * + *

      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 GID1; returns an empty string if no SIM card is inserted or + * no GID1 in the SIM card. + * @permission ohos.permission.GET_TELEPHONY_STATE + */ + function getSimGid1(slotId: number, callback: AsyncCallback): void; + function getSimGid1(slotId: number): Promise; + + /** + * @permission ohos.permission.GET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + */ + function getIMSI(slotId: number, callback: AsyncCallback): void; + function getIMSI(slotId: number): Promise; + + /** + * @permission ohos.permission.GET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getSimAccountInfo(slotId: number, callback: AsyncCallback): void; + function getSimAccountInfo(slotId: number): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void; + function setDefaultVoiceSlotId(slotId: number): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function unlockPin(slotId: number, pin: string, callback: AsyncCallback): void; + function unlockPin(slotId: number, pin: string): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback): void; + function unlockPuk(slotId: number, newPin: string, puk: string): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback): void; + function alterPin(slotId: number, newPin: string, oldPin: string): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + 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. + * @since 7 + */ + export interface IccAccountInfo { + slotIndex: number, /* slot id */ + showName: string, /* display name for card */ + showNumber: string, /* display number for card */ + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface LockStatusResponse { + result: number, /* Current operation result */ + remain?: number, /* Operations remaining */ + } + + export enum SimState { + /** + * Indicates unknown SIM card state, that is, the accurate status cannot be obtained. + */ + SIM_STATE_UNKNOWN, + + /** + * Indicates that the SIM card is in the not present state, that is, no SIM card is inserted + * into the card slot. + */ + SIM_STATE_NOT_PRESENT, + + /** + * Indicates that the SIM card is in the locked state, that is, the SIM card is locked by the + * personal identification number (PIN)/PIN unblocking key (PUK) or network. + */ + SIM_STATE_LOCKED, + + /** + * Indicates that the SIM card is in the not ready state, that is, the SIM card is in position + * but cannot work properly. + */ + SIM_STATE_NOT_READY, + + /** + * Indicates that the SIM card is in the ready state, that is, the SIM card is in position and + * is working properly. + */ + SIM_STATE_READY, + + /** + * Indicates that the SIM card is in the loaded state, that is, the SIM card is in position and + * is working properly. + */ + SIM_STATE_LOADED + } +} + export default sim; \ No newline at end of file diff --git a/api/@ohos.telephony.sms.d.ts b/api/@ohos.telephony.sms.d.ts old mode 100755 new mode 100644 index a1b162b..709f1b6 --- a/api/@ohos.telephony.sms.d.ts +++ b/api/@ohos.telephony.sms.d.ts @@ -1,155 +1,303 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides the capabilities and methods for obtaining Short Message Service (SMS) management objects. - * - * @since 6 - */ -declare namespace sms { - /** - * Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. - * - *

      After receiving the original PDU data, the system creates an SMS message instance according to the specified - * SMS protocol. - * - * @param pdu Indicates the original data, which is obtained from the received SMS. - * @param specification Indicates the SMS protocol type. The value {@code 3gpp} indicates GSM/UMTS/LTE SMS, - * and the value {@code 3gpp2} indicates CDMA/LTE SMS. - * @param callback Returns an SMS message instance; returns {@code null} if {@code pdu} is empty or - * {@code specification} is not supported. - */ - function createMessage(pdu: Array, specification: string, callback: AsyncCallback): void; - function createMessage(pdu: Array, specification: string): Promise; - - /** - * Sends a text or data SMS message. - * - *

      This method checks whether the length of an SMS message exceeds the maximum length. If the - * maximum length is exceeded, the SMS message is split into multiple parts and sent separately. - *

      You need to obtain the following permission before calling this method: - * {@code ohos.permission.SEND_MESSAGES} - * - * @param options Indicates the parameters and callback for sending the SMS message. - */ - function sendMessage(options: SendMessageOptions): void; - - export interface ShortMessage { - /** Indicates the SMS message body. */ - visibleMessageBody: string; - /** Indicates the address of the sender, which is to be displayed on the UI. */ - visibleRawAddress: string; - /** Indicates the SMS type. */ - messageClass: ShortMessageClass; - /** Indicates the protocol identifier. */ - protocolId: number; - /** Indicates the short message service center (SMSC) address. */ - scAddress: string; - /** Indicates the SMSC timestamp. */ - scTimestamp: number; - /** Indicates whether the received SMS is a "replace short message". */ - isReplaceMessage: boolean; - /** Indicates whether the received SMS contains "TP-Reply-Path". */ - hasReplyPath: boolean; - /** Indicates Protocol Data Units (PDUs) from an SMS message. */ - pdu: Array; - /** - * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the - * Short Message Service Center (SMSC). - */ - status: number; - /** Indicates whether the current message is SMS-STATUS-REPORT. */ - isSmsStatusReportMessage: boolean; - /** Indicates the email message address. */ - emailAddress: string; - /** Indicates the email message body. */ - emailMessageBody: string; - /** Indicates the user data excluding the data header. */ - userRawData: Array; - /** Indicates whether the received SMS is an email message. */ - isEmailMessage: boolean; - } - - export enum ShortMessageClass { - /** Indicates an unknown type. */ - UNKNOWN, - /** Indicates an instant message, which is displayed immediately after being received. */ - INSTANT_MESSAGE, - /** Indicates an SMS message that can be stored on the device or SIM card based on the storage status. */ - OPTIONAL_MESSAGE, - /** Indicates an SMS message containing SIM card information, which is to be stored in a SIM card. */ - SIM_MESSAGE, - /** Indicates an SMS message to be forwarded to another device. */ - FORWARD_MESSAGE - } - - export interface SendMessageOptions { - /** Indicates the ID of the SIM card slot used for sending the SMS message. */ - slotId: number; - /** Indicates the address to which the SMS message is sent. */ - destinationHost: string; - /** Indicates the SMSC address. If the value is {@code null}, the default SMSC address of the SIM card*/ - serviceCenter?: string; - /** If the content is a string, this is a short message. If the content is a byte array, this is a data message. */ - content: string | Array; - /** If send data message, destinationPort is mandatory. Otherwise is optional. */ - destinationPort?: number; - /** Indicates the callback invoked after the SMS message is sent. */ - sendCallback?: AsyncCallback; - /** Indicates the callback invoked after the SMS message is delivered. */ - deliveryCallback?: AsyncCallback; - } - - export interface ISendShortMessageCallback { - /** Indicates the SMS message sending result. */ - result: SendSmsResult; - /** Indicates the URI to store the sent SMS message. */ - url: string; - /** Specifies whether this is the last part of a multi-part SMS message. */ - isLastPart: boolean; - } - - export interface IDeliveryShortMessageCallback { - /** Indicates the SMS delivery report. */ - pdu: Array; - } - - export enum SendSmsResult { - /** - * Indicates that the SMS message is successfully sent. - */ - SEND_SMS_SUCCESS = 0, - - /** - * Indicates that sending the SMS message fails due to an unknown reason. - */ - SEND_SMS_FAILURE_UNKNOWN = 1, - - /** - * Indicates that sending the SMS fails because the modem is powered off. - */ - SEND_SMS_FAILURE_RADIO_OFF = 2, - - /** - * Indicates that sending the SMS message fails because the network is unavailable - * or does not support sending or reception of SMS messages. - */ - SEND_SMS_FAILURE_SERVICE_UNAVAILABLE = 3 - } -} - -export default sms; \ No newline at end of file +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback} from "./basic"; + +/** + * Provides the capabilities and methods for obtaining Short Message Service (SMS) management objects. + * + * @since 6 + * @sysCap SystemCapability.Telephony.Telephony + */ +declare namespace sms { + /** + * Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. + * + *

      After receiving the original PDU data, the system creates an SMS message instance according to the specified + * SMS protocol. + * + * @param pdu Indicates the original data, which is obtained from the received SMS. + * @param specification Indicates the SMS protocol type. The value {@code 3gpp} indicates GSM/UMTS/LTE SMS, + * and the value {@code 3gpp2} indicates CDMA/LTE SMS. + * @param callback Returns an SMS message instance; returns {@code null} if {@code pdu} is empty or + * {@code specification} is not supported. + */ + function createMessage(pdu: Array, specification: string, callback: AsyncCallback): void; + function createMessage(pdu: Array, specification: string): Promise; + + /** + * Sends a text or data SMS message. + * + *

      This method checks whether the length of an SMS message exceeds the maximum length. If the + * maximum length is exceeded, the SMS message is split into multiple parts and sent separately. + *

      You need to obtain the following permission before calling this method: + * {@code ohos.permission.SEND_MESSAGES} + * + * @param options Indicates the parameters and callback for sending the SMS message. + * @permission ohos.permission.SEND_MESSAGES + */ + function sendMessage(options: SendMessageOptions): void; + + /** + * Sets the default SIM card for sending SMS messages. You can obtain the default SIM card by + * using {@code getDefaultSmsSlotId}. + * + * @param slotId Indicates the default SIM card for sending SMS messages. The value {@code 0} indicates card slot 1, + * and the value {@code 1} indicates card slot 2. + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function setDefaultSmsSlotId(slotId: number, callback: AsyncCallback): void; + function setDefaultSmsSlotId(slotId: number): Promise; + + /** + * Obtains the default SIM card for sending SMS messages. + * + * @param callback Returns {@code 0} if the default SIM card for sending SMS messages is in card slot 1; + * returns {@code 1} if the default SIM card for sending SMS messages is in card slot 2. + * @since 7 + */ + function getDefaultSmsSlotId(callback: AsyncCallback): void; + function getDefaultSmsSlotId(): Promise; + + /** + * Sets the address for the Short Message Service Center (SMSC) based on a specified slot ID. + * + *

      Permissions: {@link ohos.security.SystemPermission#SET_TELEPHONY_STATE} + * + * @param slotId Indicates the ID of the slot holding the SIM card for sending SMS messages. + * @param smscAddr Indicates the SMSC address. + * @permission ohos.permission.SET_TELEPHONY_STATE + * @since 7 + */ + function setSmscAddr(slotId: number, smscAddr: string, callback: AsyncCallback): void; + function setSmscAddr(slotId: number, smscAddr: string): Promise; + + /** + * Obtains the SMSC address based on a specified slot ID. + * + *

      Permissions: {@link ohos.security.SystemPermission#GET_TELEPHONY_STATE} + * + * @param slotId Indicates the ID of the slot holding the SIM card for sending SMS messages. + * @param callback Returns the SMSC address. + * @permission ohos.permission.GET_TELEPHONY_STATE + * @since 7 + */ + function getSmscAddr(slotId: number, callback: AsyncCallback): void; + function getSmscAddr(slotId: number): Promise; + + /** + * @permission ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + * @systemapi Hide this for inner system use. + * @since 7 + */ + function addSimMessage(options: SimMessageOptions, callback: AsyncCallback): void; + function addSimMessage(options: SimMessageOptions): Promise; + + /** + * @permission ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + * @systemapi Hide this for inner system use. + * @since 7 + */ + function delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): void; + function delSimMessage(slotId: number, msgIndex: number): Promise; + + /** + * @permission ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + * @systemapi Hide this for inner system use. + * @since 7 + */ + function updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback): void; + function updateSimMessage(options: UpdateSimMessageOptions): Promise; + + /** + * @permission ohos.permission.RECEIVE_SMS + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getAllSimMessages(slotId: number, callback: AsyncCallback>): void; + function getAllSimMessages(slotId: number): Promise>; + + /** + * @permission ohos.permission.RECEIVE_SMS + * @systemapi Hide this for inner system use. + * @since 7 + */ + function setCBConfig(options: CBConfigOptions, callback: AsyncCallback): void; + function setCBConfig(options: CBConfigOptions): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface CBConfigOptions { + slotId: number, + enable: boolean, + startMessageId: number, + endMessageId: number, + ranType: number + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface SimMessageOptions { + slotId: number, + smsc: string, + pdu: string, + status: SimMessageStatus + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface UpdateSimMessageOptions { + slotId: number, + msgIndex: number, + newStatus: SimMessageStatus, + pdu: string, + smsc: string + } + + export interface ShortMessage { + /** Indicates the SMS message body. */ + visibleMessageBody: string; + /** Indicates the address of the sender, which is to be displayed on the UI. */ + visibleRawAddress: string; + /** Indicates the SMS type. */ + messageClass: ShortMessageClass; + /** Indicates the protocol identifier. */ + protocolId: number; + /** Indicates the short message service center (SMSC) address. */ + scAddress: string; + /** Indicates the SMSC timestamp. */ + scTimestamp: number; + /** Indicates whether the received SMS is a "replace short message". */ + isReplaceMessage: boolean; + /** Indicates whether the received SMS contains "TP-Reply-Path". */ + hasReplyPath: boolean; + /** Indicates Protocol Data Units (PDUs) from an SMS message. */ + pdu: Array; + /** + * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the + * Short Message Service Center (SMSC). + */ + status: number; + /** Indicates whether the current message is SMS-STATUS-REPORT. */ + isSmsStatusReportMessage: boolean; + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface SimShortMessage { + shortMessage: ShortMessage; + + /** Indicates the storage status of SMS messages in the SIM */ + simMessageStatus: SimMessageStatus; + /** Indicates the index of SMS messages in the SIM */ + indexOnSim: number; + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum SimMessageStatus { + /** status free space ON SIM */ + SIM_MESSAGE_STATUS_FREE = 0, + /** REC READ received read message */ + SIM_MESSAGE_STATUS_READ = 1, + /** REC UNREAD received unread message */ + SIM_MESSAGE_STATUS_UNREAD = 3, + /** STO SENT stored sent message (only applicable to SMs) */ + SIM_MESSAGE_STATUS_SENT = 5, + /** STO UNSENT stored unsent message (only applicable to SMs) */ + SIM_MESSAGE_STATUS_UNSENT = 7, + } + + export enum ShortMessageClass { + /** Indicates an unknown type. */ + UNKNOWN, + /** Indicates an instant message, which is displayed immediately after being received. */ + INSTANT_MESSAGE, + /** Indicates an SMS message that can be stored on the device or SIM card based on the storage status. */ + OPTIONAL_MESSAGE, + /** Indicates an SMS message containing SIM card information, which is to be stored in a SIM card. */ + SIM_MESSAGE, + /** Indicates an SMS message to be forwarded to another device. */ + FORWARD_MESSAGE + } + + export interface SendMessageOptions { + /** Indicates the ID of the SIM card slot used for sending the SMS message. */ + slotId: number; + /** Indicates the address to which the SMS message is sent. */ + destinationHost: string; + /** Indicates the SMSC address. If the value is {@code null}, the default SMSC address of the SIM card*/ + serviceCenter?: string; + /** If the content is a string, this is a short message. If the content is a byte array, this is a data message. */ + content: string | Array; + /** If send data message, destinationPort is mandatory. Otherwise is optional. */ + destinationPort?: number; + /** Indicates the callback invoked after the SMS message is sent. */ + sendCallback?: AsyncCallback; + /** Indicates the callback invoked after the SMS message is delivered. */ + deliveryCallback?: AsyncCallback; + } + + export interface ISendShortMessageCallback { + /** Indicates the SMS message sending result. */ + result: SendSmsResult; + /** Indicates the URI to store the sent SMS message. */ + url: string; + /** Specifies whether this is the last part of a multi-part SMS message. */ + isLastPart: boolean; + } + + export interface IDeliveryShortMessageCallback { + /** Indicates the SMS delivery report. */ + pdu: Array; + } + + export enum SendSmsResult { + /** + * Indicates that the SMS message is successfully sent. + */ + SEND_SMS_SUCCESS = 0, + + /** + * Indicates that sending the SMS message fails due to an unknown reason. + */ + SEND_SMS_FAILURE_UNKNOWN = 1, + + /** + * Indicates that sending the SMS fails because the modem is powered off. + */ + SEND_SMS_FAILURE_RADIO_OFF = 2, + + /** + * Indicates that sending the SMS message fails because the network is unavailable + * or does not support sending or reception of SMS messages. + */ + SEND_SMS_FAILURE_SERVICE_UNAVAILABLE = 3 + } +} + +export default sms; -- Gitee From 1930c459ef53a2aef65a543205f7bba48ffd2874 Mon Sep 17 00:00:00 2001 From: Wang Date: Tue, 12 Oct 2021 17:05:36 +0800 Subject: [PATCH 0003/1181] On branch master Your branch is up to date with 'origin/master'. Signed-off-by:lifansheng --- api/@ohos.process.d.ts | 367 ++++++++++++++++++++------------- api/@ohos.url.d.ts | 34 ++-- api/@ohos.util.d.ts | 449 +++++++++++++++++++++++++++++++++++++++-- api/@ohos.xml.d.ts | 223 ++++++++++++++++++++ 4 files changed, 905 insertions(+), 168 deletions(-) create mode 100644 api/@ohos.xml.d.ts diff --git a/api/@ohos.process.d.ts b/api/@ohos.process.d.ts index bff59be..d481c9b 100644 --- a/api/@ohos.process.d.ts +++ b/api/@ohos.process.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * The process is mainly used to obtain the relevant ID of the process, obtain and modify @@ -26,202 +26,295 @@ declare namespace process { export interface ChildProcess { /** - * return pid is the pid of the current process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the pid of the current process. - */ + * return pid is the pid of the current process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the pid of the current process. + */ readonly pid: number; /** - * return ppid is the pid of the current child process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the pid of the current child process. - */ + * return ppid is the pid of the current child process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the pid of the current child process. + */ readonly ppid: number; /** - * return exitCode is the exit code of the current child process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the exit code of the current child process. - */ + * return exitCode is the exit code of the current child process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the exit code of the current child process. + */ readonly exitCode: number; /** - * return boolean is whether the current process signal is sent successfully - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return whether the current process signal is sent successfully. - */ + * return boolean is whether the current process signal is sent successfully + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return whether the current process signal is sent successfully. + */ readonly killed: boolean; /** - * return 'number' is the targer process exit code - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the targer process exit code. - */ + * return 'number' is the targer process exit code + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the targer process exit code. + */ wait(): Promise; /** - * return it as 'Uint8Array' of the stdout until EOF - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return subprocess standard outpute. - */ + * return it as 'Uint8Array' of the stdout until EOF + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return subprocess standard outpute. + */ getOutput(): Promise; /** - * return it as 'Uint8Array of the stderr until EOF - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return subprocess standard error output. - */ + * return it as 'Uint8Array of the stderr until EOF + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return subprocess standard error output. + */ getErrorOutput(): Promise; /** - * close the target process - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ + * close the target process + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ close(): void; /** - * send a signal to process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param signal number or string represents the signal sent. - */ + * send a signal to process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param signal number or string represents the signal sent. + */ kill(signal: number | string): void; } /** - * returns the numeric valid group ID of the process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the numeric valid group ID of the process. - */ + * returns the numeric valid group ID of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric valid group ID of the process. + */ readonly getEgid: number; /** - * return the numeric valid user identity of the process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the numeric valid user identity of the process. - */ + * return the numeric valid user identity of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric valid user identity of the process. + */ readonly getEuid: number; /** - * returns the numeric group id of the process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the numeric group if of the process. - */ + * returns the numeric group id of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric group if of the process. + */ readonly getGid: number /** - * returns the digital user id of the process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the digital user id of the process. - */ + * returns the digital user id of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the digital user id of the process. + */ readonly getUid: number; /** - * return an array with supplementary group id - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return an array with supplementary group id. - */ + * return an array with supplementary group id + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return an array with supplementary group id. + */ readonly getGroups: number[]; /** - * return pid is The pid of the current process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return The pid of the current process. - */ + * return pid is The pid of the current process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return The pid of the current process. + */ readonly getPid: number; /** - * return ppid is The pid of the current child process - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return The pid of the current child processs. - */ + * return ppid is The pid of the current child process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return The pid of the current child processs. + */ readonly getPpid: number; + /** + * Returns the tid of the current thread. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return return the tid of the current thread. + */ + function getTid(): number; + + /** + * Returns a boolean whether the process is isolated. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return return boolean whether the process is isolated. + */ + function isIsolatedProcess(): boolean; + + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param v An id. + * @return return a boolean whether the specified uid belongs to a particular application. + */ + function isAppUid(v: number): boolean; + + /** + * Returns a boolean whether the process is running in a 64-bit environment. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return return a boolean whether the process is running in a 64-bit environment. + */ + function is64Bit(): boolean; + + /** + * Returns the uid based on the specified user name. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param v Process name. + * @return return the uid based on the specified user name. + */ + function getUidForName(v: string): number; + + /** + * Returns the thread priority based on the specified tid. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param v The tid of the process. + * @return Return the thread priority based on the specified tid. + */ + function getThreadPriority(v: number): number; + + /** + * Returns the elapsed real time (in milliseconds) taken from the start of the system to the start of the process. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Return the start of the system to the start of the process. + */ + function getStartRealtime(): number; + + /** + * Returns cpu cores available for the current process on a multi-core device. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Return cpu cores available for the current process on a multi-core device. + */ + function getAvailableCores​(): number[]; + + /** + * Returns the cpu time (in milliseconds) from the time when the process starts to the current time. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Return the cpu time (in milliseconds) from the time when the process starts to the current time. + */ + function getPastCpuTime(): number; + + /** + * Returns the system configuration at runtime. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param name Parameters defined by the system configuration. + * @return Return the system configuration at runtime. + */ + function getSystemConfig(name: number): number; + + /** + * Returns the system value for environment variables. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param name Parameters defined by the system environment variables. + * @Returns the system value for environment variables. + */ + function getEnvironmentVar(name: string): string; + type EventListener = (evt: Object) => void; /** - * Return a child process object and spawns a new ChildProcess to run the command - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param command string of the shell commands executed by the child process. - * @param options This is an object. The object contains three parameters. Timeout is the running time of the child - * process, killSignal is the signal sent when the child process reaches timeout, and maxBuffer is the size of the - * maximum buffer area for standard input and output. - * @return Return a child process object. - */ + * Return a child process object and spawns a new ChildProcess to run the command + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param command string of the shell commands executed by the child process. + * @param options This is an object. The object contains three parameters. Timeout is the running time of the child + * process, killSignal is the signal sent when the child process reaches timeout, and maxBuffer is the size of the + * maximum buffer area for standard input and output. + * @return Return a child process object. + */ function runCmd(command: string, options?: { timeout : number, killSignal : number | string, maxBuffer : number }): ChildProcess; /** - * Abort current process - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ + * Abort current process + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ function abort(): void; /** - * Register for an event - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param type Indicates the type of event registered. - * @param listener Represents the registered event function - */ + * Register for an event + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param type Indicates the type of event registered. + * @param listener Represents the registered event function + */ function on(type: string, listener: EventListener): void; /** - * Remove registered event - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param type Remove the type of registered event. - * @return Return removed result. - */ + * Remove registered event + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param type Remove the type of registered event. + * @return Return removed result. + */ function off(type: string): boolean; /** - * Process exit - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param code Process exit code. - */ + * Process exit + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param code Process exit code. + */ function exit(code: number): void; /** - * Return the current work directory; - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Return the current work directory. - */ + * Return the current work directory; + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the current work directory. + */ function cwd(): string; /** - * Change current directory - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param dir The path you want to change. - */ + * Change current directory + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param dir The path you want to change. + */ function chdir(dir: string): void; /** - * Returns the running time of the system - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Return the running time of the system. - */ + * Returns the running time of the system + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the running time of the system. + */ function uptime(): number; /** diff --git a/api/@ohos.url.d.ts b/api/@ohos.url.d.ts index 3bf1c44..be47f42 100644 --- a/api/@ohos.url.d.ts +++ b/api/@ohos.url.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * The url module provides utilities for URL resolution and parsing. @@ -110,10 +110,10 @@ declare namespace url { set(name: string, value: string): void; /** - * Sort all key/value pairs contained in this object in place and return undefined. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ + * Sort all key/value pairs contained in this object in place and return undefined. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ sort(): void; /** diff --git a/api/@ohos.util.d.ts b/api/@ohos.util.d.ts index 9841a83..ab23c05 100644 --- a/api/@ohos.util.d.ts +++ b/api/@ohos.util.d.ts @@ -1,17 +1,17 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * TextDecoder support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device, TextEncoder takes a * stream of code points as input and emits a stream of UTF-8 bytes, and system help function. @@ -157,6 +157,427 @@ declare namespace util { dest: Uint8Array, ): { read: number; written: number }; } -} + + class RationalNumber​ { + /** + * A constructor used to create a RationalNumber instance with a given numerator and denominator. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param numerator An integer number + * @param denominator An integer number + */ + constructor(numerator: number, denominator: number); + /** + * Creates a RationalNumber object based on a given string. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param String Expression of Rational Numbers + * @return Returns a RationalNumber object generated based on the given string. + */ + static createRationalFromString​(rationalString: string): RationalNumber​; + /** + * Compares the current RationalNumber object to the given object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param An object of other rational numbers + * @return Returns 0 or 1, or -1, depending on the comparison. + */ + compareTo​(another :RationalNumber): number; + /** + * Compares two objects for equality. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param An object + * @return Returns true if the given object is the same as the current object; Otherwise, false is returned. + */ + equals​(obj: Object): boolean; + /** + * Gets integer and floating-point values of a rational number object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the integer and floating-point values of a rational number object. + */ + value(): number; + /** + * Get the greatest common divisor of two integers. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param number1 is an integer. + * @param number2 is an integer. + * @return Returns the greatest common divisor of two integers, integer type. + */ + static getCommonDivisor​(number1: number, number2: number): number; + /** + * Gets the denominator of the current object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the denominator of the current object. + */ + getDenominator​(): number; + /** + * Gets the numerator​ of the current object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the numerator​ of the current object. + */ + getNumerator​(): number; + /** + * Checks whether the current RationalNumber object represents an infinite value. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return If the denominator is not 0, true is returned. Otherwise, false is returned. + */ + isFinite​() : boolean; + /** + * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. + */ + isNaN​(): boolean; + /** + * Checks whether the current RationalNumber object represents the value 0. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return If the value represented by the current object is 0, true is returned. Otherwise, false is returned. + */ + isZero​(): boolean; + /** + * Obtains a string representation of the current RationalNumber object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns a string representation of the current RationalNumber object. + */ + toString​(): string; + } + + class LruBuffer { + /** + * Default constructor used to create a new LruBuffer instance with the default capacity of 64. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param capacity Indicates the capacity to customize for the buffer. + */ + constructor(capacity?:number); + /** + * Updates the buffer capacity to a specified capacity. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param newCapacity Indicates the new capacity to set. + */ + updateCapacity(newCapacity: number):void + /** + *Returns a string representation of the object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the string representation of the object and outputs the string representation of the object. + */ + toString():string + /** + * Obtains a list of all values in the current buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the total number of values in the current buffer. + */ + size():number + /** + * Obtains the capacity of the current buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the capacity of the current buffer. + */ + capacity(): number; + /** + * Clears key-value pairs from the current buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + clear(): void; + /** + * Obtains the number of times createDefault(Object) returned a value. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the number of times createDefault(java.lang.Object) returned a value. + */ + getCreateCount(): number; + /** + * Obtains the number of times that the queried values are not matched. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the number of times that the queried values are not matched. + */ + getMissCount(): number; + /** + * Obtains the number of times that values are evicted from the buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the number of times that values are evicted from the buffer. + */ + getRemovalCount(): number; + /** + * Obtains the number of times that the queried values are successfully matched. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the number of times that the queried values are successfully matched. + */ + getMatchCount(): number; + /** + * Obtains the number of times that values are added to the buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the number of times that values are added to the buffer. + */ + getPutCount(): number; + /** + * Checks whether the current buffer is empty. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns true if the current buffer contains no value. + */ + isEmpty​(): boolean; + /** + * Obtains the value associated with a specified key. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param key Indicates the key to query. + * @return Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + */ + get(key: K): V | undefined; + /** + * Adds a key-value pair to the buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param key Indicates the key to add. + * @param value Indicates the value associated with the key to add. + * @return Returns the value associated with the added key; returns the original value if the key to add already exists. + */ + put(key: K, value: V): V; + /** + * Obtains a list of all values in the current buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + */ + values(): V[]; + /** + * Obtains a list of keys for the values in the current buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns a list of keys sorted from most recently accessed to least recently accessed. + */ + keys​(): K[]; + /** + * Deletes a specified key and its associated value from the current buffer. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param key key + * @return Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + */ + remove(key: K): V | undefined; + /** + * Executes subsequent operations after a value is deleted. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param isEvict The parameter value is true if this method is called due to insufficient capacity, and the parameter value is false in other cases. + * @param key Indicates the deleted key. + * @param value Indicates the deleted value. + * @param newValue The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) method is called and the key to add already exists. The parameter value is null in other cases. + */ + afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; + /** + * Checks whether the current buffer contains a specified key. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param key Indicates the key to check. + * @return Returns true if the buffer contains the specified key. + */ + contains​(key: K): boolean; + /** + * Executes subsequent operations if miss to compute a value for the specific key. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param key Indicates the missed key. + * @return Returns the value associated with the key. + */ + createDefault​(key: K): V; + /** + * Returns an array of key-value pairs of enumeratable properties of a given object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns an array of key-value pairs for the enumeratable properties of the given object itself. + */ + entries(): IterableIterator<[K, V]>; + /** + * Specifies the default iterator for an object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns a two - dimensional array in the form of key - value pairs. + */ + [Symbol.iterator](): IterableIterator<[K, V]>; + } + interface ScopeComparable { + /* The comparison function is used by the scope. */ + compareTo(other: ScopeComparable): boolean; + } + + type ScopeType = ScopeComparable | number; + class Scope{ + /** + * A constructor used to create a Scope instance with the lower and upper bounds specified. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param lowerObj A ScopeType value + * @param upperObj A ScopeType value + */ + constructor(lowerObj: ScopeType, upperObj: ScopeType); + /** + * Obtains a string representation of the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns a string representation of the current range object. + */ + toString​(): string; + /** + * Returns the intersection of a given range and the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param range A Scope range object + * @return Returns the intersection of a given range and the current range. + */ + intersect(range: Scope): Scope; + /** + * Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param lowerObj A ScopeType value + * @param upperObj A ScopeType value + * @return Returns the intersection of the current range and the range specified by the given lower and upper bounds. + */ + intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope; + /** + * Obtains the upper bound of the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the upper bound of the current range. + */ + getUpper(): ScopeType; + /** + * Obtains the lower bound of the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @return Returns the lower bound of the current range. + */ + getLower(): ScopeType; + /** + * Creates the smallest range that includes the current range and the given lower and upper bounds. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param lowerObj A ScopeType value + * @param upperObj A ScopeType value + * @return Returns the smallest range that includes the current range and the given lower and upper bounds. + */ + expand(lowerObj: ScopeType, upperObj: ScopeType): Scope; + /** + * Creates the smallest range that includes the current range and a given range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param range A Scope range object + * @return Returns the smallest range that includes the current range and a given range. + */ + expand(range: Scope): Scope; + /** + * Creates the smallest range that includes the current range and a given value. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A ScopeType value + * @return Returns the smallest range that includes the current range and a given value. + */ + expand(value: ScopeType): Scope; + /** + * Checks whether a given value is within the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param range A ScopeType range + * @return If the value is within the current range return true,oherwise return false. + */ + contains(value: ScopeType): boolean; + /** + * Checks whether a given range is within the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Scope value + * @return If the current range is within the given range return true,oherwise return false. + */ + contains(range: Scope): boolean; + /** + * Clamps a given value to the current range. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A ScopeType value + * @return Returns a ScopeType object that a given value is clamped to the current range.. + */ + clamp(value: ScopeType): ScopeType; + } + + class Base64{ + /** + * Constructor for creating base64 encoding and decoding + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param No input parameter is required. + * @return No return value. + */ + constructor(); + /** + * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Uint8Array value + * @param value A number value + * @return Return the encoded new Uint8Array. + */ + encode(src: Uint8Array): Uint8Array; + /** + * Encodes the specified byte array into a String using the Base64 encoding scheme. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Uint8Array value + * @return Return the encoded string. + */ + encodeToString(src: Uint8Array): string; + /** + * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Uint8Array value or value A string value + * @return Return the decoded Uint8Array. + */ + decode(src: Uint8Array | string): Uint8Array; + /** + * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Uint8Array value + * @return Return the encodes asynchronous new Uint8Array. + */ + encodeAsync(src: Uint8Array): Promise; + /** + * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Uint8Array value + * @return Returns the encoded asynchronous string. + */ + encodeToStringAsync(src: Uint8Array): Promise; + /** + * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @param value A Uint8Array value or value A string value + * @return Return the decoded asynchronous Uint8Array. + */ + decodeAsync(src: Uint8Array | string): Promise; + } +} export default util; \ No newline at end of file diff --git a/api/@ohos.xml.d.ts b/api/@ohos.xml.d.ts new file mode 100644 index 0000000..641e4ea --- /dev/null +++ b/api/@ohos.xml.d.ts @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * The xml module provides utilities for converting XML text to Javascript object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import xml from '@ohos.xml'; + * @permission N/A + */ +declare namespace xml { + class DefaultKey { + /** + * default Name of the declaration property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly declarationKey = "_declaration"; + /** + * default Name of the instruction property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly instructionKey = "_instruction"; + /** + * default Name of the attributes property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly attributesKey = "_attributes"; + /** + * default Name of the text property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly textKey = "_text"; + /** + * default Name of the cdata property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly cdataKey = "_cdata"; + /** + * default Name of the doctype property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly doctypeKey = "_doctype"; + /** + * default Name of the comment property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly commentKey = "_comment"; + /** + * default Name of the parent property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly parentKey = "_parent"; + /** + * default Name of the type property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly typeKey = "_type"; + /** + * default Name of the name property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly nameKey = "_name"; + /** + * default Name of the elements property key in the output object. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + readonly elementsKey = "_elements"; + } + + interface ConvertOptions { + /** + * Whether to trim whitespace characters that may exist before and after the text, default false. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + trim: boolean; + /** + * Whether to ignore writing declaration directives of xml. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreDeclaration?: boolean; + /** + * Whether to ignore writing processing instruction of xml. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreInstruction?: boolean; + /** + * Whether to print attributes across multiple lines and indent them. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreAttributes?: boolean; + /** + * Whether to ignore writing comments of the elements. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreComment?: boolean; + /** + * Whether to ignore writing CData of the elements. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreCdata?: boolean; + /** + * Whether to ignore writing Doctype of the elements. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreDoctype?: boolean; + /** + * Whether to ignore writing texts of the elements. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + ignoreText?: boolean; + /** + * Name of the property key which will be used for the declaration. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + declarationKey: string; + /** + * Name of the property key which will be used for the processing instruction. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + instructionKey: string; + /** + * Name of the property key which will be used for the attributes. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + attributesKey: string; + /** + * Name of the property key which will be used for the text. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + textKey: string; + /** + * Name of the property key which will be used for the cdata. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + cdataKey: string; + /** + * Name of the property key which will be used for the doctype. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + doctypeKey: string; + /** + * Name of the property key which will be used for the comment. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + commentKey: string; + /** + * Name of the property key which will be used for the parent. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + parentKey: string; + /** + * Name of the property key which will be used for the type. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + typeKey: string; + /** + * Name of the property key which will be used for the name. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + nameKey: string; + /** + * Name of the property key which will be used for the elements. + * @since 8 + * @sysCap SystemCapability.CCRuntime + */ + elementsKey: string; + } + + interface ConvertXML { + /** + * To convert XML text to JavaScript object. + * @since 8 + * @sysCap SystemCapability.CCRuntime. + * @param xml The xml text to be converted. + * @param option Option Inputed by user to set. + * @return Returns a JavaScript object converting from XML text. + */ + convert(xml: string, option?: ConvertOptions) : Object; + } +} +export default xml; \ No newline at end of file -- Gitee From 5cd9d048250a04dcafd6df282834c45062e2e901 Mon Sep 17 00:00:00 2001 From: lihong Date: Thu, 14 Oct 2021 17:24:40 +0800 Subject: [PATCH 0004/1181] lihong67@huawei.com update @internal. Signed-off-by: lihong Change-Id: I961d35bce47762c9b2c093376d023b6660fe3760 --- .../component/ets/ability_component.d.ts | 78 + api/@internal/component/ets/action_sheet.d.ts | 46 + api/@internal/component/ets/alert_dialog.d.ts | 168 +- .../component/ets/alphabet_indexer.d.ts | 99 + api/@internal/component/ets/animator.d.ts | 126 + api/@internal/component/ets/badge.d.ts | 96 +- api/@internal/component/ets/blank.d.ts | 28 + api/@internal/component/ets/button.d.ts | 89 +- api/@internal/component/ets/calendar.d.ts | 495 ++++ api/@internal/component/ets/camera.d.ts | 45 + api/@internal/component/ets/circle.d.ts | 30 + api/@internal/component/ets/column.d.ts | 29 + api/@internal/component/ets/column_split.d.ts | 26 + api/@internal/component/ets/common.d.ts | 2260 ++++++++++++++++- api/@internal/component/ets/counter.d.ts | 37 + .../ets/custom_dialog_controller.d.ts | 25 +- api/@internal/component/ets/datapanel.d.ts | 29 + api/@internal/component/ets/datePicker.d.ts | 92 + api/@internal/component/ets/divider.d.ts | 43 + api/@internal/component/ets/ellipse.d.ts | 28 + api/@internal/component/ets/flex.d.ts | 28 + api/@internal/component/ets/forEach.d.ts | 14 + .../component/ets/form_component.d.ts | 89 + api/@internal/component/ets/gauge.d.ts | 65 + api/@internal/component/ets/geometryView.d.ts | 23 + api/@internal/component/ets/gesture.d.ts | 399 +++ api/@internal/component/ets/grid.d.ts | 67 + api/@internal/component/ets/gridItem.d.ts | 48 + .../component/ets/grid_container.d.ts | 60 + api/@internal/component/ets/hyperlink.d.ts | 30 + api/@internal/component/ets/image.d.ts | 130 + .../component/ets/image_animator.d.ts | 89 + api/@internal/component/ets/index.d.ts | 3 + api/@internal/component/ets/inspector.d.ts | 21 +- api/@internal/component/ets/lazyForEach.d.ts | 76 + api/@internal/component/ets/line.d.ts | 43 + api/@internal/component/ets/list.d.ts | 114 + api/@internal/component/ets/listItem.d.ts | 76 + .../component/ets/loadingProgress.d.ts | 51 + api/@internal/component/ets/marquee.d.ts | 82 +- api/@internal/component/ets/menu.d.ts | 54 +- api/@internal/component/ets/navigator.d.ts | 75 +- .../component/ets/navigatorView.d.ts | 24 + api/@internal/component/ets/option.d.ts | 24 + .../component/ets/pageTransition.d.ts | 128 +- api/@internal/component/ets/panel.d.ts | 131 +- api/@internal/component/ets/path.d.ts | 34 + api/@internal/component/ets/piece.d.ts | 43 +- api/@internal/component/ets/polygon.d.ts | 30 + api/@internal/component/ets/polyline.d.ts | 34 + api/@internal/component/ets/progress.d.ts | 81 +- api/@internal/component/ets/qrcode.d.ts | 37 +- api/@internal/component/ets/radio.d.ts | 37 +- api/@internal/component/ets/rating.d.ts | 53 +- api/@internal/component/ets/rect.d.ts | 55 +- api/@internal/component/ets/refresh.d.ts | 105 + api/@internal/component/ets/row.d.ts | 27 + api/@internal/component/ets/row_split.d.ts | 28 + api/@internal/component/ets/scroll.d.ts | 138 +- api/@internal/component/ets/search.d.ts | 34 + api/@internal/component/ets/shape.d.ts | 89 +- api/@internal/component/ets/slider.d.ts | 128 +- api/@internal/component/ets/span.d.ts | 62 + api/@internal/component/ets/stack.d.ts | 28 + .../component/ets/stateManagement.d.ts | 473 +++- api/@internal/component/ets/swiper.d.ts | 109 + api/@internal/component/ets/tab_content.d.ts | 32 +- api/@internal/component/ets/tabs.d.ts | 103 + api/@internal/component/ets/text.d.ts | 248 ++ api/@internal/component/ets/textPicker.d.ts | 71 +- api/@internal/component/ets/textarea.d.ts | 62 +- api/@internal/component/ets/textinput.d.ts | 148 +- api/@internal/component/ets/toggle.d.ts | 60 + api/@internal/component/ets/video.d.ts | 152 +- api/@internal/component/ets/web.d.ts | 34 + api/@internal/ets/lifecycle.d.ts | 231 +- api/@internal/global.d.ts | 7 +- api/@internal/js/global.js.d.ts | 0 78 files changed, 8423 insertions(+), 163 deletions(-) create mode 100644 api/@internal/component/ets/refresh.d.ts create mode 100644 api/@internal/component/ets/search.d.ts create mode 100644 api/@internal/component/ets/web.d.ts mode change 100755 => 100644 api/@internal/js/global.js.d.ts diff --git a/api/@internal/component/ets/ability_component.d.ts b/api/@internal/component/ets/ability_component.d.ts index 2ca0027..9c5cb73 100644 --- a/api/@internal/component/ets/ability_component.d.ts +++ b/api/@internal/component/ets/ability_component.d.ts @@ -16,26 +16,104 @@ import {CommonMethod} from "./common"; import {Want} from "../api/common/ability/want"; +/** + * controller of ability. + * @devices phone, tablet, car. + * @since 7 + */ export declare class AbilityController { + /** + * constructor. + * @devices phone, tablet, car. + * @since 7 + */ constructor(); + + /** + * load the ability in the AbilityComponent. + * Want: Capability description to be loaded + * @devices phone, tablet, car. + * @since 7 + */ startAbility(value: Want); + + /** + * Perform a return operation inside the AbilityComponent. + * @devices phone, tablet, car. + * @since 7 + */ performBackPress(); + + /** + * Obtains the number of tasks in the internal task stack of the AbilityComponent. + * @devices phone, tablet, car. + * @since 7 + */ getStackCount(); } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare class AbilityComponentExtend extends AbilityComponentAttribute { } +/** + * AbilityComponent inheritance abilitycomponentattribute. + * Want: Capability description to be loaded. + * controller: Ability Controller. + * @devices phone, tablet, car. + * @since 7 + */ interface AbilityComponent extends AbilityComponentAttribute { (value: { want: Want, controller?: AbilityController }): AbilityComponent; } +/** + * The attribute of ability. + * @devices phone, tablet, car. + * @since 7 + */ declare class AbilityComponentAttribute extends CommonMethod { + /** + * Callback when the abilityComponent environment starts up, after which the abilityController methods can be used. + * @devices phone, tablet, car. + * @since 7 + */ onReady(event: () => void): T; + + /** + * Callback when the abilityComponent environment is destroyed. + * @devices phone, tablet, car. + * @since 7 + */ onDestroy(event: () => void): T; + + /** + * This event is triggered when the abilityComponent loads the mobility. Name indicates the Ability name. + * @devices phone, tablet, car. + * @since 7 + */ onAbilityCreated(event: (name: string) => void): T; + + /** + * Internal to the AbilityComponent, which is triggered when the Ability moves to the foreground. + * @devices phone, tablet, car. + * @since 7 + */ onAbilityMoveToFront(event: () => void): T; + + /** + * Internal to the AbilityComponent, which is triggered before the Mobility is removed. + * @devices phone, tablet, car. + * @since 7 + */ onAbilityWillRemove(event: () => void): T; } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare const AbilityComponentInterface: AbilityComponent; diff --git a/api/@internal/component/ets/action_sheet.d.ts b/api/@internal/component/ets/action_sheet.d.ts index 26a0620..cffda34 100644 --- a/api/@internal/component/ets/action_sheet.d.ts +++ b/api/@internal/component/ets/action_sheet.d.ts @@ -16,19 +16,60 @@ import { DialogAlignment } from "./alert_dialog"; import {CommonMethod, Resource} from "./common" +/** + * The information of sheet. + * @devices phone, tablet, car. + * @since 7 + */ interface SheetInfo { + /** + * Title Properties + * @devices phone, tablet, car. + * @since 7 + */ title: string | Resource; + + /** + * Icon Properties. + * @devices phone, tablet, car. + * @since 7 + */ icon?: string | Resource; + + /** + * Callback method after the operation. + * @devices phone, tablet, car. + * @since 7 + */ action: () => void; } +/** + * Callback method after the operation. + * @devices phone, tablet, car. + * @since 7 + */ export declare class ActionSheetExtend extends ActionSheetAttribute { } +/** + * create ActionSheet. + * @devices phone, tablet, car. + * @since 7 + */ interface ActionSheet extends ActionSheetAttribute { } +/** + * @devices phone, tablet, car. + * @since 7 + */ declare class ActionSheetAttribute extends CommonMethod { + /** + * Invoking method display. + * @devices phone, tablet, car. + * @since 7 + */ show(value: { title: string | Resource; message: string | Resource; @@ -44,4 +85,9 @@ declare class ActionSheetAttribute extends CommonMethod { }); } +/** + * Definitions ActionSheetInterface. + * @devices phone, tablet, car. + * @since 7 + */ export declare const ActionSheetInterface: ActionSheet; diff --git a/api/@internal/component/ets/alert_dialog.d.ts b/api/@internal/component/ets/alert_dialog.d.ts index 361b982..f87e048 100644 --- a/api/@internal/component/ets/alert_dialog.d.ts +++ b/api/@internal/component/ets/alert_dialog.d.ts @@ -15,41 +15,205 @@ import {CommonMethod, Resource} from "./common" +/** + * The alignment of dialog, + * @devices phone, tablet, car. + * @since 7 + */ export declare enum DialogAlignment { + /** + * Vertical top alignment. + * @devices phone, tablet, car. + * @since 7 + */ Top, + + /** + * Align vertically to the center. + * @devices phone, tablet, car. + * @since 7 + */ Center, + + /** + * Vertical bottom alignment. + * @devices phone, tablet, car. + * @since 7 + */ Bottom, + + /** + * Default alignment. + * @devices phone, tablet, car. + * @since 7 + */ Default } +/** + * @devices phone, tablet, car. + * @since 7 + */ interface AlertDialog { + /** + * Invoking method display. + * @devices phone, tablet, car. + * @since 7 + */ show(value: { + /** + * Title Properties + * @devices phone, tablet, car. + * @since 7 + */ title?: string | Resource; + + /** + * message Properties + * @devices phone, tablet, car. + * @since 7 + */ message: string | Resource; + + /** + * Allows users to click the mask layer to exit. + * @devices phone, tablet, car. + * @since 7 + */ autoCancel?: boolean; + + /** + * Invoke the commit function. + * @devices phone, tablet, car. + * @since 7 + */ confirm?: { + + /** + * Text content of the confirmation button. + * @devices phone, tablet, car. + * @since 7 + */ value: string | Resource; + + /** + * Method executed by the callback. + * @devices phone, tablet, car. + * @since 7 + */ action: () => void; }; + + /** + * Execute Cancel Function. + * @devices phone, tablet, car. + * @since 7 + */ cancel?: () => void; + + /** + * Alignment in the vertical direction. + * @devices phone, tablet, car. + * @since 7 + */ alignment?: DialogAlignment; + + /** + * Offset of the pop-up window relative to the alignment position. + * @devices phone, tablet, car. + * @since 7 + */ offset?: { dx: number | string | Resource, dy: number | string | Resource }; } | { + + /** + * Title Properties + * @devices phone, tablet, car. + * @since 7 + */ title?: string | Resource; + + /** + * message Properties + * @devices phone, tablet, car. + * @since 7 + */ message: string | Resource; + + /** + * Allows users to click the mask layer to exit. + * @devices phone, tablet, car. + * @since 7 + */ autoCancel?: boolean; + + /** + * First button. + * @devices phone, tablet, car. + * @since 7 + */ primaryButton: { - value: string | Resource; - action: () => void; + /** + * Text content of the confirmation button. + * @devices phone, tablet, car. + * @since 7 + */ + value: string | Resource; + + /** + * Method executed by the callback. + * @devices phone, tablet, car. + * @since 7 + */ + action: () => void; }; + + /** + * Second button. + * @devices phone, tablet, car. + * @since 7 + */ secondaryButton: { + /** + * Text content of the confirmation button. + * @devices phone, tablet, car. + * @since 7 + */ value: string | Resource; + + /** + * Method executed by the callback. + * @devices phone, tablet, car. + * @since 7 + */ action: () => void; }; + + /** + * Execute Cancel Function. + * @devices phone, tablet, car. + * @since 7 + */ cancel?: () => void; + + /** + * Alignment in the vertical direction. + * @devices phone, tablet, car. + * @since 7 + */ alignment?: DialogAlignment; + + /** + * Offset of the pop-up window relative to the alignment position. + * @devices phone, tablet, car. + * @since 7 + */ offset?: { dx: number | string | Resource, dy: number | string | Resource }; }); } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare const AlertDialogInterface: AlertDialog; diff --git a/api/@internal/component/ets/alphabet_indexer.d.ts b/api/@internal/component/ets/alphabet_indexer.d.ts index 27d0858..62d06cf 100644 --- a/api/@internal/component/ets/alphabet_indexer.d.ts +++ b/api/@internal/component/ets/alphabet_indexer.d.ts @@ -16,42 +16,141 @@ import {CommonMethod, Color, Resource} from "./common"; import {FontWeight, FontStyle} from "./text"; +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare enum IndexerAlign { + /** + * A dialog box is displayed on the right of the index bar. + * @devices phone, tablet, car. + * @since 7 + */ Left, + + /** + * A dialog box is displayed on the left of the index bar. + * @devices phone, tablet, car. + * @since 7 + */ Right } +/** + * Alphabet index bar. + * @devices phone, tablet, car. + * @since 7 + */ export declare class AlphabetIndexerExtend extends AlphabetIndexerAttribute { } +/** + * Alphabet index bar. + * @devices phone, tablet, car. + * @since 7 + */ interface AlphabetIndexer extends AlphabetIndexerAttribute { + /** + * ArrayValue: Alphabetical index string array. + * selected: ID of the selected item. + * @devices phone, tablet, car. + * @since 7 + */ (value: {ArrayValue : Array, selected : number}): AlphabetIndexer; } +/** + * @devices phone, tablet, car. + * @since 7 + */ declare class AlphabetIndexerAttribute extends CommonMethod { + /** + * Index bar selection callback. + * @devices phone, tablet, car. + * @since 7 + */ onSelected(event: (index: number) => void): T; + /** + * Definitions color. + * @devices phone, tablet, car. + * @since 7 + */ color(value: Color | number | string | Resource): T; + /** + * Select the text color. + * @devices phone, tablet, car. + * @since 7 + */ selectedColor(value: Color | number | string | Resource): T; + /** + * Font color of the pop-up prompt text. + * @devices phone, tablet, car. + * @since 7 + */ popupColor(value: Color | number | string | Resource): T; + /** + * Select the text background color. + * @devices phone, tablet, car. + * @since 7 + */ selectedBackgroundColor(value: Color | number | string | Resource): T; + /** + * Background color of the pop-up window index. + * @devices phone, tablet, car. + * @since 7 + */ popupBackground(value: Color | number | string | Resource): T; + /** + * Whether to use pop-up index hints. + * @devices phone, tablet, car. + * @since 7 + */ usingPopup(value: boolean): T; + /** + * Select the text text style, + * @devices phone, tablet, car. + * @since 7 + */ selectedFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; + /** + * Select the text background color. + * @devices phone, tablet, car. + * @since 7 + */ popupFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; + /** + * Size of the letter area on the letter index bar. The letter area is a square. Set the length of the square side. + * @devices phone, tablet, car. + * @since 7 + */ itemSize(value: string | number): T; + /** + * Definitions fonts. + * @devices phone, tablet, car. + * @since 7 + */ font(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; + /** + * Alphabet index bar alignment style. The left and right alignment styles are supported, which affects the pop-up position of the pop-up window. + * @devices phone, tablet, car. + * @since 7 + */ alignStyle(value: IndexerAlign): T; } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare const AlphabetIndexerInterface: AlphabetIndexer; diff --git a/api/@internal/component/ets/animator.d.ts b/api/@internal/component/ets/animator.d.ts index 2e51167..8af79b7 100644 --- a/api/@internal/component/ets/animator.d.ts +++ b/api/@internal/component/ets/animator.d.ts @@ -15,57 +15,183 @@ import {CommonMethod, AnimationStatus, Curve, FillMode, PlayMode} from "./common"; +/** + * Customize spring properties. + * @devices phone, tablet, car. + * @since 7 + */ export declare class SpringProp { + /** + * Constructor parameters + * @devices object, tablet. + * @since 7 + */ constructor(mass: number, stiffness: number, damping: number); } +/** + * Spring animation model. You can build a spring animation based on the start point, end point, initial speed, and spring attributes. + * @devices phone, tablet, car. + * @since 7 + */ export declare class SpringMotion { + /** + * Constructor parameters + * @devices phone, tablet, car. + * @since 7 + */ constructor(start: number, end: number, velocity: number, prop: SpringProp); } +/** + * Friction animation model. You can build friction animation by friction force, initial position, and initial velocity. + * @devices phone, tablet, car. + * @since 7 + */ export declare class FrictionMotion { + /** + * Constructor parameters + * @devices phone, tablet, car. + * @since 7 + */ constructor(friction: number, position: number, velocity: number); } +/** + * Rolling animation model: You can build rolling animation based on the initial position, initial speed, boundary position, and spring attributes. + * @devices phone, tablet, car. + * @since 7 + */ export declare class ScrollMotion { + /** + * Constructor parameters + * @devices phone, tablet, car. + * @since 7 + */ constructor(position: number, velocity: number, min: number, max: number, prop: SpringProp); } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare class AnimatorExtend extends AnimatorAttribute { } +/** + * @devices phone, tablet, car. + * @since 7 + */ interface Animator extends AnimatorAttribute { (value: string): Animator; } +/** + * @devices phone, tablet, car. + * @since 7 + */ declare class AnimatorAttribute extends CommonMethod { + /** + * Controls the playback status. The default value is the initial state. + * @devices phone, tablet, car. + * @since 7 + */ state(value: AnimationStatus): T; + /** + * Animation duration, in milliseconds. + * @devices phone, tablet, car. + * @since 7 + */ duration(value: number): T; + /** + * Animation curve, default to linear curve + * @devices phone, tablet, car. + * @since 7 + */ curve(value: Curve): T; + /** + * Delayed animation playback duration, in milliseconds. By default, the animation is not delayed. + * @devices phone, tablet, car. + * @since 7 + */ delay(value: number): T; + /** + * Sets the state before and after the animation starts. + * @devices phone, tablet, car. + * @since 7 + */ fillMode(value: FillMode): T; + /** + * The default playback is once. If the value is -1, the playback is unlimited. + * @devices phone, tablet, car. + * @since 7 + */ iterations(value: number): T; + /** + * Sets the animation playback mode. By default, the animation starts to play again after the playback is complete. + * @devices phone, tablet, car. + * @since 7 + */ playMode(value: PlayMode): T; + /** + * Configure the physical animation algorithm. + * @devices phone, tablet, car. + * @since 7 + */ motion(value: SpringMotion | FrictionMotion | ScrollMotion): T; + /** + * Status callback, which is triggered when the animation starts to play. + * @devices phone, tablet, car. + * @since 7 + */ onStart(event: () => void): T; + /** + * Status callback, triggered when the animation pauses. + * @devices phone, tablet, car. + * @since 7 + */ onPause(event: () => void): T; + /** + * Status callback, triggered when the animation is replayed. + * @devices phone, tablet, car. + * @since 7 + */ onRepeat(event: () => void): T; + /** + * Status callback, which is triggered when the animation is canceled. + * @devices phone, tablet, car. + * @since 7 + */ onCancel(event: () => void): T; + /** + * Status callback, which is triggered when the animation playback is complete. + * @devices phone, tablet, car. + * @since 7 + */ onFinish(event: () => void): T; + /** + * The callback input parameter is the interpolation during animation playback. + * @devices phone, tablet, car. + * @since 7 + */ onFrame(event: (value: number) => void): T; } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare const AnimatorInterface: Animator; \ No newline at end of file diff --git a/api/@internal/component/ets/badge.d.ts b/api/@internal/component/ets/badge.d.ts index 49587d2..b29e7a7 100644 --- a/api/@internal/component/ets/badge.d.ts +++ b/api/@internal/component/ets/badge.d.ts @@ -13,30 +13,112 @@ * limitations under the License. */ -import {CommonMethod, Color} from "./common" +import {CommonMethod, Color, Resource} from "./common" +/** + * @devices phone, tablet, car. + * @since 7 + */ declare enum BadgePosition { - Right, + /** + * The dot is displayed vertically centered on the right. + * @devices phone, tablet, car. + * @since 7 + */ RightTop, + + /** + * Dots are displayed in the upper right corner. + * @devices phone, tablet, car. + * @since 7 + */ + Right, + + /** + * The dot is displayed in the left vertical center. + * @devices phone, tablet, car. + * @since 7 + */ Left } +/** + * BadgeStyle object + * @devices phone, tablet, car. + * @since 7 + */ interface BadgeStyle { - color?: Color; + /** + * Text Color + * @devices phone, tablet, car. + * @since 7 + */ + color?: Color | number | string | Resource; + + /** + * Text size. + * @devices phone, tablet, car. + * @since 7 + */ fontSize?: number | string; - badgeSize?: number | string; - badgeColor: Color; + + /** + * Size of a badge. + * @devices phone, tablet, car. + * @since 7 + */ + badgeSize: number | string; + + /** + * Color of the badge. + * @devices phone, tablet, car. + * @since 7 + */ + badgeColor: Color | number | string | Resource; } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare class BadgeExtend extends BadgeAttribute { } +/** + * @devices phone, tablet, car. + * @since 7 + */ interface Badge extends BadgeAttribute { - (value: {count: number, position?: BadgePosition, maxCount?: number, style?: BadgeStyle}): Badge; - (value: {value: string, position?: BadgePosition, maxCount?: number, style?: BadgeStyle}): Badge; + /** + * position: Set the display position of the prompt point. + * maxCount: Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed. + * count: Set the number of reminder messages. + * style: You can set the style of the Badge component, including the text color, size, dot color, and size. + * @devices phone, tablet, car. + * @since 7 + */ + (value: {count: number, position?: BadgePosition, maxCount?: number, style: BadgeStyle}): Badge; + + /** + * value: Text string of the prompt content. + * position: Set the display position of the prompt point. + * maxCount: Maximum number of messages. If the number of messages exceeds the maximum, only maxCount+ is displayed. + * style: You can set the style of the Badge component, including the text color, size, dot color, and size. + * @devices phone, tablet, car. + * @since 7 + */ + (value: {value: string, position?: BadgePosition, maxCount?: number, style: BadgeStyle}): Badge; } +/** + * @devices phone, tablet, car. + * @since 7 + */ declare class BadgeAttribute extends CommonMethod { } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare const BadgeInterface: Badge \ No newline at end of file diff --git a/api/@internal/component/ets/blank.d.ts b/api/@internal/component/ets/blank.d.ts index 42a841d..322e46c 100644 --- a/api/@internal/component/ets/blank.d.ts +++ b/api/@internal/component/ets/blank.d.ts @@ -15,15 +15,43 @@ import {CommonMethod, Color, Resource} from "./common" +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare class BlankExtend extends BlankAttribute { } +/** + * Create Blank + * @devices phone, tablet, car. + * @since 7 + */ interface Blank extends BlankAttribute { + /** + * The minimum size of the blank fill assembly on the container spindle. + * @devices phone, tablet, car. + * @since 7 + */ (min?: number | string): Blank; } +/** + * inheritance CommonMethod Set Styles + * @devices phone, tablet, car. + * @since 7 + */ declare class BlankAttribute extends CommonMethod { + /** + * color: set color. + * @devices phone, tablet, car. + * @since 7 + */ color(value: Color | number | string | Resource): T; } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare const BlankInterface: Blank \ No newline at end of file diff --git a/api/@internal/component/ets/button.d.ts b/api/@internal/component/ets/button.d.ts index 8f7fd66..68404db 100644 --- a/api/@internal/component/ets/button.d.ts +++ b/api/@internal/component/ets/button.d.ts @@ -16,34 +16,121 @@ import {CommonMethod, Color, Resource} from "./common" import {FontWeight} from "./text" +/** + * Provides a button component. + * @devices phone, tablet, car. + * @since 7 + */ export declare enum ButtonType { + /** + * Capsule button (rounded corners default to half the height). + * @devices phone, tablet, car. + * @since 7 + */ Capsule, + + /** + * Round buttons. + * @devices phone, tablet, car. + * @since 7 + */ Circle, + + /** + * Arc Button. + * @devices phone, tablet, car. + * @since 7 + */ Arc, + + /** + * Common button (no rounded corners by default). + * @devices phone, tablet, car. + * @since 7 + */ Normal } +/** + * @devices phone, tablet, car. + * @since 7 + */ export declare class ButtonExtend extends ButtonAttribute { } +/** + * @devices phone, tablet, car. + * @since 7 + */ interface Button extends ButtonAttribute