提交 158ee3c0 编写于 作者: 赵还行 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: N赵还行 <x8688997@163.com>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
#!/bin/bash
# Copyright (c) 2020 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.
docker build -t openharmony-docker:1.0.0 .
......@@ -39,33 +39,36 @@ OpenHarmony does not support creation of a Service Extension ability for third-p
```
2. Customize a class that inherits from **ServiceExtensionAbility** in the .ts file in the directory where the Service Extension ability is defined and override the lifecycle callbacks of the base class. The code sample is as follows:
2. Customize a class that inherits from **ServiceExtensionAbility** in the .ts file in the directory where the Service Extension ability is defined (**entry\src\main\ets\ServiceExtAbility\ServiceExtAbility.ts** by default) and override the lifecycle callbacks of the base class. The code sample is as follows:
```js
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import rpc from '@ohos.rpc'
class StubTest extends rpc.RemoteObject {
constructor(des) {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
}
}
onRemoteRequest(code, data, reply, option) {
}
}
class ServiceExt extends ServiceExtensionAbility {
console.log('onCreate, want:' + want.abilityName);
}
onRequest(want, startId) {
console.log('onRequest, want:' + want.abilityName);
}
onConnect(want) {
console.log('onConnect , want:' + want.abilityName);
return new StubTest("test");
}
onDisconnect(want) {
console.log('onDisconnect, want:' + want.abilityName);
}
onDestroy() {
console.log('onDestroy');
}
class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.log('onCreate, want:' + want.abilityName);
}
onRequest(want, startId) {
console.log('onRequest, want:' + want.abilityName);
}
onConnect(want) {
console.log('onConnect , want:' + want.abilityName);
return new StubTest("test");
}
onDisconnect(want) {
console.log('onDisconnect, want:' + want.abilityName);
}
onDestroy() {
console.log('onDestroy');
}
}
```
```
\ No newline at end of file
......@@ -65,9 +65,9 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
import vibrator from "@ohos.vibrator"
vibrator.vibrate(1000).then((error) => {
if (error) { // The call fails, and error.code and error.message are printed.
Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
} else { // The call is successful, and the device starts to vibrate.
Console.log("Promise returned to indicate a successful vibration.")
console.log("Promise returned to indicate a successful vibration.")
}
})
```
......@@ -78,9 +78,9 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
import vibrator from "@ohos.vibrator"
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error) => {
if (error) { // The call fails, and error.code and error.message are printed.
Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
} else { // The call is successful, and the device stops vibrating.
Console.log("Promise returned to indicate a successful stop.");
console.log("Promise returned to indicate successful.");
}
})
```
......@@ -267,7 +267,7 @@ imageSourceApi.getImageInfo(imageInfo => {
})
// Update incremental data.
imageSourceIncrementalSApi.updateData(array, false, 0, 10,(error,data )=> {})
imageSourceIncrementalSApi.updateData(array, false, 0, 10,(error, data)=> {})
```
......
......@@ -888,7 +888,7 @@ Disconnects a connection. This API uses an asynchronous callback to return the r
startAbilityByCall(want: Want): Promise&lt;Caller&gt;;
Obtains the caller interface of the specified ability, and if the specified ability is not started, starts the ability in the background.
Starts an ability in the foreground or background and obtains the caller interface for communication with the ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -896,7 +896,7 @@ Obtains the caller interface of the specified ability, and if the specified abil
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the target ability, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, it indicates the local device.|
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, including **abilityName**, **moduleName**, **bundleName**, **deviceId** (optional), and **parameters** (optional). If **deviceId** is left blank or null, the local ability is started. If **parameters** is left blank or null, the ability is started in the background.|
**Return value**
......@@ -907,22 +907,40 @@ Obtains the caller interface of the specified ability, and if the specified abil
**Example**
```js
import Ability from '@ohos.application.Ability';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "MainAbility",
deviceId: ""
}).then((obj) => {
caller = obj;
console.log('Caller GetCaller Get ' + caller);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
let caller = undefined;
// Start an ability in the background without passing parameters.
var wantBackground = {
bundleName: "com.example.myservice",
moduleName: "entry",
abilityName: "MainAbility",
deviceId: ""
};
this.context.startAbilityByCall(wantBackground)
.then((obj) => {
caller = obj;
console.log('GetCaller success');
}).catch((error) => {
console.log(`GetCaller failed with ${error}`);
});
// Start an ability in the foreground with ohos.aafwk.param.callAbilityToForeground in parameters set to true.
var wantForeground = {
bundleName: "com.example.myservice",
moduleName: "entry",
abilityName: "MainAbility",
deviceId: "",
parameters: {
"ohos.aafwk.param.callAbilityToForeground": true
}
}
};
this.context.startAbilityByCall(wantForeground)
.then((obj) => {
caller = obj;
console.log('GetCaller success');
}).catch((error) => {
console.log(`GetCaller failed with ${error}`);
});
```
## AbilityContext.startAbilityWithAccount
......
......@@ -1327,7 +1327,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.<br> <br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.|
| callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.<br><br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.|
**Example**
......@@ -2743,13 +2743,13 @@ Defines the dialup options.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ---------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
| accountId | number | No | Account ID. This API is supported since API version 8. It is a system API. |
| videoState | [VideoStateType](#videostatetype7) | No | Video state type. This API is supported since API version 8. It is a system API. |
| dialScene | [DialScene](#dialscene8) | No | Dialup scenario. This API is supported since API version 8. It is a system API. |
| dialType | [DialType](#dialtype8) | No | Dialup type. This API is supported since API version 8. It is a system API. |
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
| accountId <sup>8+</sup> | number | No | Account ID. This is a system API. |
| videoState <sup>8+</sup> | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. |
| dialScene <sup>8+</sup> | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. |
| dialType <sup>8+</sup> | [DialType](#dialtype8) | No | Dialup type. This is a system API. |
## CallState
......
# Distributed Mission Management
The **distributedMissionManager** module implements system mission management across devices. You can use the APIs provided by this module to register or deregister a mission status listener, and start or stop synchronizing the remote mission list.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
## Modules to Import
```js
import distributedMissionManager from '@ohos.distributedMissionManager'
```
## distributedMissionManager.registerMissionListener
registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback, callback: AsyncCallback&lt;void&gt;): void;
Registers a mission status listener. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | --------- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for.|
| options | [MissionCallback](#missioncallback) | Yes | Callback to register. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```ts
function NotifyMissionsChanged(deviceId) {
console.log('NotifyMissionsChanged deviceId ' + JSON.stringify(deviceId));
}
function NotifySnapshot(deviceId, missionId) {
console.log('NotifySnapshot deviceId ' + JSON.stringify(deviceId));
console.log('NotifySnapshot missionId ' + JSON.stringify(missionId));
}
function NotifyNetDisconnect(deviceId, state) {
console.log('NotifyNetDisconnect deviceId ' + JSON.stringify(deviceId));
console.log('NotifyNetDisconnect state ' + JSON.stringify(state));
}
var parameter = {
deviceId: remoteDeviceId
};
var options = {
notifyMissionsChanged: NotifyMissionsChanged,
notifySnapshot: NotifySnapshot,
notifyNetDisconnect: NotifyNetDisconnect
}
distributedMissionManager.registerMissionListener(parameter, options, (error) => {
console.log("error.code = " + error.code)
})
```
## distributedMissionManager.registerMissionListener
registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback): Promise&lt;void&gt;
Registers a mission status listener. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------------- | ---- | -------- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. |
| options | <a href="#missioncallback">MissionCallback</a> | Yes | Callback to register.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```ts
function NotifyMissionsChanged(deviceId) {
console.log('NotifyMissionsChanged deviceId ' + JSON.stringify(deviceId));
}
function NotifySnapshot(deviceId, missionId) {
console.log('NotifySnapshot deviceId ' + JSON.stringify(deviceId));
console.log('NotifySnapshot missionId ' + JSON.stringify(missionId));
}
function NotifyNetDisconnect(deviceId, state) {
console.log('NotifyNetDisconnect deviceId ' + JSON.stringify(deviceId));
console.log('NotifyNetDisconnect state ' + JSON.stringify(state));
}
var parameter = {
deviceId: remoteDeviceId
};
var options = {
notifyMissionsChanged: NotifyMissionsChanged,
notifySnapshot: NotifySnapshot,
notifyNetDisconnect: NotifyNetDisconnect
}
distributedMissionManager.registerMissionListener(parameter, options)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
```
## distributedMissionManager.unregisterMissionListener
unregisterMissionListener(parameter: MissionDeviceInfo, callback: AsyncCallback&lt;void&gt;): void;
Deregisters a mission status listener. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | --------- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```ts
var parameter = {
deviceId: remoteDeviceId
};
distributedMissionManager.unregisterMissionListener(parameter, (error) => {
console.log("error.code = " + error.code)
})
```
## distributedMissionManager.unregisterMissionListener
unregisterMissionListener(parameter: MissionDeviceInfo): Promise&lt;void&gt;
Deregisters a mission status listener. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```ts
var parameter = {
deviceId: remoteDeviceId
};
distributedMissionManager.unregisterMissionListener(parameter)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
```
## distributedMissionManager.startSyncRemoteMissions
startSyncRemoteMissions(parameter: MissionParameter, callback: AsyncCallback&lt;void&gt;): void;
Starts to synchronize the remote mission list. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------------------------------------- | ---- | --------- |
| parameter | [MissionParameter](#missionparameter) | Yes | Parameters required for synchronization. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```ts
var parameter = {
deviceId: remoteDeviceId,
fixConflict: false,
tag: 0
};
distributedMissionManager.startSyncRemoteMissions(parameter, (error) => {
console.log("error.code = " + error.code)
})
```
## distributedMissionManager.startSyncRemoteMissions
startSyncRemoteMissions(parameter: MissionParameter): Promise&lt;void&gt;
Starts to synchronize the remote mission list. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------------------------------------- | ---- | ----- |
| parameter | [MissionParameter](#missionparameter) | Yes | Parameters required for synchronization.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```ts
var parameter = {
deviceId: remoteDeviceId,
fixConflict: false,
tag: 0
};
distributedMissionManager.startSyncRemoteMissions(parameter)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
```
## distributedMissionManager.stopSyncRemoteMissions
stopSyncRemoteMissions(parameter: MissionDeviceInfo, callback: AsyncCallback&lt;void&gt;): void;
Stops synchronizing the remote mission list. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | --------- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Parameters required for synchronization. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```ts
var parameter = {
deviceId: remoteDeviceId
};
distributedMissionManager.stopSyncRemoteMissions(parameter, (error) => {
console.log("error.code = " + error.code)
})
```
## distributedMissionManager.stopSyncRemoteMissions
stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise&lt;void&gt;
Stops synchronizing the remote mission list. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Parameters required for synchronization.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```ts
var parameter = {
deviceId: remoteDeviceId
};
distributedMissionManager.stopSyncRemoteMissions(parameter)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
```
## MissionCallback
Defines the callbacks that can be registered as a mission status listener.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| --------------------- | -------- | ---- | ---- | ------------------ |
| notifyMissionsChanged | function | Yes | No | Callback used to notify the mission change event and return the device ID. |
| notifySnapshot | function | Yes | No | Callback used to notify the snapshot change event and return the device ID and mission ID.|
| notifyNetDisconnect | function | Yes | No | Callback used to notify the disconnection event and return the device ID and network status.|
## MissionParameter
Defines the parameters required for mission synchronization.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| ----------- | ------- | ---- | ---- | ----------- |
| deviceId | string | Yes | Yes | Device ID. |
| fixConflict | boolean | Yes | Yes | Whether a version conflict occurs.|
| tag | number | Yes | Yes | Tag of the mission. |
## MissionDeviceInfo
Defines the parameters required for registering a listener.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| deviceId | string | Yes | Yes | Device ID.|
......@@ -61,7 +61,7 @@ Creates a **VideoPlayer** instance in asynchronous mode. This API uses a callbac
let videoPlayer
media.createVideoPlayer((error, video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoPlayer = video;
console.info('video createVideoPlayer success');
} else {
......@@ -90,7 +90,7 @@ Creates a **VideoPlayer** instance in asynchronous mode. This API uses a promise
let videoPlayer
media.createVideoPlayer().then((video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoPlayer = video;
console.info('video createVideoPlayer success');
} else {
......@@ -143,7 +143,7 @@ Only one **AudioRecorder** instance can be created per device.
let videoRecorder
media.createVideoRecorder((error, video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoRecorder = video;
console.info('video createVideoRecorder success');
} else {
......@@ -173,7 +173,7 @@ Only one **AudioRecorder** instance can be created per device.
let videoRecorder
media.createVideoRecorder().then((video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoRecorder = video;
console.info('video createVideoRecorder success');
} else {
......@@ -370,7 +370,7 @@ Seeks to the specified playback position.
```js
audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the 'timeUpdate' event callback.
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -443,7 +443,7 @@ function printfDescription(obj) {
}
audioPlayer.getTrackDescription((error, arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
}
......@@ -479,7 +479,7 @@ function printfDescription(obj) {
}
audioPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
arrayDescription = arrlist;
} else {
console.log('audio getTrackDescription fail');
......@@ -505,7 +505,7 @@ Subscribes to the audio buffering update event.
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'bufferingUpdate'** in this case. |
| type | string | Yes | Event type, which is **'bufferingUpdate'** in this case. |
| callback | function | Yes | Callback invoked when the event is triggered.<br>When [BufferingInfoType](#bufferinginfotype8) is set to **BUFFERING_PERCENT** or **CACHED_DURATION**, **value** is valid. Otherwise, **value** is fixed at **0**.|
**Example**
......@@ -554,7 +554,7 @@ audioPlayer.on('reset', () => { // Set the 'reset' event callback.
audioPlayer = undefined;
});
audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the 'timeUpdate' event callback.
if (typeof(seekDoneTime) == "undefined") {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -602,14 +602,14 @@ Subscribes to the **'timeUpdate'** event.
| Name | Type | Mandatory| Description |
| -------- | ----------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'timeUpdate'** in this case.<br>The **'timeUpdate'** event is triggered when the [seek()](#audioplayer_seek) API is called. |
| type | string | Yes | Event type, which is **'timeUpdate'** in this case.<br>The **'timeUpdate'** event is triggered when the [seek()](#audioplayer_seek) API is called.|
| callback | Callback\<number> | Yes | Callback invoked when the event is triggered. The input parameter of the callback is the time when the seek operation is successful. |
**Example**
```js
audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the 'timeUpdate' event callback.
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -630,7 +630,7 @@ Subscribes to audio playback error events. After an error event is reported, you
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during audio playback. |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during audio playback.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -727,7 +727,7 @@ Sets **SurfaceId**. This API uses a callback to return the result.
```js
videoPlayer.setDisplaySurface(surfaceId, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setDisplaySurface success!');
} else {
console.info('setDisplaySurface fail!');
......@@ -785,7 +785,7 @@ Prepares for video playback. This API uses a callback to return the result.
```js
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('prepare success!');
} else {
console.info('prepare fail!');
......@@ -835,7 +835,7 @@ Starts to play video resources. This API uses a callback to return the result.
```js
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('play success!');
} else {
console.info('play fail!');
......@@ -885,7 +885,7 @@ Pauses video playback. This API uses a callback to return the result.
```js
videoPlayer.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('pause success!');
} else {
console.info('pause fail!');
......@@ -935,7 +935,7 @@ Stops video playback. This API uses a callback to return the result.
```js
videoPlayer.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('stop success!');
} else {
console.info('stop fail!');
......@@ -985,7 +985,7 @@ Switches the video resource to be played. This API uses a callback to return the
```js
videoPlayer.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('reset success!');
} else {
console.info('reset fail!');
......@@ -1037,7 +1037,7 @@ Seeks to the specified playback position. The next key frame at the specified po
```js
let seekTime = 5000;
videoPlayer.seek(seekTime, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('seek success!');
} else {
console.info('seek fail!');
......@@ -1068,7 +1068,7 @@ import media from '@ohos.multimedia.media'
let seekTime = 5000;
let seekMode = media.SeekMode.SEEK_NEXT_SYNC;
videoPlayer.seek(seekTime, seekMode, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('seek success!');
} else {
console.info('seek fail!');
......@@ -1134,7 +1134,7 @@ Sets the volume. This API uses a callback to return the result.
```js
let vol = 0.5;
videoPlayer.setVolume(vol, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setVolume success!');
} else {
console.info('setVolume fail!');
......@@ -1191,7 +1191,7 @@ Releases the video playback resource. This API uses a callback to return the res
```js
videoPlayer.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('release success!');
} else {
console.info('release fail!');
......@@ -1249,7 +1249,7 @@ function printfDescription(obj) {
}
videoPlayer.getTrackDescription((error, arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist) != null) {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
}
......@@ -1286,7 +1286,7 @@ function printfDescription(obj) {
let arrayDescription;
videoPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
arrayDescription = arrlist;
} else {
console.log('video getTrackDescription fail');
......@@ -1321,7 +1321,7 @@ import media from '@ohos.multimedia.media'
let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X;
videoPlayer.setSpeed(speed, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setSpeed success!');
} else {
console.info('setSpeed fail!');
......@@ -1382,7 +1382,7 @@ Selects a bit rate from available ones, which can be obtained by calling [availa
```js
let bitrate = 1024000;
videoPlayer.selectBitrate(bitrate, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('selectBitrate success!');
} else {
console.info('selectBitrate fail!');
......@@ -1433,7 +1433,7 @@ Subscribes to the video playback completion event.
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ----------------------------------------------------------- |
| type | string | Yes | Event type, which is **'playbackCompleted'** in this case. |
| type | string | Yes | Event type, which is **'playbackCompleted'** in this case.|
| callback | function | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1456,7 +1456,7 @@ Subscribes to the video buffering update event.
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'bufferingUpdate'** in this case. |
| type | string | Yes | Event type, which is **'bufferingUpdate'** in this case. |
| callback | function | Yes | Callback invoked when the event is triggered.<br>When [BufferingInfoType](#bufferinginfotype8) is set to **BUFFERING_PERCENT** or **CACHED_DURATION**, **value** is valid. Otherwise, **value** is fixed at **0**.|
**Example**
......@@ -1480,7 +1480,7 @@ Subscribes to the frame rendering start event.
| Name | Type | Mandatory| Description |
| -------- | --------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'startRenderFrame'** in this case. |
| type | string | Yes | Event type, which is **'startRenderFrame'** in this case.|
| callback | Callback\<void> | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1503,7 +1503,7 @@ Subscribes to the video width and height change event.
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'videoSizeChanged'** in this case. |
| type | string | Yes | Event type, which is **'videoSizeChanged'** in this case.|
| callback | function | Yes | Callback invoked when the event is triggered. **width** indicates the video width, and **height** indicates the video height. |
**Example**
......@@ -1527,7 +1527,7 @@ Subscribes to video playback error events. After an error event is reported, you
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during video playback. |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during video playback.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1640,7 +1640,7 @@ function printfItemDescription(obj, key) {
}
audioPlayer.getTrackDescription((error, arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
for (let i = 0; i < arrlist.length; i++) {
printfItemDescription(arrlist[i], MD_KEY_TRACK_TYPE); // Print the MD_KEY_TRACK_TYPE value of each track.
}
......@@ -1866,7 +1866,7 @@ Subscribes to audio recording error events. After an error event is reported, yo
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during audio recording. |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during audio recording.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
......@@ -1996,7 +1996,7 @@ let eventEmitter = new events.EventEmitter();
eventEmitter.on('prepare', () => {
videoRecorder.prepare(videoConfig, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('prepare success');
} else {
console.info('prepare failed and error is ' + err.message);
......@@ -2005,7 +2005,7 @@ eventEmitter.on('prepare', () => {
});
media.createVideoRecorder((err, recorder) => {
if (typeof (err) == 'undefined' && typeof (recorder) != 'undefined') {
if (err == null && recorder != null) {
videoRecorder = recorder;
console.info('createVideoRecorder success');
eventEmitter.emit('prepare'); // Trigger the 'prepare' event.
......@@ -2065,7 +2065,7 @@ let videoConfig = {
// promise
let videoRecorder = null;
media.createVideoRecorder().then((recorder) => {
if (typeof (recorder) != 'undefined') {
if (recorder != null) {
videoRecorder = recorder;
console.info('createVideoRecorder success');
} else {
......@@ -2106,7 +2106,7 @@ This API can be called only after [prepare()](#videorecorder_prepare1) is called
// asyncallback
let surfaceID = null; // Surface ID passed to the external system.
videoRecorder.getInputSurface((err, surfaceId) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('getInputSurface success');
surfaceID = surfaceId;
} else {
......@@ -2167,7 +2167,7 @@ This API can be called only after [prepare()](#videorecorder_prepare1) and [getI
```js
// asyncallback
videoRecorder.start((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('start videorecorder success');
} else {
console.info('start videorecorder failed and error is ' + err.message);
......@@ -2223,7 +2223,7 @@ This API can be called only after [start()](#videorecorder_start1) is called. Yo
```js
// asyncallback
videoRecorder.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('pause videorecorder success');
} else {
console.info('pause videorecorder failed and error is ' + err.message);
......@@ -2277,7 +2277,7 @@ Resumes video recording in asynchronous mode. This API uses a callback to return
```js
// asyncallback
videoRecorder.resume((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('resume videorecorder success');
} else {
console.info('resume videorecorder failed and error is ' + err.message);
......@@ -2331,7 +2331,7 @@ To start another recording, you must call [prepare()](#videorecorder_prepare1) a
```js
// asyncallback
videoRecorder.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('stop videorecorder success');
} else {
console.info('stop videorecorder failed and error is ' + err.message);
......@@ -2385,7 +2385,7 @@ Releases the video recording resource in asynchronous mode. This API uses a call
```js
// asyncallback
videoRecorder.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('release videorecorder success');
} else {
console.info('release videorecorder failed and error is ' + err.message);
......@@ -2439,7 +2439,7 @@ To start another recording, you must call [prepare()](#videorecorder_prepare1) a
```js
// asyncallback
videoRecorder.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('reset videorecorder success');
} else {
console.info('reset videorecorder failed and error is ' + err.message);
......@@ -2486,13 +2486,13 @@ Subscribes to video recording error events. After an error event is reported, yo
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during video recording. |
| type | string | Yes | Event type, which is **'error'** in this case.<br>The **'error'** event is triggered when an error occurs during video recording.|
| callback | ErrorCallback | Yes | Callback invoked when the event is triggered. |
**Example**
```js
videoRecorder.on('error', (error) => { // Set the 'error event' callback.
videoRecorder.on('error', (error) => { // Set the 'error' event callback.
console.info(`audio error called, errName is ${error.name}`); // Print the error name.
console.info(`audio error called, errCode is ${error.code}`); // Print the error code.
console.info(`audio error called, errMessage is ${error.message}`); // Print the detailed description of the error type.
......
......@@ -2280,7 +2280,7 @@ Describes options for fetching media files.
| ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ |
| selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:<br>selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
| selectionArgs | Array&lt;string&gt; | Yes | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.<br>Example:<br>selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " AESC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"|
| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:<br>Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " ASC"<br>Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC" |
| uri<sup>8+</sup> | string | Yes | Yes | No | File URI. |
| networkId<sup>8+</sup> | string | Yes | Yes | No | Network ID of the registered device. |
| extendArgs<sup>8+</sup> | string | Yes | Yes | No | Extended parameters for fetching the files. Currently, no extended parameters are available. |
......
# Mouse Pointer
The mouse pointer module provides APIs related to pointer attribute management.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import pointer from '@ohos.multimodalInput.pointer';
```
## pointer.setPointerVisibele
setPointerVisible(visible: boolean, callback: AsyncCallback&lt;void&gt;): void
Sets the visible status of the mouse pointer. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------------- |
| visible | boolean | Yes | Whether the mouse pointer is visible. The value **true** indicates that the mouse pointer is visible, and the value **false** indicates the opposite.|
| callback | AysncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
```js
pointer.setPointerVisible(true, (err, data) => {
if (err) {
console.log(`set pointer visible failed. err=${JSON.stringify(err)}`);
return;
}
console.log(`set pointer visible success.`);
);
```
## pointer.setPointerVisible
setPointerVisible(visible: boolean): Promise&lt;void&gt;
Sets the visible status of the mouse pointer. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------- | ---- | ------------------------------------------------------------------- |
| visible | boolean | Yes | Whether the mouse pointer is visible. The value **true** indicates that the mouse pointer is visible, and the value **false** indicates the opposite.|
**Return value**
| Parameter | Description |
| ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```js
pointer.setPointerVisible(false).then( data => {
console.log(`set mouse pointer visible success`);
}, data => {
console.log(`set mouse pointer visible failed err=${JSON.stringify(data)}`);
});
```
## pointer.isPointerVisible
isPointerVisible(callback: AsyncCallback&lt;boolean&gt;): void
Checks the visible status of the mouse pointer. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Example**
```js
pointer.isPointerVisible((visible)=>{
console.log("The mouse pointer visible attributes is " + visible);
});
```
## pointer.isPointerVisible
isPointerVisible(): Promise&lt;boolean&gt;
Checks the visible status of the mouse pointer. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**Return value**
| Parameter | Description |
| ---------------------- | ------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
```js
pointer.isPointerVisible().then( data => {
console.log(`isPointerThen success data=${JSON.stringify(data)}`);
});
```
......@@ -1588,6 +1588,128 @@ promise.then(data => {
});
```
## radio.getImsRegInfo<sup>9+</sup>
getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback<ImsRegInfo\>): void
Obtains the IMS registration status of the specified IMS service type. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
| callback | AsyncCallback<[ImsRegInfo](#imsreginfo9)\> | Yes | Callback used to return the result. |
**Example**
```js
radio.getImsRegInfo(0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getImsRegInfo<sup>9+</sup>
getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise<ImsRegInfo\>
Obtains the IMS registration status of the specified IMS service type. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ---------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
**Return value**
| Type | Description |
| ------------------------------------- | ----------------------- |
| Promise\<[ImsRegInfo](#imsreginfo9)\> | Promise used to return the result.|
**Example**
```js
let promise = radio.getImsRegInfo(0, 1);
promise.then(data => {
console.log(`getImsRegInfo success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getImsRegInfo fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.on('imsRegStateChange')<sup>9+</sup>
on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback<ImsRegInfo\>): void
Enables listening for **imsRegStateChange** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | -------------------------------------- |
| type | string | Yes | IMS registration status changes. |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | Yes | Callback used to return the result. |
**Example**
```js
radio.on('imsRegStateChange', 0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.off('imsRegStateChange')<sup>9+</sup>
off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback<ImsRegInfo\>): void
Disables listening for **imsRegStateChange** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | -------------------------------------- |
| type | string | Yes | IMS registration status changes. |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. |
**Example**
```js
radio.off('imsRegStateChange', 0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## RadioTechnology
Enumerates radio access technologies.
......@@ -1755,11 +1877,11 @@ This is a system API.
| Name | Type | Description |
| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| networkType | [NetworkType](#networkType) | Network type of the cell. |
| networkType | [NetworkType](#networktype) | Network type of the cell. |
| isCamped | boolean | Status of the cell. |
| timeStamp | number | Timestamp when cell information is obtained. |
| signalInformation | [SignalInformation](#signalinformation) | Signal information. |
| data | [CdmaCellInformation](#cdmacellinformation) \| [GsmCellInformation](#gsmcellinformation) \| [LteCellInformation](#ltecellinformation) \| [NrCellInformation](#nrcellinformation) \| [TdscdmaCellInformation](#tdscdmacellinformation) | CDMA cell information \| GSM cell information \| LTE cell information \| NR cell information \| TD-SCDMA cell information |
| data | [CdmaCellInformation](#cdmacellinformation8) \| [GsmCellInformation](#gsmcellinformation8) \| [LteCellInformation](#ltecellinformation8) \| [NrCellInformation](#nrcellinformation8) \| [TdscdmaCellInformation](#tdscdmacellinformation8) | CDMA cell information \|GSM cell information \|LTE cell information \|NR cell information \|TD-SCDMA cell information|
## CdmaCellInformation<sup>8+</sup>
......@@ -1883,6 +2005,8 @@ This is a system API.
Defines the network search result.
This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description |
......@@ -1934,3 +2058,59 @@ This is a system API.
| selectMode | [NetworkSelectionMode](#networkselectionmode) | Network selection mode. |
| networkInformation | [NetworkInformation](#networkinformation) | Network information. |
| resumeSelection | boolean | Whether to resume selection. |
## ImsRegState<sup>9+</sup>
Enumerates IMS registration states.
This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description |
| ---------------- | ---- | -------- |
| IMS_UNREGISTERED | 0 | Not registered.|
| IMS_REGISTERED | 1 | Registered.|
## ImsRegTech<sup>9+</sup>
Enumerates IMS registration technologies.
This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description |
| ----------------------- | ---- | --------------- |
| REGISTRATION_TECH_NONE | 0 | None. |
| REGISTRATION_TECH_LTE | 1 | LTE. |
| REGISTRATION_TECH_IWLAN | 2 | I-WLAN.|
| REGISTRATION_TECH_NR | 3 | NR. |
## ImsRegInfo<sup>9+</sup>
Defines the IMS registration information.
This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description |
| ----------- | ---------------------------- | ------------- |
| imsRegState | [ImsRegState](#imsregstate9) | IMS registration state.|
| imsRegTech | [ImsRegTech](#imsregtech9) | IMS registration technology.|
## ImsServiceType<sup>9+</sup>
Enumerates IMS service types.
This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description |
| ---------- | ---- | ---------- |
| TYPE_VOICE | 0 | Voice service.|
| TYPE_VIDEO | 1 | Video service.|
| TYPE_UT | 2 | UT service. |
| TYPE_SMS | 3 | SMS service.|
......@@ -5,7 +5,7 @@ The **Router** module provides APIs to access pages through URLs. You can use th
> **NOTE**
>
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>
> - Page routing APIs can be invoked only after page rendering is complete. Do not call these APIs in **onInit** and **onReady** when the page is still in the rendering phase.
## Modules to Import
......@@ -23,9 +23,9 @@ Navigates to a specified page in the application.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------------------------------- | ---- | ------------------ |
| options | [RouterOptions](#routeroptions) | Yes | Page routing parameters.|
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | --------- |
| options | [RouterOptions](#routeroptions) | Yes | Page routing parameters.|
**Example**
......@@ -49,10 +49,10 @@ Navigates to a specified page in the application.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory| Description |
| ----------------- | ------------------------------- | ---- | -------------------- |
| options | [RouterOptions](#routeroptions) | Yes | Page routing parameters. |
| mode<sup>9+</sup> | [RouterMode](#routermode9) | Yes | Routing mode.|
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------- |
| options | [RouterOptions](#routeroptions) | Yes | Page routing parameters. |
| mode | [RouterMode](#routermode9) | Yes | Routing mode.|
**Example**
......@@ -77,6 +77,7 @@ Replaces the current page with another one in the application and destroys the c
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------------------------------- | ---- | ------------------ |
| options | [RouterOptions](#routeroptions) | Yes | Description of the new page.|
......@@ -101,10 +102,10 @@ Replaces the current page with another one in the application and destroys the c
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory| Description |
| ----------------- | ------------------------------- | ---- | -------------------- |
| options | [RouterOptions](#routeroptions) | Yes | Description of the new page. |
| mode<sup>9+</sup> | [RouterMode](#routermode9) | Yes | Routing mode.|
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | ---------- |
| options | [RouterOptions](#routeroptions) | Yes | Description of the new page. |
| mode | [RouterMode](#routermode9) | Yes | Routing mode.|
**Example**
......@@ -128,7 +129,7 @@ Returns to the previous page or a specified page.
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| options | [RouterOptions](#routeroptions) | No | Description of the page. The **url** parameter indicates the URL of the page to return to. If the specified page does not exist in the page stack, the application does not respond. If this parameter is not set, the application returns to the previous page.|
| options | [RouterOptions](#routeroptions) | No | Description of the page. The **url** parameter indicates the URL of the page to return to. If the specified page does not exist in the page stack, the application does not respond. If no URL is set, the previous page is returned, and the page in the page stack is not reclaimed. It will be reclaimed after being popped up.|
**Example**
......@@ -159,8 +160,8 @@ Obtains the number of pages in the current stack.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| ------ | ---------------------------------- |
| Type | Description |
| ------ | ------------------ |
| string | Number of pages in the stack. The maximum value is **32**.|
**Example**
......@@ -179,8 +180,8 @@ Obtains state information about the current page.
**Return value**
| Type | Description |
| --------------------------- | -------------- |
| Type | Description |
| --------------------------- | ------- |
| [RouterState](#routerstate) | Page routing state.|
**Example**
......@@ -197,11 +198,11 @@ Describes the page routing state.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Description |
| ----- | ------ | ------------------------------------------------------------ |
| Name | Type | Description |
| ----- | ------ | ---------------------------------- |
| index | number | Index of the current page in the stack. The index starts from 1 from the bottom to the top of the stack.|
| name | string | Name of the current page, that is, the file name. |
| path | string | Path of the current page. |
| name | string | Name of the current page, that is, the file name. |
| path | string | Path of the current page. |
## router.enableAlertBeforeBackPage
......@@ -212,9 +213,9 @@ Enables the display of a confirm dialog box before returning to the previous pag
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | ------------------ |
| options | [EnableAlertOptions](#enablealertoptions) | Yes | Description of the dialog box.|
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | --------- |
| options | [EnableAlertOptions](#enablealertoptions) | Yes | Description of the dialog box.|
**Example**
......@@ -229,9 +230,9 @@ Describes the confirm dialog box.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ---------------- |
| message | string | Yes | Content displayed in the confirm dialog box.|
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | -------- |
| message | string | Yes | Content displayed in the confirm dialog box.|
## router.disableAlertBeforeBackPage
......@@ -256,8 +257,8 @@ Obtains the parameters passed from the page that initiates redirection to the cu
**Return value**
| Type | Description |
| ------ | ---------------------------------- |
| Type | Description |
| ------ | ----------------- |
| Object | Parameters passed from the page that initiates redirection to the current page.|
**Example**
......@@ -272,14 +273,13 @@ Describes the page routing options.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
| Name | Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| url | string | Yes | URI of the destination page, in either of the following formats:<br>- Absolute path of the page. The value is available in the pages list in the **config.json** file, for example:<br>- pages/index/index<br>- pages/detail/detail<br>- Particular path. If the URI is a slash (/), the home page is displayed. |
| params | Object | No | Data that needs to be passed to the destination page during redirection. After the destination page is displayed, it can use the passed data, for example, **this.data1** (**data1** is a key in **params**). If there is the same key (for example, **data1**) on the destination page, the passed **data1** value will replace the original value on the destination page.|
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| url | string | Yes | URI of the destination page, in either of the following formats:<br>- Absolute path of the page. The value is available in the pages list in the **config.json** file, for example:<br>- pages/index/index<br>- pages/detail/detail<br>- Particular path. If the URI is a slash (/), the home page is displayed.|
| params | Object | No | Data that needs to be passed to the destination page during redirection. After the destination page is displayed, it can use the passed data, for example, **this.data1** (**data1** is a key in **params**). If there is the same key (for example, **data1**) on the destination page, the passed **data1** value will replace the original value on the destination page.|
> **NOTE**
>
> The page routing stack supports a maximum of 32 pages.
## RouterMode<sup>9+</sup>
......@@ -288,9 +288,9 @@ Enumerates the routing modes.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Description |
| -------- | ------------------------------------------------------------ |
| Standard | Standard mode. |
| Name | Description |
| -------- | ---------------------------------------- |
| Standard | Standard mode. |
| Single | Singleton mode.<br>If the URL of the target page already exists in the page stack, the page closest to the top of the stack is moved as a new page to the top of the stack.<br>If the URL of the target page does not exist in the page stack, the page is redirected to in standard mode.|
## Examples
......
......@@ -1482,7 +1482,7 @@ promise.then(data => {
## sim.**unlockPin**2<sup>8+</sup>
****unlockPin2****(slotId: number,pin2: string ,callback: AsyncCallback<LockStatusResponse\>): void
unlockPin2(slotId: number,pin2: string ,callback: AsyncCallback<LockStatusResponse\>): void
Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
......@@ -1549,7 +1549,7 @@ promise.then(data => {
## sim.**unlockPuk**2<sup>8+</sup>
unlockPuk2(slotId: number,newPin2: string,puk2: string ,callback: AsyncCallback<LockStatusResponse\>): void
unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback<LockStatusResponse\>): void
Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
......@@ -1581,7 +1581,7 @@ sim.unlockPuk2(0, newPin2, puk2, (err, data) => {
## sim.**unlockPuk2**<sup>8+</sup>
unlockPuk2slotId: number,newPin2: string,puk2: string): Promise&lt;LockStatusResponse\>
unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise&lt;LockStatusResponse\>
Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to return the result.
......@@ -2653,7 +2653,7 @@ promise.then(data => {
## sim.getOpKey<sup>9+</sup>
getOpKey(slotId: number, callback: AsyncCallback<number\>): void
getOpKey(slotId: number, callback: AsyncCallback<string\>): void
Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
......@@ -2666,7 +2666,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<number\> | Yes | Callback used to return the result. |
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. |
**Example**
......@@ -2679,7 +2679,7 @@ sim.getOpKey(0, (err, data) => {
## sim.getOpKey<sup>9+</sup>
getOpKey(slotId: number): Promise<number\>
getOpKey(slotId: number): Promise<string\>
Obtains the opkey of the SIM card in the specified slot. This API uses a promise to return the result.
......@@ -2697,7 +2697,7 @@ This is a system API.
| Type | Description |
| ---------------- | ----------------------------------------- |
| Promise<number\> | Promise used to return the result.|
| Promise<string\> | Promise used to return the result.|
**Example**
......
......@@ -678,7 +678,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ----------------------------------------- |
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage8)\>> | Yes | Callback used to return the result. |
| callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage7)\>> | Yes | Callback used to return the result. |
**Example**
......@@ -712,7 +712,7 @@ This is a system API.
| Type | Description |
| ------------------------------------------------------- | ---------------------------------- |
| PromiseArray<[SimShortMessage](#simshortmessage8)\>&gt; | Promise used to return the result.|
| PromiseArray<[SimShortMessage](#simshortmessage7)\>&gt; | Promise used to return the result.|
**Example**
......@@ -742,7 +742,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------ |
| options | [CBConfigOptions](#cbconfigoptions8) | Yes | Cell broadcast configuration options.|
| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -776,7 +776,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | ------------ |
| options | [CBConfigOptions](#cbconfigoptions8) | Yes | Cell broadcast configuration options.|
| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.|
**Return value**
......@@ -818,7 +818,7 @@ This is a system API.
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| message | string | Yes | SMS message. |
| force7bit | boolean | Yes | Whether to use 7-bit coding. |
| callback | AsyncCallback&lt;[SmsSegmentsInfo](#<smssegmentsinfo8)&gt; | Yes | Callback used to return the result. |
| callback | | Yes | Callback used to return the result. |
**Example**
......@@ -852,7 +852,7 @@ This is a system API.
| Type | Description |
| ------------------------------------------------------- | ----------------------------- |
| Promise&lt;[SmsSegmentsInfo](#<smssegmentsinfo8)&gt; | Promise used to return the result.|
| | Promise used to return the result.|
**Example**
......@@ -1331,6 +1331,25 @@ This is a system API.
| date | number | Yes | Date. |
| readStatus | number | Yes | Read status.|
## MmsReadRecInd<sup>8+</sup>
Defines the MMS message reading index.
This is a system API.
**System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description |
| ---------- | ---------------------------------- | ---- | -------- |
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version |
| messageId | string | Yes | Message ID. |
| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination. |
| from | [MmsAddress](#mmsaddress8) | Yes | Source. |
| readStatus | number | Yes | Read state.|
| date | number | No | Date. |
## MmsAttachment<sup>8+</sup>
Defines the attachment of an MMS message.
......@@ -1466,7 +1485,7 @@ This is a system API.
| MMS_YES | 128 | YES |
| MMS_NO | 129 | NO |
## CBConfigOptions<sup>8+</sup>
## CBConfigOptions<sup>7+</sup>
Defines the cell broadcast configuration options.
......@@ -1557,7 +1576,7 @@ This is a system API.
| pdu | string | Yes | Protocol data unit. |
| smsc | string | Yes | Short message service center.|
## SimShortMessage<sup>8+</sup>
## SimShortMessage<sup>7+</sup>
Defines a SIM message.
......
# Page Routing
The **Router** module provides APIs to access pages through URIs.
> **NOTE**
>
> - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.router`](js-apis-router.md) instead.
......@@ -372,12 +374,12 @@ Defines the **EnableAlertBeforeBackPage** parameters.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| -------- | ------------------------ | ---- | ------------------------- |
| message | string | Yes | Content displayed in the confirm dialog box. |
| success | (errMsg: string) => void | No | Called when a dialog box is displayed. **errMsg** indicates the returned information. |
| fail | (errMsg: string) => void | No | Called when the API fails to be called. **errMsg** indicates the returned information.|
| complete | () => void | No | Called when the API call is complete. |
| Name | Type | Mandatory| Description |
| -------- | ------------------------ | ---- | -------------------------------------------------- |
| message | string | Yes | Content displayed in the confirm dialog box. |
| success | (errMsg: string) => void | No | Called when the **OK** button in the confirm dialog box is clicked. **errMsg** indicates the returned information.|
| cancel | (errMsg: string) => void | No | Called when the **Cancel** button in the confirm dialog box is clicked. **errMsg** indicates the returned information.|
| complete | () => void | No | Called when the API call is complete. |
## DisableAlertBeforeBackPageOptions<sup>6+</sup>
......@@ -385,11 +387,11 @@ Define the **DisableAlertBeforeBackPage** parameters.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| -------- | ------------------------ | ---- | ------------------------- |
| success | (errMsg: string) => void | No | Called when a dialog box is displayed. **errMsg** indicates the returned information. |
| fail | (errMsg: string) => void | No | Called when the API fails to be called. **errMsg** indicates the returned information.|
| complete | () => void | No | Called when the API call is complete. |
| Name | Type | Mandatory| Description |
| -------- | ------------------------ | ---- | -------------------------------------------------- |
| success | (errMsg: string) => void | No | Called when the dialog box is closed. **errMsg** indicates the returned information.|
| cancel | (errMsg: string) => void | No | Called when the dialog box fails to be closed. **errMsg** indicates the returned information.|
| complete | () => void | No | Called when the API call is complete. |
## ParamsInterface
......
......@@ -65,7 +65,7 @@ To draw a 2D image without using WebGL, that is, to implement CPU rather than GP
3. Edit the **index.js** file to add the 2D drawing logic code. The following is an example of the file content:
```
//index.js
// index.js
export default { // Native API interaction code
data: {
title: "DEMO BY TEAMOL",
......@@ -136,7 +136,7 @@ To use WebGL to draw a color triangle (GPU drawing), perform the following steps
3. Edit the JavaScript code file to add the logic code for drawing a color triangle. The following is an example of the file content:
```
//index.js
// index.js
// WebGL-related predefinition
var gl = {
......@@ -696,13 +696,6 @@ To use WebGL to draw a color triangle (GPU drawing), perform the following steps
}
```
**Figure 2** Effect of clicking the button to draw a color triangle
![en-us_image_0000001192429306](figures/en-us_image_0000001192429306.gif)
## Samples
The following sample is provided to help you better understand how to develop WebGL:
- [`JsWbgGL`: WebGL (JS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/Graphics/JsWebGL)
......@@ -10,12 +10,11 @@ For details about the APIs, see [Display](../reference/apis/js-apis-display.md).
## How to Develop
Call **getDefaultDisplay(): Promise<Display>** to obtain the default display object. An example code snippet is as follows:
Call `getDefaultDisplay(): Promise<Display>` to obtain the default display object. An example code snippet is as follows:
```js
import display from '@ohos.display' // Import the module.
let disp; // disp is used to save the default display object.
display.getDefaultDisplay().then((disp) => {
console.log('display.getDefaultDisplay success, display :' + JSON.stringify(disp));
}, (err) => {
......
......@@ -77,7 +77,6 @@
- [init Module](subsys-boot-init.md)
- [appspawn Module](subsys-boot-appspawn.md)
- [bootstrap Module](subsys-boot-bootstrap.md)
- [syspara Module](subsys-boot-syspara.md)
- [FAQs](subsys-boot-faqs.md)
- [Reference](subsys-boot-ref.md)
- [Test Case Development](subsys-testguide-test.md)
......
......@@ -20,7 +20,7 @@
};
```
The preceding code implements the **IPlugin** API provided by the server. [Table 1](#table567211582104) shows the mapping between the client APIs and the plug-in APIs.
The preceding code implements the **IPlugin** API provided by the server. The following table shows the mapping between the client APIs and the plug-in APIs.
**Table 1** Mapping between the client APIs and the plug-in APIs
......
......@@ -15,15 +15,19 @@ In the overall planning of the AI engine framework, northbound SDKs are a part o
- SDK code directory: //foundation/ai/engine/services/client/algorithm\_sdk
e.g. //foundation/ai/engine/services/client/algorithm\_sdk/cv
Examples:
//foundation/ai/engine/services/client/algorithm\_sdk/cv
e.g. //foundation/ai/engine/services/client/algorithm\_sdk/nlu
//foundation/ai/engine/services/client/algorithm\_sdk/nlu
- Plug-in code directory: //foundation/ai/engine/services/server/plugin
e.g. //foundation/ai/engine/services/server/plugin/cv
Examples:
e.g. //foundation/ai/engine/services/server/plugin/nlu
//foundation/ai/engine/services/server/plugin/cv
//foundation/ai/engine/services/server/plugin/nlu
## Rule: Store all external APIs provided by plug-ins in the **interfaces/kits** directory of the AI subsystem.<a name="section2551029111312"></a>
......
......@@ -160,6 +160,20 @@ A job is a command set, where you can manage the commands to be executed. A maxi
Small and standard systems
</td>
</tr>
<tr height="162" style="height:121.5pt">
<td height="162" class="xl6621952" width="140" style="height:121.5pt;border-top: none;width:105pt">
write
</td>
<td class="xl6621952" width="215" style="border-top:none;border-left:none; width:161pt">
write filename value<br>Example:<br>write /data/testfile 0
</td>
<td class="xl6621952" width="225" style="border-top:none;border-left:none; width:169pt">
Writes a file. <strong>filename</strong> and <strong>value</strong> respectively indicate the absolute file path and the string to write.
</td>
<td class="xl6621952" width="190" style="border-top:none;border-left:none; width:143pt">
Standard system
</td>
</tr>
<tr height="185" style="height:138.75pt">
<td height="185" class="xl6621952" width="140" style="height:138.75pt;border-top: none;width:105pt">
stop
......@@ -300,6 +314,20 @@ A job is a command set, where you can manage the commands to be executed. A maxi
Small and standard systems
</td>
</tr>
<tr height="162" style="height:121.5pt">
<td height="162" class="xl6621952" width="140" style="height:121.5pt;border-top: none;width:105pt">
syncexec
</td>
<td class="xl6621952" width="215" style="border-top:none;border-left:none; width:161pt">
syncexec <i>Path of the executable file</i> <i>Parameters passed by the executable file</i><br>Example:<br>syncexec /system/bin/udevadm trigger
</td>
<td class="xl6621952" width="225" style="border-top:none;border-left:none; width:169pt">
Runs an executable file synchronously. The **wait** function will be called to wait for the child process to end. The command must not contain more than 10 parameters.
</td>
<td class="xl6621952" width="190" style="border-top:none;border-left:none; width:143pt">
Standard system
</td>
</tr>
<tr height="231" style="height:173.25pt">
<td height="231" class="xl6621952" width="140" style="height:173.25pt;border-top: none;width:105pt">
mknode
......
......@@ -17,7 +17,7 @@ bootchart is available only for the standard system, and begetctl is available f
## How to Develop
### Parameters
**Table 1** Description of begetctl commands
**Table 1** Description of begetctl commands<a name="table14737791480"></a>
| Command| Format and Example| Description|
| :---------- | :---------- |:--------|
| init group test [stage] | init group test | For details about **stage**, see **ServiceStatus**.|
......
......@@ -114,7 +114,7 @@ The service management module is available only for the mini system and standard
By parsing the <strong>*.cfg</strong> file, you can obtain **service** fields, and then set and start the service.
### Parameters
**Table 1** Description of service fields
**Table 1** Description of service fields<a name="table14737791471"></a>
<table border="0" cellpadding="0" cellspacing="0" width="737" style="border-collapse: collapse;table-layout:fixed;width:554pt;border-spacing: 0px;font-variant-ligatures: normal; font-variant-caps: normal;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px; text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial">
<tbody>
<tr height="24" style="height:18.0pt">
......@@ -208,11 +208,11 @@ By parsing the <strong>*.cfg</strong> file, you can obtain **service** fields, a
importance
</td>
<td class="xl6621805" width="196" style="border-top:none;border-left:none; width:147pt">
Current service priority.
Service priority (for the standard system) or service importance (for the mini system).
</td>
<td class="xl6621805" width="242" style="border-top:none;border-left:none; width:182pt">
Standard system: The service priority ranges from -20 to 19. A value beyond the range is invalid.<br>
Small system: The value <strong>0</strong> indicates an unimportant process and a value greater than <strong>0</strong> indicates an important process.
Small system: The value <strong>0</strong> indicates that a system restart is not required, and a value greater than <strong>0</strong> indicates the opposite.
</td>
<td class="xl6621805" width="173" style="border-top:none;border-left:none; width:130pt">
Small and standard systems
......@@ -362,7 +362,7 @@ By parsing the <strong>*.cfg</strong> file, you can obtain **service** fields, a
| option | Socket option. This field is passed when **setsockopt** is called. Currently, the available options include <strong>SOCKET_OPTION_PASSCRED</strong>, <strong>SOCKET_OPTION_RCVBUFFORCE</strong>, <strong>SOCK_CLOEXEC</strong>, and <strong>SOCK_NONBLOCK</strong>.|
### Available APIs
**Table 3** FD proxy APIs
**Table 3** FD proxy APIs<a name="table14737791479"></a>
| API | Function| Description |
| ---------- | ---------- |--------|
| int *ServiceGetFd(const char *serviceName, size_t *outfdCount) | Obtains the proxy FD from the init process.| Return value: Returns the pointer to the fd array if the operation is successful; returns **NULL** otherwise. (Note: Manual release is required.)<br>Arguments:<br> **serviceName**: service name.<br>**outfdCount**: length of the returned fd array.|
......
......@@ -4,7 +4,6 @@
- **[init Module](subsys-boot-init.md)**
- **[appspawn Module](subsys-boot-appspawn.md)**
- **[bootstrap Module](subsys-boot-bootstrap.md)**
- **[syspara Module](subsys-boot-syspara.md)**
- **[FAQs](subsys-boot-faqs.md)**
- **[Reference](subsys-boot-ref.md)**
......
......@@ -23,13 +23,14 @@ Use HiSysEvent logging to flush logged event data to disks.
HiSysEvent logging is implemented using the API provided by the **HiSysEvent** class. For details, see the API Reference.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
>
> In OpenHarmony-3.2-Beta3, HiSysEvent logging is open for restricted use to avoid event storms. The **HiSysEvent::Write** API in Table 1 is replaced by the **HiSysEventWrite** API in Table 2. The **HiSysEvent::Write** API has been deprecated. Use the **HiSysEventWrite** API instead for HiSysEvent logging.
**Table 1** C++ event logging API (deprecated)
| API | Description |
| ------------------------------------------------------------ | ---------------------- |
| template&lt;typename...&nbsp;Types&gt;&nbsp;<br>static&nbsp;int&nbsp;Write(const&nbsp;std::string&nbsp;&amp;domain,&nbsp;const&nbsp;std::string&nbsp;&amp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Types...&nbsp;keyValues) | Flushes logged event data to disks.|
| template&lt;typename... Types&gt; <br>static int Write(const std::string &amp;domain, const std::string &amp;eventName, EventType type, Types... keyValues) | Flushes logged event data to disks.|
**Table 2** C++ event logging API (in use)
| API | Description |
......@@ -49,7 +50,7 @@ HiSysEvent logging is implemented using the API provided by the **HiSysEvent** c
The following table describes the kernel event logging APIs.
**Table 4** Description of kernel event logging APIs
**Table 4** Kernel event logging APIs
| API | Description |
| ------------------------------------------------------------ | ------------------------------------ |
......
......@@ -15,7 +15,7 @@ If OpenHarmony devices and applications need to be used globally, they must meet
## Architecture<a name="section1558604311012"></a>
**Figure 1** Architecture of the globalization subsystem<a name="fig1687592425010"></a>
**Figure 1** Architecture of the globalization subsystem<a name="fig1687592425010"></a>
![](figures/architecture-of-the-globalization-subsystem.png "architecture-of-the-globalization-subsystem")
......
......@@ -8,7 +8,7 @@ With the location awareness capability offered by OpenHarmony, mobile devices wi
Your application can call location-specific APIs to obtain the location information of a mobile device for offering location-based services such as drive navigation and motion track recording.
Basic Concepts
**Basic Concepts**
Location awareness helps determine where a mobile device locates. The system identifies the location of a mobile device with its coordinates, and uses location technologies such as Global Navigation Satellite System (GNSS) and network positioning (for example, base station positioning or WLAN/Bluetooth positioning) to provide diverse location-based services. These advanced location technologies make it possible to obtain the accurate location of the mobile device, regardless of whether it is indoors or outdoors.
......@@ -28,6 +28,10 @@ Location awareness helps determine where a mobile device locates. The system ide
WLAN or Bluetooth positioning estimates the current location of a mobile device based on the locations of WLANs and Bluetooth devices that can be discovered by the device. The location accuracy of this technology depends on the distribution of fixed WLAN access points (APs) and Bluetooth devices around the device. A high density of WLAN APs and Bluetooth devices can produce a more accurate location result than base station positioning. This technology also requires access to the network.
**Figure 1** ** Location subsystem architecture**<a name="fig4460722185514"></a>
![](figures/location_En-1.png)
![](figures/location_En-1.png)
## Directory Structure<a name="section161941989596"></a>
......@@ -102,7 +106,8 @@ The following table describes APIs available for obtaining device location infor
**Obtaining the device location information:**
1. Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user.
The system provides the following location permissions:
The system provides the following location permissions:
- ohos.permission.LOCATION
- ohos.permission.LOCATION_IN_BACKGROUND
......@@ -131,7 +136,7 @@ The following table describes APIs available for obtaining device location infor
}
```
For details about the configuration fields, see the description of the **module.json** file.
For details about the configuration fields, see [Application Package Structure Configuration File](../application-dev/quick-start/stage-structure.md).
2. Import the **geolocation** module by which you can implement all APIs related to the basic location capabilities.
......@@ -204,7 +209,8 @@ The following table describes APIs available for obtaining device location infor
```
4. Instantiate the **Callback** object for the system to report location results.
Your application needs to implement the callback defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
Your application needs to implement the callback defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
```
var locationChange = (location) => {
......@@ -239,6 +245,7 @@ The following table describes APIs available for obtaining device location infor
**Converting the coordinates and geocoding information:**
> **NOTE**
>
> The **GeoConvert** instance needs to access backend services to obtain information. Therefore, before performing the following steps, ensure that your device is connected to the network.
1. Import the **geolocation** module by which you can implement all APIs related to the geocoding and reverse geocoding conversion capabilities.
......@@ -248,6 +255,7 @@ The following table describes APIs available for obtaining device location infor
```
2. Obtain the conversion result.
- Call **getAddressesFromLocation** to convert coordinates into geographical location information.
```
......@@ -258,6 +266,7 @@ The following table describes APIs available for obtaining device location infor
```
Your application can obtain the **GeoAddress** list that matches the specified coordinates and then read location information from it. For details, see the *API Reference*.
- Call **getAddressesFromLocationName** to convert geographic description into coordinates.
```
......
......@@ -117,7 +117,7 @@
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err,data) {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) {
console.log("put err: " + JSON.stringify(err));
return;
......@@ -139,13 +139,13 @@
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err,data) {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) {
console.log("put err: " + JSON.stringify(err));
return;
}
console.log("put success");
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err,data) {
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) {
console.log("get success data: " + data);
});
});
......
......@@ -42,4 +42,4 @@
针对位置服务,有以下相关实例可供参考:
-[`Location`:位置服务(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/device/Location)
-[`Location`:位置服务(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/device/Location)
......@@ -320,6 +320,6 @@
针对Intl开发,有以下相关实例可供参考:
-[`International`:国际化(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/International)
-[`International`:国际化(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/International)
-[`International`:国际化(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/common/International)
\ No newline at end of file
-[`International`:国际化(eTS)(API8)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International)
\ No newline at end of file
......@@ -15,6 +15,6 @@
下面将详细介绍这些布局能力。
## 相关实例
针对一次开发,多端部署,有以下相关实例可供参考:
- [`AdaptiveCapabilities`:多设备自适应能力(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities)
- [`JsAdaptiveCapabilities`:多设备自适应能力(JS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities)
- [`AdaptiveCapabilities`:多设备自适应能力(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities)
- [`JsAdaptiveCapabilities`:多设备自适应能力(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities)
- [一次开发多端部署(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/MultiDeploymentEts)
......@@ -22,24 +22,24 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
```js
var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var audioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 1
}
var audioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 1
}
var audioCapturerOptions = {
streamInfo: audioStreamInfo,
capturerInfo: audioCapturerInfo
}
var audioCapturerOptions = {
streamInfo: audioStreamInfo,
capturerInfo: audioCapturerInfo
}
let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
var state = audioRenderer.state;
let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
var state = audioRenderer.state;
```
2. (可选)使用on('stateChange')订阅音频采集器状态更改。
......@@ -49,26 +49,26 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
audioCapturer.on('stateChange',(state) => {
console.info('AudioCapturerLog: Changed State to : ' + state)
switch (state) {
case audio.AudioState.STATE_PREPARED:
console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------');
console.info('Audio State is : Prepared');
break;
case audio.AudioState.STATE_RUNNING:
console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------');
console.info('Audio State is : Running');
break;
case audio.AudioState.STATE_STOPPED:
console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------');
console.info('Audio State is : stopped');
break;
case audio.AudioState.STATE_RELEASED:
console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------');
console.info('Audio State is : released');
break;
default:
console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------');
console.info('Audio State is : invalid');
break;
case audio.AudioState.STATE_PREPARED:
console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------');
console.info('Audio State is : Prepared');
break;
case audio.AudioState.STATE_RUNNING:
console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------');
console.info('Audio State is : Running');
break;
case audio.AudioState.STATE_STOPPED:
console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------');
console.info('Audio State is : stopped');
break;
case audio.AudioState.STATE_RELEASED:
console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------');
console.info('Audio State is : released');
break;
default:
console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------');
console.info('Audio State is : invalid');
break;
}
});
```
......@@ -80,9 +80,9 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
```js
await audioCapturer.start();
if (audioCapturer.state == audio.AudioState.STATE_RUNNING) {
console.info('AudioRecLog: Capturer started');
console.info('AudioRecLog: Capturer started');
} else {
console.info('AudioRecLog: Capturer start failed');
console.info('AudioRecLog: Capturer start failed');
}
```
......@@ -103,29 +103,29 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
const path = '/data/data/.pulse_dir/capture_js.wav';
let fd = fileio.openSync(path, 0o102, 0o777);
if (fd !== null) {
console.info('AudioRecLog: file fd created');
console.info('AudioRecLog: file fd created');
}
else{
console.info('AudioRecLog: file fd create : FAILED');
return;
console.info('AudioRecLog: file fd create : FAILED');
return;
}
fd = fileio.openSync(path, 0o2002, 0o666);
if (fd !== null) {
console.info('AudioRecLog: file fd opened in append mode');
console.info('AudioRecLog: file fd opened in append mode');
}
var numBuffersToCapture = 150;
while (numBuffersToCapture) {
var buffer = await audioCapturer.read(bufferSize, true);
if (typeof(buffer) == undefined) {
console.info('read buffer failed');
} else {
var number = fileio.writeSync(fd, buffer);
console.info('AudioRecLog: data written: ' + number);
}
var buffer = await audioCapturer.read(bufferSize, true);
if (typeof(buffer) == undefined) {
console.info('read buffer failed');
} else {
var number = fileio.writeSync(fd, buffer);
console.info('AudioRecLog: data written: ' + number);
}
numBuffersToCapture--;
numBuffersToCapture--;
}
```
......@@ -134,9 +134,9 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
```
await audioCapturer.stop();
if (audioCapturer.state == audio.AudioState.STATE_STOPPED) {
console.info('AudioRecLog: Capturer stopped');
console.info('AudioRecLog: Capturer stopped');
} else {
console.info('AudioRecLog: Capturer stop failed');
console.info('AudioRecLog: Capturer stop failed');
}
```
......@@ -145,8 +145,8 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
```js
await audioCapturer.release();
if (audioCapturer.state == audio.AudioState.STATE_RELEASED) {
console.info('AudioRecLog: Capturer released');
console.info('AudioRecLog: Capturer released');
} else {
console.info('AudioRecLog: Capturer release failed');
console.info('AudioRecLog: Capturer release failed');
}
```
\ No newline at end of file
......@@ -115,6 +115,7 @@ pixelmap.release(()=>{
done();
})
let path = '/data/local/tmp/test.jpg';
// 用于创建imagesource(uri)
const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.jpg'
......@@ -145,7 +146,7 @@ imagePackerApi.release();
### 解码场景
```js
/data/local/tmp/test.jpg // 设置创建imagesource的路径
let path = '/data/local/tmp/test.jpg'; // 设置创建imagesource的路径
// 用路径创建imagesource
const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.jpg'
......@@ -222,7 +223,7 @@ catch(error => {
### 编码场景
```js
/data/local/tmp/test.png // 设置创建imagesource的路径
let path = '/data/local/tmp/test.png' // 设置创建imagesource的路径
// 用于设置imagesource
const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.png'
......
......@@ -284,6 +284,6 @@ let alarm : reminderAgent.ReminderRequestAlarm = {
- [`AlarmClock`:后台代理提醒(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/Notification/AlarmClock)
- [`FlipClock`:翻页时钟(eTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/CompleteApps/FlipClock)
- [`FlipClock`:翻页时钟(eTS)(API8)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/CompleteApps/FlipClock)
- [闹钟应用(eTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock)
\ No newline at end of file
......@@ -182,6 +182,8 @@
- [@ohos.nfc.cardEmulation (标准NFC-cardEmulation)](js-apis-cardEmulation.md)
- [@ohos.nfc.controller (标准NFC)](js-apis-nfcController.md)
- [@ohos.nfc.tag (标准NFC-Tag)](js-apis-nfcTag.md)
- [@ohos.nfc.tag (标准NFC-Tag Nfc 技术)](js-apis-nfctech.md)
- [@ohos.nfc.tag (标准NFC-Tag TagSession)](js-apis-tagSession.md)
- [@ohos.rpc (RPC通信)](js-apis-rpc.md)
- [@ohos.wifi (WLAN)](js-apis-wifi.md)
- [@ohos.wifiext (WLAN)](js-apis-wifiext.md)
......
......@@ -195,6 +195,44 @@ context.requestPermissionsFromUser(
```
## Context.requestPermissionsFromUser<sup>7+</sup>
requestPermissionsFromUser(permissions: Array\<string>, requestCode: number): Promise\<[PermissionRequestResult](#permissionrequestresult7)>
从系统请求某些权限(promise形式)。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| -------------- | ------------------- | ----- | -------------------------------------------- |
| permissions | Array\<string> | 是 | 指示要请求的权限列表。此参数不能为null。 |
| requestCode | number | 是 | 指示要传递给PermissionRequestResult的请求代码。 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------------- | ---------------- |
| Promise\<[PermissionRequestResult](#permissionrequestresult7)> | 返回授权结果信息。 |
**示例:**
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.requestPermissionsFromUser(
["com.example.permission1",
"com.example.permission2",
"com.example.permission3",
"com.example.permission4",
"com.example.permission5"],
1).then((data)=>{
console.info("====>requestdata====>" + JSON.stringify(data));
});
```
## Context.getApplicationInfo<sup>7+</sup>
......
......@@ -9,10 +9,18 @@ AccessibilityExtensionContext模块提供扩展的上下文的能力,包括允
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
## 导入模块
## 使用说明
在使用AccessibilityExtensionContext的功能前,需要通过AccessibilityExtensionAbility子类实例获取。
```js
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'
class MainAbility extends AccessibilityExtensionAbility {
onConnect(): void {
console.log("AxExtensionAbility onConnect");
let axContext = this.context;
}
}
```
## FocusDirection
......@@ -203,9 +211,9 @@ this.context.getWindows().then(windows => {
})
```
## AccessibilityExtensionContext.gestureInject
## AccessibilityExtensionContext.injectGesture
gestureInject(gesturePath: GesturePath, listener: Callback\<boolean>): Promise\<boolean
injectGesture(gesturePath: GesturePath, listener: Callback\<boolean>): Promise\<boolean
注入手势。
......
......@@ -268,6 +268,8 @@ constructor(jsonObject)
构造函数。
**系统能力**:SystemCapability.BarrierFree.Accessibility.Core
- **参数:**
| 参数名 | 参数类型 | 必填 | 说明 |
......
......@@ -797,7 +797,7 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
});
```
### getAssociatedDataSync
### getAssociatedDataSync<sup>9+</sup>
getAssociatedDataSync(name: string, key: string): string;
......
......@@ -18,7 +18,7 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
辅助事件信息。
**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
### 属性
......@@ -32,7 +32,7 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
表示手势路径信息。
**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
### 属性
......@@ -41,29 +41,11 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
| points | Array&lt;[GesturePoint](gesturepoint)&gt; | 是 | 是 | 手势。 |
| durationTime | number | 是 | 是 | 手势总耗时。 |
### constructor
constructor(durationTime: number)
构造函数。
- **参数:**
| 参数名 | 参数类型 | 必填 | 说明 |
| ------------ | ------ | ---- | ------ |
| durationTime | number | 是 | 手势总耗时。 |
- **示例:**
```typescript
let gesturePath = new GesturePath(100);
```
## GesturePoint
表示手势触摸点。
**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
### 属性
......@@ -72,30 +54,11 @@ constructor(durationTime: number)
| positionX | number | 是 | 是 | 触摸点X坐标。 |
| positionY | number | 是 | 是 | 触摸点Y坐标。 |
### constructor
constructor(positionX: number, positionY: number)
构造函数。
- **参数:**
| 参数名 | 参数类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------- |
| positionX | number | 是 | 触摸点X坐标。 |
| positionY | number | 是 | 触摸点Y坐标。 |
- **示例:**
```typescript
let gesturePoint = new GesturePoint(100, 200);
```
## GestureType
手势事件类型。
**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 描述 |
| ------------- | ------------ |
......@@ -120,7 +83,7 @@ constructor(positionX: number, positionY: number)
页面刷新类型。
**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 描述 |
| ----------------- | --------- |
......@@ -131,7 +94,7 @@ constructor(positionX: number, positionY: number)
触摸浏览事件类型。
**系统能力**:以下各项对应的系统能力均为 SystemCapability.Barrierfree.Accessibility.Core
**系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core
| 名称 | 描述 |
| ---------- | ------------ |
......@@ -205,7 +168,7 @@ onAccessibilityEvent(event: AccessibilityEvent): void {
## AccessibilityExtensionAbility.onKeyEvent
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean;
onKeyEvent(keyEvent: KeyEvent): boolean;
在物理按键按下时回调此方法,可以在该方法中根据业务判断是否对事件进行拦截。
......@@ -215,7 +178,7 @@ onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean;
| 参数名 | 参数类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------------- |
| keyEvent | [KeyEvent](js-apis-inputeventclient.md#KeyEvent) | 是 | 按键事件回调函数。返回true表示拦截此按键。 |
| keyEvent | [KeyEvent](js-apis-keyevent.md#KeyEvent) | 是 | 按键事件回调函数。返回true表示拦截此按键。 |
**示例:**
......
......@@ -762,6 +762,56 @@ getVolumeGroupInfos();
管理音频音量和音频设备。在调用AudioManager的接口前,需要先通过[getAudioManager](#audiogetaudiomanager)创建实例。
### getRoutingManager<sup>9+</sup>
getRoutingManager(callback: AsyncCallback&lt;AudioRoutingManager&gt;): void
获取AudioRoutingManager对象,使用callback方式异步返回结果。
**系统能力:** SystemCapability.Multimedia.Audio.Device
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------------------------------------- | ---- | --------------------------------- |
| callback | AsyncCallback&lt;[AudioRoutingManager](#audioroutingmanager9)&gt; | 是 | 回调,返回AudioRoutingManager对象。 |
**示例:**
```js
await audioManager.getRoutingManager((err,callback) => {
if (err) {
console.error(`Result ERROR: ${err.message}`);
}
console.info('getRoutingManager Callback SUCCESS.');
var audioRoutingManager;
audioRoutingManager = callback;
});
```
### getRoutingManager<sup>9+</sup>
getRoutingManager(): Promise&lt;AudioRoutingManager&gt;
获取AudioRoutingManager对象,使用Promise方式异步返回结果。
**系统能力:** SystemCapability.Multimedia.Audio.Device
**返回值:**
| 类型 | 说明 |
| ----------------------------------------------------------- | --------------------------------------- |
| Promise&lt;[AudioRoutingManager](#audioroutingmanager9)&gt; | Promise回调返回AudioRoutingManager对象。 |
**示例:**
```js
await audioManager.getRoutingManager().then((value) => {
var routingManager = value;
console.info('getRoutingManager Promise SUCCESS.');
}).catch((err) => {
console.error(`Result ERROR: ${err.message}`);
});
```
### setVolume
setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&lt;void&gt;): void
......@@ -2805,6 +2855,172 @@ let result = audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamIn
console.info(`isAudioRendererLowLatencySupported success var ${result}`);
```
## AudioRoutingManager<sup>9+</sup>
音频路由管理。在使用AudioRoutingManager的接口前,需要使用[getRoutingManager](#getroutingmanager9)获取AudioRoutingManager实例。
### selectOutputDevice<sup>9+</sup>
selectOutputDevice(audiodevicedescriptors: AudioDeviceDescriptors, callback: AsyncCallback&lt;void&gt;): void
选择音频输出设备,当前只能选择一个输出设备,使用callback方式异步返回结果。该接口为系统应用接口。
**系统能力:** SystemCapability.Multimedia.Audio.Device
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------------------- | ------------------------------------------------------------ | ---- | ------------------------- |
| audiodevicedescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 输出设备类。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调,返回获取输出设备结果。 |
**示例:**
```js
let outputAudioDeviceDescriptor = [{
"deviceRole":audio.DeviceRole.OUTPUT_DEVICE,
"networkId":audio.LOCAL_NETWORK_ID,
"interruptGroupId":1,
"volumeGroupId":1 }];
var audioRoutingManager;
await audioManager.getRoutingManager().then((value) => {
audioRoutingManager = value;
audioRoutingManager.selectOutputDevice(outputAudioDeviceDescriptor, (err) => {
if (err) {
console.error(`Result ERROR: ${err.message}`);
} else {
console.info('Select output devices result callback: SUCCESS'); }
});
});
```
### selectOutputDevice<sup>9+</sup>
selectOutputDevice(audiodevicedescriptors: AudioDeviceDescriptors): Promise&lt;void&gt;
选择音频输出设备,当前只能选择一个输出设备,使用Promise方式异步返回结果。该接口为系统应用接口。
**系统能力:** SystemCapability.Multimedia.Audio.Device
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------------------- | ------------------------------------------------------------ | ---- | ------------------------- |
| audiodevicedescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 输出设备类。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise返回选择输出设备结果。 |
**示例:**
```js
let outputAudioDeviceDescriptor =[{
"deviceRole":audio.DeviceRole.OUTPUT_DEVICE,
"networkId":audio.LOCAL_NETWORK_ID,
"interruptGroupId":1,
"volumeGroupId":1 }];
var audioRoutingManager;
await audioManager.getRoutingManager().then((value) => {
audioRoutingManager = value;
audioRoutingManager.selectOutputDevice(outputAudioDeviceDescriptor).then(() => {
console.info('Select output devices result promise: SUCCESS');
}).catch((err) => {
console.error(`Result ERROR: ${err.message}`);
});
});
```
### selectOutputDeviceByFilter<sup>9+</sup>
selectOutputDeviceByFilter(audiorendererfilter: AudioRendererFilter, audiodevicedescriptors: AudioDeviceDescriptors, callback: AsyncCallback&lt;void&gt;): void
根据过滤条件,选择音频输出设备,当前只能选择一个输出设备,使用callback方式异步返回结果。该接口为系统应用接口。
**系统能力:** SystemCapability.Multimedia.Audio.Device
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------------------- | ------------------------------------------------------------ | ---- | ------------------------- |
| audiorendererfilter | [AudioRendererFilter](#audiorendererfilter9) | 是 | 过滤条件类。 |
| audiodevicedescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 输出设备类。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调,返回获取输出设备结果。 |
**示例:**
```js
let outputAudioRendererFilter = {
"uid":20010041,
"rendererInfo": {
"contentType":audio.ContentType.CONTENT_TYPE_MUSIC,
"streamUsage":audio.StreamUsage.STREAM_USAGE_MEDIA,
"rendererFlags":0 },
"rendererId":0 };
let outputAudioDeviceDescriptor = [{
"deviceRole":audio.DeviceRole.OUTPUT_DEVICE,
"networkId":audio.LOCAL_NETWORK_ID,
"interruptGroupId":1,
"volumeGroupId":1 }];
var audioRoutingManager;
await audioManager.getRoutingManager().then((value) => {
audioRoutingManager = value;
audioRoutingManager.selectOutputDeviceByFilter(outputAudioRendererFilter, outputAudioDeviceDescriptor, (err) => {
if (err) {
console.error(`Result ERROR: ${err.message}`);
} else {
console.info('Select output devices by filter result callback: SUCCESS'); }
});
});
```
### selectOutputDeviceByFilter<sup>9+</sup>
selectOutputDeviceByFilter(audiorendererfilter: AudioRendererFilter, audiodevicedescriptors: AudioDeviceDescriptors): Promise&lt;void&gt;
根据过滤条件,选择音频输出设备,当前只能选择一个输出设备,使用Promise方式异步返回结果。该接口为系统应用接口。
**系统能力:** SystemCapability.Multimedia.Audio.Device
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------------------------- | ------------------------------------------------------------ | ---- | ------------------------- |
| audiorendererfilter | [AudioRendererFilter](#audiorendererfilter9) | 是 | 过滤条件类。 |
| audiodevicedescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 输出设备类。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise返回选择输出设备结果。 |
**示例:**
```js
let outputAudioRendererFilter = {
"uid":20010041,
"rendererInfo": {
"contentType":audio.ContentType.CONTENT_TYPE_MUSIC,
"streamUsage":audio.StreamUsage.STREAM_USAGE_MEDIA,
"rendererFlags":0 },
"rendererId":0 };
let outputAudioDeviceDescriptor = [{
"deviceRole":audio.DeviceRole.OUTPUT_DEVICE,
"networkId":audio.LOCAL_NETWORK_ID,
"interruptGroupId":1,
"volumeGroupId":1 }];
var audioRoutingManager;
await audioManager.getRoutingManager().then((value) => {
audioRoutingManager = value;
audioRoutingManager.selectOutputDeviceByFilter(outputAudioRendererFilter, outputAudioDeviceDescriptor).then(() => {
console.info('Select output devices by filter result promise: SUCCESS');
}).catch((err) => {
console.error(`Result ERROR: ${err.message}`);
})
});
```
## AudioRendererChangeInfo<sup>9+</sup>
描述音频渲染器更改信息。
......@@ -2936,16 +3152,19 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) =>
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Audio.Device
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------------------- | -------------------------- | ---- | ---- | ---------- |
| deviceRole | [DeviceRole](#devicerole) | 是 | 否 | 设备角色。 |
| deviceType | [DeviceType](#devicetype) | 是 | 否 | 设备类型。 |
| id<sup>9+</sup> | number | 是 | 否 | 设备id。 |
| name<sup>9+</sup> | string | 是 | 否 | 设备名称。 |
| address<sup>9+</sup> | string | 是 | 否 | 设备地址。 |
| sampleRates<sup>9+</sup> | Array&lt;number&gt; | 是 | 否 | 支持的采样率。 |
| channelCounts<sup>9+</sup> | Array&lt;number&gt; | 是 | 否 | 支持的通道数。 |
| channelMasks<sup>9+</sup> | Array&lt;number&gt; | 是 | 否 | 支持的通道掩码。 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------------------------- | -------------------------- | ---- | ---- | ---------- |
| deviceRole | [DeviceRole](#devicerole) | 是 | 否 | 设备角色。 |
| deviceType | [DeviceType](#devicetype) | 是 | 否 | 设备类型。 |
| id<sup>9+</sup> | number | 是 | 否 | 设备id。 |
| name<sup>9+</sup> | string | 是 | 否 | 设备名称。 |
| address<sup>9+</sup> | string | 是 | 否 | 设备地址。 |
| sampleRates<sup>9+</sup> | Array&lt;number&gt; | 是 | 否 | 支持的采样率。 |
| channelCounts<sup>9+</sup> | Array&lt;number&gt; | 是 | 否 | 支持的通道数。 |
| channelMasks<sup>9+</sup> | Array&lt;number&gt; | 是 | 否 | 支持的通道掩码。 |
| networkId<sup>9+</sup> | string | 是 | 否 | 设备组网的ID。 |
| interruptGroupId<sup>9+</sup> | number | 是 | 否 | 设备所处的焦点组ID。 |
| volumeGroupId<sup>9+</sup> | number | 是 | 否 | 设备所处的音量组ID。 |
## AudioDeviceDescriptors
......@@ -2975,6 +3194,30 @@ promise.then(function (value) {
});
```
## AudioRendererFilter<sup>9+</sup>
过滤条件类。在调用selectOutputDeviceByFilter接口前,需要先创建AudioRendererFilter实例。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Audio.Device
| 名称 | 类型 | 必填 | 说明 |
| -------------| ---------------------------------------- | ---- | -------------- |
| uid | number | 是 | 表示应用ID。 |
| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 否 | 表示渲染器信息。 |
| rendererId | number | 否 | 音频流唯一id。 |
**示例:**
```js
let outputAudioRendererFilter = {
"uid":20010041,
"rendererInfo": {
"contentType":audio.ContentType.CONTENT_TYPE_MUSIC,
"streamUsage":audio.StreamUsage.STREAM_USAGE_MEDIA,
"rendererFlags":0 },
"rendererId":0 };
```
## AudioRenderer<sup>8+</sup>
提供音频渲染的相关接口。在调用AudioRenderer的接口前,需要先通过[createAudioRenderer](#audiocreateaudiorenderer8)创建实例。
......
......@@ -11,10 +11,6 @@
## 系统能力
SystemCapability.BundleManager.BundleFramework
## BundleInstaller.install
install(bundleFilePaths: Array&lt;string&gt;, param: InstallParam, callback: AsyncCallback&lt;InstallStatus&gt;): void;
......@@ -29,6 +25,8 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
**参数:**
| 名称 | 类型 | 必填 | 描述 |
......@@ -51,6 +49,8 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
**参数:**
| 名称 | 类型 | 必填 | 描述 |
......@@ -59,7 +59,7 @@ SystemCapability.BundleManager.BundleFramework
| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 |
| callback | AsyncCallback&lt;[InstallStatus](#installstatus)&gt; | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 |
## BundleInstaller.recover
## BundleInstaller.recover<sup>8+</sup>
recover(bundleName: string, param: InstallParam, callback: AsyncCallback&lt;InstallStatus&gt;): void;
......@@ -73,6 +73,8 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
**参数:**
| 名称 | 类型 | 必填 | 描述 |
......@@ -81,17 +83,34 @@ SystemCapability.BundleManager.BundleFramework
| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 |
| callback | AsyncCallback&lt;[InstallStatus](#installstatus)&gt; | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 |
## HashParam<sup>9+</sup>
应用程序安装卸载信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 说明 |
| ---------- | ------ | ---------------- |
| moduleName | string | 应用程序模块名称 |
| hashValue | string | 哈希值 |
## InstallParam
应用程序安装卸载信息
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
| 名称 | 类型 | 说明 |
| ----------- | ------- | ------------------ |
| userId | number | 指示用户id |
| installFlag | number | 指示安装标志 |
| isKeepData | boolean | 指示参数是否有数据 |
**系统API:** 此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 说明 |
| ------------------------------ | ------------------------------ | ------------------ |
| userId | number | 指示用户id |
| installFlag | number | 指示安装标志 |
| isKeepData | boolean | 指示参数是否有数据 |
| hashParams<sup>9+</sup> | Array<[HashParam](#hashparam)> | 哈希值参数 |
| crowdtestDeadline<sup>9+</sup> | number | 测试包的被杀死时间 |
## InstallStatus
......@@ -99,7 +118,9 @@ SystemCapability.BundleManager.BundleFramework
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ |
| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | 是 | 否 | 表示安装或卸载错误状态码 |
| statusMessage | string | 是 | 否 | 表示安装或卸载的字符串结果信息 |
\ No newline at end of file
| statusMessage | string | 是 | 否 | 表示安装或卸载的字符串结果信息 |
......@@ -13,6 +13,8 @@
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ------ | ---- | ---- | -------------- |
| permissionName | string | 是 | 否 | 用户权限名称 |
......
......@@ -18,6 +18,8 @@
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------------- | ------ | ---- | ---- | -------------------- |
| targetBundle | string | 是 | 否 | 快捷方式的目标捆绑包 |
......
......@@ -11,7 +11,9 @@
## RemoteAbilityInfo
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.DistributedBundleFramework
**系统API:** 此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | -------------------------------------------- | ---- | ---- | ----------------------- |
......
......@@ -11,7 +11,8 @@ import deviceInfo from '@ohos.deviceInfo'
## 属性
**系统能力**:以下各项对应的系统能力均为SystemCapability.Startup.SysInfo。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Startup.SystemInfo。
**权限**:以下各项所需要的权限有所不同,详见下表。
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
......
......@@ -2281,6 +2281,8 @@ constructor()
创建Pin码认证的实例。
此接口为系统接口,三方应用不支持调用。
**系统能力**:SystemCapability.Account.OsAccount
**示例:**
......
......@@ -299,6 +299,48 @@ on(type: 'headerReceive', callback: (header: object) =&gt; void): void
```
### on('complete' | 'fail')<sup>9+</sup>
on(type:'complete' | 'fail', callback: Callback&lt;Array&lt;TaskState&gt;&gt;): void;
开启上传任务监听,异步方法,使用callback形式返回结果。
**需要权限**:ohos.permission.INTERNET
**系统能力**: SystemCapability.MiscServices.Upload
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 订阅的事件类型,取值为'complete',表示上传任务完成;取值为'fail',表示上传任务失败。|
| callback | function | 是 | 上传任务完成或失败的回调函数。 |
回调函数的参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| taskstates | Array&lt;[TaskState](#taskstate9)&gt; | 是 | 上传任务返回结果 |
**示例:**
```js
uploadTask.on('complete', function callback(taskStates) {
for (let i = 0; i < taskStates.length; i++ ) {
console.info("upOnComplete taskState:" + JSON.stringify(taskStates[i]));
}
}
);
uploadTask.on('fail', function callback(taskStates) {
for (let i = 0; i < taskStates.length; i++ ) {
console.info("upOnFail taskState:" + JSON.stringify(taskStates[i]));
}
}
);
```
### off('progress')
off(type: 'progress', callback?: (uploadedSize: number, totalSize: number) =&gt; void): void
......@@ -365,6 +407,47 @@ off(type: 'headerReceive', callback?: (header: object) =&gt; void): void
);
```
### off('complete' | 'fail')<sup>9+</sup>
off(type:'complete' | 'fail', callback?: Callback&lt;Array&lt;TaskState&gt;&gt;): void;
关闭上传任务监听,异步方法,使用callback形式返回结果。
**需要权限**:ohos.permission.INTERNET
**系统能力**: SystemCapability.MiscServices.Upload
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 订阅的事件类型,取值为'complete',表示上传任务完成;取值为'fail',表示上传任务失败。|
| callback | function | 否 | 上传任务完成或失败的回调函数。 |
回调函数的参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| taskstates | Array&lt;[TaskState](#taskstate9)&gt; | 是 | 上传任务返回结果 |
**示例:**
```js
uploadTask.off('complete', function callback(taskStates) {
for (let i = 0; i < taskStates.length; i++ ) {
console.info("upOnComplete taskState:" + JSON.stringify(taskStates[i]));
}
}
);
uploadTask.off('fail', function callback(taskStates) {
for (let i = 0; i < taskStates.length; i++ ) {
console.info("upOnFail taskState:" + JSON.stringify(taskStates[i]));
}
}
);
```
### remove
......@@ -444,6 +527,17 @@ remove(callback: AsyncCallback&lt;boolean&gt;): void
| files | Array&lt;[File](#file)&gt; | 是 | 要上传的文件列表。请使用&nbsp;multipart/form-data提交。 |
| data | Array&lt;[RequestData](#requestdata)&gt; | 是 | 请求的表单数据。 |
## TaskState<sup>9+</sup>
**需要权限**:ohos.permission.INTERNET
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MiscServices.Upload。
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| path | string | 是 | 文件路径 |
| responseCode | number | 是 | 上传任务返回值 |
| message | string | 是 | 上传任务结果描述信息 |
## File
......@@ -1118,7 +1212,7 @@ resume(callback: AsyncCallback&lt;void&gt;): void
| filePath<sup>7+</sup> | string | 否 | 设置下载路径(默认在'internal://cache/'路径下)。<br/>-&nbsp;filePath:'workspace/test.txt':默认路径下创建workspace路径,并将文件存储在workspace路径下。<br/>-&nbsp;filePath:'test.txt':将文件存储在默认路径下。<br/>-&nbsp;filePath:'workspace/':默认路径下创建workspace路径,并将文件存储在workspace路径下。 |
| networkType | number | 否 | 设置允许下载的网络类型。<br/>-&nbsp;NETWORK_MOBILE:0x00000001<br/>-&nbsp;NETWORK_WIFI:0x00010000|
| title | string | 否 | 设置下载会话标题。 |
| background | boolean | 否 | 后台任务通知开关,开启后可在通知中显示下载状态。 |
| background<sup>9+</sup> | boolean | 否 | 后台任务通知开关,开启后可在通知中显示下载状态。 |
## DownloadInfo<sup>7+</sup>
......
......@@ -17,7 +17,7 @@ getSync(key: string, def?: string): string
获取系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......@@ -50,7 +50,7 @@ get(key: string, callback: AsyncCallback&lt;string&gt;): void
获取系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......@@ -81,7 +81,7 @@ get(key: string, def: string, callback: AsyncCallback&lt;string&gt;): void
获取系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......@@ -114,7 +114,7 @@ get(key: string, def?: string): Promise&lt;string&gt;
获取系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......@@ -151,7 +151,7 @@ setSync(key: string, value: string): void
设置系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......@@ -177,7 +177,7 @@ set(key: string, value: string, callback: AsyncCallback&lt;void&gt;): void
设置系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......@@ -209,7 +209,7 @@ set(key: string, value: string): Promise&lt;void&gt;
设置系统属性Key对应的值。
**系统能力:** SystemCapability.Startup.SysInfo
**系统能力:** SystemCapability.Startup.SystemInfo
**参数:**
......
......@@ -29,7 +29,7 @@ createTimer(options: TimerOptions, callback: AsyncCallback&lt;number&gt;): void
| options | TimerOptions | 是 | const TIMER_TYPE_REALTIME: 设置为系统启动时间定时器,否则为walltime定时器; <br/>const TIMER_TYPE_WAKEUP: 设置为唤醒定时器,否则为非唤醒; <br/>const TIMER_TYPE_EXACT: 设置为精准定时器,否则为非精准定时器; <br/>const TIMER_TYPE_IDLE: number: 设置为IDLE模式定时器,否则为非IDLE模式定时器(暂不支持) |
| repeat | boolean | 是 | true 为循环定时器,false为单次定时器。 |
| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 |
| wantAgent| wantAgent | 否 | 设置通知的wantagent,定时器到期后通知。 |
| wantAgent| wantAgent | 否 | 设置通知的wantagent,定时器到期后通知。(支持拉起鸿蒙应用MainAbility,暂不支持拉起SA) |
**返回值:**
......@@ -40,17 +40,21 @@ createTimer(options: TimerOptions, callback: AsyncCallback&lt;number&gt;): void
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
systemTime.createTimer(options, (error, data) => {
if (error) {
console.error(`failed to systemTime.createTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.createTimer success data : ` + JSON.stringify(data));
});
export default {
systemTimer () {
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
}
systemTimer.createTimer(options, (error, data) => {
if (error) {
console.error(`failed to systemTime.createTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.createTimer success data : ` + JSON.stringify(data));
});
}
}
```
......@@ -69,7 +73,7 @@ createTimer(options: TimerOptions): Promise&lt;number&gt;
| options | TimerOptions | 是 | const TIMER_TYPE_REALTIME: 设置为系统启动时间定时器,否则为walltime定时器; <br/>const TIMER_TYPE_WAKEUP: 设置为唤醒定时器,否则为非唤醒; <br/>const TIMER_TYPE_EXACT: 设置为精准定时器,否则为非精准定时器; <br/>const TIMER_TYPE_IDLE: number: 设置为IDLE模式定时器,否则为非IDLE模式定时器(暂不支持) |
| repeat | boolean | 是 | true 为循环定时器,false为单次定时器。 |
| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 |
| wantAgent| wantAgent | 否 | 设置通知的wantagent,定时器到期后通知。 |
| wantAgent| wantAgent | 否 | 设置通知的wantagent,定时器到期后通知。(支持拉起鸿蒙应用MainAbility,暂不支持拉起SA) |
**返回值:**
......@@ -80,15 +84,19 @@ createTimer(options: TimerOptions): Promise&lt;number&gt;
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
systemTime.createTimer(options).then((data) => {
console.log(`systemTime.createTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.createTimer because ` + JSON.stringify(error));
});
export default {
systemTimer () {
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
systemTimer.createTimer(options).then((data) => {
console.log(`systemTime.createTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.createTimer because ` + JSON.stringify(error));
});
}
}
```
......@@ -111,18 +119,22 @@ startTimer(timer: number, triggerTime: number, callback: AsyncCallback&lt;void&g
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTime.startTimer(timerId, 10000, (error, data) => {
if (error) {
console.error(`failed to systemTime.startTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
});
export default {
systemTimer () {
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTimer.startTimer(timerId, 10000, (error, data) => {
if (error) {
console.error(`failed to systemTime.startTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
});
}
}
```
## systemTime.startTimer
......@@ -144,16 +156,20 @@ startTimer(timer: number, triggerTime: number): Promise&lt;void&gt;
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTime.startTimer(timerId, 10000).then((data) => {
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error));
});
export default {
systemTimer (){
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTimer.startTimer(timerId, 10000).then((data) => {
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error));
});
}
}
```
......@@ -174,19 +190,23 @@ stopTimer(timer: number, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
let startTimerRes = systemTimer.startTimer(timerId, 100000)
systemTime.stopTimer(timerId, (error, data) => {
if (error) {
console.error(`failed to systemTime.stopTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.stopTimer success data : ` + JSON.stringify(data));
});
export default {
systemTimer () {
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTimer.startTimer(timerId, 100000)
systemTimer.stoptTimer(timerId, 10000, (error, data) => {
if (error) {
console.error(`failed to systemTime.startTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
});
}
}
```
......@@ -207,17 +227,21 @@ stopTimer(timer: number): Promise&lt;void&gt;
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
let startTimerRes = systemTimer.startTimer(timerId, 100000)
systemTime.stopTimer(timerId).then((data) => {
console.log(`systemTime.stopTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.stopTimer because ` + JSON.stringify(error));
});
export default {
systemTimer (){
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTimer.startTimer(timerId, 100000)
systemTimer.stoptTimer(timerId, 10000).then((data) => {
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error));
});
}
}
```
......@@ -238,20 +262,24 @@ destroyTimer(timer: number, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
let startTimerRes = systemTimer.startTimer(timerId, 100000)
let stopTimerRes = systemTimer.stopTimer(timerId)
systemTime.destroyTimer(timerId, (error, data) => {
if (error) {
console.error(`failed to systemTime.destroyTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.destroyTimer success data : ` + JSON.stringify(data));
});
export default {
systemTimer () {
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTimer.startTimer(timerId, 100000)
systemTimer.stopTimer(timerId)
systemTimer.destroyTimer(timerId, (error, data) => {
if (error) {
console.error(`failed to systemTime.startTimer ` + JSON.stringify(error));
return;
}
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
});
}
}
```
......@@ -272,16 +300,20 @@ destroyTimer(timer: number): Promise&lt;void&gt;
**示例:**
```js
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
let startTimerRes = systemTimer.startTimer(timerId, 100000)
let stopTimerRes = systemTimer.stopTimer(timerId)
systemTime.destroyTimer(timerId).then((data) => {
console.log(`systemTime.destroyTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.destroyTimer because ` + JSON.stringify(error));
});
export default {
systemTimer (){
var options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = systemTimer.Timer(options)
systemTimer.startTimer(timerId, 100000)
systemTimer.stopTimer(timerId)
systemTimer.destroytTimer(timerId, 10000).then((data) => {
console.log(`systemTime.startTimer success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error));
});
}
}
```
\ No newline at end of file
......@@ -1647,7 +1647,7 @@ async function demo() {
fling(from: Point, to: Point, stepLen: number, speed: number): Promise\<void>
植入从给出的起始坐标点按照指定的间隔与速度滑向给出的目的坐标点的滑动操作。
模拟手指滑动后脱离屏幕的快速滑动操作。
**系统能力**:SystemCapability.Test.UiTest
......@@ -1655,8 +1655,8 @@ fling(from: Point, to: Point, stepLen: number, speed: number): Promise\<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------- | ---- | ------------------------------------------------------------ |
| from | [Point](#point9) | 是 | 起始点的坐标。 |
| to | [Point](#point9) | 是 | 目的点的坐标。 |
| from | [Point](#point9) | 是 | 手指接触屏幕的起始点坐标。 |
| to | [Point](#point9) | 是 | 手指离开屏幕时的坐标点。 |
| stepLen | number | 是 | 间隔距离,单位:像素点。 |
| speed | number | 是 | 滑动速率,范围:200-3000,不在范围内设为默认值为600,单位:像素点/秒。 |
......
......@@ -7,6 +7,8 @@ WebGL标准图形API,对应OpenGL ES 2.0特性集。更多信息请参考[WebG
> **说明:**
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> WebGL遵循OpenGL协议,不支持多线程调用。
## 调用方式
......
......@@ -7,6 +7,8 @@ WebGL标准图形API,对应OpenGL ES 3.0特性集。更多信息请参考[WebG
> **说明:**
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> WebGL2遵循OpenGL协议,不支持多线程调用。
## 调用方式
......
......@@ -40,12 +40,17 @@ startWork(work: WorkInfo): boolean
```js
let workInfo = {
workId: 1,
batteryLevel:50,
batteryStatus:workScheduler.BatteryStatus.BATTERY_STATUS_LOW,
isRepeat: false,
isPersisted: true,
bundleName: "com.example.myapplication",
abilityName: "MyExtension"
abilityName: "MyExtension",
parameters: {
mykey0: 1,
mykey1: "string value",
mykey2: true,
mykey3: 1.5
}
}
var res = workScheduler.startWork(workInfo);
console.info("workschedulerLog res:" + res);
......@@ -76,12 +81,17 @@ stopWork(work: WorkInfo, needCancel?: boolean): boolean
```js
let workInfo = {
workId: 1,
batteryLevel:50,
batteryStatus:workScheduler.BatteryStatus.BATTERY_STATUS_LOW,
isRepeat: false,
isPersisted: true,
bundleName: "com.example.myapplication",
abilityName: "MyExtension"
abilityName: "MyExtension",
parameters: {
mykey0: 1,
mykey1: "string value",
mykey2: true,
mykey3: 1.5
}
}
var res = workScheduler.stopWork(workInfo, false);
console.info("workschedulerLog res:" + res);
......@@ -299,6 +309,7 @@ isLastWorkTimeOut(workId: number): Promise\<boolean>
| isPersisted | boolean | 否 | 是否持久化保存工作 |
| isDeepIdle | boolean | 否 | 是否要求设备进入空闲状态 |
| idleWaitTime | number | 否 | 空闲等待时间 |
| parameters | {[key: string]: any} | 否 | 携带参数信息 |
## NetworkType
触发工作的网络类型。
......
......@@ -27,10 +27,11 @@ Worker构造函数的选项信息,用于为Worker添加其他信息。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ---- | --------- | ---- | ---- | ---------------------- |
| type | "classic" | 是 | 是 | 按照指定方式执行脚本。 |
| name | string | 是 | 是 | Worker的名称。 |
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ------ | --------- | ---- | ---- | ---------------------- |
| type | "classic" | 是 | 是 | 按照指定方式执行脚本。 |
| name | string | 是 | 是 | Worker的名称。 |
| shared | boolean | 是 | 是 | Worker是否可以被分享。 |
## Worker
......@@ -438,7 +439,7 @@ Worker线程用于与宿主线程通信的类,通过postMessage接口发送消
### postMessage
postMessage(message: Object, options?: PostMessageOptions): void
postMessage(messageObject: Object, options?: PostMessageOptions): void
Worker向宿主线程发送消息。
......
......@@ -17,28 +17,10 @@
| 名称 | 参数类型 | 默认值 | 描述 |
| ---------- | ---------------------------------------- | --------------- | ----------------------- |
| duration | number | 1000 | 单位为毫秒,默认动画时长为1000毫秒。 |
| curve | Curve | Curve.Linear | 默认曲线为线性。 |
| curve | [Curve](ts-appendix-enums.md#curve) | Curve.Linear | 默认曲线为线性。 |
| delay | number | 0 | 单位为毫秒,默认不延时播放。 |
| iterations | number | 1 | 默认播放一次,设置为-1时表示无限次播放。 |
| playMode | [PlayMode](ts-appendix-enums.md#playmode枚举值说明) | PlayMode.Normal | 设置动画播放模式,默认播放完成后重头开始播放。 |
- Curve枚举说明
| 名称 | 描述 |
| ------------------- | ---------------------------------------- |
| Linear | 表示动画从头到尾的速度都是相同的。 |
| Ease | 表示动画以低速开始,然后加快,在结束前变慢,CubicBezier(0.25,&nbsp;0.1,&nbsp;0.25,&nbsp;1.0)。 |
| EaseIn | 表示动画以低速开始,CubicBezier(0.42,&nbsp;0.0,&nbsp;1.0,&nbsp;1.0)。 |
| EaseOut | 表示动画以低速结束,CubicBezier(0.0,&nbsp;0.0,&nbsp;0.58,&nbsp;1.0)。 |
| EaseInOut | 表示动画以低速开始和结束,CubicBezier(0.42,&nbsp;0.0,&nbsp;0.58,&nbsp;1.0)。 |
| FastOutSlowIn | 标准曲线,cubic-bezier(0.4,&nbsp;0.0,&nbsp;0.2,&nbsp;1.0)。 |
| LinearOutSlowIn | 减速曲线,cubic-bezier(0.0,&nbsp;0.0,&nbsp;0.2,&nbsp;1.0)。 |
| FastOutLinearIn | 加速曲线,cubic-bezier(0.4,&nbsp;0.0,&nbsp;1.0,&nbsp;1.0)。 |
| ExtremeDeceleration | 急缓曲线,cubic-bezier(0.0,&nbsp;0.0,&nbsp;0.0,&nbsp;1.0)。 |
| Sharp | 锐利曲线,cubic-bezier(0.33,&nbsp;0.0,&nbsp;0.67,&nbsp;1.0)。 |
| Rhythm | 节奏曲线,cubic-bezier(0.7,&nbsp;0.0,&nbsp;0.2,&nbsp;1.0)。 |
| Smooth | 平滑曲线,cubic-bezier(0.4,&nbsp;0.0,&nbsp;0.4,&nbsp;1.0)。 |
| Friction | 阻尼曲线,CubicBezier(0.2,&nbsp;0.0,&nbsp;0.2,&nbsp;1.0)。 |
| playMode | [PlayMode](ts-appendix-enums.md#playmode) | PlayMode.Normal | 设置动画播放模式,默认播放完成后重头开始播放。 |
## 示例
......
......@@ -45,25 +45,15 @@ Image(src: string | PixelMap | Resource)
| 名称 | 参数类型 | 默认值 | 描述 |
| --------------------- | ------------------------------------------------------- | ------------------------ | ------------------------------------------------------------ |
| alt | string \| [Resource](../../ui/ts-types.md#resource类型) | - | 加载时显示的占位图,支持本地图片和网络图片。 |
| objectFit | ImageFit | ImageFit.Cover | 设置图片的缩放类型。 |
| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | ImageFit.Cover | 设置图片的缩放类型。 |
| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | 设置图片的重复样式。<br/>> **说明:**<br/>>&nbsp;-&nbsp;svg类型图源不支持该属性。 |
| interpolation | [ImageInterpolation](#imageinterpolation) | ImageInterpolation.None | 设置图片的插值效果,即减轻低清晰度图片在放大显示的时候出现的锯齿问题,仅针对图片放大插值。<br/>>&nbsp;**说明:**<br/>>&nbsp;-&nbsp;svg类型图源不支持该属性。<br/>>&nbsp;-&nbsp;PixelMap资源不支持该属性。 |
| renderMode | [ImageRenderMode](#imagerendermode) | ImageRenderMode.Original | 设置图片渲染的模式。<br/>>&nbsp;**说明:**<br/>>&nbsp;-&nbsp;svg类型图源不支持该属性。 |
| sourceSize | {<br/>width:&nbsp;number,<br/>height:&nbsp;number<br/>} | - | 设置图片裁剪尺寸,将原始图片解码成pixelMap,指定尺寸的图片,单位为px。<br/>>&nbsp;**说明:**<br/>>&nbsp;PixelMap资源不支持该属性。 |
| syncLoad<sup>8+</sup> | boolean | false | 设置是否同步加载图片,默认是异步加载。同步加载时阻塞UI线程,不会显示占位图。 |
| copyOption<sup>9+</sup> | [CopyOptions](#copyoptions) | CopyOptions.None | 设置图片是否可复制(SVG图片不支持复制)。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | CopyOptions.None | 设置图片是否可复制(SVG图片不支持复制)。 |
| colorFilter<sup>9+</sup> | [ColorFilter](../../ui/ts-types.md) | - | 给图像设置颜色滤镜效果。 |
### ImageFit
| 名称 | 描述 |
| --------- | ------------------------------------------------------------ |
| Cover | 保持宽高比进行缩小或者放大,使得图片两边都大于或等于显示边界。 |
| Contain | 保持宽高比进行缩小或者放大,使得图片完全显示在显示边界内。 |
| Fill | 不保持宽高比进行放大缩小,使得图片充满显示边界。 |
| None | 保持原有尺寸显示。 |
| ScaleDown | 保持宽高比显示,图片缩小或者保持不变。 |
### ImageInterpolation
| 名称 | 描述 |
......@@ -80,15 +70,6 @@ Image(src: string | PixelMap | Resource)
| Original | 按照原图进行渲染,包括颜色。 |
| Template | 将图片渲染为模板图片,忽略图片的颜色信息。 |
### CopyOptions<sup>9+</sup>
| 名称 | 描述 |
| -------- | -------- |
| None | 不支持复制粘贴。 |
| InApp | 支持应用内复制粘贴。 |
| LocalDevice | 支持设备内复制粘贴。 |
| CrossDevice | 支持跨设备复制粘贴。 |
## 事件
除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件:
......@@ -171,6 +152,72 @@ struct ImageExample1 {
![zh-cn_image_0000001250492613](figures/zh-cn_image_0000001250492613.gif)
### 网络图片
加载网络图片时,默认网络超时是5分钟,建议使用alt配置加载时的占位图。如果需要更灵活的网络配置,可以使用SDK中提供的[HTTP](../../connectivity/http-request.md)工具包发送网络请求,接着将返回的数据解码为Image组件中的`PixelMap`,图片开发可参考[图片处理](../../media/image.md)。代码如下。
```tsx
// @ts-nocheck
import http from '@ohos.net.http';
import ResponseCode from '@ohos.net.http';
import image from '@ohos.multimedia.image'
@Entry
@Component
struct Index {
// 先创建一个PixelMap状态变量用于接收网络图片
@State image: PixelMap = undefined
build() {
Column({space: 10}) {
Button("获取网络图片")
.onClick(() => {
this.httpRequest();
})
Image(this.image).height(100).width(100)
}
.width('100%')
.height('100%')
.padding(10)
}
// 网络图片请求方法
private httpRequest() {
let httpRequest = http.createHttp();
httpRequest.request(
"https://www.example.com/xxx.png", // 请填写一个具体的网络图片地址
(error, data) => {
if(error) {
console.log("error code: " + error.code + ", msg: " + error.message)
} else {
let code = data.responseCode
if(ResponseCode.ResponseCode.OK == code) {
let imageSource = image.createImageSource(data.result)
let options = {alphaType: 0, // 透明度
editable: false, // 是否可编辑
pixelFormat: 3, // 像素格式
scaleMode: 1, // 缩略值
size: {height: 100, width: 100}} // 创建图片大小
imageSource.createPixelMap(options).then((pixelMap) => {
this.image = pixelMap
})
} else {
console.log("response code: " + code);
}
}
}
)
}
}
```
**说明**:网络图片加载的请求方式、超时、额外请求参数等配置可以参考HTTP工具包中关于[`request()`](../../reference/apis/js-apis-http.md)请求方法的细节。
### 设置属性
```ts
......
......@@ -27,12 +27,12 @@ ImageAnimator()
| 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| images | Array&lt;ImageFrameInfo&gt; | [] | 是 | 设置图片帧信息集合。每一帧的帧信息(ImageFrameInfo)包含图片路径、图片大小、图片位置和图片播放时长信息,详见ImageFrameInfo属性说明。 |
| state | AnimationStatus | Initial | 否 | 默认为初始状态,用于控制播放状态。 |
| state | [AnimationStatus](ts-appendix-enums.md#animationstatus) | Initial | 否 | 默认为初始状态,用于控制播放状态。 |
| duration | number | 1000 | 否 | 单位为毫秒,默认时长为1000ms;duration为0时,不播放图片;值的改变只会在下一次循环开始时生效;当images中任意一帧图片设置了单独的duration后,该属性设置无效。 |
| reverse | boolean | false | 否 | 设置播放顺序。false表示从第1张图片播放到最后1张图片;&nbsp;true表示从最后1张图片播放到第1张图片。 |
| fixedSize | boolean | true | 否 | 设置图片大小是否固定为组件大小。&nbsp;true表示图片大小与组件大小一致,此时设置图片的width&nbsp;、height&nbsp;、top&nbsp;和left属性是无效的。false表示每一张图片的width&nbsp;、height&nbsp;、top和left属性都要单独设置。 |
| preDecode | number | 0 | 否 | 是否启用预解码,默认值为0,即不启用预解码,如该值设为2,则播放当前页时会提前加载后面两张图片至缓存以提升性能。 |
| fillMode | FillMode | Forwards | 否 | 设置动画开始前和结束后的状态,可选值参见FillMode说明。 |
| fillMode | [FillMode](ts-appendix-enums.md#fillmode) | Forwards | 否 | 设置动画开始前和结束后的状态,可选值参见FillMode说明。 |
| iterations | number | 1 | 否 | 默认播放一次,设置为-1时表示无限次播放。 |
- ImageFrameInfo属性说明
......@@ -45,20 +45,6 @@ ImageAnimator()
| left | [Length](../../ui/ts-types.md#长度类型) | 0 | 否 | 图片相对于组件左上角的横向坐标 |
| duration | number | 0 | 否 | 每一帧图片的播放时长,单位毫秒 |
- AnimationStatus枚举说明
| 名称 | 描述 |
| -------- | -------- |
| Initial | 动画初始状态。 |
| Running | 动画处于播放状态。 |
| Paused | 动画处于暂停状态。 |
| Stopped | 动画处于停止状态。 |
- FillMode枚举值说明
| 名称 | 描述 |
| -------- | -------- |
| None | 播放完成后恢复初始状态。 |
| Forwards | 播放完成后保持动画结束时的状态。 |
## 事件
......
......@@ -26,7 +26,7 @@ ScrollBar(value: ScrollBarOptions)
| -------- | -------- | -------- | -------- | -------- |
| scroller | [Scroller](ts-container-scroll.md#scroller) | 是 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 |
| direction | ScrollBarDirection | 否 | ScrollBarDirection.Vertical | 滚动条的方向,控制可滚动组件对应方向的滚动。 |
| state | BarState | 否 | BarState.Auto | 滚动条状态。 |
| state | [BarState](ts-appendix-enums.md#barstate) | 否 | BarState.Auto | 滚动条状态。 |
> **说明:**
> ScrollBar组件负责定义可滚动区域的行为样式,ScrollBar的子节点负责定义滚动条的行为样式。
......@@ -37,14 +37,7 @@ ScrollBar(value: ScrollBarOptions)
| 名称 | 描述 |
| -------- | -------- |
| Vertical | 纵向滚动条。 |
| Horizontal | 横向滚动条。 |
- BarState枚举说明
| 名称 | 描述 |
| -------- | -------- |
| On | 常驻显示。 |
| Off | 不显示。 |
| Auto | 按需显示(触摸时显示,无操作2s后消失)。 |
| Horizontal | 横向滚动条。 |
## 示例
......
......@@ -30,54 +30,15 @@ Text(content?: string)
| 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- |
| textAlign | TextAlign | TextAlign.Start | 设置多行文本的文本对齐方式。 |
| textOverflow | {overflow:&nbsp;TextOverflow} | {overflow:&nbsp;TextOverflow.Clip} | 设置文本超长时的显示方式。<br/>**说明:**<br/>文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格:\u200B。<br />需配合`maxLines`使用,单独设置不生效。 |
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | TextAlign.Start | 设置多行文本的文本对齐方式。 |
| textOverflow | {overflow:&nbsp;[TextOverflow](ts-appendix-enums.md#textoverflow)} | {overflow:&nbsp;TextOverflow.Clip} | 设置文本超长时的显示方式。<br/>**说明:**<br/>文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格:\u200B。<br />需配合`maxLines`使用,单独设置不生效。 |
| maxLines | number | Infinity | 设置文本的最大行数。<br />**说明:**<br />默认情况下,文本是自动折行的,如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过 `textOverflow`来指定截断方式。 |
| lineHeight | Length | - | 设置文本的文本行高,设置值不大于0时,不限制文本行高,自适应字体大小,Length为number类型时单位为fp。 |
| decoration | {<br/>type:&nbsp;TextDecorationType,<br/>color?:&nbsp;Color<br/>} | {<br/>type:&nbsp;TextDecorationType.None,<br/>color: Color.Black<br/>} | 设置文本装饰线样式及其颜色。 |
| decoration | {<br/>type:&nbsp;[TextDecorationType](ts-appendix-enums.md#textdecorationtype),<br/>color?:&nbsp;Color<br/>} | {<br/>type:&nbsp;TextDecorationType.None,<br/>color: Color.Black<br/>} | 设置文本装饰线样式及其颜色。 |
| baselineOffset | Length | - | 设置文本基线的偏移量。 |
| textCase | TextCase | TextCase.Normal | 设置文本大小写。 |
| copyOption<sup>9+</sup> | CopyOptions | CopyOptions.None | 组件支持设置文本是否可复制粘贴。 |
- TextAlign枚举说明
| 名称 | 描述 |
| -------- | -------- |
| Center | 文本居中对齐。 |
| Start | 根据文字书写相同的方向对齐。 |
| End | 根据文字书写相反的方向对齐。 |
- TextOverflow枚举说明
| 名称 | 描述 |
| -------- | -------- |
| Clip | 文本超长时进行裁剪显示。 |
| Ellipsis | 文本超长时显示不下的文本用省略号代替。 |
| None | 文本超长时不进行裁剪。 |
- TextDecorationType枚举说明
| 名称 | 描述 |
| -------- | -------- |
| Underline | 文字下划线修饰。 |
| LineThrough | 穿过文本的修饰线。 |
| Overline | 文字上划线修饰。 |
| None | 不使用文本装饰线。 |
- TextCase枚举说明
| textCase | [TextCase](ts-appendix-enums.md#textcase) | TextCase.Normal | 设置文本大小写。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | CopyOptions.None | 组件支持设置文本是否可复制粘贴。 |
| 名称 | 描述 |
| --------- | -------------------- |
| Normal | 保持文本原有大小写。 |
| LowerCase | 文本采用全小写。 |
| UpperCase | 文本采用全大写。 |
- CopyOptions<sup>9+</sup>枚举说明
| 名称 | 描述 |
| -------- | -------- |
| None | 不支持复制粘贴。 |
| InApp | 支持应用内复制粘贴。 |
| LocalDevice | 支持设备内复制粘贴。 |
| CrossDevice | 支持跨设备复制粘贴。 |
> **说明:**
> 不支持Text内同时存在文本内容和Span子组件。如果同时存在,只显示Span内的内容。
......
......@@ -36,18 +36,11 @@ TextArea(value?:{placeholder?: string| Resource, text?: string| Resource, contro
| ------------------------ | ---------------------------------------- | ----- | ---------------------------------------- |
| placeholderColor | Color | - | 设置placeholder文本颜色。 |
| placeholderFont | {<br/>size?:&nbsp;number,<br/>weight?:number&nbsp;\|&nbsp;[FontWeight](ts-universal-attributes-text-style.md),<br/>family?:&nbsp;string,<br/>style?:&nbsp;[FontStyle](ts-universal-attributes-text-style.md)<br/>} | - | 设置placeholder文本样式:<br/>-&nbsp;size:&nbsp;设置文本尺寸,Length为number类型时,使用fp单位。<br/>-&nbsp;weight:&nbsp;设置文本的字体粗细,number类型取值[100,&nbsp;900],取值间隔为100,默认为400,取值越大,字体越粗。<br/>-&nbsp;family:&nbsp;设置文本的字体列表。使用多个字体,使用','进行分割,优先级按顺序生效,例如:'Arial,&nbsp;sans-serif'。<br/>-&nbsp;style:&nbsp;设置文本的字体样式。 |
| textAlign | TextAlign | Start | 设置文本水平对齐方式。 |
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Start | 设置文本水平对齐式。 |
| caretColor | Color | - | 设置输入框光标颜色。 |
| inputFilter<sup>8+</sup> | {<br/>value:&nbsp;[ResourceStr](../../ui/ts-types.md)<sup>8+</sup>,<br/>error?:&nbsp;(value:&nbsp;string)<br/>} | - | 通过正则表达式设置输入过滤器。满足表达式的输入允许显示,不满足的输入被忽略。仅支持单个字符匹配,不支持字符串匹配。例如:^(?=.\*\d)(?=.\*[a-z])(?=.\*[A-Z]).{8,10}$,不支持过滤8到10位的强密码。<br/>-&nbsp;value:设置正则表达式。<br/>-&nbsp;error:正则匹配失败时,返回被忽略的内容。 |
| copyOption<sup>9+</sup> | [CopyOptions](ts-basic-components-text.md) | CopyOptions.CrossDevice | 设置文本是否可复制。 |
- TextAlign枚举说明
| 名称 | 描述 |
| ------ | ------- |
| Start | 水平对齐首部。 |
| Center | 水平居中对齐。 |
| End | 水平对齐尾部。 |
## 事件
......
......@@ -2,7 +2,7 @@
> **说明:**
>
> 该组件从API&nbsp;Version&nbsp;9开始支持。
> 该组件从API&nbsp;Version&nbsp;9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
> 本组件均为系统接口,三方应用不支持调用。
......@@ -11,28 +11,13 @@
## 使用约束
使用AbilityComponent必须是平台签名使用,并申请权限。
AbilityComponent为独立层次渲染,不能再之上叠加其他显示内容。
AbilityComponent不支持处理输入事件,事件不经过当前Ability,直接分发给内部的Ability处理。
AbilityComponent需设置且只能设置width、height,且width、height不支持动态更新。
被启动的Ability必须是resizeable。
被启动的Ability需要设置为多任务栏不显示。
## 权限列表
ohos.permission.INFUSE_EVENTS
ohos.permission.CONTROL_ABILITY_STACKS
ohos.permission.INTEGRATED_ABILITY
ohos.permission.INTEGRATED_INTERIOR_WINDOW
被拉起的Ability必须继承[WindowExtension](../apis/js-apis-application-WindowExtensionAbility.md)
## 子组件
......@@ -43,19 +28,26 @@ ohos.permission.INTEGRATED_INTERIOR_WINDOW
AbilityComponent(value: {want : Want})
- 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| want | [Want](../../reference/apis/js-apis-application-Want.md) | 是 | - | 默认加载的Ability描述。 |
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| want | [Want](../../reference/apis/js-apis-application-Want.md) | 是 | - | 默认加载的Ability描述。 |
## 事件
| 名称 | 功能描述 |
| -------- | -------- |
| onConnect()&nbsp;=&gt;&nbsp;void | AbilityComponent环境启动完成时的回调,之后可使用AbilityComponent的方法。 |
| onDisconnect()&nbsp;=&gt;&nbsp;void | AbilityComponent环境销毁时的回调。 |
### onConnect
onConnect()&nbsp;=&gt;&nbsp;void
AbilityComponent环境启动完成时的回调,之后可使用AbilityComponent的方法。
### onDisconnect
onDisconnect()&nbsp;=&gt;&nbsp;void
AbilityComponent环境销毁时的回调。
## 示例
......
......@@ -30,10 +30,10 @@ AlphabetIndexer(value: {arrayValue : Array&lt;string&gt;, selected : number})
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
| selectedColor | Color | 选中文本文字颜色。 |
| popupColor | Color | 弹出提示文本字体颜色。 |
| selectedBackgroundColor | Color | 选中文本背景颜色。 |
| popupBackground | Color | 弹窗索引背景色。 |
| selectedColor | [ResourceColor](../../ui/ts-types.md) | 选中文本文字颜色。 |
| popupColor | [ResourceColor](../../ui/ts-types.md) | 弹出提示文本字体颜色。 |
| selectedBackgroundColor | [ResourceColor](../../ui/ts-types.md) | 选中文本背景颜色。 |
| popupBackground | [ResourceColor](../../ui/ts-types.md) | 弹窗索引背景色。 |
| usingPopup | boolean | 是否使用弹出索引提示。 |
| selectedFont | {<br/>size?:&nbsp;number,<br/>weight?:&nbsp;FontWeight,<br/>family?:&nbsp;string,<br/>style?:&nbsp;FontStyle<br/>} | 选中文本文字样式。 |
| popupFont | {<br/>size?:&nbsp;number,<br/>weight?:&nbsp;FontWeight,<br/>family?:&nbsp;string,<br/>style?:&nbsp;FontStyle<br/>} | 弹出提示文本字体样式。 |
......
......@@ -58,7 +58,7 @@ struct RefreshExample {
build() {
Column() {
Refresh({ refreshing: this.isRefreshing, offset: 120, friction: 100 }) {
Refresh({ refreshing: $$this.isRefreshing, offset: 120, friction: 100 }) {
Text('Pull Down and refresh: ' + this.counter)
.fontSize(30)
.margin(10)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册