From 9d9df0137d027bcb780648f0accd0f4b306aae68 Mon Sep 17 00:00:00 2001 From: verystone Date: Fri, 24 Sep 2021 20:50:44 +0800 Subject: [PATCH 001/183] =?UTF-8?q?=E4=BF=AE=E6=94=B9updateOsAccountDistri?= =?UTF-8?q?butedInfo=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=80=BC=E4=B8=BA?= =?UTF-8?q?void?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: verystone --- api/@ohos.account.distributedaccount.d.ts | 55 +++++++++++++---------- 1 file changed, 31 insertions(+), 24 deletions(-) mode change 100755 => 100644 api/@ohos.account.distributedaccount.d.ts diff --git a/api/@ohos.account.distributedaccount.d.ts b/api/@ohos.account.distributedaccount.d.ts old mode 100755 new mode 100644 index 6dc7516931..294ca7fe1b --- a/api/@ohos.account.distributedaccount.d.ts +++ b/api/@ohos.account.distributedaccount.d.ts @@ -15,53 +15,60 @@ import {AsyncCallback} from './basic' -/** - * Defines distributed account functions and interfaces. - * - * @name distributedAccount - * @since 5 - * @syscap SystemCapability.Account.OsAccount - * @devices phone - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS - */ declare namespace distributedAccount { /** * Get the ability of the distributed account. - * - * @syscap SystemCapability.Account.OsAccount - * @devices phone - * @param NA + * @since 7 + * @sysCap SystemCapability.Account.OsAccount + * @devices phone, tablet, tv, wearable, car + * @permission N/A * @return Ability to manage operations of distributed account. */ function getDistributedAccountAbility(): DistributedAccountAbility; + /** + * Defines distributed account functions and interfaces. + * + * @name DistributedAccountAbility + * @since 7 + * @sysCap SystemCapability.Account.OsAccount + * @devices phone, tablet, tv, wearable, car + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + */ interface DistributedAccountAbility { /** * Queries the distributed information of the current OS account. * - * @syscap SystemCapability.Account.OsAccount - * @devices phone - * @param NA + * @since 7 + * @devices phone, tablet, tv, wearable, car * @return The distributed information of the current OS account. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. */ queryOsAccountDistributedInfo(callback: AsyncCallback): void; - queryOsAccountDistributedInfo(): Promise; /** * Updates the distributed information of the OS account. * - * @syscap SystemCapability.Account.OsAccount - * @devices phone + * @since 7 + * @devices phone, tablet, tv, wearable, car * @param accountInfo Indicates the information of the OS account used for a distributed system. - * @return Returns {@code true} if the distributed information of the account is updated; - * returns {@code false} otherwise. + * @return void + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. */ - updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback): void; - - updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise; + updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback): void; + updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise; } + /** + * Provides the distributed information of the OS account. + * + * @name DistributedInfo + * @since 7 + * @sysCap SystemCapability.Account.OsAccount + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ interface DistributedInfo { /** * The name in the distributed information of the OS account. -- Gitee From c059cf1d7505feb1ad27ba37faae1df75de8208c Mon Sep 17 00:00:00 2001 From: smagicyun Date: Sun, 26 Sep 2021 16:17:33 +0800 Subject: [PATCH 002/183] update js commemts Signed-off-by: smagicyun --- api/@ohos.data.dataAbility.d.ts | 175 ++++++++++++++++++------ api/@ohos.data.rdb.d.ts | 234 +++++++++++++++++++++++++------- api/data/rdb/resultSet.d.ts | 136 +++++++++++++------ 3 files changed, 412 insertions(+), 133 deletions(-) diff --git a/api/@ohos.data.dataAbility.d.ts b/api/@ohos.data.dataAbility.d.ts index 76aabb8bd3..a2bf9e1937 100644 --- a/api/@ohos.data.dataAbility.d.ts +++ b/api/@ohos.data.dataAbility.d.ts @@ -15,28 +15,47 @@ import { AsyncCallback } from './basic'; import rdb from './@ohos.data.rdb'; +/** + * Provides predicates for implementing diverse query methods. + * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_dataAbility from '@ohos.data.dataAbility'; + * @permission N/A + */ declare namespace dataAbility { /** * Create an RdbPredicates by table name and DataAbilityPredicates. * + * @note This method is similar to = of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param name Indicates the table name. * @param dataAbilityPredicates Indicates the dataAbility predicates. * @return Returns an RdbPredicates. - * @since 7 */ - function createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates) : rdb.RdbPredicates; + function createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates; /** * Manages relational database configurations. * - * @Syscap SystemCapability.Data.DATA_APPDATAMGR - * @version 7 + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_dataAbility from '@ohos.data.dataAbility'; + * @permission N/A */ class DataAbilityPredicates { /** * Configures the DataAbilityPredicates to match the field whose data type is ValueType and value is equal * to a specified value. * + * @note This method is similar to = of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. * @return Returns the DataAbilityPredicates that match the specified field. @@ -47,8 +66,10 @@ declare namespace dataAbility { * Configures the DataAbilityPredicates to match the field whose data type is ValueType and value is unequal to * a specified value. * - * This method is similar to != of the SQL statement. - * + * @note This method is similar to != of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. * @return Returns the DataAbilityPredicates that match the specified field. @@ -58,9 +79,10 @@ declare namespace dataAbility { /** * Adds a left parenthesis to the DataAbilityPredicates. * - * This method is similar to ( of the SQL statement and needs to be used together - * with endWrap(). - * + * @note This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the DataAbilityPredicates with the left parenthesis. */ beginWrap(): DataAbilityPredicates; @@ -68,9 +90,11 @@ declare namespace dataAbility { /** * Adds a right parenthesis to the DataAbilityPredicates. * - * This method is similar to ) of the SQL statement and needs to be used together + * @note This method is similar to ) of the SQL statement and needs to be used together * with beginWrap(). - * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the DataAbilityPredicates with the right parenthesis. */ endWrap(): DataAbilityPredicates; @@ -78,8 +102,10 @@ declare namespace dataAbility { /** * Adds an or condition to the DataAbilityPredicates. * - * This method is similar to or of the SQL statement. - * + * @note This method is similar to or of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the DataAbilityPredicates with the or condition. */ or(): DataAbilityPredicates; @@ -87,8 +113,10 @@ declare namespace dataAbility { /** * Adds an and condition to the DataAbilityPredicates. * - * This method is similar to and of the SQL statement. - * + * @note This method is similar to and of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the DataAbilityPredicates with the and condition. */ and(): DataAbilityPredicates; @@ -97,8 +125,10 @@ declare namespace dataAbility { * Configures the DataAbilityPredicates to match the field whose data type is string and value * contains a specified value. * - * This method is similar to contains of the SQL statement. - * + * @note This method is similar to contains of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. * @return Returns the DataAbilityPredicates that match the specified field. @@ -109,8 +139,10 @@ declare namespace dataAbility { * Configures the DataAbilityPredicates to match the field whose data type is string and value starts * with a specified string. * - * This method is similar to value% of the SQL statement. - * + * @note This method is similar to value% of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. * @return Returns the DataAbilityPredicates that match the specified field. @@ -121,8 +153,10 @@ declare namespace dataAbility { * Configures the DataAbilityPredicates to match the field whose data type is string and value * ends with a specified string. * - * This method is similar to %value of the SQL statement. - * + * @note This method is similar to %value of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. * @return Returns the DataAbilityPredicates that match the specified field. @@ -132,8 +166,10 @@ declare namespace dataAbility { /** * Configures the DataAbilityPredicates to match the fields whose value is null. * - * This method is similar to is null of the SQL statement. - * + * @note This method is similar to is null of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @return Returns the DataAbilityPredicates that match the specified field. */ @@ -142,8 +178,10 @@ declare namespace dataAbility { /** * Configures the DataAbilityPredicates to match the specified fields whose value is not null. * - * This method is similar to is not null of the SQL statement. - * + * @note This method is similar to is not null of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @return Returns the DataAbilityPredicates that match the specified field. */ @@ -153,8 +191,10 @@ declare namespace dataAbility { * Configures the DataAbilityPredicates to match the fields whose data type is string and value is * similar to a specified string. * - * This method is similar to like of the SQL statement. - * + * @note This method is similar to like of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. The percent sign (%) in the value * is a wildcard (like * in a regular expression). @@ -166,18 +206,23 @@ declare namespace dataAbility { * Configures DataAbilityPredicates to match the specified field whose data type is string and the value contains * a wildcard. * - * Different from like, the input parameters of this method are case-sensitive. - * + * @note Different from like, the input parameters of this method are case-sensitive. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with DataAbilityPredicates. * @return Returns the SQL statement with the specified DataAbilityPredicates. - * */ glob(field: string, value: string): DataAbilityPredicates; /** * Restricts the value of the field to the range between low value and high value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param low Indicates the minimum value. * @param high Indicates the maximum value. @@ -189,17 +234,24 @@ declare namespace dataAbility { * Configures DataAbilityPredicates to match the specified field whose data type is int and value is * out of a given range. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param low Indicates the minimum value to match with DataAbilityPredicates}. * @param high Indicates the maximum value to match with DataAbilityPredicates}. * @return Returns the SQL query statement with the specified DataAbilityPredicates. - * */ notBetween(field: string, low: ValueType, high: ValueType): DataAbilityPredicates; /** * Restricts the value of the field to be greater than the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified DataAbilityPredicates. @@ -209,6 +261,10 @@ declare namespace dataAbility { /** * Restricts the value of the field to be smaller than the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified DataAbilityPredicates. @@ -218,6 +274,10 @@ declare namespace dataAbility { /** * Restricts the value of the field to be greater than or equal to the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified DataAbilityPredicates. @@ -227,6 +287,10 @@ declare namespace dataAbility { /** * Restricts the value of the field to be smaller than or equal to the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified DataAbilityPredicates. @@ -237,6 +301,10 @@ declare namespace dataAbility { * Restricts the ascending order of the return list. When there are several orders, * the one close to the head has the highest priority. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name for sorting the return list. * @return Returns the SQL query statement with the specified DataAbilityPredicates. */ @@ -246,6 +314,10 @@ declare namespace dataAbility { * Restricts the descending order of the return list. When there are several orders, * the one close to the head has the highest priority. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name for sorting the return list. * @return Returns the SQL query statement with the specified DataAbilityPredicates. */ @@ -254,6 +326,10 @@ declare namespace dataAbility { /** * Restricts each row of the query result to be unique. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the SQL query statement with the specified DataAbilityPredicates. */ distinct(): DataAbilityPredicates; @@ -261,6 +337,10 @@ declare namespace dataAbility { /** * Restricts the max number of return records. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param value Indicates the max length of the return list. * @return Returns the SQL query statement with the specified DataAbilityPredicates. * @throws IllegalPredicateException Throws this exception if DataAbilityPredicates are added to a wrong position. @@ -270,31 +350,36 @@ declare namespace dataAbility { /** * Configures DataAbilityPredicates to specify the start position of the returned result. * - * Use this method together with limit(int). - * + * @note Use this method together with limit(int). + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param rowOffset Indicates the start position of the returned result. The value is a positive integer. * @return Returns the SQL query statement with the specified AbsPredicates. - * */ offsetAs(rowOffset: number): DataAbilityPredicates; /** * Configures DataAbilityPredicates to group query results by specified columns. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param fields Indicates the specified columns by which query results are grouped. * @return Returns the DataAbilityPredicates with the specified columns by which query results are grouped. - * */ groupBy(fields: Array): DataAbilityPredicates; /** * Configures DataAbilityPredicates to specify the index column. * - * Before using this method, you need to create an index column. - * + * @note Before using this method, you need to create an index column. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param indexName Indicates the name of the index column. * @return Returns DataAbilityPredicates with the specified index column. - * */ indexedBy(field: string): DataAbilityPredicates; @@ -302,10 +387,13 @@ declare namespace dataAbility { * Configures DataAbilityPredicates to match the specified field whose data type is ValueType array and values * are within a given range. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param values Indicates the values to match with DataAbilityPredicates. * @return Returns DataAbilityPredicates that matches the specified field. - * */ in(field: string, value: Array): DataAbilityPredicates; @@ -313,6 +401,10 @@ declare namespace dataAbility { * Configures {@code DataAbilityPredicates} to match the specified field whose data type is String array and values * are out of a given range. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param values Indicates the values to match with DataAbilityPredicates. * @return Returns DataAbilityPredicates that matches the specified field. @@ -321,6 +413,11 @@ declare namespace dataAbility { } /** * Indicates possible value types + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A */ type ValueType = number | string | boolean; } diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index 162c2bd3e2..d77415c1bd 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -15,6 +15,15 @@ import { AsyncCallback } from './basic'; import { ResultSet } from './data/rdb/resultSet'; +/** + * Provides methods for rdbStore create and delete. + * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A + */ declare namespace rdb { /** * Obtains an RDB store. @@ -22,11 +31,14 @@ declare namespace rdb { * You can set parameters of the RDB store as required. In general, this method is recommended * to obtain a rdb store. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param config Indicates the configuration of the database related to this RDB store. The configurations include * the database path, storage mode, and whether the database is read-only. * @param version Indicates the database version for upgrade or downgrade. * @return Returns an RDB store {@link ohos.data.rdb.RdbStore}. - * @since 7 */ function getRdbStore(config: StoreConfig, version: number, callback: AsyncCallback): void; function getRdbStore(config: StoreConfig, version: number): Promise; @@ -34,9 +46,12 @@ declare namespace rdb { /** * Deletes the database with a specified name. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param name Indicates the database name. * @return Returns true if the database is deleted; returns false otherwise. - * @since 7 */ function deleteRdbStore(name: string, callback: AsyncCallback): void; function deleteRdbStore(name: string): Promise; @@ -46,18 +61,23 @@ declare namespace rdb { * * This class provides methods for creating, querying, updating, and deleting RDBs. * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR * @devices phone, tablet, tv, wearable, car - * @Syscap SystemCapability.Data.DATA_APPDATAMGR - * @version 7 + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A */ interface RdbStore { /** * Inserts a row of data into the target table. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param name Indicates the target table. * @param values Indicates the row of data to be inserted into the table. * @return Returns the row ID if the operation is successful; returns -1 otherwise. - * @since 7 */ insert(name: string, values: ValuesBucket, callback: AsyncCallback): void; insert(name: string, values: ValuesBucket): Promise; @@ -65,10 +85,13 @@ declare namespace rdb { /** * Updates data in the database based on a a specified instance object of rdbPredicates. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param values Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. * @param rdbPredicates Indicates the specified update condition by the instance object of RdbPredicates. * @return Returns the number of affected rows. - * @since 7 */ update(values: ValuesBucket, rdbPredicates: RdbPredicates, callback: AsyncCallback): void; update(values: ValuesBucket, rdbPredicates: RdbPredicates): Promise; @@ -76,9 +99,12 @@ declare namespace rdb { /** * Deletes data from the database based on a specified instance object of rdbPredicates. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param rdbPredicates Indicates the specified delete condition by the instance object of RdbPredicates. * @return Returns the number of affected rows. - * @since 7 */ delete(rdbPredicates: RdbPredicates, callback: AsyncCallback): void; delete(rdbPredicates: RdbPredicates): Promise; @@ -86,10 +112,13 @@ declare namespace rdb { /** * Queries data in the database based on specified conditions. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param rdbPredicates Indicates the specified query condition by the instance object of RdbPredicates. * @param columns Indicates the columns to query. If the value is null, the query applies to all columns. * @return Returns a ResultSet object if the operation is successful; - * @since 7 */ query(rdbPredicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; query(rdbPredicates: RdbPredicates, columns: Array): Promise; @@ -97,9 +126,12 @@ declare namespace rdb { /** * Executes an SQL statement that contains specified parameters but returns no value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param sql Indicates the SQL statement to execute. * @param bindArgs Indicates the values of the parameters in the SQL statement. The values are strings. - * @since 7 */ executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; executeSql(sql: string, bindArgs: Array): Promise; @@ -107,11 +139,23 @@ declare namespace rdb { /** * Indicates possible value types + * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A */ type ValueType = number | string | boolean; /** * Values in buckets are stored in key-value pairs + * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A */ type ValuesBucket = { [key: string]: ValueType | Uint8Array | null; @@ -120,13 +164,18 @@ declare namespace rdb { /** * Manages relational database configurations. * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR * @devices phone, tablet, tv, wearable, car - * @Syscap SystemCapability.Data.DATA_APPDATAMGR - * @version 7 + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A */ interface StoreConfig { /** * Indicates the name of the database file + * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR */ name: string; } @@ -134,14 +183,21 @@ declare namespace rdb { /** * Manages relational database configurations. * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR * @devices phone, tablet, tv, wearable, car - * @Syscap SystemCapability.Data.DATA_APPDATAMGR - * @version 7 + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A */ class RdbPredicates { /** * A parameterized constructor used to create an RdbPredicates instance. * name Indicates the table name of the database. + * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ constructor(name: string) @@ -149,6 +205,10 @@ declare namespace rdb { * Configures the RdbPredicates to match the field whose data type is ValueType and value is equal * to a specified value. * + * @note This method is similar to = of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the RdbPredicates. * @return Returns the RdbPredicates that match the specified field. @@ -159,8 +219,10 @@ declare namespace rdb { * Configures the RdbPredicates to match the field whose data type is ValueType and value is unequal to * a specified value. * - * This method is similar to != of the SQL statement. - * + * @note This method is similar to != of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the RdbPredicates. * @return Returns the RdbPredicates that match the specified field. @@ -170,9 +232,10 @@ declare namespace rdb { /** * Adds a left parenthesis to the RdbPredicates. * - * This method is similar to ( of the SQL statement and needs to be used together - * with endWrap(). - * + * @note This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the RdbPredicates with the left parenthesis. */ beginWrap(): RdbPredicates; @@ -180,9 +243,11 @@ declare namespace rdb { /** * Adds a right parenthesis to the RdbPredicates. * - * This method is similar to ) of the SQL statement and needs to be used together + * @note This method is similar to ) of the SQL statement and needs to be used together * with beginWrap(). - * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the RdbPredicates with the right parenthesis. */ endWrap(): RdbPredicates; @@ -190,8 +255,10 @@ declare namespace rdb { /** * Adds an or condition to the RdbPredicates. * - * This method is similar to or of the SQL statement. - * + * @note This method is similar to or of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the RdbPredicates with the or condition. */ or(): RdbPredicates; @@ -199,8 +266,10 @@ declare namespace rdb { /** * Adds an and condition to the RdbPredicates. * - * This method is similar to and of the SQL statement. - * + * @note This method is similar to and of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the RdbPredicates with the and condition. */ and(): RdbPredicates; @@ -209,8 +278,10 @@ declare namespace rdb { * Configures the RdbPredicates to match the field whose data type is string and value * contains a specified value. * - * This method is similar to contains of the SQL statement. - * + * @note This method is similar to contains of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the RdbPredicates. * @return Returns the RdbPredicates that match the specified field. @@ -221,8 +292,10 @@ declare namespace rdb { * Configures the RdbPredicates to match the field whose data type is string and value starts * with a specified string. * - * This method is similar to value% of the SQL statement. - * + * @note This method is similar to value% of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the RdbPredicates. * @return Returns the RdbPredicates that match the specified field. @@ -233,8 +306,10 @@ declare namespace rdb { * Configures the RdbPredicates to match the field whose data type is string and value * ends with a specified string. * - * This method is similar to %value of the SQL statement. - * + * @note This method is similar to %value of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the RdbPredicates. * @return Returns the RdbPredicates that match the specified field. @@ -244,8 +319,10 @@ declare namespace rdb { /** * Configures the RdbPredicates to match the fields whose value is null. * - * This method is similar to is null of the SQL statement. - * + * @note This method is similar to is null of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @return Returns the RdbPredicates that match the specified field. */ @@ -254,8 +331,10 @@ declare namespace rdb { /** * Configures the RdbPredicates to match the specified fields whose value is not null. * - * This method is similar to is not null of the SQL statement. - * + * @note This method is similar to is not null of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @return Returns the RdbPredicates that match the specified field. */ @@ -265,8 +344,10 @@ declare namespace rdb { * Configures the RdbPredicates to match the fields whose data type is string and value is * similar to a specified string. * - * This method is similar to like of the SQL statement. - * + * @note This method is similar to like of the SQL statement. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the RdbPredicates. The percent sign (%) in the value * is a wildcard (like * in a regular expression). @@ -278,18 +359,23 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is string and the value contains * a wildcard. * - * Different from like, the input parameters of this method are case-sensitive. - * + * @note Different from like, the input parameters of this method are case-sensitive. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param value Indicates the value to match with RdbPredicates. * @return Returns the SQL statement with the specified RdbPredicates. - * */ glob(field: string, value: string): RdbPredicates; /** * Restricts the value of the field to the range between low value and high value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param low Indicates the minimum value. * @param high Indicates the maximum value. @@ -301,17 +387,24 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is int and value is * out of a given range. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. - * @param low Indicates the minimum value to match with DataAbilityPredicates}. - * @param high Indicates the maximum value to match with DataAbilityPredicates}. + * @param low Indicates the minimum value to match with DataAbilityPredicates. + * @param high Indicates the maximum value to match with DataAbilityPredicates. * @return Returns the SQL query statement with the specified RdbPredicates. - * */ notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates; /** * Restricts the value of the field to be greater than the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified RdbPredicates. @@ -321,6 +414,10 @@ declare namespace rdb { /** * Restricts the value of the field to be smaller than the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified RdbPredicates. @@ -330,6 +427,10 @@ declare namespace rdb { /** * Restricts the value of the field to be greater than or equal to the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified RdbPredicates. @@ -339,6 +440,10 @@ declare namespace rdb { /** * Restricts the value of the field to be smaller than or equal to the specified value. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name. * @param value Indicates the String field. * @return Returns the SQL query statement with the specified RdbPredicates. @@ -349,6 +454,10 @@ declare namespace rdb { * Restricts the ascending order of the return list. When there are several orders, * the one close to the head has the highest priority. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name for sorting the return list. * @return Returns the SQL query statement with the specified RdbPredicates. */ @@ -358,6 +467,10 @@ declare namespace rdb { * Restricts the descending order of the return list. When there are several orders, * the one close to the head has the highest priority. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name for sorting the return list. * @return Returns the SQL query statement with the specified RdbPredicates. */ @@ -366,6 +479,10 @@ declare namespace rdb { /** * Restricts each row of the query result to be unique. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns the SQL query statement with the specified RdbPredicates. */ distinct(): RdbPredicates; @@ -373,40 +490,48 @@ declare namespace rdb { /** * Restricts the max number of return records. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param value Indicates the max length of the return list. * @return Returns the SQL query statement with the specified RdbPredicates. - * @throws IllegalPredicateException Throws this exception if RdbPredicates are added to a wrong position. */ limitAs(value: number): RdbPredicates; /** * Configures RdbPredicates to specify the start position of the returned result. * - * Use this method together with limit(int). - * + * @note Use this method together with limit(int). + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param rowOffset Indicates the start position of the returned result. The value is a positive integer. * @return Returns the SQL query statement with the specified AbsPredicates. - * */ offsetAs(rowOffset: number): RdbPredicates; /** * Configures RdbPredicates to group query results by specified columns. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param fields Indicates the specified columns by which query results are grouped. * @return Returns the RdbPredicates with the specified columns by which query results are grouped. - * */ groupBy(fields: Array): RdbPredicates; /** * Configures RdbPredicates to specify the index column. * - * Before using this method, you need to create an index column. - * + * @note Before using this method, you need to create an index column. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param indexName Indicates the name of the index column. * @return Returns RdbPredicates with the specified index column. - * */ indexedBy(field: string): RdbPredicates; @@ -414,10 +539,13 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is ValueType array and values * are within a given range. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param values Indicates the values to match with RdbPredicates. * @return Returns RdbPredicates that matches the specified field. - * */ in(field: string, value: Array): RdbPredicates; @@ -425,6 +553,10 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is ValueType array and values * are out of a given range. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param field Indicates the column name in the database table. * @param values Indicates the values to match with RdbPredicates. * @return Returns RdbPredicates that matches the specified field. diff --git a/api/data/rdb/resultSet.d.ts b/api/data/rdb/resultSet.d.ts index 799fdc4474..ac0e5eb6ea 100755 --- a/api/data/rdb/resultSet.d.ts +++ b/api/data/rdb/resultSet.d.ts @@ -15,68 +15,84 @@ import { AsyncCallback } from '../../basic' /** -* Provides methods for accessing a database result set generated by querying the database. -* -* @devices phone, tablet, tv, wearable, car -* @Syscap SystemCapability.Data.DATA_APPDATAMGR -* @version 7 -*/ - + * Provides methods for accessing a database result set generated by querying the database. + * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @import import data_rdb from '@ohos.data.rdb'; + * @permission N/A + */ interface ResultSet { /** * Obtains the names of all columns in a result set. * - * The column names are returned as a string array, in which the strings are in the same order + * @note The column names are returned as a string array, in which the strings are in the same order * as the columns in the result set. - * * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ columnNames: Array; /** * Obtains the number of columns in the result set. * - * The returned number is equal to the length of the string array returned by the + * @note The returned number is equal to the length of the string array returned by the * columnCount method. - * * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ columnCount: number; /** * Obtains the number of rows in the result set. * + * @note N/A * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ rowCount: number; /** * Obtains the current index of the result set. * - * The result set index starts from 0. - * + * @note The result set index starts from 0. * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ rowIndex: number; /** * Checks whether the result set is positioned at the first row. * + * @note N/A * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ isAtFirstRow: boolean; /** * Checks whether the result set is positioned at the last row. * + * @note N/A * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ isAtLastRow: boolean; /** * Checks whether the result set is positioned after the last row. * + * @note N/A * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ isEnded: boolean; @@ -84,7 +100,10 @@ interface ResultSet { * Returns whether the cursor is pointing to the position before the first * row. * + * @note N/A * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ isStarted: boolean; @@ -93,29 +112,34 @@ interface ResultSet { * * If the result set is closed by calling the close method, true will be returned. * + * @note N/A * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car */ isClosed: boolean; /** * Obtains the column index based on the specified column name. * - * The column name is passed as an input parameter. - * + * @note The column name is passed as an input parameter. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnName Indicates the name of the specified column in the result set. * @return Returns the index of the specified column. - * @since 7 */ getColumnIndex(columnName: string): number; /** * Obtains the column name based on the specified column index. * - * The column index is passed as an input parameter. - * + * @note The column index is passed as an input parameter. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnIndex Indicates the index of the specified column in the result set. * @return Returns the name of the specified column. - * @since 7 */ getColumnName(columnIndex: number): string; @@ -123,123 +147,149 @@ interface ResultSet { * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param offset Indicates the offset relative to the current position. * @return Returns true if the result set is moved successfully and does not go beyond the range; * returns false otherwise. - * @since 7 */ goTo(offset: number): boolean; /** * Go to the specified row of the result set. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param rowIndex Indicates the index of the specified row, which starts from 0. * @return Returns true if the result set is moved successfully; returns false otherwise. - * @since 7 */ goToRow(position: number): boolean; /** * Go to the first row of the result set. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is empty. - * @since 7 */ goToFirstRow(): boolean; /** * Go to the last row of the result set. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is empty. - * @since 7 */ goToLastRow(): boolean; /** * Go to the next row of the result set. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is already in the last row. - * @since 7 */ goToNextRow(): boolean; /** * Go to the previous row of the result set. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @return Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is already in the first row. - * @since 7 */ goToPreviousRow(): boolean; /** * Obtains the value of the specified column in the current row as a byte array. * - * The implementation class determines whether to throw an exception if the value of the specified column + * @note The implementation class determines whether to throw an exception if the value of the specified column * in the current row is null or the specified column is not of the Blob type. - * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnIndex Indicates the specified column index, which starts from 0. * @return Returns the value of the specified column as a byte array. - * @since 7 */ getBlob(columnIndex: number): Uint8Array; /** * Obtains the value of the specified column in the current row as string. * - * The implementation class determines whether to throw an exception if the value of the specified column + * @note The implementation class determines whether to throw an exception if the value of the specified column * in the current row is null or the specified column is not of the string type. - * + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnIndex Indicates the specified column index, which starts from 0. * @return Returns the value of the specified column as a string. - * @since 7 */ getString(columnIndex: number): string; /** * Obtains the value of the specified column in the current row as long. * - * The implementation class determines whether to throw an exception if the value of the specified column - * in the current row is null, the specified column is not of the integer type - * + * @note The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the integer type. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnIndex Indicates the specified column index, which starts from 0. * @return Returns the value of the specified column as a long. - * @since 7 */ getLong(columnIndex: number): number; /** * Obtains the value of the specified column in the current row as double. * - * The implementation class determines whether to throw an exception if the value of the specified column - * in the current row is null, the specified column is not of the double type - * + * @note The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the double type. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnIndex Indicates the specified column index, which starts from 0. * @return Returns the value of the specified column as a double. - * @since 7 */ getDouble(columnIndex: number): number; /** * Checks whether the value of the specified column in the current row is null. * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car * @param columnIndex Indicates the specified column index, which starts from 0. * @return Returns true if the value of the specified column in the current row is null; * returns false otherwise. - * @since 7 */ isColumnNull(columnIndex: number): boolean; /** * Closes the result set. * - * Calling this method on the result set will release all of its resources and makes it ineffective. - * - * @return Returns true if the result set is closed; returns false otherwise. + * @note Calling this method on the result set will release all of its resources and makes it ineffective. * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @return Returns true if the result set is closed; returns false otherwise. */ close(): void; } \ No newline at end of file -- Gitee From 0d196dbeb28c50aed061680b90d22d21527ebecb Mon Sep 17 00:00:00 2001 From: lifansheng Date: Sun, 26 Sep 2021 20:28:20 +0800 Subject: [PATCH 003/183] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. Changes to be committed: modified: api/@ohos.process.d.ts modified: api/@ohos.url.d.ts modified: api/@ohos.util.d.ts --- api/@ohos.process.d.ts | 285 ++++++++++++++++++++++++++++++++--- api/@ohos.url.d.ts | 334 +++++++++++++++++++++++++++++------------ api/@ohos.util.d.ts | 162 +++++++++++++++----- 3 files changed, 625 insertions(+), 156 deletions(-) diff --git a/api/@ohos.process.d.ts b/api/@ohos.process.d.ts index 845c97fe98..b3305c41fe 100644 --- a/api/@ohos.process.d.ts +++ b/api/@ohos.process.d.ts @@ -13,68 +13,309 @@ * limitations under the License. */ +/** + * The process is mainly used to obtain the relevant ID of the process, obtain and modify + * the working directory of the process, exit and close the process. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import url from '@ohos.process'; + * @permission N/A + */ 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. + */ 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. + */ 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. + */ 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. + */ readonly killed: boolean; + /** + * return 'number' is the targer process exit code + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the targer process exit code. + */ wait(): Promise; + /** - * Buffer the stdout until EOF and return it as 'Uint8Array' + * return it as 'Uint8Array' of the stdout until EOF + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return subprocess standard outpute. */ getOutput(): Promise; + /** - * Buffer the stderr until EOF and return it as 'Uint8Array' + * 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(): void; + /** * send a signal to process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param signal number or string represents the signal sent. */ - kill(signo: number): void; + 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. + */ + readonly getEgid: number; + /** - * spawns a new ChildProcess to run the command + * return the numeric valid user identity of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric valid user identity of the process. */ - function runCmd(command: string, options?: RunOptions): ChildProcess; + readonly getEuid: number; - function getPid(): number; - function getPpid(): number; + /** + * 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 /** - *abort current process - *@return void + * 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. + */ + 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. + */ + 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. + */ + readonly getPpid: number; + + /** + * Returns the tid of the current thread. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the tid of the current thread. + */ + function getTid(): number; + + /** + * Returns a boolean whether the process is isolated. + * @since 7 + * @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 7 + * @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 7 + * @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 7 + * @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 7 + * @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 7 + * @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 7 + * @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 7 + * @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 7 + * @sysCap SystemCapability.CCRuntime + * @param name Parameters defined by the system configuration. + * @return Return the system configuration at runtime. + */ + function getSystemConfig(name: number): number; + + 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. + */ + function runCmd(command: string, + options?: { timeout : number, killSignal : number | string, maxBuffer : number }): ChildProcess; + + /** + * 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 + */ function on(type: string, listener: EventListener): void; - function exit(code?:number): void; /** - *get current work directory; + * 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. + */ + function exit(code: number): void; + + /** + * Return the current work directory; + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the current work directory. */ function cwd(): string; - + /** - *change current directory - *@param dir + * Change current directory + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param dir The path you want to change. */ function chdir(dir: string): void; - function getEgid(): number; - function getEuid(): number; - - function getGid(): number - function getUid(): number; + /** + * Returns the running time of the system + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the running time of the system. + */ function uptime(): number; - function getGroups(): number[]; - function kill(signal?: number, pid?: number): boolean; + /** + * Return whether the signal was sent successfully + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param signal Signal sent. + * @param pid Send signal to target pid. + * @return Return the result of the signal. + */ + function kill(signal: number, pid: number): boolean; } -export default process; \ No newline at end of file +export default process; diff --git a/api/@ohos.url.d.ts b/api/@ohos.url.d.ts index fa3cb00c50..3bf1c4482b 100644 --- a/api/@ohos.url.d.ts +++ b/api/@ohos.url.d.ts @@ -4,7 +4,7 @@ * 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 +* 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, @@ -13,113 +13,257 @@ * limitations under the License. */ -declare class URLSearchParams { - constructor(init ? : string[][] | Record | string | URLSearchParams -}; - -/** Appends a specified key/value pair as a new search parameter. +/** + * The url module provides utilities for URL resolution and parsing. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import url from '@ohos.url'; + * @permission N/A */ -append(name: string, value : string) : void; -/** Delete the given search parameter and its associated value, - * from the list of all search parameters. - */ -delete(name: string) : void; +declare namespace url { + class URLSearchParams { + /** + * A parameterized constructor used to create an URLSearchParams instance. + * As the input parameter of the constructor function, init supports four types. + * The input parameter is a character string two-dimensional array. + * The input parameter is the object list. + * The input parameter is a character string. + * The input parameter is the URLSearchParams object. + */ + constructor(init?: string[][] | Record | string | URLSearchParams); -/** Returns all the values associated with a given search parameter - * as an array. - */ -getAll(name: string) : string[]; + /** + * Appends a specified key/value pair as a new search parameter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Key name of the search parameter to be inserted. + * @param value Values of search parameters to be inserted. + */ + append(name: string, value: string): void; -/** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - */ -entries() : IterableIterator<[string, string]>; + /** + * Deletes the given search parameter and its associated value,from the list of all search parameters. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param Name of the key-value pair to be deleted. + */ + delete(name: string): void; -/** Allows iteration through all values contained in this object via a callback function. - */ -forEach(callbackfn: (value: string, key : string, parent : this) = > void, thisArg ? : object) : void; + /** + * Returns all key-value pairs associated with a given search parameter as an array. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param Name Specifies the name of a key value. + * @return string[] Returns all key-value pairs with the specified name. + */ + getAll(name: string): string[]; -/** Returns the first value associated to the given search parameter. - */ -get(name: string) : string | null; + /** + * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an iterator for ES6. + */ + entries(): IterableIterator<[string, string]>; -/** Returns a Boolean that indicates whether a parameter with the - * specified name exists. - */ -has(name: string) : boolean; + /** + * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param value Current traversal key value. + * @param key Indicates the name of the key that is traversed. + * @param searchParams The instance object that is currently calling the forEach method. + */ + forEach(callbackfn: (value: string, key: string, searchParams: this) => void): void; -/**Sets the value associated with a given search parameter to the - * given value.If there were several matching values, this methods - * deletes the others. If the search parameter doesn't exist, this - * methods creates it. - */ -set(name: string, value : string) : void; + /** + * Returns the first value associated to the given search parameter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Specifies the name of a key-value pair. + * @return Returns the first value found by name. If no value is found, null is returned. + */ + get(name: string): string | null; -/** Sort all key/value pairs contained in this object in place and - * return undefined. - */ -sort() : void; + /** + * Returns a Boolean that indicates whether a parameter with the specified name exists. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Specifies the name of a key-value pair. + * @return Returns a Boolean value that indicates whether a found + */ + has(name: string): boolean; -/** Returns an iterator allowing to go through all keys contained - * in this object. - */ -keys() :IterableIterator; + /** + * Sets the value associated with a given search parameter to the + * given value. If there were several matching values, this method + * deletes the others. If the search parameter doesn't exist, this + * method creates it. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Key name of the parameter to be set. + * @param value Indicates the parameter value to be set. + */ + set(name: string, value: string): void; -/** Returns an iterator allowing to go through all values contained - * in this object. - */ -values() : IterableIterator; + /** + * Sort all key/value pairs contained in this object in place and return undefined. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + sort(): void; + /** + * Returns an iterator allowing to go through all keys contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 Iterator over the names of each name-value pair. + */ + keys(): IterableIterator; -/** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - */ -[Symbol.iterator]() : IterableIterator<[string, string]>; + /** + * Returns an iterator allowing to go through all values contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 Iterator over the values of each name-value pair. + */ + values(): IterableIterator; -/** Returns a query string suitable for use in a URL. - */ -toString() :string; -} + /** + * Returns an iterator allowing to go through all key/value + * pairs contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + */ + [Symbol.iterator](): IterableIterator<[string, string]>; -/* web api URL interface */ -declare class URL { - /** constructor of URL - * url:absolute URL string or a relative URL string - * base:base URL string - */ - constructor(url: string, base ? : string | URL); - - /* methods */ - createObjectURL(object: object) : string; - revokeObjectURL(url: string) : void; - toString() : string; - toJSON() : string; - - /* fragment identifier of URL */ -hash: string; - /* domain: port of URL */ -host: string; - /* domain of URL */ -hostname: string; - /* whole URL */ -href: string; - /* contain the origin of the URL, readonly */ - readonly origin : string; - /* password specified before the domain name */ -password: string; - /* an '/' followed by the path of the URL */ -pathname: string; - /* port of the URL */ -port: string; - /* the protocol scheme of the URL, readonly */ -protocol: string; - /* indicating the parameter string of the URL */ -search: string; - /* URLSearchParams object which used to access the individual query parameters */ - readonly searchParams : URLSearchParams; - /* the username before the domain name */ -username: string; -} + /** + * Returns a query string suitable for use in a URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns a search parameter serialized as a string, percent-encoded if necessary. + */ + toString(): string; + } + + class URL { + /** + * URL constructor, which is used to instantiate a URL object. + * url: Absolute or relative input URL to resolve. Base is required if input is relative. + * If input is an absolute value, base ignores the value. + * base: Base URL to parse if input is not absolute. + */ + constructor(url: string, base?: string | URL); + + /** + * Returns the serialized URL as a string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns the serialized URL as a string. + */ + toString(): string; + + /** + * Returns the serialized URL as a string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns the serialized URL as a string. + */ + toJSON(): string; -export {URL, URLSearchParams}; \ No newline at end of file + /** + * Gets and sets the fragment portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + hash: string; + + /** + * Gets and sets the host portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + host: string; + + /** + * Gets and sets the host name portion of the URL,not include the port. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + hostname: string; + + /** + * Gets and sets the serialized URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + href: string; + + /** + * Gets the read-only serialization of the URL's origin. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + readonly origin: string; + + /** + * Gets and sets the password portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + password: string; + + /** + * Gets and sets the path portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + pathname: string; + + /** + * Gets and sets the port portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + port: string; + + /** + * Gets and sets the protocol portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + protocol: string; + + /** + * Gets and sets the serialized query portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + search: string; + + /** + * Gets the URLSearchParams object that represents the URL query parameter. + * This property is read-only, but URLSearchParams provides an object that can be used to change + * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @note Be careful when modifying with .searchParams, because the URLSearchParams + * object uses different rules to determine which characters to + * percent-encode according to the WHATWG specification. + */ + readonly searchParams: URLSearchParams; + + /** + * Gets and sets the username portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + username: string; + } +} +export default url; \ No newline at end of file diff --git a/api/@ohos.util.d.ts b/api/@ohos.util.d.ts index 8ff27facc7..04ea18e76b 100644 --- a/api/@ohos.util.d.ts +++ b/api/@ohos.util.d.ts @@ -12,66 +12,150 @@ * 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. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import util from '@ohos.util'; + * @permission N/A + */ declare namespace util { - /** return a formatted string using the first argument as a printf-like format. */ - /** %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will - be represented with an n and Objects that have no user defined toString function are inspected using - util.inspect() with options { depth: 0, colors: false, compact: 3 }. - %d: Number will be used to convert all values except BigInt and Symbol. - %i: parseInt(value, 10) is used for all values except BigInt and Symbol. - %f: parseFloat(value) is used for all values except Bigint and Symbol. - %j: JSON. Replaced whith the string '[Circular]' if the argument contains circular references. - %o: Object. A string representation of an object with generic JavaScript object formatting. - Similar to util.inspect() with options { showHidden: true, showProxy: true}. This will show the - full object including non-enumerable properties and proxies. - %O: Object. A string representation of an object with generic JavaScript object formatting. - Similar to util.inspect() without options. This will show the full object not including - non-enumerable properties and proxies. - %c: CSS. This specifier is ignored and will skip any CSS passed in. - %%: single percent sign ('%'). This does not consume an argument. - Returns: The formatted string */ + /** + * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented + * with an n and Objects that have no user defined toString function are inspected using util.inspect() with + * options { depth: 0, colors: false, compact: 3 }. + * %d: Number will be used to convert all values except BigInt and Symbol. + * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. + * %f: parseFloat(value) is used for all values except Bigint and Symbol. + * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. + * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to + * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including + * non-enumerable properties and proxies. + * %O: Object. A string representation of an object with generic JavaScript object formatting. + * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to + * util.inspect() without options. This will show the full object not including non-enumerable properties and + * proxies. + * %c: CSS. This specifier is ignored and will skip any CSS passed in. + * %%: single percent sign ('%'). This does not consume an argument.Returns: The formatted string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param format styled string + * @param args data to be formatted + * @return Return the character string formatted in a specific format + */ function printf(format: string, ...args: Object[]): string; - - /** return the string name of a system errno*/ + + /** + * Get the string name of the system errno. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param errno the error code generated by an error in the system + * @return return the string name of a system errno + */ function getErrorString(errno: number): string; - - /** Takes an async function (or a function that returns a Promise) and returns a function following the - error-first callback style */ - function callbackWrapper(original: Function): (err: Object, value: Object) => void; - /** Takes a function following the common error-first callback style, i.e taking an (err, value) => ... - callback as the last argument, and return a version that returns promises */ - function promiseWrapper(original: (err: Object, value: Object) => void): Object; + /** + * Takes an async function (or a function that returns a Promise) and returns a function following the + * error-first callback style. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param original asynchronous function + */ + function callbackWrapper(original: Function): (err: Object, value: Object) => void; /** - * encoding name: support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device + * Takes a function following the common error-first callback style, i.e taking an (err, value) => + * callback as the last argument, and return a version that returns promises. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param original asynchronous function + * @return return a version that returns promises */ + function promiseWrapper(original: (err: Object, value: Object) => void): Object; + class TextDecoder { - /** the source encoding's name, lowercased. */ + /** + * the source encoding's name, lowercased. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly encoding: string; - /** Returns `true` if error mode is "fatal", and `false` otherwise. */ + + /** + * Returns `true` if error mode is "fatal", and `false` otherwise. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly fatal: boolean; - /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ + + /** + * Returns `true` if ignore BOM flag is set, and `false` otherwise. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly ignoreBOM = false; + + /** + * the textEncoder constructor. + * @param 7 + * @sysCap SystemCapability.CCRuntime + * @param encoding decoding format + */ constructor( encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }, ); - /** Returns the result of running encoding's decoder. */ - decode(input?: ArrayBuffer | ArrayBufferView, options?: { stream?: false }): string; + + constructor( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean }, + ); + /** + * Returns the result of running encoding's decoder. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param input decoded numbers in accordance with the format + * @return return decoded text + */ + decode(input: Uint8Array, options?: { stream?: false }): string; } - /** - * TextEncoder takes a stream of code points as input and emits a stream of UTF-8 bytes. - */ + class TextEncoder { + /** + * Encoding format. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly encoding = "utf-8"; - + + /** + * the textEncoder constructor. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ constructor(); - /** Returns the result of encoder. */ + /** + * Returns the result of encoder. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param The string to be encoded. + * @return returns the encoded text. + */ encode(input?: string): Uint8Array; - /** encode string, write the result to dest array */ + /** + * encode string, write the result to dest array. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param input The string to be encoded. + * @param dest decoded numbers in accordance with the format + * @return returns Returns the object, where read represents + * the number of characters that have been encoded, and written + * represents the number of bytes occupied by the encoded characters. + */ encodeInto( input: string, dest: Uint8Array, @@ -79,4 +163,4 @@ declare namespace util { } } -export default util; +export default util; \ No newline at end of file -- Gitee From fd1b54eb0e7fa718402d9f47098d57603d0b80f2 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Mon, 27 Sep 2021 18:53:35 +0800 Subject: [PATCH 004/183] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. Changes to be committed: modified: api/@ohos.process.d.ts modified: api/@ohos.util.d.ts --- api/@ohos.process.d.ts | 84 ------------------------------------------ api/@ohos.util.d.ts | 4 -- 2 files changed, 88 deletions(-) diff --git a/api/@ohos.process.d.ts b/api/@ohos.process.d.ts index b3305c41fe..bff59be60e 100644 --- a/api/@ohos.process.d.ts +++ b/api/@ohos.process.d.ts @@ -153,90 +153,6 @@ declare namespace process { */ readonly getPpid: number; - /** - * Returns the tid of the current thread. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return return the tid of the current thread. - */ - function getTid(): number; - - /** - * Returns a boolean whether the process is isolated. - * @since 7 - * @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 7 - * @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 7 - * @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 7 - * @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 7 - * @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 7 - * @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 7 - * @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 7 - * @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 7 - * @sysCap SystemCapability.CCRuntime - * @param name Parameters defined by the system configuration. - * @return Return the system configuration at runtime. - */ - function getSystemConfig(name: number): number; - type EventListener = (evt: Object) => void; /** * Return a child process object and spawns a new ChildProcess to run the command diff --git a/api/@ohos.util.d.ts b/api/@ohos.util.d.ts index 04ea18e76b..9841a835ce 100644 --- a/api/@ohos.util.d.ts +++ b/api/@ohos.util.d.ts @@ -108,10 +108,6 @@ declare namespace util { options?: { fatal?: boolean; ignoreBOM?: boolean }, ); - constructor( - encoding?: string, - options?: { fatal?: boolean; ignoreBOM?: boolean }, - ); /** * Returns the result of running encoding's decoder. * @since 7 -- Gitee From 8e4f3105a5c6262e1a97d81b12fbf90cead44ed3 Mon Sep 17 00:00:00 2001 From: meaty-bag-and-wangwang-meat Date: Mon, 27 Sep 2021 17:01:44 +0800 Subject: [PATCH 005/183] update intl apis Signed-off-by: meaty-bag-and-wangwang-meat --- api/@ohos.i18n.d.ts | 4 +- api/@ohos.intl.d.ts | 319 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 320 insertions(+), 3 deletions(-) diff --git a/api/@ohos.i18n.d.ts b/api/@ohos.i18n.d.ts index 53ebb62f92..7de84c3ce6 100644 --- a/api/@ohos.i18n.d.ts +++ b/api/@ohos.i18n.d.ts @@ -17,7 +17,7 @@ * Provides international settings related APIs. * * @since 7 - * @devices phone, table, tv, wearable, car + * @devices phone, tablet, tv, wearable, car */ declare namespace i18n { /** @@ -43,7 +43,7 @@ export function getDisplayCountry(country: string, locale: string, sentenceCase? export function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; /** - * Obtain all regions supported by the system. + * Obtain all languages supported by the system. * * @return Returns all languages supported by the system. * @since 7 diff --git a/api/@ohos.intl.d.ts b/api/@ohos.intl.d.ts index 04ac9877a6..8755ac6814 100755 --- a/api/@ohos.intl.d.ts +++ b/api/@ohos.intl.d.ts @@ -63,6 +63,157 @@ export class Locale { * @since 6 */ baseName: string + + /** + * Indicates the case first style of the locale. + */ + caseFirst: string + + /** + * Indicates the calendar. + */ + calendar: string + + /** + * Indicates the collation. + */ + collation: string + + /** + * Indicates the hour cycle. + */ + hourCycle: string + + /** + * Indicates the numbering system. + */ + numberingSystem: string + + /** + * Indicates whether it is numeric. + */ + numeric: boolean + + /** + * Convert the locale information to string. + * + * @return Returns locale information in string form. + */ + toString(): string; + + /** + * Maximize the locale's base information. + * + * @return Returns maximized locale. + */ + maximize(): Locale; + + /** + * Minimize the locale's base information. + * + * @return Returns minimized locale. + */ + minimize(): Locale; +} + +/** + * Provides the options of date time format. + */ +export interface DateTimeOptions { + /** + * Indicates the locale. + */ + locale: string + + /** + * Indicates the date style. + */ + dateStyle: string + + /** + * Indicates the time style. + */ + timeStyle: string + + /** + * Indicates the hour cycle. + */ + hourCycle: string + + /** + * Indicates the timezone. + */ + timeZone: string + + /** + * Indicates the numbering system. + */ + numberingSystem: string + + /** + * Indicates whether is 12 hour or not. + */ + hour12: boolean + + /** + * Indicates the weekday style. + */ + weekday: string + + /** + * Indicates the era style. + */ + era: string + + /** + * Indicates the year style. + */ + year: string + + /** + * Indicates the month style. + */ + month: string + + /** + * Indicates the day style. + */ + day: string + + /** + * Indicates the hour style. + */ + hour: string + + /** + * Indicates the minute style. + */ + minute: string + + /** + * Indicates the second style. + */ + second: string + + /** + * Indicates the timezone name. + */ + timeZoneName: string + + /** + * Indicates the day period format. + */ + dayPeriod: string + + /** + * Indicates the locale matching algorithm. + */ + localeMatcher: string + + /** + * Indicates the format matching algorithm. + */ + formatMatcher: string } /** @@ -76,9 +227,20 @@ export class DateTimeFormat { * * @param locale Indicates a character string containing the locale information, including * the language and optionally the script and region, for the DateTimeFormat object. + * @param options Indicates the options used to format the date. * @since 6 */ - constructor(locale?: string); + constructor(locale: string, options?: DateTimeOptions); + + /** + * A constructor used to create a DateTimeFormat object. + * + * @param locale Indicates an array of character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param options Indicates the options used to format the date. + * @since 6 + */ + constructor(locale: Array, options?: DateTimeOptions); /** * Obtains the formatted date strings. @@ -88,6 +250,161 @@ export class DateTimeFormat { * @since 6 */ format(date: Date): string; + + /** + * Obtains the formatted date strings of a date range. + * + * @param startDate Indicates the start date of the date range. + * @param endDate Indicates the end date of the date range. + * @return Returns a date string formatted based on the specified locale. + * @since 6 + */ + formatRange(startDate: Date, endDate: Date): string; + + /** + * Obtains the options of the DateTimeFormat object. + * + * @return Returns the options of the DateTimeFormat object. + * @since 6 + */ + resolvedOptions(): DateTimeOptions; +} + +/** + * Provides the options of number format. + */ +export interface NumberOptions { + /** + * Indicates the locale. + */ + locale: string + + /** + * Indicates the currency. + */ + currency: string + + /** + * Indicates the currency sign. + */ + currencySign: string + + /** + * Indicates the currency display format. + */ + currencyDisplay: string + + /** + * Indicates the unit. + */ + unit: string + + /** + * Indicates the unit display format. + */ + unitDisplay: string + + /** + * Indicates the sign display format. + */ + signDisplay: string + + /** + * Indicates the compact display format. + */ + compactDisplay: string + + /** + * Indicates the notation. + */ + notation: string + + /** + * Indicates the locale matching algorithm. + */ + localeMatcher: string + + /** + * Indicates the style. + */ + style: string + + /** + * Indicates the numbering system. + */ + numberingSystem: string + + /** + * Indicates whether using grouping or not. + */ + useGrouping: boolean + + /** + * Indicates the minimum integer digits. + */ + minimumIntegerDigits: number + + /** + * Indicates the minimum fraction digits. + */ + minimumFractionDigits: number + + /** + * Indicates the maximum fraction digits. + */ + maximumFractionDigits: number + + /** + * Indicates the minimum significant digits. + */ + minimumSignificantDigits: number + + /** + * Indicates the maximum significant digits. + */ + maximumSignificantDigits: number +} + +/** + * Provides the API for formatting number strings. + */ +export class NumberFormat { + /** + * A constructor used to create a NumberFormat object. + * + * @param locale Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param options Indicates the options used to format the number. + * @since 6 + */ + constructor(locale: string, options?: NumberOptions); + + /** + * A constructor used to create a NumberFormat object. + * + * @param locale Indicates an array of character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param options Indicates the options used to format the number. + * @since 6 + */ + constructor(locale: Array, options?: NumberOptions); + + /** + * Obtains the formatted number string. + * + * @param number Indicates the number to be formatted. + * @return Returns a number string formatted based on the specified locale. + * @since 6 + */ + format(number: number): string; + + /** + * Obtains the options of the NumberFormat object. + * + * @return Returns the options of the NumberFormat object. + * @since 6 + */ + resolvedOptions(): NumberOptions; } } export default intl; \ No newline at end of file -- Gitee From 333e323cc437704911a533cfcea587d61c4eb642 Mon Sep 17 00:00:00 2001 From: zhaoyuan Date: Mon, 27 Sep 2021 14:12:43 +0000 Subject: [PATCH 006/183] update d.ts files Signed-off-by: zhaoyuan --- api/@ohos.commonEvent.d.ts | 1 + api/@ohos.wantAgent.d.ts | 80 ++++++++++++++++++- api/commonEvent/commonEventData.d.ts | 8 ++ api/commonEvent/commonEventPublishData.d.ts | 8 ++ api/notification/notificationContent.d.ts | 21 ++++- api/notification/notificationRequest.d.ts | 3 + api/notification/notificationSorting.d.ts | 1 + api/notification/notificationSortingMap.d.ts | 1 + api/notification/notificationSubscribeInfo.ts | 1 + api/wantAgent/triggerInfo.d.ts | 31 +++++++ api/wantAgent/wantAgentInfo.d.ts | 3 +- 11 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 api/wantAgent/triggerInfo.d.ts diff --git a/api/@ohos.commonEvent.d.ts b/api/@ohos.commonEvent.d.ts index 19d056ce6d..2c57934e66 100644 --- a/api/@ohos.commonEvent.d.ts +++ b/api/@ohos.commonEvent.d.ts @@ -45,6 +45,7 @@ declare namespace commonEvent { */ function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void; + /** * create the CommonEventSubscriber for the SubscriberInfo. * diff --git a/api/@ohos.wantAgent.d.ts b/api/@ohos.wantAgent.d.ts index 2bdd0a1f0b..f7eab8a04f 100644 --- a/api/@ohos.wantAgent.d.ts +++ b/api/@ohos.wantAgent.d.ts @@ -16,6 +16,7 @@ import { AsyncCallback , Callback} from './basic'; import { Want } from './ability/want'; import { WantAgentInfo } from './wantAgent/wantAgentInfo'; +import { TriggerInfo } from './wantAgent/triggerInfo'; /** * Provide the method obtain trigger, cancel, and compare and to obtain @@ -23,17 +24,78 @@ import { WantAgentInfo } from './wantAgent/wantAgentInfo'; * * @name wantAgent * @since 7 - * @devices phone, tablet + * @devices phone, tablet, tv, wearable, car + * @import wantAgent from '@ohos.wantAgent'; * @permission N/A */ declare namespace wantAgent { + /** + * Obtains the bundle name of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose bundle name is to be obtained. + * @return Returns the bundle name of the {@link WantAgent} if any. + * @since 7 + */ + function getBundleName(agent: WantAgent, callback: AsyncCallback): void; + function getBundleName(agent: WantAgent): Promise; + + /** + * Obtains the bundle name of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. + * @return Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise. + * @since 7 + */ + function getUid(agent: WantAgent, callback: AsyncCallback): void; + function getUid(agent: WantAgent): Promise; + + /** + * Obtains the {@link Want} of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. + * @return Returns the {@link Want} of the {@link WantAgent}. + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getWant(agent: WantAgent, callback: AsyncCallback): void; + function getWant(agent: WantAgent): Promise; + + /** + * Cancels an {@link WantAgent}. Only the application that creates the {@link IntentAgent} can cancel it. + * + * @param agent Indicates the {@link WantAgent} to cancel. + * @since 7 + */ + function cancel(agent: WantAgent, callback: AsyncCallback): void; + function cancel(agent: WantAgent): Promise; + + /** + * Obtains the bundle name of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose bundle name is to be obtained. + * @param triggerInfo Indicates the {@link TriggerInfo} object that contains triggering parameters. + * @param callback Indicates the callback method to be called after the {@link WantAgent} is triggered. + * @since 7 + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void; + + /** + * Checks whether two {@link WantAgent} objects are the same. + * + * @param agent Indicates one of the {@link WantAgent} object to compare. + * @param otherAgent Indicates the other {@link WantAgent} object to compare. + * @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise. + * @since 7 + */ + function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + function equal(agent: WantAgent, otherAgent: WantAgent): Promise; + /** * Obtains an {@link WantAgent} object. * * @param info Indicates the {@link WantAgentInfo} object that contains parameters of the * {@link WantAgent} object to create. * @return Returns the created {@link WantAgent} object. - * * @since 7 */ function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; @@ -69,6 +131,20 @@ declare namespace wantAgent { START_SERVICE, SEND_COMMON_EVENT } + + /** + * A callback for the {@link trigger()} method. After the method execution is complete, + * the callback process will start. + * + * @since 7 + */ + export interface CompleteData { + info: WantAgent; + want: Want; + finalCode: number; + finalData: string; + extraInfo?: {[key: string]: any}; + } } export type WantAgent = object; diff --git a/api/commonEvent/commonEventData.d.ts b/api/commonEvent/commonEventData.d.ts index 6447604ca6..6e985c7156 100644 --- a/api/commonEvent/commonEventData.d.ts +++ b/api/commonEvent/commonEventData.d.ts @@ -49,4 +49,12 @@ export interface CommonEventData { * @since 7 */ data?: string; + + /** + * The description of the parameters in a common event. + * + * @default - + * @since 7 + */ + parameters?: {[key: string]: any}; } diff --git a/api/commonEvent/commonEventPublishData.d.ts b/api/commonEvent/commonEventPublishData.d.ts index b9e46b93b0..4c1dd0b5dd 100644 --- a/api/commonEvent/commonEventPublishData.d.ts +++ b/api/commonEvent/commonEventPublishData.d.ts @@ -66,4 +66,12 @@ export interface CommonEventPublishData { * @since 7 */ isSticky?: boolean; + + /** + * The description of the parameters in a common event. + * + * @default - + * @since 7 + */ + parameters?: {[key: string]: any}; } \ No newline at end of file diff --git a/api/notification/notificationContent.d.ts b/api/notification/notificationContent.d.ts index 134218f5ef..7624cd304a 100644 --- a/api/notification/notificationContent.d.ts +++ b/api/notification/notificationContent.d.ts @@ -14,6 +14,7 @@ */ import notification from '../@ohos.notification'; +import image from './@ohos.multimedia.image'; /** * Constructs basic notifications. @@ -61,9 +62,24 @@ export interface NotificationMultiLineContent extends NotificationBasicContent { } /** - * Constructs a notification that includes multiple lines of text. + * Constructs a notification that includes a picture. * - * @name NotificationMultiLineContent + * @name NotificationPictureContent + * @since 7 + * @sysCap SystemCapability.Notification.ANS + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ +export interface NotificationPictureContent extends NotificationBasicContent { + briefText: string; + expandedTitle: string; + picture: image.PixelMap; +} + +/** + * Constructs a notification. + * + * @name NotificationContent * @since 7 * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car @@ -74,4 +90,5 @@ export interface NotificationContent { normal?: NotificationBasicContent; longText?: NotificationLongTextContent; multiLine?: NotificationMultiLineContent; + picture?: NotificationPictureContent; } diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index 0914b648d2..f3e2657fe0 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -14,6 +14,7 @@ */ import notification from '../@ohos.notification'; +import image from '../@ohos.multimedia.image'; import { WantAgent } from '../@ohos.wantAgent'; import { NotificationContent } from './notificationContent'; import { NotificationActionButton } from './notificationActionButton'; @@ -48,6 +49,8 @@ export interface NotificationRequest { badgeIconStyle?: number; showDeliveryTime?: boolean; actionButtons?: Array; + smallIcon?: image.PixelMap; + largeIcon?: image.PixelMap; readonly creatorBundleName?: string; readonly creatorUid?: number; readonly creatorPid?: number; diff --git a/api/notification/notificationSorting.d.ts b/api/notification/notificationSorting.d.ts index 1a34e32fa2..a4d9171451 100644 --- a/api/notification/notificationSorting.d.ts +++ b/api/notification/notificationSorting.d.ts @@ -22,6 +22,7 @@ import { NotificationSlot } from './notificationSlot'; * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car * @permission N/A + * @systemapi Hide this for inner system use. * @since 7 */ export interface NotificationSorting { diff --git a/api/notification/notificationSortingMap.d.ts b/api/notification/notificationSortingMap.d.ts index 829ddaf15c..2b2a73b4e4 100644 --- a/api/notification/notificationSortingMap.d.ts +++ b/api/notification/notificationSortingMap.d.ts @@ -23,6 +23,7 @@ import { NotificationSorting } from './notificationSorting'; * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car * @permission N/A + * @systemapi Hide this for inner system use. */ interface NotificationSortingMap { readonly sortings: {[key: string]: NotificationSorting}; diff --git a/api/notification/notificationSubscribeInfo.ts b/api/notification/notificationSubscribeInfo.ts index ea1f69fc2a..d7ee89bd9a 100644 --- a/api/notification/notificationSubscribeInfo.ts +++ b/api/notification/notificationSubscribeInfo.ts @@ -21,6 +21,7 @@ * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car * @permission N/A + * @systemapi Hide this for inner system use. */ export interface NotificationSubscribeInfo { bundleNames?: Array; diff --git a/api/wantAgent/triggerInfo.d.ts b/api/wantAgent/triggerInfo.d.ts new file mode 100644 index 0000000000..20dfdeab1f --- /dev/null +++ b/api/wantAgent/triggerInfo.d.ts @@ -0,0 +1,31 @@ +/* + * 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 { Want } from '../ability/want'; + +/** + * the info when object of WantAgent trigger + * + * @name TriggerInfo + * @since 7 + * @devices phone, tablet, tv, wearable, car + * @permission N/A + */ +export interface TriggerInfo { + code: number; + want?: Want; + permission?: string; + extraInfo?: {[key: string]: any}; +} \ No newline at end of file diff --git a/api/wantAgent/wantAgentInfo.d.ts b/api/wantAgent/wantAgentInfo.d.ts index 4cc5aa2948..d4d1c87052 100644 --- a/api/wantAgent/wantAgentInfo.d.ts +++ b/api/wantAgent/wantAgentInfo.d.ts @@ -21,8 +21,7 @@ import wantAgent from '../@ohos.wantAgent' * * @name WantAgentInfo * @since 7 - * @sysCap ans - * @devices phone, tablet + * @devices phone, tablet, tv, wearable, car * @permission N/A */ export interface WantAgentInfo { -- Gitee From 2febd82061b2420ca58225092a1af03b83dbad77 Mon Sep 17 00:00:00 2001 From: zhaoyuan Date: Mon, 27 Sep 2021 14:19:50 +0000 Subject: [PATCH 007/183] update d.ts Signed-off-by: zhaoyuan --- api/@ohos.commonEvent.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/@ohos.commonEvent.d.ts b/api/@ohos.commonEvent.d.ts index 2c57934e66..c3dc0d5b8f 100644 --- a/api/@ohos.commonEvent.d.ts +++ b/api/@ohos.commonEvent.d.ts @@ -45,7 +45,6 @@ declare namespace commonEvent { */ function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void; - /** * create the CommonEventSubscriber for the SubscriberInfo. * @@ -887,4 +886,4 @@ declare namespace commonEvent { } } -export default commonEvent; \ No newline at end of file +export default commonEvent; -- Gitee From 96d869f7e424a37a8c5c3737ddccdaced626b272 Mon Sep 17 00:00:00 2001 From: blackleon Date: Mon, 27 Sep 2021 12:44:19 +0000 Subject: [PATCH 008/183] update api/commonEvent/commonEventSubscriber.d.ts. Signed-off-by: zhaoyuan --- api/commonEvent/commonEventSubscriber.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/commonEvent/commonEventSubscriber.d.ts b/api/commonEvent/commonEventSubscriber.d.ts index 1a8182bb1b..65e5aba353 100644 --- a/api/commonEvent/commonEventSubscriber.d.ts +++ b/api/commonEvent/commonEventSubscriber.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ import { AsyncCallback } from './../basic'; -import { CommonEventSubscribeInfo } from './commoneventsubscribeinfo'; +import { CommonEventSubscribeInfo } from './commonEventSubscribeInfo'; /** * the subscriber of common event -- Gitee From 55ca057514a0ac323c821e4aa1ec8e48ccdd7180 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Mon, 27 Sep 2021 13:16:37 +0000 Subject: [PATCH 009/183] Signed-off-by:hellohyh001 Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 715 ++++++++++++++++++++++++++++++++++++++++ api/@ohos.vibrator.d.ts | 67 ++++ 2 files changed, 782 insertions(+) create mode 100755 api/@ohos.sensor.d.ts create mode 100755 api/@ohos.vibrator.d.ts diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts new file mode 100755 index 0000000000..3372c64911 --- /dev/null +++ b/api/@ohos.sensor.d.ts @@ -0,0 +1,715 @@ +/* + * 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'; + +export interface Response {} + +/** + * This module provides the capability to subscribe to sensor data. + * + * @since 7 + * @SysCap SystemCapability.Sensors.Sensor + * @devices phone, tablet + * @import import sensor from '@ohos.sensor' + * @permission N/A + */ +declare namespace sensor { + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. + * @param callback Specified callback method. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @return - + * @since 7 + */ + function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback, + options?: Options): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback): void; + + /** + * Subscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback): void; + + /** + * Unsubscribe to sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function off(type: SensorType, callback: AsyncCallback): void; + + /** + * Subscribe to the sensor's optional parameters. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface Options { + interval?: number; /**< Sensor event reporting event interval */ + } + + /** + * The type of sensor. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + enum SensorType { + SENSOR_TYPE_ID_ACCELEROMETER = 1, /**< Acceleration sensor */ + SENSOR_TYPE_ID_GYROSCOPE = 2, /**< Gyroscope sensor */ + SENSOR_TYPE_ID_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ + SENSOR_TYPE_ID_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ + SENSOR_TYPE_ID_BAROMETER = 8, /**< Barometric pressure sensor */ + SENSOR_TYPE_ID_HALL = 10, /**< Hall effect sensor */ + SENSOR_TYPE_ID_PROXIMITY = 12, /**< Proximity sensor */ + SENSOR_TYPE_ID_HUMIDITY = 13, /**< Humidity sensor */ + SENSOR_TYPE_ID_ORIENTATION = 256, /**< Orientation sensor */ + SENSOR_TYPE_ID_GRAVITY = 257, /**< Gravity sensor */ + SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ + SENSOR_TYPE_ID_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ + SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ + SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ + SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ + SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ + SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ + SENSOR_TYPE_ID_PEDOMETER = 266, /**< Pedometer sensor */ + SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ + SENSOR_TYPE_ID_WEAR_DETECTION = 280, /**< Wear detection sensor */ + SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ + } + + /** + * Acceleration sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface AccelerometerResponse extends Response { + x: number; /**< Acceleration x-axis component */ + y: number; /**< Acceleration y-axis component */ + z: number; /**< Acceleration z-axis component */ + } + + /** + * Linear acceleration sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface LinearAccelerometerResponse extends Response{ + x: number; /**< Linear acceleration x-axis component */ + y: number; /**< Linear acceleration y-axis component */ + z: number; /**< Linear acceleration z-axis component */ + } + + /** + * Acceleration uncalibrated sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface AccelerometerUncalibratedResponse extends Response { + x: number; /**< Acceleration uncalibrated x-axis component */ + y: number; /**< Acceleration uncalibrated y-axis component */ + z: number; /**< Acceleration uncalibrated z-axis component */ + biasX: number; /**< Acceleration uncalibrated x-axis offset */ + biasY: number; /**< Acceleration uncalibrated y-axis offset */ + biasZ: number; /**< Acceleration uncalibrated z-axis offset */ + } + + /** + * Gravity sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface GravityResponse extends Response { + x: number; /**< Gravity x-axis component */ + y: number; /**< Gravity y-axis component */ + z: number; /**< Gravity z-axis component */ + } + + /** + * Orientation sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface OrientationResponse extends Response { + x: number; /**< Orientation x-axis component */ + y: number; /**< Orientation y-axis component */ + z: number; /**< Orientation z-axis component */ + } + + /** + * Rotation vector sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface RotationVectorResponse extends Response { + x: number; /**< Rotation vector x-axis component */ + y: number; /**< Rotation vector y-axis component */ + z: number; /**< Rotation vector z-axis component */ + } + + /** + * Gyroscope sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface GyroscopeResponse extends Response { + x: number; /**< Gyroscope x-axis component */ + y: number; /**< Gyroscope y-axis component */ + z: number; /**< Gyroscope z-axis component */ + } + + /** + * Gyroscope uncalibrated sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface GyroscopeUncalibratedResponse extends Response { + x: number; /**< Gyroscope uncalibrated x-axis component */ + y: number; /**< Gyroscope uncalibrated y-axis component */ + z: number; /**< Gyroscope uncalibrated z-axis component */ + biasX: number; /**< Gyroscope uncalibrated x-axis offset */ + biasY: number; /**< Gyroscope uncalibrated y-axis offset */ + biasZ: number; /**< Gyroscope uncalibrated z-axis offset */ + } + + /** + * Significant motion sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface SignificantMotionResponse extends Response { + scalar: number; /**< The degree of significant motion */ + } + + /** + * Proximity sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface ProximityResponse extends Response { + distance: number; /**< Indicates the degree of proximity, event 0 indicates proximity, while 1 indicates distance */ + } + + /** + * Light sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface LightResponse extends Response { + intensity: number; /**< Indicates light intensity, in lux */ + } + + /** + * Hall sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface HallResponse extends Response { + status: number; /**< Indicates hall status, event 0 indicates open, while 1 indicates close*/ + } + + /** + * Magnetic field sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface MagneticFieldResponse extends Response { + x: number; /**< Magnetic field x-axis component */ + y: number; /**< Magnetic field y-axis component */ + z: number; /**< Magnetic field z-axis component */ + } + + /** + * Magnetic field uncalibrated sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface MagneticFieldUncalibratedResponse extends Response { + x: number; /**< Magnetic field uncalibrated x-axis component */ + y: number; /**< Magnetic field uncalibrated y-axis component */ + z: number; /**< Magnetic field uncalibrated z-axis component */ + biasX: number; /**< Magnetic field uncalibrated x-axis offset */ + biasY: number; /**< Magnetic field uncalibrated y-axis offset */ + biasZ: number; /**< Magnetic field uncalibrated z-axis offset */ + } + + /** + * Pedometer sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface PedometerResponse extends Response { + steps: number; /**< Indicates the number of steps */ + } + + /** + * Humidity sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface HumidityResponse extends Response { + humidity: number; /**< Indicates the number of humidity */ + } + + /** + * Pedometer detection sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface PedometerDetectionResponse extends Response { + scalar: number; /**< Indicates the pedometer detection status, 1 indicates that a walking action has occurred, and 0 indicates that no movement has occurred */ + } + + /** + * Ambient temperature sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface AmbientTemperatureResponse extends Response { + temperature: number; /**< Indicates ambient temperature, in celsius */ + } + + /** + * Barometer sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface BarometerResponse extends Response { + pressure: number; /**< Indicates the number of barometer, in pascal */ + } + + /** + * Heart rate sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface HeartRateResponse extends Response { + heartRate: number; /**< Indicates the number of heart rate */ + } + + /** + * Wear detection sensor event data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface WearDetectionResponse extends Response { + value: number; /**< Indicates the status of wear detection, 1 for wearing, 0 for wearing not */ + } + } + + export default sensor; \ No newline at end of file diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts new file mode 100755 index 0000000000..bcc94eef34 --- /dev/null +++ b/api/@ohos.vibrator.d.ts @@ -0,0 +1,67 @@ +/* + * 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'; + +/** + * This module provides the capability to control motor vibration. + * + * @since 7 + * @SysCap SystemCapability.Sensors.Miscdevice + * @devices phone, tablet + * @import import sensor from '@ohos.sensor' + * @permission N/A + */ +declare namespace vibrator { + /** + * The trigger motor vibrates for a specified length of time. + * @param duration Indicate the duration of the motor vibration. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function vibrate(duration: number, callback?: AsyncCallback): void; + function vibrate(duration: number): Promise; + + /** + * The trigger motor vibrates for the specified effect of the preset. + * @param effectId Indicate the specified effect of the preset, {@code EffectId}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function vibrate(effectId: EffectId): Promise; + function vibrate(effectId: EffectId, callback?: AsyncCallback): void; + + /** + * Stop the motor from vibrating. + * @param stopMode Indicate the stop mode in which the motor vibrates, {@code VibratorStopMode}. + * @param callback Specified callback method. + * @return - + * @since 7 + */ + function stop(stopMode: VibratorStopMode): Promise; + function stop(stopMode: VibratorStopMode, callback?: AsyncCallback): void; + + enum EffectId { + EFFECT_CLOCK_TIMER = "haptic.clock.timer", + } + + enum VibratorStopMode { + VIBRATOR_STOP_MODE_TIME = "time", + VIBRATOR_STOP_MODE_PRESET = "preset", + } +} + +export default vibrator; \ No newline at end of file -- Gitee From 1aa982db9c90b2297019c665a835a341e2a099af Mon Sep 17 00:00:00 2001 From: y00576111 Date: Mon, 27 Sep 2021 22:32:25 +0800 Subject: [PATCH 010/183] 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 d7b9ca850a..1ae39b267c 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 30ff6223c44cafaa2dfe66aaca8e9c0759d95fcb Mon Sep 17 00:00:00 2001 From: sunyaozu Date: Thu, 30 Sep 2021 10:13:24 +0800 Subject: [PATCH 011/183] add phone number format to i18n Signed-off-by: sunyaozu --- api/@ohos.i18n.d.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/api/@ohos.i18n.d.ts b/api/@ohos.i18n.d.ts index 7de84c3ce6..8e9598d253 100644 --- a/api/@ohos.i18n.d.ts +++ b/api/@ohos.i18n.d.ts @@ -122,4 +122,47 @@ export function getSystemLocale(): string; * @systemapi Hide this for inner system use. */ export function setSystemLocale(locale: string): boolean; + +/** + * Provides the options of PhoneNumberFormat. + * + * @since 8 + */ +export interface PhoneNumberFormatOptions { + /** + * Indicates the type to format phone number. + */ + type: string; +} + +/** + * Provides the API for formatting phone number strings + * + * @since 8 + */ +export class PhoneNumberFormat { + /** + * A constructor used to create a PhoneNumberFormat object. + * @param country Indicates a character string containing the country information for the PhoneNumberFormat object. + * @param type Indicates the type used to format the phone number, includes: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". + * @since 8 + */ + constructor(country: string, options?: PhoneNumberFormatOptions); + + /** + * Judges whether phone number is valid. + * @param number Indicates the input phone number to be judged. + * @return Returns a boolean indicates whether the input phone number is valid. + * @since 8 + */ + isValidNumber(number: string): boolean; + + /** + * Obtains the formatted phone number strings of number. + * @param number Indicates the input phone number to be formatted. + * @return Returns the formatted phone number. + * @since 8 + */ + format(number: string): string; +} } \ No newline at end of file -- Gitee From 7604c53c14c0ac97d0277aa6b6a364c8fa08b579 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Thu, 30 Sep 2021 07:25:47 +0000 Subject: [PATCH 012/183] Signed-off-by:hellohyh001 Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 222 ++++++++++++++++------------------------ api/@ohos.vibrator.d.ts | 36 ++++--- 2 files changed, 113 insertions(+), 145 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 3372c64911..2df661d48b 100755 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -19,20 +19,20 @@ export interface Response {} /** * This module provides the capability to subscribe to sensor data. * - * @since 7 - * @SysCap SystemCapability.Sensors.Sensor + * @since 8 + * @sysCap SystemCapability.Sensors.Sensor * @devices phone, tablet * @import import sensor from '@ohos.sensor' - * @permission N/A + * @permission ohos.permission.ACCELEROMETER, ohos.permission.GRYOSCOPE, + * ohos.permission.ACTIVITY_MOTION, ohos.permission.HEALTH_DATA */ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.ACCELEROMETER + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback, options?: Options): void; @@ -40,10 +40,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.ACCELEROMETER + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: AsyncCallback, options?: Options): void; @@ -51,10 +50,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback, options?: Options): void; @@ -62,10 +60,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: AsyncCallback, options?: Options): void; @@ -73,10 +70,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback, options?: Options): void; @@ -84,10 +80,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback, options?: Options): void; @@ -95,10 +90,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.GRYOSCOPE + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback, options?: Options): void; @@ -106,10 +100,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.GRYOSCOPE + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: AsyncCallback, options?: Options): void; @@ -117,10 +110,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback, options?: Options): void; @@ -128,10 +120,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.HEALTH_DATA + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback, options?: Options): void; @@ -139,10 +130,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback, options?: Options): void; @@ -150,10 +140,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.ACCELEROMETER + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: AsyncCallback, options?: Options): void; @@ -161,10 +150,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback, options?: Options): void; @@ -172,10 +160,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: AsyncCallback, options?: Options): void; @@ -183,10 +170,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback, options?: Options): void; @@ -194,10 +180,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.ACTIVITY_MOTION + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback, options?: Options): void; @@ -205,10 +190,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission ohos.permission.ACTIVITY_MOTION + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback, options?: Options): void; @@ -216,10 +200,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback, options?: Options): void; @@ -227,10 +210,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback, options?: Options): void; @@ -238,10 +220,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback, options?: Options): void; @@ -249,10 +230,9 @@ declare namespace sensor { /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. - * @param callback Specified callback method. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback, options?: Options): void; @@ -260,198 +240,176 @@ declare namespace sensor { /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.ACCELEROMETER + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.ACCELEROMETER + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_BAROMETER}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GRAVITY}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.GYROSCOPE + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.GYROSCOPE + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HALL}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.HEART_RATE + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.ACCELERATION + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.ACTIVITY_MOTION + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.ACTIVITY_MOTION + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback): void; /** * Subscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback): void; /** * Unsubscribe to sensor data once. * @param type Indicate the sensor type to listen for, {@code SensorType}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission N/A + * @since 8 */ function off(type: SensorType, callback: AsyncCallback): void; diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts index bcc94eef34..ed5eac57fc 100755 --- a/api/@ohos.vibrator.d.ts +++ b/api/@ohos.vibrator.d.ts @@ -17,19 +17,18 @@ import { AsyncCallback } from './basic'; /** * This module provides the capability to control motor vibration. * - * @since 7 - * @SysCap SystemCapability.Sensors.Miscdevice + * @since 8 + * @sysCap SystemCapability.Sensors.MiscDevice * @devices phone, tablet - * @import import sensor from '@ohos.sensor' - * @permission N/A + * @import import vibrator from '@ohos.vibrator' + * @permission ohos.permission.VIBRATE */ declare namespace vibrator { /** * The trigger motor vibrates for a specified length of time. * @param duration Indicate the duration of the motor vibration. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.VIBRATE + * @since 8 */ function vibrate(duration: number, callback?: AsyncCallback): void; function vibrate(duration: number): Promise; @@ -37,9 +36,8 @@ declare namespace vibrator { /** * The trigger motor vibrates for the specified effect of the preset. * @param effectId Indicate the specified effect of the preset, {@code EffectId}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.VIBRATE + * @since 8 */ function vibrate(effectId: EffectId): Promise; function vibrate(effectId: EffectId, callback?: AsyncCallback): void; @@ -47,19 +45,31 @@ declare namespace vibrator { /** * Stop the motor from vibrating. * @param stopMode Indicate the stop mode in which the motor vibrates, {@code VibratorStopMode}. - * @param callback Specified callback method. - * @return - - * @since 7 + * @permission ohos.permission.VIBRATE + * @since 8 */ function stop(stopMode: VibratorStopMode): Promise; function stop(stopMode: VibratorStopMode, callback?: AsyncCallback): void; + /** + * Preset vibration effect string. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.MiscDevice + */ enum EffectId { + /* Describes the vibration effect of the vibrator when a user adjusts the timer.*/ EFFECT_CLOCK_TIMER = "haptic.clock.timer", } + /** + * Vibrator vibration stop mode. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.MiscDevice + */ enum VibratorStopMode { + /* Indicates the mode of stopping a one-shot vibration effect.*/ VIBRATOR_STOP_MODE_TIME = "time", + /* Indicates the mode of stopping a preset vibration effect.*/ VIBRATOR_STOP_MODE_PRESET = "preset", } } -- Gitee From 994dc9b1b73f94cc1865465edf9ff889258857c3 Mon Sep 17 00:00:00 2001 From: zhaoyuan Date: Thu, 30 Sep 2021 17:24:52 +0000 Subject: [PATCH 013/183] update d.ts Signed-off-by: zhaoyuan --- api/@ohos.notification.d.ts | 285 +++++++++++++----- api/@ohos.wantAgent.d.ts | 143 +++++++-- ...utton.ts => notificationActionButton.d.ts} | 15 +- api/notification/notificationContent.d.ts | 74 ++++- api/notification/notificationRequest.d.ts | 104 ++++++- api/notification/notificationSlot.d.ts | 26 +- ...Info.ts => notificationSubscribeInfo.d.ts} | 0 api/wantAgent/triggerInfo.d.ts | 24 +- api/wantAgent/wantAgentInfo.d.ts | 22 +- 9 files changed, 553 insertions(+), 140 deletions(-) rename api/notification/{notificationActionButton.ts => notificationActionButton.d.ts} (83%) rename api/notification/{notificationSubscribeInfo.ts => notificationSubscribeInfo.d.ts} (100%) diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index 869beba60a..b1eb7f274a 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -34,6 +34,7 @@ import { NotificationRequest } from './notification/notificationRequest'; * @since 7 * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car + * @import import notification from '@ohos.notification'; * @permission N/A */ declare namespace notification { @@ -43,39 +44,29 @@ declare namespace notification { *

If a notification with the same ID has been published by the current application and has not been deleted, * this method will update the notification. * - * @param request Indicates the {@link NotificationRequest} object for setting the notification content. - * This parameter must be specified. - * - * @since 7 + * @param Publishes a notification. */ function publish(request: NotificationRequest, callback: AsyncCallback): void; function publish(request: NotificationRequest): Promise; /** - * Cancels a published notification. + * Cancels a notification with the specified ID. * - * @param id Indicates the unique notification ID in the application. The value must be the ID - * of a published notification. Otherwise, this method does not take effect. - * - * @since 7 + * @param ID of the notification to cancel, which must be unique in the application. */ function cancel(id: number, callback: AsyncCallback): void; /** - * Cancels a published notification matching the specified {@code label} and {@code notificationId}. - * - * @param label Indicates the label of the notification to cancel. - * @param id Indicates the ID of the notification to cancel. + * Cancels a notification with the specified label and ID. * - * @since 7 + * @param ID of the notification to cancel, which must be unique in the application. + * @param Label of the notification to cancel. */ function cancel(id: number, label: string, callback: AsyncCallback): void; function cancel(id: number, label?: string): Promise; /** - * Cancels all the published notifications. - * - * @since 7 + * Cancels all notifications of the current application. */ function cancelAll(callback: AsyncCallback): void; function cancelAll(): Promise; @@ -87,18 +78,23 @@ declare namespace notification { * This parameter must be specified. * * @systemapi Hide this for inner system use. - * @since 7 */ function addSlot(slot: NotificationSlot, callback: AsyncCallback): void; - function addSlot(slot: NotificationSlot): Promise; /** * Creates a notification slot. * - * @param slot Indicates the notification slot to be created, which is set by {@link SlotType}. + * @param slot Indicates the notification slot to be created, which is set by {@link NotificationSlot}. * This parameter must be specified. * - * @since 7 + * @systemapi Hide this for inner system use. + */ + function addSlot(slot: NotificationSlot): Promise; + + /** + * Adds a slot type. + * + * @param Slot type to add. */ function addSlot(type: SlotType, callback: AsyncCallback): void; function addSlot(type: SlotType): Promise; @@ -110,66 +106,83 @@ declare namespace notification { * This parameter must be specified. * * @systemapi Hide this for inner system use. - * @since 7 */ function addSlots(slots: Array, callback: AsyncCallback): void; + + /** + * Creates a notification slot. + * + * @param slots Indicates the notification slots to be created, which is set by {@link NotificationSlot}. + * This parameter must be specified. + * + * @systemapi Hide this for inner system use. + */ function addSlots(slots: Array): Promise; /** - * Queries a created notification slot. + * Obtains a notification slot of the specified slot type. * - * @param slotType Indicates the type of the slot, which is created by + * @param Type of the notification slot to obtain. * * @return Returns the created {@link NotificationSlot}. - * - * @since 7 */ function getSlot(slotType: SlotType, callback: AsyncCallback): void; function getSlot(slotType: SlotType): Promise; /** - * Obtains all notification slots of this application. + * Obtains all NotificationSlot objects created by the current application. * * @return Returns all notification slots of this application. - * - * @since 7 */ function getSlots(callback: AsyncCallback>): void; function getSlots(): Promise>; /** - * Deletes a created notification slot based on the slot type. + * Removes a NotificationSlot of the specified SlotType created by the current application. * - * @param slotType Indicates the type of the slot. - * - * @since 7 + * @param Type of the NotificationSlot to remove. */ function removeSlot(slotType: SlotType, callback: AsyncCallback): void; function removeSlot(slotType: SlotType): Promise; /** - * Deletes all notification slots. - * - * @since 7 + * Removes all NotificationSlot objects created by the current application. */ function removeAllSlots(callback: AsyncCallback): void; function removeAllSlots(): Promise; /** - * Indicates the type of the slot - * - * @since 7 + * Describes NotificationSlot types. */ export enum SlotType { + /** + * NotificationSlot of an unknown type. + */ UNKNOWN_TYPE = 0, + + /** + * NotificationSlot for social communication. + */ SOCIAL_COMMUNICATION = 1, + + /** + * NotificationSlot for service information. + */ SERVICE_INFORMATION = 2, + + /** + * NotificationSlot for service information. + */ CONTENT_INFORMATION = 3, + + /** + * NotificationSlot for other purposes. + */ OTHER_TYPES = 0xFFFF, } /** - * Indicates the type of the content + * Describes notification content types. * * @name ContentType * @since 7 @@ -178,23 +191,63 @@ declare namespace notification { * @permission N/A */ export enum ContentType { + /** + * Normal text notification. + */ NOTIFICATION_CONTENT_BASIC_TEXT, + + /** + * Long text notification. + */ NOTIFICATION_CONTENT_LONG_TEXT, + + /** + * Picture-attached notification. + */ NOTIFICATION_CONTENT_PICTURE, + + /** + * Conversation notification. + */ NOTIFICATION_CONTENT_CONVERSATION, + + /** + * Multi-line text notification. + */ NOTIFICATION_CONTENT_MULTILINE, } /** * Indicates the level of the slot - * - * @since 7 */ export enum SlotLevel { + /** + * Indicates that the notification function is disabled. + */ LEVEL_NONE = 0, + + /** + * Indicates that the notification function is enabled but notification + * icons are not displayed in the status bar, with no banner or prompt tone. + */ LEVEL_MIN = 1, + + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with no banner or prompt tone. + */ LEVEL_LOW = 2, + + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with no banner but with a prompt tone. + */ LEVEL_DEFAULT = 3, + + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with a banner and a prompt tone. + */ LEVEL_HIGH = 4, } @@ -202,119 +255,214 @@ declare namespace notification { * subscribe * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + + /** + * subscribe + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback): void; + + /** + * subscribe + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise; /** * unsubscribe * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + + /** + * unsubscribe + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function unsubscribe(subscriber: NotificationSubscriber): Promise; /** * enableNotification * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void; + + /** + * enableNotification + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function enableNotification(bundle: BundleOption, enable: boolean): Promise; /** * isNotificationEnabled * * @systemapi Hide this for inner system use. - * @since 7 */ function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback): void; + + /** + * isNotificationEnabled + * + * @systemapi Hide this for inner system use. + */ function isNotificationEnabled(bundle: BundleOption): Promise; /** * isNotificationEnabled * * @systemapi Hide this for inner system use. - * @since 7 */ function isNotificationEnabled(callback: AsyncCallback): void; + + /** + * isNotificationEnabled + * + * @systemapi Hide this for inner system use. + */ function isNotificationEnabled(): Promise; /** * displayBadge * * @systemapi Hide this for inner system use. - * @since 7 */ function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback): void; + + /** + * displayBadge + * + * @systemapi Hide this for inner system use. + */ function displayBadge(bundle: BundleOption, enable: boolean): Promise; /** * isBadgeDisplayed * * @systemapi Hide this for inner system use. - * @since 7 */ function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback): void; + + /** + * isBadgeDisplayed + * + * @systemapi Hide this for inner system use. + */ function isBadgeDisplayed(bundle: BundleOption): Promise; /** * setSlotByBundle * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback): void; + + /** + * setSlotByBundle + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; /** * getSlotsByBundle * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback>): void; + + /** + * getSlotsByBundle + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function getSlotsByBundle(bundle: BundleOption): Promise>; /** * getSlotNumByBundle * * @systemapi Hide this for inner system use. - * @since 7 */ function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback): void; + + /** + * getSlotNumByBundle + * + * @systemapi Hide this for inner system use. + */ function getSlotNumByBundle(bundle: BundleOption): Promise; /** * remove * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; + + /** + * remove + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function remove(bundle: BundleOption, notificationKey: NotificationKey): Promise; /** * remove * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function remove(hashCode: string, callback: AsyncCallback): void; + + /** + * remove + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function remove(hashCode: string): Promise; /** * removeAll * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function removeAll(bundle: BundleOption, callback: AsyncCallback): void; + + /** + * removeAll + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function removeAll(callback: AsyncCallback): void; + + /** + * removeAll + * + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ function removeAll(bundle?: BundleOption): Promise; /** @@ -322,31 +470,33 @@ declare namespace notification { * call this method. * * @systemapi Hide this for inner system use. - * @since 7 + * @permission ohos.permission.NOTIFICATION_CONTROLLER */ function getAllActiveNotifications(callback: AsyncCallback>): void; - function getAllActiveNotifications(): Promise>; /** - * Obtains the number of active notifications of the current application in the system. + * Obtains all active notifications in the current system. The caller must have system permissions to + * call this method. * - * @since 7 + * @systemapi Hide this for inner system use. + * @permission ohos.permission.NOTIFICATION_CONTROLLER + */ + function getAllActiveNotifications(): Promise>; + + /** + * Obtains the number of all active notifications. */ function getActiveNotificationCount(callback: AsyncCallback): void; function getActiveNotificationCount(): Promise; /** - * Obtains active notifications of the current application in the system. - * - * @since 7 + * Obtains an array of active notifications. */ function getActiveNotifications(callback: AsyncCallback>): void; function getActiveNotifications(): Promise>; /** - * BundleOption - * - * @since 7 + * Describes a BundleOption. */ export interface BundleOption { bundle: string; @@ -354,9 +504,7 @@ declare namespace notification { } /** - * NotificationKey - * - * @since 7 + * Describes a NotificationKey, which can be used to identify a notification. */ export interface NotificationKey { id: number; @@ -367,7 +515,6 @@ declare namespace notification { * DisturbMode * * @systemapi Hide this for inner system use. - * @since 7 */ export enum DoNotDisturbMode { ALLOW_UNKNOWN, diff --git a/api/@ohos.wantAgent.d.ts b/api/@ohos.wantAgent.d.ts index f7eab8a04f..17dd1c8aa2 100644 --- a/api/@ohos.wantAgent.d.ts +++ b/api/@ohos.wantAgent.d.ts @@ -25,26 +25,24 @@ import { TriggerInfo } from './wantAgent/triggerInfo'; * @name wantAgent * @since 7 * @devices phone, tablet, tv, wearable, car - * @import wantAgent from '@ohos.wantAgent'; + * @import import wantAgent from '@ohos.wantAgent'; * @permission N/A */ declare namespace wantAgent { /** - * Obtains the bundle name of an {@link WantAgent}. + * Obtains the bundle name of a WantAgent. * - * @param agent Indicates the {@link WantAgent} whose bundle name is to be obtained. + * @param WantAgent whose bundle name to obtain. * @return Returns the bundle name of the {@link WantAgent} if any. - * @since 7 */ function getBundleName(agent: WantAgent, callback: AsyncCallback): void; function getBundleName(agent: WantAgent): Promise; /** - * Obtains the bundle name of an {@link WantAgent}. + * Obtains the UID of a WantAgent. * - * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. + * @param WantAgent whose UID to obtain. * @return Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise. - * @since 7 */ function getUid(agent: WantAgent, callback: AsyncCallback): void; function getUid(agent: WantAgent): Promise; @@ -55,98 +53,177 @@ declare namespace wantAgent { * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. * @return Returns the {@link Want} of the {@link WantAgent}. * @systemapi Hide this for inner system use. - * @since 7 */ function getWant(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the {@link Want} of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. + * @return Returns the {@link Want} of the {@link WantAgent}. + * @systemapi Hide this for inner system use. + */ function getWant(agent: WantAgent): Promise; /** - * Cancels an {@link WantAgent}. Only the application that creates the {@link IntentAgent} can cancel it. + * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. * - * @param agent Indicates the {@link WantAgent} to cancel. - * @since 7 + * @param WantAgent to cancel. */ function cancel(agent: WantAgent, callback: AsyncCallback): void; function cancel(agent: WantAgent): Promise; /** - * Obtains the bundle name of an {@link WantAgent}. + * Triggers a WantAgent. * - * @param agent Indicates the {@link WantAgent} whose bundle name is to be obtained. - * @param triggerInfo Indicates the {@link TriggerInfo} object that contains triggering parameters. + * @param WantAgent to trigger. + * @param Trigger parameters. * @param callback Indicates the callback method to be called after the {@link WantAgent} is triggered. - * @since 7 */ function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void; /** - * Checks whether two {@link WantAgent} objects are the same. + * Checks whether two WantAgent objects are equal. * - * @param agent Indicates one of the {@link WantAgent} object to compare. - * @param otherAgent Indicates the other {@link WantAgent} object to compare. + * @param WantAgent to compare. + * @param WantAgent to compare. * @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise. - * @since 7 */ function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; function equal(agent: WantAgent, otherAgent: WantAgent): Promise; /** - * Obtains an {@link WantAgent} object. + * Obtains a WantAgent object. * - * @param info Indicates the {@link WantAgentInfo} object that contains parameters of the - * {@link WantAgent} object to create. + * @param Information about the WantAgent object to obtain. * @return Returns the created {@link WantAgent} object. - * @since 7 */ function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; function getWantAgent(info: WantAgentInfo): Promise; /** - * Enumerates flags for using an {@link WantAgent}. - * - * @since 7 + * Enumerates flags for using a WantAgent. */ export enum WantAgentFlags { + /** + * Indicates that the WantAgent can be used only once. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ ONE_TIME_FLAG = 0, + + /** + * Indicates that null is returned if the WantAgent does not exist. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ NO_BUILD_FLAG, + + /** + * Indicates that the existing WantAgent should be canceled before a new object is generated. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ CANCEL_PRESENT_FLAG, + + /** + * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ UPDATE_PRESENT_FLAG, + + /** + * Indicates that the created WantAgent should be immutable. + */ CONSTANT_FLAG, + + /** + * Indicates that the current value of element can be replaced when the WantAgent is triggered. + */ REPLACE_ELEMENT, + + /** + * Indicates that the current value of action can be replaced when the WantAgent is triggered. + */ REPLACE_ACTION, + + /** + * Indicates that the current value of uri can be replaced when the WantAgent is triggered. + */ REPLACE_URI, + + /** + * Indicates that the current value of entities can be replaced when the WantAgent is triggered. + */ REPLACE_ENTITIES, + + /** + * Indicates that the current value of packageName can be replaced when the WantAgent is triggered. + */ REPLACE_BUNDLE } /** - * Identifies the operation for using an {@link WantAgent}, such as starting an ability or sending a common event. - * - * @since 7 + * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event. */ export enum OperationType { + /** + * Unknown operation. + */ UNKNOWN_TYPE = 0, + + /** + * Starts an ability with a UI. + */ START_ABILITY, + + /** + * Starts multiple abilities with a UI. + */ START_ABILITIES, + + /** + * Starts an ability without a UI. + */ START_SERVICE, + + /** + * Sends a common event. + */ SEND_COMMON_EVENT } /** - * A callback for the {@link trigger()} method. After the method execution is complete, - * the callback process will start. - * - * @since 7 + * Describes the data returned by after wantAgent.trigger is called. */ export interface CompleteData { + /** + * Triggered WantAgent. + */ info: WantAgent; + + /** + * Existing Want that is triggered. + */ want: Want; + + /** + * Request code used to trigger the WantAgent. + */ finalCode: number; + + /** + * Final data collected by the common event. + */ finalData: string; + + /** + * Extra data collected by the common event. + */ extraInfo?: {[key: string]: any}; } } +/** + * WantAgent object. + */ export type WantAgent = object; export default wantAgent; \ No newline at end of file diff --git a/api/notification/notificationActionButton.ts b/api/notification/notificationActionButton.d.ts similarity index 83% rename from api/notification/notificationActionButton.ts rename to api/notification/notificationActionButton.d.ts index 140215050e..39cc3db49e 100644 --- a/api/notification/notificationActionButton.ts +++ b/api/notification/notificationActionButton.d.ts @@ -16,15 +16,26 @@ import { WantAgent } from '../@ohos.wantAgent'; /** - * The action button of notification + * Describes an action button displayed in a notification. * @name NotificationActionButton * @since 7 - * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car * @permission N/A + * @sysCap SystemCapability.Notification.ANS */ export interface NotificationActionButton { + /** + * Button title. + */ title: string; + + /** + * WantAgent of the button. + */ wantAgent: WantAgent; + + /** + * Extra information of the button. + */ extras?: {[key: string]: any}; } diff --git a/api/notification/notificationContent.d.ts b/api/notification/notificationContent.d.ts index 7624cd304a..d2cc36ebdc 100644 --- a/api/notification/notificationContent.d.ts +++ b/api/notification/notificationContent.d.ts @@ -15,9 +15,8 @@ import notification from '../@ohos.notification'; import image from './@ohos.multimedia.image'; - /** - * Constructs basic notifications. + * Describes a normal text notification. * * @name NotificationBasicContent * @since 7 @@ -26,13 +25,24 @@ import image from './@ohos.multimedia.image'; * @permission N/A */ export interface NotificationBasicContent { + /** + * Title of the normal text notification. + */ title: string; + + /** + * Content of the normal text notification. + */ text: string; + + /** + * Additional information of the normal text notification. + */ additionalText?: string; } /** - * Constructs notifications that include long text. The long text contains a maximum of 1024 characters. + * Describes a long text notification. * * @name NotificationLongTextContent * @since 7 @@ -41,13 +51,24 @@ export interface NotificationBasicContent { * @permission N/A */ export interface NotificationLongTextContent extends NotificationBasicContent { + /** + * Long text content of the notification. + */ longText: string; + + /** + * Brief text of the long text notification. + */ briefText: string; + + /** + * Title that will be displayed for the long text notification when it is expanded. + */ expandedTitle: string; } /** - * Constructs a notification that includes multiple lines of text. + * Describes a multi-line text notification. * * @name NotificationMultiLineContent * @since 7 @@ -56,13 +77,24 @@ export interface NotificationLongTextContent extends NotificationBasicContent { * @permission N/A */ export interface NotificationMultiLineContent extends NotificationBasicContent { + /** + * Brief text of the multi-line text notification. + */ briefText: string; + + /** + * Brief text of the multi-line text notification. + */ longTitle: string; + + /** + * Multi-line content of the multi-line text notification. + */ lines: Array; } /** - * Constructs a notification that includes a picture. + * Describes a picture-attached notification. * * @name NotificationPictureContent * @since 7 @@ -71,13 +103,24 @@ export interface NotificationMultiLineContent extends NotificationBasicContent { * @permission N/A */ export interface NotificationPictureContent extends NotificationBasicContent { + /** + * Multi-line content of the multi-line text notification. + */ briefText: string; + + /** + * Title that will be displayed for the picture-attached notification when it is expanded. + */ expandedTitle: string; + + /** + * Picture to be included in a notification. + */ picture: image.PixelMap; } /** - * Constructs a notification. + * Describes notification types. * * @name NotificationContent * @since 7 @@ -86,9 +129,28 @@ export interface NotificationPictureContent extends NotificationBasicContent { * @permission N/A */ export interface NotificationContent { + /** + * Notification content type. + */ contentType: notification.ContentType; + + /** + * Normal text notification. + */ normal?: NotificationBasicContent; + + /** + * Long text notification. + */ longText?: NotificationLongTextContent; + + /** + * Multi-line text notification. + */ multiLine?: NotificationMultiLineContent; + + /** + * Picture-attached notification. + */ picture?: NotificationPictureContent; } diff --git a/api/notification/notificationRequest.d.ts b/api/notification/notificationRequest.d.ts index f3e2657fe0..b7e6575057 100644 --- a/api/notification/notificationRequest.d.ts +++ b/api/notification/notificationRequest.d.ts @@ -20,7 +20,7 @@ import { NotificationContent } from './notificationContent'; import { NotificationActionButton } from './notificationActionButton'; /** - * Carries notifications. + * Defines a NotificationRequest instance. * * @name NotificationRequest * @since 7 @@ -29,44 +29,140 @@ import { NotificationActionButton } from './notificationActionButton'; * @permission N/A */ export interface NotificationRequest { + /** + * Notification content. + */ content: NotificationContent; + + /** + * Notification ID. + */ id?: number; + + /** + * Notification slot type. + */ slotType?: notification.SlotType; + + /** + * Whether the notification is an ongoing notification. + */ isOngoing?: boolean; + + /** + * Whether the notification can be removed. + */ isUnremovable?: boolean; + + /** + * Time when the notification is sent. + */ deliveryTime?: number; + + /** + * Whether the notification is automatically cleared. + */ tapDismissed?: boolean; + + /** + * Time when the notification is automatically cleared. + */ autoDeletedTime?: number; + + /** + * WantAgent instance to which the notification will be redirected after being clicked. + */ wantAgent?: WantAgent; + + /** + * Extended parameter. + */ extraInfo?: {[key: string]: any}; + + /** + * Background color of the notification. + */ color?: number; + + /** + * Whether the notification background color can be enabled. + */ colorEnabled?: boolean; + + /** + * Whether the notification triggers an alert only once. + */ isAlertOnce?: boolean; + + /** + * Whether to display the stopwatch. + */ isStopwatch?: boolean; + + /** + * Whether to display the countdown time. + */ isCountDown?: boolean; + + /** + * Whether the notification is displayed as a floating icon. + */ isFloatingIcon?: boolean; + + /** + * Notification label. + */ label?: string; + + /** + * Notification badge type. + */ badgeIconStyle?: number; + + /** + * Whether to display the time when the notification is delivered. + */ showDeliveryTime?: boolean; + + /** + * Buttons in the notification. Up to two buttons are allowed. + */ actionButtons?: Array; + + /** + * Small notification icon. + */ smallIcon?: image.PixelMap; + + /** + * Large notification icon. + */ largeIcon?: image.PixelMap; + + /** + * Read-only name of the package for which a notification is created. + */ readonly creatorBundleName?: string; + + /** + * Read-only UID of the notification creator. + */ readonly creatorUid?: number; + + /** + * Read-only PID of the notification creator. + */ readonly creatorPid?: number; /** * Obtains the classification of this notification. * * @systemapi Hide this for inner system use. - * @since 7 */ classification?: string; /** * Obtains the unique hash code of a notification in the current application. - * - * @since 7 */ readonly hashCode?: string; } diff --git a/api/notification/notificationSlot.d.ts b/api/notification/notificationSlot.d.ts index 56f987e69e..82ff360f74 100644 --- a/api/notification/notificationSlot.d.ts +++ b/api/notification/notificationSlot.d.ts @@ -16,89 +16,67 @@ import notification from '../@ohos.notification'; /** - * A constructor used to initialize the type, desc, and level of a {@code NotificationSlot} object. + * Describes a NotificationSlot instance. * * @name NotificationSlot * @since 7 - * @sysCap SystemCapability.Notification.ANS * @devices phone, tablet, tv, wearable, car * @permission N/A + * @sysCap SystemCapability.Notification.ANS */ export interface NotificationSlot { /** * Obtains the type of a notification slot. - * - * @since 7 */ type: notification.SlotType; /** * Obtains the level of a notification slot - * - * @since 7 */ level?: notification.SlotLevel; /** * Obtains the description of a notification slot. - * - * @since 7 */ desc?: string; /** * Obtains the application icon badge status of a notification slot. - * - * @since 7 */ badgeFlag?: boolean; /** * Obtains whether DND mode is bypassed for a notification slot. - * - * @since 7 */ bypassDnd?: boolean; /** * Whether and how to display notifications on the lock screen. - * - * @since 7 */ lockscreenVisibility?: number; /** * Obtains the vibration status of the notification slot. - * - * @since 7 */ vibrationEnabled?: boolean; /** * Obtains the prompt tone of the notification slot. - * - * @since 7 */ sound?: string; /** * Obtains whether the notification light is enabled in a notification slot. - * - * @since 7 */ lightEnabled?: boolean; /** * Obtains the color of the notification light in a notification slot. - * - * @since 7 */ lightColor?: number; /** * Obtains the vibration style of notifications in this notification slot. - * - * @since 7 */ vibrationValues?: Array; } diff --git a/api/notification/notificationSubscribeInfo.ts b/api/notification/notificationSubscribeInfo.d.ts similarity index 100% rename from api/notification/notificationSubscribeInfo.ts rename to api/notification/notificationSubscribeInfo.d.ts diff --git a/api/wantAgent/triggerInfo.d.ts b/api/wantAgent/triggerInfo.d.ts index 20dfdeab1f..8cd951dce9 100644 --- a/api/wantAgent/triggerInfo.d.ts +++ b/api/wantAgent/triggerInfo.d.ts @@ -16,7 +16,7 @@ import { Want } from '../ability/want'; /** - * the info when object of WantAgent trigger + * Provides the information required for triggering a WantAgent. * * @name TriggerInfo * @since 7 @@ -24,8 +24,30 @@ import { Want } from '../ability/want'; * @permission N/A */ export interface TriggerInfo { + /** + * Result code. + */ code: number; + + /** + * Extra Want. + * If flags in WantAgentInfo contain CONSTANT_FLAG, this parameter is invalid. + * If flags contain REPLACE_ELEMENT, REPLACE_ACTION, REPLACE_URI, REPLACE_ENTITIES, and REPLACE_BUNDLE, + * the element, action, uri, entities, and bundleName attributes of the Want specified in this parameter + * will be used to replace the corresponding attributes in the original Want, respectively. + * If this parameter is null, the original Want remains unchanged. + */ want?: Want; + + /** + * Permission required for a WantAgent recipient. + * This parameter is valid only when the WantAgent is triggered to send common events. + * If permission is null, no permission is required on the recipient. + */ permission?: string; + + /** + * Custom extra data you want to add for triggering a WantAgent. + */ extraInfo?: {[key: string]: any}; } \ No newline at end of file diff --git a/api/wantAgent/wantAgentInfo.d.ts b/api/wantAgent/wantAgentInfo.d.ts index d4d1c87052..f33531d327 100644 --- a/api/wantAgent/wantAgentInfo.d.ts +++ b/api/wantAgent/wantAgentInfo.d.ts @@ -17,7 +17,7 @@ import { Want } from '../ability/want'; import wantAgent from '../@ohos.wantAgent' /** - * the info of WantAgent + * Provides the information required for triggering a WantAgent. * * @name WantAgentInfo * @since 7 @@ -25,9 +25,29 @@ import wantAgent from '../@ohos.wantAgent' * @permission N/A */ export interface WantAgentInfo { + /** + * An array of all Wants for starting abilities or sending common events. Only Wants can be displayed. + */ wants: Array; + + /** + * Type of the action specified in a Want. + */ operationType: wantAgent.OperationType; + + /** + * Request code defined by the user. + */ requestCode: number; + + /** + * An array of flags for using the WantAgent. + */ wantAgentFlags?: Array; + + /** + * Extra information about how the Want starts an ability. + * If there is no extra information to set, this constant can be left empty. + */ extraInfo?: {[key: string]: any}; } \ No newline at end of file -- Gitee From d35e38fc46fc6f7e11df5657e7b4f235c82832bb Mon Sep 17 00:00:00 2001 From: clevercong Date: Mon, 11 Oct 2021 15:18:39 +0800 Subject: [PATCH 014/183] 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 a6d8fe57e0..25680a731f --- 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 ffa1a3f853..0000000000 --- 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 2e07a4b7b3..d1c0fe0b18 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 139ae0be8b..bbc4dcfc71 --- 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 e586e47276..ed9652a51a --- 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 a1b162bf6d..709f1b6900 --- 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 015/183] 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 bff59be60e..d481c9bf4b 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 3bf1c4482b..be47f42ebd 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 9841a835ce..ab23c0546d 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 0000000000..641e4ea0d2 --- /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 016/183] 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 2ca0027728..9c5cb73a28 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 26a0620988..cffda34912 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 361b9823cc..f87e0485b4 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 27d0858af6..62d06cf8a5 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 2e51167d79..8af79b7089 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 49587d21ee..b29e7a7f32 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 42a841d29d..322e46cd54 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 8f7fd66a66..68404dbb96 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