提交 3f09719e 编写于 作者: G Gloria

Update docs against 10219+10669+10871+10360

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 d6eada90
......@@ -14,20 +14,20 @@ As the entry of the ability continuation capability, **continuationManager** is
## Available APIs
| API | Description|
| ---------------------------------------------------------------------------------------------- | ----------- |
| register(callback: AsyncCallback\<number>): void | Registers the continuation management service and obtains a token. This API does not involve any filter parameters and uses an asynchronous callback to return the result.|
| register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void | Registers the continuation management service and obtains a token. This API uses an asynchronous callback to return the result.|
| register(options?: ContinuationExtraParams): Promise\<number> | Registers the continuation management service and obtains a token. This API uses a promise to return the result.|
| on(type: "deviceConnect", token: number, callback: Callback\<Array\<ContinuationResult>>): void | Subscribes to device connection events. This API uses an asynchronous callback to return the result.|
| on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>): void | Subscribes to device disconnection events. This API uses an asynchronous callback to return the result.|
| off(type: "deviceConnect", token: number): void | Unsubscribes from device connection events.|
| off(type: "deviceDisconnect", token: number): void | Unsubscribes from device disconnection events.|
| startDeviceManager(token: number, callback: AsyncCallback\<void>): void | Starts the device selection module to show the list of available devices. This API does not involve any filter parameters and uses an asynchronous callback to return the result.|
| startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void | Starts the device selection module to show the list of available devices. This API uses an asynchronous callback to return the result.|
| startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void> | Starts the device selection module to show the list of available devices. This API uses a promise to return the result.|
| updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void | Instructs the device selection module to update the device connection state. This API uses an asynchronous callback to return the result.|
| updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\<void> | Instructs the device selection module to update the device connection state. This API uses a promise to return the result.|
| unregister(token: number, callback: AsyncCallback\<void>): void | Deregisters the continuation management service. This API uses an asynchronous callback to return the result.|
| unregister(token: number): Promise\<void> | Deregisters the continuation management service. This API uses a promise to return the result.|
| registerContinuation(callback: AsyncCallback\<number>): void | Registers the continuation management service and obtains a token. This API does not involve any filter parameters and uses an asynchronous callback to return the result.|
| registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void | Registers the continuation management service and obtains a token. This API uses an asynchronous callback to return the result.|
| registerContinuation(options?: ContinuationExtraParams): Promise\<number> | Registers the continuation management service and obtains a token. This API uses a promise to return the result.|
| on(type: "deviceSelected", token: number, callback: Callback\<Array\<ContinuationResult>>): void | Subscribes to device connection events. This API uses an asynchronous callback to return the result.|
| on(type: "deviceUnselected", token: number, callback: Callback\<Array\<ContinuationResult>>): void | Subscribes to device disconnection events. This API uses an asynchronous callback to return the result.|
| off(type: "deviceSelected", token: number): void | Unsubscribes from device connection events.|
| off(type: "deviceUnselected", token: number): void | Unsubscribes from device disconnection events.|
| startContinuationDeviceManager(token: number, callback: AsyncCallback\<void>): void | Starts the device selection module to show the list of available devices. This API does not involve any filter parameters and uses an asynchronous callback to return the result.|
| startContinuationDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void | Starts the device selection module to show the list of available devices. This API uses an asynchronous callback to return the result.|
| startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void> | Starts the device selection module to show the list of available devices. This API uses a promise to return the result.|
| updateContinuationState(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void | Instructs the device selection module to update the device connection state. This API uses an asynchronous callback to return the result.|
| updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise\<void> | Instructs the device selection module to update the device connection state. This API uses a promise to return the result.|
| unregisterContinuation(token: number, callback: AsyncCallback\<void>): void | Deregisters the continuation management service. This API uses an asynchronous callback to return the result.|
| unregisterContinuation(token: number): Promise\<void> | Deregisters the continuation management service. This API uses a promise to return the result.|
## How to Develop
1. Import the **continuationManager** module.
......@@ -36,7 +36,7 @@ As the entry of the ability continuation capability, **continuationManager** is
import continuationManager from '@ohos.continuation.continuationManager';
```
2. Apply for permissions required for cross-device continuation or collaboration operations.
2. Apply for the **DISTRIBUTED_DATASYNC** permission.
The permission application operation varies according to the ability model in use. In the FA mode, add the required permission in the `config.json` file, as follows:
......@@ -57,6 +57,7 @@ As the entry of the ability continuation capability, **continuationManager** is
```ts
import abilityAccessCtrl from "@ohos.abilityAccessCtrl";
import bundle from '@ohos.bundle';
import featureAbility from '@ohos.ability.featureAbility';
async function requestPermission() {
let permissions: Array<string> = [
......@@ -124,7 +125,8 @@ As the entry of the ability continuation capability, **continuationManager** is
// If the permission is not granted, call requestPermissionsFromUser to apply for the permission.
if (needGrantPermission) {
try {
await globalThis.abilityContext.requestPermissionsFromUser(permissions);
// globalThis.context is Ability.context, which must be assigned a value in the MainAbility.ts file in advance.
await globalThis.context.requestPermissionsFromUser(permissions);
} catch (err) {
console.error('app permission request permissions error' + JSON.stringify(err));
}
......@@ -140,13 +142,16 @@ As the entry of the ability continuation capability, **continuationManager** is
```ts
let token: number = -1; // Used to save the token returned after the registration. The token will be used when listening for device connection/disconnection events, starting the device selection module, and updating the device connection state.
continuationManager.register().then((data) => {
console.info('register finished, ' + JSON.stringify(data));
token = data; // Obtain a token and assign a value to the token variable.
}).catch((err) => {
console.error('register failed, cause: ' + JSON.stringify(err));
});
try {
continuationManager.registerContinuation().then((data) => {
console.info('registerContinuation finished, ' + JSON.stringify(data));
token = data; // Obtain a token and assign a value to the token variable.
}).catch((err) => {
console.error('registerContinuation failed, cause: ' + JSON.stringify(err));
});
} catch (err) {
console.error('registerContinuation failed, cause: ' + JSON.stringify(err));
}
```
4. Listen for the device connection/disconnection state.
......@@ -156,28 +161,31 @@ As the entry of the ability continuation capability, **continuationManager** is
```ts
let remoteDeviceId: string = ""; // Used to save the information about the remote device selected by the user, which will be used for cross-device continuation or collaboration.
// The token parameter is the token obtained during the registration.
continuationManager.on("deviceConnect", token, (continuationResults) => {
console.info('registerDeviceConnectCallback len: ' + continuationResults.length);
if (continuationResults.length <= 0) {
console.info('no selected device');
return;
}
remoteDeviceId = continuationResults[0].id; // Assign the deviceId of the first selected remote device to the remoteDeviceId variable.
// Pass the remoteDeviceId parameter to want.
let want = {
deviceId: remoteDeviceId,
bundleName: 'ohos.samples.continuationmanager',
abilityName: 'MainAbility'
};
// To initiate multi-device collaboration, you must obtain the ohos.permission.DISTRIBUTED_DATASYNC permission.
globalThis.abilityContext.startAbility(want).then((data) => {
console.info('StartRemoteAbility finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('StartRemoteAbility failed, cause: ' + JSON.stringify(err));
try {
// The token parameter is the token obtained during the registration.
continuationManager.on("deviceSelected", token, (continuationResults) => {
console.info('registerDeviceSelectedCallback len: ' + continuationResults.length);
if (continuationResults.length <= 0) {
console.info('no selected device');
return;
}
remoteDeviceId = continuationResults[0].id; // Assign the deviceId of the first selected remote device to the remoteDeviceId variable.
// Pass the remoteDeviceId parameter to want.
let want = {
deviceId: remoteDeviceId,
bundleName: 'ohos.samples.continuationmanager',
abilityName: 'MainAbility'
};
globalThis.abilityContext.startAbility(want).then((data) => {
console.info('StartRemoteAbility finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('StartRemoteAbility failed, cause: ' + JSON.stringify(err));
});
});
});
} catch (err) {
console.error('on failed, cause: ' + JSON.stringify(err));
}
```
The preceding multi-device collaboration operation is performed across devices in the stage model. For details about this operation in the FA model, see [Page Ability Development](https://gitee.com/openharmony/docs/blob/master/en/application-dev/ability/fa-pageability.md).
......@@ -189,35 +197,43 @@ As the entry of the ability continuation capability, **continuationManager** is
let deviceConnectStatus: continuationManager.DeviceConnectState = continuationManager.DeviceConnectState.CONNECTED;
// The token parameter is the token obtained during the registration, and the remoteDeviceId parameter is the remoteDeviceId obtained.
continuationManager.updateConnectStatus(token, remoteDeviceId, deviceConnectStatus).then((data) => {
console.info('updateConnectStatus finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('updateConnectStatus failed, cause: ' + JSON.stringify(err));
});
try {
continuationManager.updateContinuationState(token, remoteDeviceId, deviceConnectStatus).then((data) => {
console.info('updateContinuationState finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('updateContinuationState failed, cause: ' + JSON.stringify(err));
});
} catch (err) {
console.error('updateContinuationState failed, cause: ' + JSON.stringify(err));
}
```
Listen for the device disconnection state so that the user can stop cross-device continuation or collaboration in time. The sample code is as follows:
```ts
// The token parameter is the token obtained during the registration.
continuationManager.on("deviceDisconnect", token, (deviceIds) => {
console.info('onDeviceDisconnect len: ' + deviceIds.length);
if (deviceIds.length <= 0) {
console.info('no unselected device');
return;
}
try {
// The token parameter is the token obtained during the registration.
continuationManager.on("deviceUnselected", token, (continuationResults) => {
console.info('onDeviceUnselected len: ' + continuationResults.length);
if (continuationResults.length <= 0) {
console.info('no unselected device');
return;
}
// Update the device connection state.
let unselectedDeviceId: string = deviceIds[0]; // Assign the deviceId of the first deselected remote device to the unselectedDeviceId variable.
let deviceConnectStatus: continuationManager.DeviceConnectState = continuationManager.DeviceConnectState.DISCONNECTING; // Device disconnected.
// Update the device connection state.
let unselectedDeviceId: string = continuationResults[0].id; // Assign the deviceId of the first deselected remote device to the unselectedDeviceId variable.
let deviceConnectStatus: continuationManager.DeviceConnectState = continuationManager.DeviceConnectState.DISCONNECTING; // Device disconnected.
// The token parameter is the token obtained during the registration, and the unselectedDeviceId parameter is the unselectedDeviceId obtained.
continuationManager.updateConnectStatus(token, unselectedDeviceId, deviceConnectStatus).then((data) => {
console.info('updateConnectStatus finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('updateConnectStatus failed, cause: ' + JSON.stringify(err));
// The token parameter is the token obtained during the registration, and the unselectedDeviceId parameter is the unselectedDeviceId obtained.
continuationManager.updateContinuationState(token, unselectedDeviceId, deviceConnectStatus).then((data) => {
console.info('updateContinuationState finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('updateContinuationState failed, cause: ' + JSON.stringify(err));
});
});
});
} catch (err) {
console.error('updateContinuationState failed, cause: ' + JSON.stringify(err));
}
```
5. Start the device selection module to show the list of available devices on the network.
......@@ -231,12 +247,16 @@ As the entry of the ability continuation capability, **continuationManager** is
continuationMode: continuationManager.ContinuationMode.COLLABORATION_SINGLE // Single-choice mode of the device selection module.
};
// The token parameter is the token obtained during the registration.
continuationManager.startDeviceManager(token, continuationExtraParams).then((data) => {
console.info('startDeviceManager finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('startDeviceManager failed, cause: ' + JSON.stringify(err));
});
try {
// The token parameter is the token obtained during the registration.
continuationManager.startContinuationDeviceManager(token, continuationExtraParams).then((data) => {
console.info('startContinuationDeviceManager finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('startContinuationDeviceManager failed, cause: ' + JSON.stringify(err));
});
} catch (err) {
console.error('startContinuationDeviceManager failed, cause: ' + JSON.stringify(err));
}
```
6. If you do not need to perform cross-device migration or collaboration operations, you can deregister the continuation management service, by passing the token obtained during the registration.
......@@ -244,10 +264,14 @@ As the entry of the ability continuation capability, **continuationManager** is
The sample code is as follows:
```ts
// The token parameter is the token obtained during the registration.
continuationManager.unregister(token).then((data) => {
console.info('unregister finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('unregister failed, cause: ' + JSON.stringify(err));
});
try {
// The token parameter is the token obtained during the registration.
continuationManager.unregisterContinuation(token).then((data) => {
console.info('unregisterContinuation finished, ' + JSON.stringify(data));
}).catch((err) => {
console.error('unregisterContinuation failed, cause: ' + JSON.stringify(err));
});
} catch (err) {
console.error('unregisterContinuation failed, cause: ' + JSON.stringify(err));
}
```
# 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.
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, start or stop synchronizing a remote mission list, and continue a mission on a remote device.
> **NOTE**
>
......@@ -48,16 +48,23 @@ Registers a mission status listener. This API uses an asynchronous callback to r
console.log('NotifyNetDisconnect state ' + JSON.stringify(state));
}
var parameter = {
deviceId: remoteDeviceId
deviceId: ""
};
var options = {
notifyMissionsChanged: NotifyMissionsChanged,
notifySnapshot: NotifySnapshot,
notifyNetDisconnect: NotifyNetDisconnect
}
distributedMissionManager.registerMissionListener(parameter, options, (error) => {
console.log("error.code = " + error.code)
})
try {
distributedMissionManager.registerMissionListener(parameter, options, (error) => {
if (error.code != 0) {
console.error('registerMissionListener failed, cause: ' + JSON.stringify(error))
}
console.info('registerMissionListener finished')
})
} catch (error) {
console.error('registerMissionListener failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.registerMissionListener
......@@ -97,19 +104,23 @@ Registers a mission status listener. This API uses a promise to return the resul
console.log('NotifyNetDisconnect state ' + JSON.stringify(state));
}
var parameter = {
deviceId: remoteDeviceId
deviceId: ""
};
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);
})
try {
distributedMissionManager.registerMissionListener(parameter, options)
.then(data => {
console.info('registerMissionListener finished, ' + JSON.stringify(data));
}).catch(error => {
console.error('registerMissionListener failed, cause: ' + JSON.stringify(error));
})
} catch (error) {
console.error('registerMissionListener failed, cause: ' + JSON.stringify(error))
}
```
......@@ -134,11 +145,18 @@ Deregisters a mission status listener. This API uses an asynchronous callback to
```ts
var parameter = {
deviceId: remoteDeviceId
deviceId: ""
};
distributedMissionManager.unRegisterMissionListener(parameter, (error) => {
console.log("error.code = " + error.code)
})
try {
distributedMissionManager.unRegisterMissionListener(parameter, (error) => {
if (error.code != 0) {
console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error))
}
console.info('unRegisterMissionListener finished')
})
} catch (error) {
console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error))
}
```
......@@ -168,14 +186,18 @@ Deregisters a mission status listener. This API uses a promise to return the res
```ts
var parameter = {
deviceId: remoteDeviceId
deviceId: ""
};
distributedMissionManager.unRegisterMissionListener(parameter)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
try {
distributedMissionManager.unRegisterMissionListener(parameter)
.then(data => {
console.info('unRegisterMissionListener finished, ' + JSON.stringify(data));
}).catch(error => {
console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error));
})
} catch (error) {
console.error('unRegisterMissionListener failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.startSyncRemoteMissions
......@@ -199,13 +221,20 @@ Starts to synchronize the remote mission list. This API uses an asynchronous cal
```ts
var parameter = {
deviceId: remoteDeviceId,
deviceId: "",
fixConflict: false,
tag: 0
};
distributedMissionManager.startSyncRemoteMissions(parameter, (error) => {
console.log("error.code = " + error.code)
})
try {
distributedMissionManager.startSyncRemoteMissions(parameter, (error) => {
if (error.code != 0) {
console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error))
}
console.info('startSyncRemoteMissions finished')
})
} catch (error) {
console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.startSyncRemoteMissions
......@@ -234,16 +263,20 @@ Starts to synchronize the remote mission list. This API uses a promise to return
```ts
var parameter = {
deviceId: remoteDeviceId,
deviceId: "",
fixConflict: false,
tag: 0
};
distributedMissionManager.startSyncRemoteMissions(parameter)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
try {
distributedMissionManager.startSyncRemoteMissions(parameter)
.then(data => {
console.info('startSyncRemoteMissions finished, ' + JSON.stringify(data));
}).catch(error => {
console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error));
})
} catch (error) {
console.error('startSyncRemoteMissions failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.stopSyncRemoteMissions
......@@ -267,11 +300,18 @@ Stops synchronizing the remote mission list. This API uses an asynchronous callb
```ts
var parameter = {
deviceId: remoteDeviceId
deviceId: ""
};
distributedMissionManager.stopSyncRemoteMissions(parameter, (error) => {
console.log("error.code = " + error.code)
})
try {
distributedMissionManager.stopSyncRemoteMissions(parameter, (error) => {
if (error.code != 0) {
console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error))
}
console.info('stopSyncRemoteMissions finished')
})
} catch (error) {
console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.stopSyncRemoteMissions
......@@ -300,14 +340,113 @@ Stops synchronizing the remote mission list. This API uses a promise to return t
```ts
var parameter = {
deviceId: remoteDeviceId
deviceId: ""
};
try {
distributedMissionManager.stopSyncRemoteMissions(parameter)
.then(data => {
console.info('stopSyncRemoteMissions finished, ' + JSON.stringify(data));
}).catch(error => {
console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error));
})
} catch (error) {
console.error('stopSyncRemoteMissions failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.continueMission
continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback&lt;void&gt;): void;
Continues a mission on a remote device. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | Yes | Parameters required for mission continuation.|
| options | [ContinueCallback](#continuecallback) | Yes | Callback invoked when the mission continuation is complete.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```ts
var parameter = {
srcDeviceId: "",
dstDeviceId: "",
missionId: 1,
wantParam: {"key": "value"}
};
function OnContinueDone(resultCode) {
console.log('OnContinueDone resultCode: ' + JSON.stringify(resultCode));
};
var options = {
OnContinueDone: OnContinueDone
};
try {
distributedMissionManager.continueMission(parameter, options, (error) => {
if (error.code != 0) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
console.info('continueMission finished')
})
} catch (error) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.continueMission
continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise&lt;void&gt;
Continues a mission on a remote device. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | Yes | Parameters required for mission continuation.|
| options | [ContinueCallback](#continuecallback) | Yes | Callback invoked when the mission continuation is complete.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```ts
var parameter = {
srcDeviceId: "",
dstDeviceId: "",
missionId: 1,
wantParam: {"key": "value"}
};
function OnContinueDone(resultCode) {
console.log('OnContinueDone resultCode: ' + JSON.stringify(resultCode));
};
var options = {
OnContinueDone: OnContinueDone
};
distributedMissionManager.stopSyncRemoteMissions(parameter)
.then(data => {
console.info('success data is ' + data);
}).catch(error => {
console.info('error error is ' + error);
})
try {
distributedMissionManager.continueMission(parameter, options)
.then(data => {
console.info('continueMission finished, ' + JSON.stringify(data));
}).catch(error => {
console.error('continueMission failed, cause: ' + JSON.stringify(error));
})
} catch (error) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
```
## MissionCallback
......@@ -349,3 +488,30 @@ Defines the parameters required for registering a listener.
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| deviceId | string | Yes | Yes | Device ID.|
## ContinueDeviceInfo
Defines the parameters required for mission continuation.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| srcDeviceId | string | Yes | Yes | ID of the source device.|
| dstDeviceId | string | Yes | Yes | ID of the target device.|
| missionId | number | Yes | Yes | Mission ID.|
| wantParam | {[key: string]: any} | Yes | Yes | Extended parameters.|
## ContinueCallback
Defines the callback invoked when the mission continuation is complete.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| --------------------- | -------- | ---- | ---- | ------------------ |
| onContinueDone | function | Yes | No | Callback used to notify the user that the mission continuation is complete and return the continuation result. |
# Distributed Scheduler Error Codes
## 16600001 The system ability works abnormally.
**Error Message**
The system ability works abnormally.
**Description**
This error code is reported when the system ability is abnormal.
**Possible Causes**
The possible causes are as follows:
1. The DMS service is not started.
2. The **binder** object of DMS is not obtained.
3. Other services on which ability continuation depends are not started or the **binder** object is not obtained.
**Solution**
Try again later or restart the device.
## 16600002 The specified token or callback is not registered.
**Description**
This error code is reported if the token or callback used in an API of **continuationManager** is not registered when the API is called.
**Error Message**
The specified token or callback is not registered.
**Possible Causes**
The specified token or callback is not registered.
**Solution**
Register the token or callback before calling the API.
## 16600003 The number of token registration times has reached the upper limit.
**Description**
This error code is reported when the number of times that the **continuationManager.registerContinuation** API is called has reached the upper limit.
**Error Message**
The number of token registration times has reached the upper limit.
**Possible Causes**
The number of token registration times has reached the upper limit.
**Solution**
Use a registered token. Do not register the token too frequently.
## 16600004 The specified callback has been registered.
**Description**
This error code is reported when the **continuationManager.on** API is called with a callback the same as a previous one.
**Error Message**
The specified callback has been registered.
**Possible Causes**
The same callback is used for repeated registration.
**Solution**
Use a different callback for registration.
## 16300501 The system ability works abnormally.
**Description**
This error code is reported when the system ability is abnormal.
**Error Message**
The system ability works abnormally.
**Possible Causes**
The possible causes are as follows:
1. The DMS service is not started.
2. The **binder** object of DMS is not obtained.
3. Other services on which ability continuation depends are not started or the **binder** object is not obtained.
**Solution**
Try again later or restart the device.
## 16300502 Failed to get the missionInfo of the specified missionId.
**Description**
This error code is reported when calling the **distributedMissionManager.continueMission** API fails.
**Error Message**
Failed to get the missionInfo of the specified missionId.
**Possible Causes**
The possible causes are as follows:
1. The mission ID is incorrect.
2. The mission information corresponding to the mission ID does not exist.
**Solution**
Verify the mission ID.
## 16300503 The application is not installed on the remote end and installation-free is not supported.
**Description**
This error code is reported if the application is not installed on the remote end and the installation-free feature is not supported when the **distributedMissionManager.continueMission** API is called.
**Error Message**
The application is not installed on the remote end and installation-free is not supported.
**Possible Causes**
The application to continue is not installed on the remote end, and the installation-free feature is not supported.
**Solution**
1. Check whether the application has been installed on the remote end.
2. Check whether the remote end supports installation-free.
## 16300504 The application is not installed on the remote end and installation-free is supported. Try again with the freeInstall flag.
**Description**
This error code is reported if the application is not installed on the remote end and installation-free is supported when the **distributedMissionManager.continueMission** API is called.
**Error Message**
The application is not installed on the remote end and installation-free is supported. Try again with the freeInstall flag.
**Possible Causes**
The application to continue is not installed on the remote end, and installation-free is supported. However, the **freeInstall** flag is not carried.
**Solution**
Try again with the **freeInstall** flag.
## 16300505 The operation device must be the device where the application to be continued is currently located or the target device.
**Description**
This error code is reported if the operation device is not the device where the application to be continued is currently located (source device) or the target device when the **distributedMissionManager.continueMission** API is called.
**Error Message**
The operation device must be the device where the application to be continued is currently located or the target device.
**Possible Causes**
The operation device is not the source or target device.
**Solution**
Use the source or target device for the operation.
## 16300506 The local continuation task is already in progress.
**Description**
This error code is reported if the local continuation task is in progress when the **distributedMissionManager.continueMission** API is called.
**Error Message**
The local continuation task is already in progress.
**Possible Causes**
The continuation task has been initiated and is not complete yet.
**Solution**
Wait until the continuation task is complete.
## 3 Failed to flatten the object.
**Description**
This error code is reported if the system parameter **DMS_PROXY_INTERFACE_TOKEN** fails flattening when an API of **continuationManager** is called.
**Error Message**
Failed to flatten the object.
**Possible Causes**
The system parameter **DMS_PROXY_INTERFACE_TOKEN** fails to be written in serialization.
**Solution**
Make sure the system functions properly. Restart the system when needed.
## 7 The object is null.
**Error Message**
The object is null.
**Description**
This error code is reported if DMS and other objects are empty or reading in serialization fails when an API of **continuationManager** is called.
**Possible Causes**
The possible causes are as follows:
1. Reading the input parameters in serialization fails.
2. The DMS service is not started or the **binder** object is not obtained.
3. Other services on which DMS depends are not started or the **binder** object is not obtained.
**Solution**
1. Check whether the input parameters are valid.
2. Check whether the DMS service is started normally. Restart the service or device when needed.
3. Check whether other services on which DMS depends are started normally. Restart the services or device when needed.
## 29360207 The number of registrations has reached the upper limit.
**Description**
This error code is reported when the number of times that the **continuationManager.register** API is called exceeds the upper limit.
**Error Message**
The number of registrations has reached the upper limit.
**Possible Causes**
The number of device registration times has reached the upper limit.
**Solution**
Restart the service and avoid frequent registration.
## 29360208 The token is not registered.
**Description**
This error code is reported when an API of **continuationManager** is called with an unregistered token.
**Error Message**
The token is not registered.
**Possible Causes**
The token is not registered.
**Solution**
Register a token and use it in the API.
## 29360209 The callback has been registered.
**Description**
This error code is reported when the **continuationManager.on** API is called with a callback the same as a previous one.
**Error Message**
The callback has been registered.
**Possible Causes**
The specified callback has been registered.
**Solution**
Do not use the same callback for repeated registration.
## 29360210 The callback is not registered.
**Description**
This error code is reported when the **off**, **updateConnectStatus**, or **startDeviceManager** API of **continuationManager** is called with a callback that has been not registered by calling **on**.
**Error Message**
The callback is not registered.
**Possible Causes**
The specified callback is not registered.
**Solution**
Register a callback and use it in the API.
## 29360211 Failed to connect to the ability.
**Description**
This error code is reported if connection to the specified ability fails when the **startDeviceManager** API of **continuationManager** is called.
**Error Message**
Failed to connect to the ability.
**Possible Causes**
The specified token is invalid or the target ability is not working properly.
**Solution**
Check whether the token is valid and whether the corresponding ability is normal. Restart the service or device when needed.
## 29360214 The type of callback is not supported.
**Description**
This error code is reported when the **callback** parameter in the **on** or **off** API of **continuationManager** is set to an incorrect type.
**Error Message**
The type of callback is not supported.
**Possible Causes**
The callback type is not supported.
**Solution**
Pass a supported type for the **callback** parameter.
## 29360215 Invalid connection state.
**Description**
This error code is reported when the **status** parameter in the **updateConnectStatus** API of **continuationManager** is invalid.
**Error Message**
Invalid connection state.
**Possible Causes**
The **status** parameter is invalid.
**Solution**
Use a valid value for the **status** parameter.
## 29360216 Invalid continuation mode.
**Error Message**
Invalid continuation mode.
**Description**
This error code is reported when the **ContinuationExtraParams.continuationMode** parameter in the **register** or **startDeviceManager** API of **continuationManager** is invalid.
**Possible Causes**
The **ContinuationExtraParams.continuationMode** parameter is invalid.
**Solution**
Use a valid value for the **ContinuationExtraParams.continuationMode** parameter.
......@@ -10,7 +10,7 @@ Failed to execute the function.
An error occurred during internal invocation.
**Procedure**
**Solution**
Call the API again.
......@@ -24,7 +24,7 @@ Failed to obtain the service.
The service is not started or fails to start.
**Procedure**
**Solution**
Check whether the service is started normally and obtain the service again.
......@@ -52,7 +52,7 @@ Discovery invalid.
The last discovery service is still in progress.
**Procedure**
**Solution**
Wait until the last discovery service is complete and call the discovery API again.
......@@ -66,6 +66,6 @@ Publish invalid.
The last publish service is still in progress.
**Procedure**
**Solution**
Wait until the last publish service is complete and call the publish API again.
......@@ -2,42 +2,53 @@
## 1400001 Invalid Display or Screen
**Error Message**
Invalid display or screen.
**Description**
This error code is reported when an invalid display, including a virtual screen, is operated.
**Possible Causes**
1. The virtual screen has not been created.
2. The virtual screen has been destroyed.
**Procedure**
**Solution**
1. Before operating the virtual screen, check whether the virtual screen has been created.
2. Check whether the virtual screen has been destroyed.
## 1400002 Unauthorized Operation
**Error Message**
Unauthorized operation.
**Description**
This error code is reported when the API does not have the required permissions to operate an object.
**Possible Causes**
The virtual screen object of another process is operated.
**Procedure**
**Solution**
Check whether unauthorized operations are performed on the object of another process. If yes, delete the operations.
## 1400003 Abnormal Display Manager Service
**Error Message**
This display manager service works abnormally.
**Description**
This error code is reported when the display manager service is abnormal.
**Possible Causes**
1. The display manager service is not started normally.
2. The bottom-layer graphics synthesis and rendering are abnormal.
**Procedure**
Try again later or restart the device.
**Solution**
Try again later or restart the device.
\ No newline at end of file
......@@ -10,7 +10,7 @@
The API is supported, but certain features in the API, such as the algorithm, are not supported.
**Procedure**
**Solution**
Modify the parameters and use the features supported.
......@@ -23,7 +23,7 @@ Failed to obtain `${messageInfo}`. It is not set in ParamSet.
The key parameter is not set.
**Procedure**
**Solution**
1. Determine the missing parameter from the error message.
2. Set the parameter.
......@@ -38,7 +38,7 @@ Invalid `${messageInfo}`.
An invalid parameter is found.
**Procedure**
**Solution**
1. Determine the invalid parameter from the error message.
2. Correct the invalid parameter.
......@@ -55,7 +55,7 @@ Failed to write the file.
The file operation failed.
**Procedure**
**Solution**
1. Check whether the disk space is used up and whether the file system is abnormal.
2. Clear the disk space.
......@@ -72,7 +72,7 @@ Failed to obtain messages from IPC.
IPC failed.
**Procedure**
**Solution**
Locate and rectify the IPC failure.
......@@ -89,7 +89,7 @@ The algorithm library operation fails. The possible causes include the following
1. The encryption and decryption on the algorithm library failed due to incorrect ciphertext data.
2. Incorrect key parameters exist.
**Procedure**
**Solution**
1. Check and correct the ciphertext data.
2. Check and correct the key parameters.
......@@ -107,7 +107,7 @@ The possible causes include the following:
1. The key is configured with the user access control attribute and becomes invalid after the password is cleared.
2. The key is configured with the user access control attribute and becomes invalid after a new biometric feature is enrolled.
**Procedure**
**Solution**
1. Locate the cause of the authentication failure based on the log.
2. If the authentication fails due to the access control attribute configured, the key cannot be used any more.
......@@ -122,7 +122,7 @@ The authentication token verification failed.
The authentication token verification failed due to an incorrect challenge value.
**Procedure**
**Solution**
1. Check whether the challenge for userIAM authentication is correctly assembled.
2. If the challenge value is incorrect, modify the assembly mode, use the bytes generated by HUKS to assembly challenge value, and pass it to userIAM for authentication.
......@@ -137,7 +137,7 @@ The Authentication token timed out.
The authentication failed because the authentication token timed out.
**Procedure**
**Solution**
The difference between the current time and the authentication token generation time must be less than the timeout interval. Otherwise, the access will be rejected.
......@@ -151,7 +151,7 @@ The number of key operation sessions has reached the limit.
The number of concurrent key operation sessions has reached the maximum (15).
**Procedure**
**Solution**
1. Check whether there are multiple key session operations (**init** operations) for the same application. If yes, modify the code to avoid concurrent invoking.
2. If the key operation sessions are set up for different applications, wait until the sessions are released.
......@@ -166,7 +166,7 @@ The entity does not exist.
The key corresponding to the key alias does not exist.
**Procedure**
**Solution**
1. Check whether the key alias is misspelled.
2. Check whether the key corresponding to the key alias is successfully generated.
......@@ -181,7 +181,7 @@ External error `${messageInfo}`.
An external error, such as a hardware fault or file error occurs.
**Procedure**
**Solution**
Provide the error code and log information to the related party.
......@@ -195,7 +195,7 @@ The credential does not exist.
The credential, such as the PIN, fingerprint, or face image, is not enrolled.
**Procedure**
**Solution**
Enroll the credential or change the authentication type bound to the key.
......@@ -209,7 +209,7 @@ Memory is insufficient.
The system memory is insufficient.
**Procedure**
**Solution**
Release memory or restart the device.
......@@ -223,6 +223,6 @@ Failed to call the `${messageInfo}` service to do `${messageInfo}`.
The called system service has not started.
**Procedure**
**Solution**
Wait for the system service to start and call the API again.
......@@ -14,6 +14,6 @@ This error code is reported when an internal error that cannot be rectified by d
The operation for obtaining the rendering engine or parsing parameters fails.
**Procedure**
**Solution**
NA
......@@ -14,7 +14,7 @@ This error code is reported when an internal error that cannot be rectified by d
The operation for obtaining the rendering engine or parsing parameters fails.
**Procedure**
**Solution**
NA
......@@ -32,7 +32,7 @@ This error code is reported when the URI of the page to redirect is incorrect or
The entered URI is incorrect or does not exist.
**Procedure**
**Solution**
Ensure that the URI is correct.
......@@ -50,7 +50,7 @@ This error code is reported when more than 32 pages are pushed into the page sta
Too many pages are pushed.
**Procedure**
**Solution**
Delete unnecessary or invalid pages.
......@@ -68,6 +68,6 @@ This error code is reported when the URI of the page to be used for replacement
The entered URI is incorrect or does not exist.
**Procedure**
**Solution**
Ensure that the URI is correct.
# Sensor Error Codes
## 14500101 Service exception.
## 14500101 Service Exception
**Error Message**
......@@ -14,7 +14,7 @@ This error code is reported if the HDI service is abnormal when the **on**, **on
The HDI service is abnormal.
**Procedure**
**Solution**
1. Retry the operation at a specified interval (for example, 1s) or at an exponential increase interval.
2. If the operation fails for three consecutive times, stop the retry. You can also attempt to obtain the sensor list to check for device availability.
......@@ -15,7 +15,7 @@ This error code is reported if the HDI service is abnormal or the device is occu
1. The HDI service is abnormal.
2. The device is occupied.
**Procedure**
**Solution**
1. Retry the operation at a specified interval or at an exponential increase interval. If the operation fails for three consecutive times, stop the retry. You can also obtain the vibrator list to check for device availability.
2. Set a higher priority for the vibrator.
......@@ -2,78 +2,101 @@
## 1300001 Repeated Operation
**Error Message**
Repeated operation.
**Description**
This error code is reported when a repeated operation is performed.
**Possible Causes**
The window to create already exists.
**Procedure**
**Solution**
Before creating a window, check whether the window already exists. If it already exists, use it directly.
## 1300002 Abnormal Window State
**Error Message**
This window state is abnormal.
**Description**
This error code is reported when you operate a window in an abnormal state, for example, a window that has been destroyed.
**Possible Causes**
The window has been destroyed when being operated.
**Procedure**
**Solution**
Before operating the window, check whether it exists.
## 1300003 Abnormal Window Manager Service
**Error Message**
This window manager service works abnormally.
**Description**
This error code is reported when the window manager service is abnormal.
**Possible Causes**
The internal services of the window are not started normally.
**Procedure**
**Solution**
Try again later or restart the device.
## 1300004 Unauthorized Operation
**Error Message**
Unauthorized operation.
**Description**
This error code is reported when the API does not have the required permissions to operate an object.
**Possible Causes**
The window object of another process is operated.
**Procedure**
**Solution**
Check whether unauthorized operations are performed on the object of another process. If yes, delete the operations.
## 1300005 Abnormal Window Stage
**Error Message**
This window stage is abnormal.
**Description**
This error code is reported when you operate a window stage in the abnormal state, for example, a window stage that has been destroyed.
**Possible Causes**
The window stage has been destroyed when being operated.
**Procedure**
Before operating a window stage, check whether it exists.
## 1300006 Abnormal Window Context
**Error Message**
This window context is abnormal.
**Description**
This error code is reported when you operate a window context in the abnormal state, for example, a window context that has been destroyed.
**Possible Causes**
The window context has been destroyed when being operated.
**Procedure**
Before operating the window context, check whether it exists.
**Solution**
Before operating the window context, check whether it exists.
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册