“f42ea489961fa131066d93a9a188ac89206cabb0”上不存在“doc/git@gitcode.net:s920243400/PaddleDetection.git”
提交 730a6f34 编写于 作者: G ge-yafang

Merge branch 'master' of https://gitee.com/ge-yafang/docs

...@@ -24,7 +24,7 @@ Registers a listener for location changes with a location request initiated. ...@@ -24,7 +24,7 @@ Registers a listener for location changes with a location request initiated.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **locationChange** indicates a location change event.| | type | string | Yes| Event type. The value **locationChange** indicates a location change event.|
| request | LocationRequest | Yes| Location request.| | request | LocationRequest | Yes| Location request.|
...@@ -54,7 +54,7 @@ Unregisters the listener for location changes with the corresponding location re ...@@ -54,7 +54,7 @@ Unregisters the listener for location changes with the corresponding location re
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **locationChange** indicates a location change event.| | type | string | Yes| Event type. The value **locationChange** indicates a location change event.|
| callback | Callback<[Location](#location)> | No| Callback used to return the location change event.| | callback | Callback<[Location](#location)> | No| Callback used to return the location change event.|
...@@ -84,7 +84,7 @@ Registers a listener for location service status change events. ...@@ -84,7 +84,7 @@ Registers a listener for location service status change events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.| | type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.|
| callback | Callback<boolean> | Yes| Callback used to return the location service status change event.| | callback | Callback<boolean> | Yes| Callback used to return the location service status change event.|
...@@ -112,7 +112,7 @@ Unregisters the listener for location service status change events. ...@@ -112,7 +112,7 @@ Unregisters the listener for location service status change events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.| | type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.|
| callback | Callback<boolean> | No| Callback used to return the location service status change event.| | callback | Callback<boolean> | No| Callback used to return the location service status change event.|
...@@ -141,7 +141,7 @@ Registers a listener for cached GNSS location reports. ...@@ -141,7 +141,7 @@ Registers a listener for cached GNSS location reports.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.| | type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.|
| request | CachedGnssLocationsRequest | Yes| Request for reporting cached GNSS location.| | request | CachedGnssLocationsRequest | Yes| Request for reporting cached GNSS location.|
...@@ -171,7 +171,7 @@ Unregisters the listener for cached GNSS location reports. ...@@ -171,7 +171,7 @@ Unregisters the listener for cached GNSS location reports.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.| | type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.|
| callback | Callback<boolean> | No| Callback used to return cached GNSS locations.| | callback | Callback<boolean> | No| Callback used to return cached GNSS locations.|
...@@ -201,7 +201,7 @@ Registers a listener for GNSS satellite status change events. ...@@ -201,7 +201,7 @@ Registers a listener for GNSS satellite status change events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.| | type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.|
| callback | Callback<SatelliteStatusInfo> | Yes| Callback used to return GNSS satellite status changes.| | callback | Callback<SatelliteStatusInfo> | Yes| Callback used to return GNSS satellite status changes.|
...@@ -229,7 +229,7 @@ Unregisters the listener for GNSS satellite status change events. ...@@ -229,7 +229,7 @@ Unregisters the listener for GNSS satellite status change events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.| | type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.|
| callback | Callback<SatelliteStatusInfo> | No| Callback used to return GNSS satellite status changes.| | callback | Callback<SatelliteStatusInfo> | No| Callback used to return GNSS satellite status changes.|
...@@ -257,7 +257,7 @@ Registers a listener for GNSS NMEA message change events. ...@@ -257,7 +257,7 @@ Registers a listener for GNSS NMEA message change events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.| | type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.|
| callback | Callback<string> | Yes| Callback used to return GNSS NMEA message changes.| | callback | Callback<string> | Yes| Callback used to return GNSS NMEA message changes.|
...@@ -285,7 +285,7 @@ Unregisters the listener for GNSS NMEA message change events. ...@@ -285,7 +285,7 @@ Unregisters the listener for GNSS NMEA message change events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.| | type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.|
| callback | Callback<string> | No| Callback used to return GNSS NMEA message changes.| | callback | Callback<string> | No| Callback used to return GNSS NMEA message changes.|
...@@ -314,7 +314,7 @@ Registers a listener for status change events of the specified geofence. ...@@ -314,7 +314,7 @@ Registers a listener for status change events of the specified geofence.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.| | type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.|
| request | GeofenceRequest | Yes| Geofencing request.| | request | GeofenceRequest | Yes| Geofencing request.|
...@@ -359,7 +359,7 @@ Unregisters the listener for status change events of the specified geofence. ...@@ -359,7 +359,7 @@ Unregisters the listener for status change events of the specified geofence.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.| | type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.|
| request | GeofenceRequest | Yes| Geofencing request.| | request | GeofenceRequest | Yes| Geofencing request.|
...@@ -402,7 +402,7 @@ Subscribe to country code information reporting events. ...@@ -402,7 +402,7 @@ Subscribe to country code information reporting events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is "countrycodechange", which means subscribing to the submission of country code information. | | type | string | Yes| Event type. The value is "countrycodechange", which means subscribing to the submission of country code information. |
| callback | Callback<CountryCode> | Yes | Callback is used to receive the country code information report. | | callback | Callback<CountryCode> | Yes | Callback is used to receive the country code information report. |
...@@ -428,7 +428,7 @@ Unsubscribe from the country code to report events. ...@@ -428,7 +428,7 @@ Unsubscribe from the country code to report events.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is "countrycodechange", which means unsubscribing to the submission of country code information. | | type | string | Yes| Event type. The value is "countrycodechange", which means unsubscribing to the submission of country code information. |
| callback | Callback<CountryCode> | Yes | Callback is used to receive the country code information report. | | callback | Callback<CountryCode> | Yes | Callback is used to receive the country code information report. |
...@@ -458,7 +458,7 @@ Obtains the current location. This API uses an asynchronous callback to return t ...@@ -458,7 +458,7 @@ Obtains the current location. This API uses an asynchronous callback to return t
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.| | request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.|
| callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the current location.| | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the current location.|
...@@ -493,13 +493,13 @@ Obtains the current location. This API uses a promise to return the result. ...@@ -493,13 +493,13 @@ Obtains the current location. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.| | request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.|
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<[Location](#location)> | Promise used to return the current location.| | Promise<[Location](#location)> | Promise used to return the current location.|
...@@ -526,7 +526,7 @@ Obtains the previous location. This API uses an asynchronous callback to return ...@@ -526,7 +526,7 @@ Obtains the previous location. This API uses an asynchronous callback to return
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the previous location.| | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the previous location.|
...@@ -557,7 +557,7 @@ Obtains the previous location. This API uses a promise to return the result. ...@@ -557,7 +557,7 @@ Obtains the previous location. This API uses a promise to return the result.
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<[Location](#location)> | Promise used to return the previous location.| | Promise<[Location](#location)> | Promise used to return the previous location.|
...@@ -584,7 +584,7 @@ Checks whether the location service is enabled. This API uses an asynchronous ca ...@@ -584,7 +584,7 @@ Checks whether the location service is enabled. This API uses an asynchronous ca
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.|
...@@ -614,7 +614,7 @@ Checks whether the location service is enabled. This API uses a promise to retur ...@@ -614,7 +614,7 @@ Checks whether the location service is enabled. This API uses a promise to retur
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the location service status.| | Promise<boolean> | Promise used to return the location service status.|
...@@ -640,7 +640,7 @@ Requests to enable the location service. This API uses an asynchronous callback ...@@ -640,7 +640,7 @@ Requests to enable the location service. This API uses an asynchronous callback
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.|
...@@ -670,7 +670,7 @@ Requests to enable the location service. This API uses a promise to return the r ...@@ -670,7 +670,7 @@ Requests to enable the location service. This API uses a promise to return the r
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the location service status.| | Promise<boolean> | Promise used to return the location service status.|
...@@ -697,7 +697,7 @@ Enables the location service. This API uses an asynchronous callback to return t ...@@ -697,7 +697,7 @@ Enables the location service. This API uses an asynchronous callback to return t
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.|
...@@ -729,7 +729,7 @@ Enables the location service. This API uses a promise to return the result. ...@@ -729,7 +729,7 @@ Enables the location service. This API uses a promise to return the result.
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the location service status.| | Promise<boolean> | Promise used to return the location service status.|
...@@ -755,7 +755,7 @@ Disables the location service. This API uses an asynchronous callback to return ...@@ -755,7 +755,7 @@ Disables the location service. This API uses an asynchronous callback to return
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.|
...@@ -787,7 +787,7 @@ Disables the location service. This API uses a promise to return the result. ...@@ -787,7 +787,7 @@ Disables the location service. This API uses a promise to return the result.
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the location service status.| | Promise<boolean> | Promise used to return the location service status.|
...@@ -811,7 +811,7 @@ Checks whether the (reverse) geocoding service is available. This API uses an as ...@@ -811,7 +811,7 @@ Checks whether the (reverse) geocoding service is available. This API uses an as
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the (reverse) geocoding service status.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the (reverse) geocoding service status.|
...@@ -841,7 +841,7 @@ Checks whether the (reverse) geocoding service is available. This API uses a pro ...@@ -841,7 +841,7 @@ Checks whether the (reverse) geocoding service is available. This API uses a pro
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the (reverse) geocoding service status.| | Promise<boolean> | Promise used to return the (reverse) geocoding service status.|
...@@ -866,7 +866,7 @@ Converts coordinates into geographic description through reverse geocoding. This ...@@ -866,7 +866,7 @@ Converts coordinates into geographic description through reverse geocoding. This
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.| | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.|
| callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the reverse geocoding result.| | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the reverse geocoding result.|
...@@ -898,13 +898,13 @@ Converts coordinates into geographic description through reverse geocoding. This ...@@ -898,13 +898,13 @@ Converts coordinates into geographic description through reverse geocoding. This
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.| | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.|
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<Array<[GeoAddress](#geoaddress)>> | Promise used to return the reverse geocoding result.| | Promise<Array<[GeoAddress](#geoaddress)>> | Promise used to return the reverse geocoding result.|
...@@ -930,7 +930,7 @@ Converts geographic description into coordinates through geocoding. This API use ...@@ -930,7 +930,7 @@ Converts geographic description into coordinates through geocoding. This API use
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.| | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.|
| callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the geocoding result.| | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the geocoding result.|
...@@ -962,13 +962,13 @@ Converts geographic description into coordinates through geocoding. This API use ...@@ -962,13 +962,13 @@ Converts geographic description into coordinates through geocoding. This API use
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.| | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.|
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<Array<[GeoAddress](#geoaddress)>> | Callback used to return the geocoding result.| | Promise<Array<[GeoAddress](#geoaddress)>> | Callback used to return the geocoding result.|
...@@ -994,7 +994,7 @@ Obtains the number of cached GNSS locations. ...@@ -994,7 +994,7 @@ Obtains the number of cached GNSS locations.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<number> | Yes| Callback used to return the number of cached GNSS locations. | | callback | AsyncCallback<number> | Yes| Callback used to return the number of cached GNSS locations. |
...@@ -1024,7 +1024,7 @@ Obtains the number of cached GNSS locations. ...@@ -1024,7 +1024,7 @@ Obtains the number of cached GNSS locations.
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<number> | Promise used to return the number of cached GNSS locations.| | Promise<number> | Promise used to return the number of cached GNSS locations.|
...@@ -1049,7 +1049,7 @@ Obtains all cached GNSS locations and clears the GNSS cache queue. ...@@ -1049,7 +1049,7 @@ Obtains all cached GNSS locations and clears the GNSS cache queue.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.|
...@@ -1079,7 +1079,7 @@ Obtains all cached GNSS locations and clears the GNSS cache queue. ...@@ -1079,7 +1079,7 @@ Obtains all cached GNSS locations and clears the GNSS cache queue.
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the operation result.| | Promise<boolean> | Promise used to return the operation result.|
...@@ -1104,7 +1104,7 @@ Sends an extended command to the location subsystem. This API can only be called ...@@ -1104,7 +1104,7 @@ Sends an extended command to the location subsystem. This API can only be called
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| command | LocationCommand | Yes| Extended command (string) to be sent.| | command | LocationCommand | Yes| Extended command (string) to be sent.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.|
...@@ -1136,13 +1136,13 @@ Sends an extended command to the location subsystem. This API can only be called ...@@ -1136,13 +1136,13 @@ Sends an extended command to the location subsystem. This API can only be called
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| command | LocationCommand | Yes| Extended command (string) to be sent.| | command | LocationCommand | Yes| Extended command (string) to be sent.|
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Callback used to return the operation result.| | Promise<boolean> | Callback used to return the operation result.|
...@@ -1170,7 +1170,7 @@ Checks whether a user agrees with the privacy statement of the location service. ...@@ -1170,7 +1170,7 @@ Checks whether a user agrees with the privacy statement of the location service.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
...@@ -1203,13 +1203,13 @@ Checks whether a user agrees with the privacy statement of the location service. ...@@ -1203,13 +1203,13 @@ Checks whether a user agrees with the privacy statement of the location service.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.|
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Callback used to return the result, which indicates whether the user agrees with the privacy statement.| | Promise<boolean> | Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
...@@ -1236,7 +1236,7 @@ Sets the user confirmation status for the privacy statement of the location serv ...@@ -1236,7 +1236,7 @@ Sets the user confirmation status for the privacy statement of the location serv
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.|
| isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
...@@ -1270,14 +1270,14 @@ Sets the user confirmation status for the privacy statement of the location serv ...@@ -1270,14 +1270,14 @@ Sets the user confirmation status for the privacy statement of the location serv
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.|
| isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Callback used to return the operation result.| | Promise<boolean> | Callback used to return the operation result.|
...@@ -1300,7 +1300,7 @@ Query the current country code. ...@@ -1300,7 +1300,7 @@ Query the current country code.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<CountryCode> | Yes | Callback is used to receive the country code. | | callback | AsyncCallback<CountryCode> | Yes | Callback is used to receive the country code. |
...@@ -1332,7 +1332,7 @@ None ...@@ -1332,7 +1332,7 @@ None
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<CountryCode> | return country code. | | Promise<CountryCode> | return country code. |
...@@ -1361,7 +1361,7 @@ Enable the position simulation function of a scene, and only one scene can be en ...@@ -1361,7 +1361,7 @@ Enable the position simulation function of a scene, and only one scene can be en
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | No | Indicates under what scenario the position simulation function is enabled. | | scenario | LocationRequestScenario | No | Indicates under what scenario the position simulation function is enabled. |
| callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1392,14 +1392,14 @@ Enable the position simulation function of a scene, and only one scene can be en ...@@ -1392,14 +1392,14 @@ Enable the position simulation function of a scene, and only one scene can be en
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | No | Indicates which scene's position simulation function is enabled. If this parameter is not carried, it means that the position simulation function of all scenes is enabled. | | scenario | LocationRequestScenario | No | Indicates which scene's position simulation function is enabled. If this parameter is not carried, it means that the position simulation function of all scenes is enabled. |
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1433,7 +1433,7 @@ To disable the position simulation function. ...@@ -1433,7 +1433,7 @@ To disable the position simulation function.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | No | Indicates to disable the position simulation function of a scene. If this parameter is not carried, it means to disable the position simulation function of all scenes. | | scenario | LocationRequestScenario | No | Indicates to disable the position simulation function of a scene. If this parameter is not carried, it means to disable the position simulation function of all scenes. |
| callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1465,13 +1465,13 @@ To disable the position simulation function. ...@@ -1465,13 +1465,13 @@ To disable the position simulation function.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | No | Indicates to disable the position simulation function of a scene. If this parameter is not carried, it means to disable the position simulation function of all scenes. | | scenario | LocationRequestScenario | No | Indicates to disable the position simulation function of a scene. If this parameter is not carried, it means to disable the position simulation function of all scenes. |
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr, otherwise it will return an error message | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr, otherwise it will return an error message |
...@@ -1505,7 +1505,7 @@ Set the simulated location information, and then report the simulated location a ...@@ -1505,7 +1505,7 @@ Set the simulated location information, and then report the simulated location a
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | LocationMockConfig | Yes | Indicates the configuration parameters of location simulation, including the time interval of simulation location reporting and the array of simulation locations. | | config | LocationMockConfig | Yes | Indicates the configuration parameters of location simulation, including the time interval of simulation location reporting and the array of simulation locations. |
| callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1543,13 +1543,13 @@ Set the simulated location information, and then report the simulated location a ...@@ -1543,13 +1543,13 @@ Set the simulated location information, and then report the simulated location a
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | LocationMockConfig | Yes | Indicates the configuration parameters of location simulation, including the time interval of simulation location reporting and the array of simulation locations. | | config | LocationMockConfig | Yes | Indicates the configuration parameters of location simulation, including the time interval of simulation location reporting and the array of simulation locations. |
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1591,7 +1591,7 @@ Enable reverse geocoding simulation function. ...@@ -1591,7 +1591,7 @@ Enable reverse geocoding simulation function.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1625,7 +1625,7 @@ None ...@@ -1625,7 +1625,7 @@ None
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1658,7 +1658,7 @@ Disable reverse geocoding simulation function. ...@@ -1658,7 +1658,7 @@ Disable reverse geocoding simulation function.
**Parameters**: **Parameters**:
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message |
...@@ -1692,7 +1692,7 @@ None ...@@ -1692,7 +1692,7 @@ None
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1725,7 +1725,7 @@ Set the configuration information of the reverse geocoding simulation function, ...@@ -1725,7 +1725,7 @@ Set the configuration information of the reverse geocoding simulation function,
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| mockInfos | Array<ReverseGeocodingMockInfo> | Yes | An array of configuration parameters indicating the inverse geocoding simulation function. The configuration parameters of the inverse geocoding simulation function include a location and a place name. | | mockInfos | Array<ReverseGeocodingMockInfo> | Yes | An array of configuration parameters indicating the inverse geocoding simulation function. The configuration parameters of the inverse geocoding simulation function include a location and a place name. |
| callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1734,11 +1734,11 @@ Set the configuration information of the reverse geocoding simulation function, ...@@ -1734,11 +1734,11 @@ Set the configuration information of the reverse geocoding simulation function,
```js ```js
var mockInfos = [ var mockInfos = [
{"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}},
]; ];
geolocation.setReverseGeocodingMockInfo(mockInfos, (err, data) => { geolocation.setReverseGeocodingMockInfo(mockInfos, (err, data) => {
if (err) { if (err) {
...@@ -1763,13 +1763,13 @@ Set the configuration information of the reverse geocoding simulation function, ...@@ -1763,13 +1763,13 @@ Set the configuration information of the reverse geocoding simulation function,
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| mockInfos | Array<ReverseGeocodingMockInfo> | Yes | An array of configuration parameters indicating the inverse geocoding simulation function. The configuration parameters of the inverse geocoding simulation function include a location and a place name. | | mockInfos | Array<ReverseGeocodingMockInfo> | Yes | An array of configuration parameters indicating the inverse geocoding simulation function. The configuration parameters of the inverse geocoding simulation function include a location and a place name. |
**Return value** **Return value**
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. |
...@@ -1777,11 +1777,11 @@ Set the configuration information of the reverse geocoding simulation function, ...@@ -1777,11 +1777,11 @@ Set the configuration information of the reverse geocoding simulation function,
```js ```js
var mockInfos = [ var mockInfos = [
{"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}},
]; ];
geolocation.setReverseGeocodingMockInfo(mockInfos) geolocation.setReverseGeocodingMockInfo(mockInfos)
.then((result) => { .then((result) => {
......
...@@ -200,7 +200,9 @@ ...@@ -200,7 +200,9 @@
- [@ohos.screenLock (锁屏管理)](js-apis-screen-lock.md) - [@ohos.screenLock (锁屏管理)](js-apis-screen-lock.md)
- [@ohos.systemTime (设置系统时间)](js-apis-system-time.md) - [@ohos.systemTime (设置系统时间)](js-apis-system-time.md)
- [@ohos.wallpaper (壁纸)](js-apis-wallpaper.md) - [@ohos.wallpaper (壁纸)](js-apis-wallpaper.md)
- [@ohos.systemTimer(设置系统时间)](js-apis-system-timer.md)
- [Timer (定时器)](js-apis-timer.md) - [Timer (定时器)](js-apis-timer.md)
- 设备管理 - 设备管理
- [@ohos.batteryInfo (电量信息)](js-apis-battery-info.md) - [@ohos.batteryInfo (电量信息)](js-apis-battery-info.md)
......
...@@ -1912,7 +1912,7 @@ getCurrentAudioRendererInfoArray(callback: AsyncCallback<AudioRendererChangeI ...@@ -1912,7 +1912,7 @@ getCurrentAudioRendererInfoArray(callback: AsyncCallback<AudioRendererChangeI
**示例:** **示例:**
``` ```
audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => {
console.info('[GET_RENDERER_STATE_1_CALLBACK] **** Get Callback Called ****'); console.info('getCurrentAudioRendererInfoArray **** Get Callback Called ****');
if (err) { if (err) {
console.log('getCurrentAudioRendererInfoArray :ERROR: '+ err.message); console.log('getCurrentAudioRendererInfoArray :ERROR: '+ err.message);
resultFlag = false; resultFlag = false;
...@@ -1960,7 +1960,7 @@ getCurrentAudioRendererInfoArray(): Promise<AudioRendererChangeInfoArray> ...@@ -1960,7 +1960,7 @@ getCurrentAudioRendererInfoArray(): Promise<AudioRendererChangeInfoArray>
**示例:** **示例:**
``` ```
await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) {
console.info('[GET_RENDERER_STATE_3_PROMISE] ######### Get Promise is called ##########'); console.info('getCurrentAudioRendererInfoArray ######### Get Promise is called ##########');
if (AudioRendererChangeInfoArray != null) { if (AudioRendererChangeInfoArray != null) {
for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) {
AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; AudioRendererChangeInfo = AudioRendererChangeInfoArray[i];
...@@ -1985,7 +1985,6 @@ await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (Audi ...@@ -1985,7 +1985,6 @@ await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (Audi
} }
}).catch((err) => { }).catch((err) => {
console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message); console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message);
resultFlag = false;
}); });
``` ```
...@@ -2006,10 +2005,9 @@ getCurrentAudioCapturerInfoArray(callback: AsyncCallback&lt;AudioCapturerChangeI ...@@ -2006,10 +2005,9 @@ getCurrentAudioCapturerInfoArray(callback: AsyncCallback&lt;AudioCapturerChangeI
**示例:** **示例:**
``` ```
audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => {
console.info('[GET_CAPTURER_STATE_1_CALLBACK] **** Get Callback Called ****'); console.info('getCurrentAudioCapturerInfoArray **** Get Callback Called ****');
if (err) { if (err) {
console.log('getCurrentAudioCapturerInfoArray :ERROR: '+err.message); console.log('getCurrentAudioCapturerInfoArray :ERROR: '+err.message);
resultFlag = false;
} else { } else {
if (AudioCapturerChangeInfoArray != null) { if (AudioCapturerChangeInfoArray != null) {
for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) {
...@@ -2051,8 +2049,8 @@ getCurrentAudioCapturerInfoArray(): Promise&lt;AudioCapturerChangeInfoArray&gt; ...@@ -2051,8 +2049,8 @@ getCurrentAudioCapturerInfoArray(): Promise&lt;AudioCapturerChangeInfoArray&gt;
**示例:** **示例:**
``` ```
await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) {
console.info('AFCapturerChangeLog: [GET_CAP_STA_1_PR] **** Get Promise Called ****'); console.info('getCurrentAudioCapturerInfoArray **** Get Promise Called ****');
if (AudioCapturerChangeInfoArray != null) { if (AudioCapturerChangeInfoArray != null) {
for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) {
console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId);
...@@ -2075,7 +2073,6 @@ await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (Au ...@@ -2075,7 +2073,6 @@ await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (Au
} }
}).catch((err) => { }).catch((err) => {
console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message);
resultFlag = false;
}); });
``` ```
...@@ -2096,7 +2093,7 @@ on(type: "audioRendererChange", callback: Callback&lt;AudioRendererChangeInfoArr ...@@ -2096,7 +2093,7 @@ on(type: "audioRendererChange", callback: Callback&lt;AudioRendererChangeInfoArr
**示例:** **示例:**
``` ```
audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => {
for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) {
AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; AudioRendererChangeInfo = AudioRendererChangeInfoArray[i];
console.info('## RendererChange on is called for ' + i + ' ##'); console.info('## RendererChange on is called for ' + i + ' ##');
...@@ -2125,7 +2122,7 @@ audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) = ...@@ -2125,7 +2122,7 @@ audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) =
off(type: "audioRendererChange"); off(type: "audioRendererChange");
监听音频渲染器更改事件。 取消监听音频渲染器更改事件。
**系统能力:** SystemCapability.Multimedia.Audio.Renderer **系统能力:** SystemCapability.Multimedia.Audio.Renderer
...@@ -2137,8 +2134,8 @@ off(type: "audioRendererChange"); ...@@ -2137,8 +2134,8 @@ off(type: "audioRendererChange");
**示例:** **示例:**
``` ```
audioStreamManagerCB.off('audioRendererChange'); audioStreamManager.off('audioRendererChange');
console.info('[RENDERER-CHANGE-ON-001] ######### RendererChange Off is called #########'); console.info('######### RendererChange Off is called #########');
``` ```
### on('audioCapturerChange')<sup>9+</sup> ### on('audioCapturerChange')<sup>9+</sup>
...@@ -2184,7 +2181,7 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => ...@@ -2184,7 +2181,7 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) =>
off(type: "audioCapturerChange"); off(type: "audioCapturerChange");
监听音频捕获器更改事件。 取消监听音频捕获器更改事件。
**系统能力:** SystemCapability.Multimedia.Audio.Capturer **系统能力:** SystemCapability.Multimedia.Audio.Capturer
...@@ -2197,7 +2194,7 @@ off(type: "audioCapturerChange"); ...@@ -2197,7 +2194,7 @@ off(type: "audioCapturerChange");
**示例:** **示例:**
``` ```
audioStreamManager.off('audioCapturerChange'); audioStreamManager.off('audioCapturerChange');
console.info('[GET_CAPTURER_STATE_2_PROMISE] ######### CapturerChange Off is called #########'); console.info('######### CapturerChange Off is called #########');
``` ```
...@@ -2228,8 +2225,8 @@ var AudioStreamInfo = { ...@@ -2228,8 +2225,8 @@ var AudioStreamInfo = {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
var streamManagerCB = audioManager.getStreamManager(); var audioStreamManager = audioManager.getStreamManager();
streamManagerCB.isAudioRendererLowLatencySupported(AudioStreamInfo, (result) => { audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo, (result) => {
console.info('isAudioRendererLowLatencySupported success var = ' + result); console.info('isAudioRendererLowLatencySupported success var = ' + result);
}); });
``` ```
...@@ -2266,8 +2263,8 @@ var AudioStreamInfo = { ...@@ -2266,8 +2263,8 @@ var AudioStreamInfo = {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
var streamManager = await audioManager.getStreamManager(); var audioStreamManager = await audioManager.getStreamManager();
var result = streamManager.isAudioRendererLowLatencySupported(AudioStreamInfo); var result = audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo);
console.info('isAudioRendererLowLatencySupported success var =' + result); console.info('isAudioRendererLowLatencySupported success var =' + result);
``` ```
...@@ -2298,6 +2295,7 @@ import audio from '@ohos.multimedia.audio'; ...@@ -2298,6 +2295,7 @@ import audio from '@ohos.multimedia.audio';
var audioStreamManager; var audioStreamManager;
var audioStreamManagerCB; var audioStreamManagerCB;
var Tag = "AFCapLog : "; var Tag = "AFCapLog : ";
var resultFlag = false;
await audioManager.getStreamManager().then(async function (data) { await audioManager.getStreamManager().then(async function (data) {
audioStreamManager = data; audioStreamManager = data;
...@@ -2337,7 +2335,7 @@ audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) = ...@@ -2337,7 +2335,7 @@ audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) =
} }
if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) { if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) {
resultFlag = true; resultFlag = true;
console.info(Tag + '[RENDERER-CHANGE-ON-001] ResultFlag for '+ i +' is:'+ resultFlag); console.info(Tag + 'ResultFlag for '+ i +' is:'+ resultFlag);
} }
} }
}); });
...@@ -2369,6 +2367,7 @@ import audio from '@ohos.multimedia.audio'; ...@@ -2369,6 +2367,7 @@ import audio from '@ohos.multimedia.audio';
const audioManager = audio.getAudioManager(); const audioManager = audio.getAudioManager();
var Tag = "AFCapLog : "; var Tag = "AFCapLog : ";
var resultFlag = false;
audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => {
for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) {
console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##');
...@@ -2390,7 +2389,7 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => ...@@ -2390,7 +2389,7 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) =>
} }
if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) { if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) {
resultFlag = true; resultFlag = true;
console.info(Tag + '[CAPTURER-CHANGE-ON-001] ResultFlag for element ' + i + ' is: ' + resultFlag); console.info(Tag + 'ResultFlag for element ' + i + ' is: ' + resultFlag);
} }
} }
}); });
......
...@@ -21,7 +21,7 @@ import data_rdb from '@ohos.data.rdb'; ...@@ -21,7 +21,7 @@ import data_rdb from '@ohos.data.rdb';
getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback&lt;RdbStore&gt;): void getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback&lt;RdbStore&gt;): void
获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,结果以callback形式返回 获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -51,7 +51,7 @@ data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, function (err, rdbStore) { ...@@ -51,7 +51,7 @@ data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, function (err, rdbStore) {
getRdbStore(context: Context, config: StoreConfig, version: number): Promise&lt;RdbStore&gt; getRdbStore(context: Context, config: StoreConfig, version: number): Promise&lt;RdbStore&gt;
获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,结果以Promise形式返回 获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -85,7 +85,7 @@ promise.then(async (rdbStore) => { ...@@ -85,7 +85,7 @@ promise.then(async (rdbStore) => {
deleteRdbStore(context: Context, name: string, callback: AsyncCallback&lt;void&gt;): void deleteRdbStore(context: Context, name: string, callback: AsyncCallback&lt;void&gt;): void
删除数据库,结果以callback形式返回 删除数据库,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -111,7 +111,7 @@ data_rdb.deleteRdbStore(this.context, "RdbTest.db", function (err, rdbStore) { ...@@ -111,7 +111,7 @@ data_rdb.deleteRdbStore(this.context, "RdbTest.db", function (err, rdbStore) {
deleteRdbStore(context: Context, name: string): Promise&lt;void&gt; deleteRdbStore(context: Context, name: string): Promise&lt;void&gt;
使用指定的数据库文件配置删除数据库,结果以Promise形式返回 使用指定的数据库文件配置删除数据库,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -953,7 +953,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]) ...@@ -953,7 +953,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"])
insert(table: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;):void insert(table: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;):void
向目标表中插入一行数据,结果以callback形式返回 向目标表中插入一行数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -972,12 +972,12 @@ const valueBucket = { ...@@ -972,12 +972,12 @@ const valueBucket = {
"SALARY": 100.5, "SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]), "CODES": new Uint8Array([1, 2, 3, 4, 5]),
} }
rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) { rdbStore.insert("EMPLOYEE", valueBucket, function (status, rowId) {
if (err) { if (status) {
console.info("Insert failed, err: " + err) console.log("Insert is failed");
return return;
} }
console.log("Insert first done: " + ret) console.log("Insert is successful, rowId = " + rowId);
}) })
``` ```
...@@ -986,7 +986,7 @@ rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) { ...@@ -986,7 +986,7 @@ rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) {
insert(table: string, values: ValuesBucket):Promise&lt;number&gt; insert(table: string, values: ValuesBucket):Promise&lt;number&gt;
向目标表中插入一行数据,结果以Promise形式返回 向目标表中插入一行数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1010,19 +1010,113 @@ const valueBucket = { ...@@ -1010,19 +1010,113 @@ const valueBucket = {
"CODES": new Uint8Array([1, 2, 3, 4, 5]), "CODES": new Uint8Array([1, 2, 3, 4, 5]),
} }
let promise = rdbStore.insert("EMPLOYEE", valueBucket) let promise = rdbStore.insert("EMPLOYEE", valueBucket)
promise.then(async (ret) => { promise.then((rowId) => {
console.log("Insert first done: " + ret) console.log("Insert is successful, rowId = " + rowId);
}).catch((err) => { }).catch((status) => {
console.log("Insert failed, err: " + err) console.log("Insert is failed");
}) })
``` ```
### batchInsert<sup>9+</sup>
batchInsert(table: string, values: Array&lt;ValuesBucket&gt;, callback: AsyncCallback&lt;number&gt;):void
向目标表中插入一组数据,使用callback异步回调。
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| table | string | 是 | 指定的目标表名。 |
| values | Array&lt;[ValuesBucket](#valuesbucket)&gt; | 是 | 表示要插入到表中的一组数据。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定callback回调函数。如果操作成功,返回插入的数据个数,否则返回-1。 |
**示例:**
```js
const valueBucket1 = {
"NAME": "Lisa",
"AGE": 18,
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5])
}
const valueBucket2 = {
"NAME": "Jack",
"AGE": 19,
"SALARY": 101.5,
"CODES": new Uint8Array([6, 7, 8, 9, 10])
}
const valueBucket3 = {
"NAME": "Tom",
"AGE": 20,
"SALARY": 102.5,
"CODES": new Uint8Array([11, 12, 13, 14, 15])
}
var valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3);
rdbStore.batchInsert("EMPLOYEE", valueBuckets, function(status, insertNum) {
if (status) {
console.log("bathInsert is failed, status = " + status);
return;
}
console.log("bathInsert is successful, the number of values that were inserted = " + insertNum);
})
```
### batchInsert<sup>9+</sup>
batchInsert(table: string, values: Array&lt;ValuesBucket&gt;):Promise&lt;number&gt;
向目标表中插入一组数据,使用Promise异步回调。
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| table | string | 是 | 指定的目标表名。 |
| values | Array&lt;[ValuesBucket](#valuesbucket)&gt; | 是 | 表示要插入到表中的一组数据。 |
**返回值**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;number&gt; | 指定Promise回调函数。如果操作成功,返回插入的数据个数,否则返回-1。 |
**示例:**
```js
const valueBucket1 = {
"NAME": "Lisa",
"AGE": 18,
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5])
}
const valueBucket2 = {
"NAME": "Jack",
"AGE": 19,
"SALARY": 101.5,
"CODES": new Uint8Array([6, 7, 8, 9, 10])
}
const valueBucket3 = {
"NAME": "Tom",
"AGE": 20,
"SALARY": 102.5,
"CODES": new Uint8Array([11, 12, 13, 14, 15])
}
var valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3);
let promise = rdbStore.batchInsert("EMPLOYEE", valueBuckets);
promise.then((insertNum) => {
console.log("bathInsert is successful, the number of values that were inserted = " + insertNum);
}).catch((status) => {
console.log("bathInsert is failed, status = " + status);
})
```
### update ### update
update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback&lt;number&gt;):void update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback&lt;number&gt;):void
根据RdbPredicates的指定实例对象更新数据库中的数据,结果以callback形式返回 根据RdbPredicates的指定实例对象更新数据库中的数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1057,7 +1151,7 @@ rdbStore.update(valueBucket, predicates, function (err, ret) { ...@@ -1057,7 +1151,7 @@ rdbStore.update(valueBucket, predicates, function (err, ret) {
update(values: ValuesBucket, predicates: RdbPredicates):Promise&lt;number&gt; update(values: ValuesBucket, predicates: RdbPredicates):Promise&lt;number&gt;
根据RdbPredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回 根据RdbPredicates的指定实例对象更新数据库中的数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1093,7 +1187,7 @@ promise.then(async (ret) => { ...@@ -1093,7 +1187,7 @@ promise.then(async (ret) => {
### update<sup>9+</sup> ### update<sup>9+</sup>
update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback&lt;number&gt;):void update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback&lt;number&gt;):void
根据DataSharePredicates的指定实例对象更新数据库中的数据,结果以callback形式返回 根据DataSharePredicates的指定实例对象更新数据库中的数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1128,7 +1222,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { ...@@ -1128,7 +1222,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) {
update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise&lt;number&gt; update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise&lt;number&gt;
根据DataSharePredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回 根据DataSharePredicates的指定实例对象更新数据库中的数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1168,7 +1262,7 @@ promise.then(async (ret) => { ...@@ -1168,7 +1262,7 @@ promise.then(async (ret) => {
delete(predicates: RdbPredicates, callback: AsyncCallback&lt;number&gt;):void delete(predicates: RdbPredicates, callback: AsyncCallback&lt;number&gt;):void
根据RdbPredicates的指定实例对象从数据库中删除数据,结果以callback形式返回 根据RdbPredicates的指定实例对象从数据库中删除数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1196,7 +1290,7 @@ rdbStore.delete(predicates, function (err, rows) { ...@@ -1196,7 +1290,7 @@ rdbStore.delete(predicates, function (err, rows) {
delete(predicates: RdbPredicates):Promise&lt;number&gt; delete(predicates: RdbPredicates):Promise&lt;number&gt;
根据RdbPredicates的指定实例对象从数据库中删除数据,结果以Promise形式返回 根据RdbPredicates的指定实例对象从数据库中删除数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1227,7 +1321,7 @@ promise.then((rows) => { ...@@ -1227,7 +1321,7 @@ promise.then((rows) => {
delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback&lt;number&gt;):void delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback&lt;number&gt;):void
根据DataSharePredicates的指定实例对象从数据库中删除数据,结果以callback形式返回 根据DataSharePredicates的指定实例对象从数据库中删除数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1255,7 +1349,7 @@ rdbStore.delete("EMPLOYEE", predicates, function (err, rows) { ...@@ -1255,7 +1349,7 @@ rdbStore.delete("EMPLOYEE", predicates, function (err, rows) {
delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promise&lt;number&gt; delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promise&lt;number&gt;
根据DataSharePredicates的指定实例对象从数据库中删除数据,结果以Promise形式返回 根据DataSharePredicates的指定实例对象从数据库中删除数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1287,7 +1381,7 @@ promise.then((rows) => { ...@@ -1287,7 +1381,7 @@ promise.then((rows) => {
query(predicates: RdbPredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void query(predicates: RdbPredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void
根据指定条件查询数据库中的数据,结果以callback形式返回 根据指定条件查询数据库中的数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1317,7 +1411,7 @@ rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (e ...@@ -1317,7 +1411,7 @@ rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (e
query(predicates: RdbPredicates, columns?: Array&lt;string&gt;):Promise&lt;ResultSet&gt; query(predicates: RdbPredicates, columns?: Array&lt;string&gt;):Promise&lt;ResultSet&gt;
根据指定条件查询数据库中的数据,结果以Promise形式返回 根据指定条件查询数据库中的数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1349,7 +1443,7 @@ query(predicates: RdbPredicates, columns?: Array&lt;string&gt;):Promise&lt;Resul ...@@ -1349,7 +1443,7 @@ query(predicates: RdbPredicates, columns?: Array&lt;string&gt;):Promise&lt;Resul
query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void
根据指定条件查询数据库中的数据,结果以callback形式返回 根据指定条件查询数据库中的数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1380,7 +1474,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], ...@@ -1380,7 +1474,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array&lt;string&gt;):Promise&lt;ResultSet&gt; query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array&lt;string&gt;):Promise&lt;ResultSet&gt;
根据指定条件查询数据库中的数据,结果以Promise形式返回 根据指定条件查询数据库中的数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1414,7 +1508,7 @@ promise.then((resultSet) => { ...@@ -1414,7 +1508,7 @@ promise.then((resultSet) => {
querySql(sql: string, bindArgs: Array&lt;ValueType&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void querySql(sql: string, bindArgs: Array&lt;ValueType&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void
根据指定SQL语句查询数据库中的数据,结果以callback形式返回 根据指定SQL语句查询数据库中的数据,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1442,7 +1536,7 @@ rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ...@@ -1442,7 +1536,7 @@ rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?",
querySql(sql: string, bindArgs?: Array&lt;ValueType&gt;):Promise&lt;ResultSet&gt; querySql(sql: string, bindArgs?: Array&lt;ValueType&gt;):Promise&lt;ResultSet&gt;
根据指定SQL语句查询数据库中的数据,结果以Promise形式返回 根据指定SQL语句查询数据库中的数据,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1473,7 +1567,7 @@ promise.then((resultSet) => { ...@@ -1473,7 +1567,7 @@ promise.then((resultSet) => {
executeSql(sql: string, bindArgs: Array&lt;ValueType&gt;, callback: AsyncCallback&lt;void&gt;):void executeSql(sql: string, bindArgs: Array&lt;ValueType&gt;, callback: AsyncCallback&lt;void&gt;):void
执行包含指定参数但不返回值的SQL语句,结果以callback形式返回 执行包含指定参数但不返回值的SQL语句,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1501,7 +1595,7 @@ rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) { ...@@ -1501,7 +1595,7 @@ rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) {
executeSql(sql: string, bindArgs?: Array&lt;ValueType&gt;):Promise&lt;void&gt; executeSql(sql: string, bindArgs?: Array&lt;ValueType&gt;):Promise&lt;void&gt;
执行包含指定参数但不返回值的SQL语句,结果以Promise形式返回 执行包含指定参数但不返回值的SQL语句,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1620,7 +1714,7 @@ try { ...@@ -1620,7 +1714,7 @@ try {
backup(destName:string, callback: AsyncCallback&lt;void&gt;):void backup(destName:string, callback: AsyncCallback&lt;void&gt;):void
以指定名称备份数据库,结果以callback形式返回 以指定名称备份数据库,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1645,7 +1739,7 @@ rdbStore.backup("dbBackup.db", function(err) { ...@@ -1645,7 +1739,7 @@ rdbStore.backup("dbBackup.db", function(err) {
backup(destName:string): Promise&lt;void&gt; backup(destName:string): Promise&lt;void&gt;
以指定名称备份数据库,结果以promise形式返回 以指定名称备份数据库,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1673,7 +1767,7 @@ promiseBackup.then(()=>{ ...@@ -1673,7 +1767,7 @@ promiseBackup.then(()=>{
restore(srcName:string, callback: AsyncCallback&lt;void&gt;):void restore(srcName:string, callback: AsyncCallback&lt;void&gt;):void
从指定的数据库备份文件恢复数据库,结果以callback形式返回 从指定的数据库备份文件恢复数据库,使用callback异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1698,7 +1792,7 @@ rdbStore.restore("dbBackup.db", function(err) { ...@@ -1698,7 +1792,7 @@ rdbStore.restore("dbBackup.db", function(err) {
restore(srcName:string): Promise&lt;void&gt; restore(srcName:string): Promise&lt;void&gt;
从指定的数据库备份文件恢复数据库,结果以promise形式返回 从指定的数据库备份文件恢复数据库,使用Promise异步回调
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。
...@@ -1726,7 +1820,7 @@ promiseRestore.then(()=>{ ...@@ -1726,7 +1820,7 @@ promiseRestore.then(()=>{
setDistributedTables(tables: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void setDistributedTables(tables: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
设置分布式列表,结果以callback形式返回 设置分布式列表,使用callback异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
...@@ -1754,7 +1848,7 @@ rdbStore.setDistributedTables(["EMPLOYEE"], function (err) { ...@@ -1754,7 +1848,7 @@ rdbStore.setDistributedTables(["EMPLOYEE"], function (err) {
setDistributedTables(tables: Array&lt;string&gt;): Promise&lt;void&gt; setDistributedTables(tables: Array&lt;string&gt;): Promise&lt;void&gt;
设置分布式列表,结果以Promise形式返回 设置分布式列表,使用Promise异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
...@@ -1784,7 +1878,7 @@ promise.then(() => { ...@@ -1784,7 +1878,7 @@ promise.then(() => {
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback&lt;string&gt;): void obtainDistributedTableName(device: string, table: string, callback: AsyncCallback&lt;string&gt;): void
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 结果以callback形式返回 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
...@@ -1813,7 +1907,7 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, ...@@ -1813,7 +1907,7 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err,
obtainDistributedTableName(device: string, table: string): Promise&lt;string&gt; obtainDistributedTableName(device: string, table: string): Promise&lt;string&gt;
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,结果以Promise形式返回 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
...@@ -1844,7 +1938,7 @@ promise.then((tableName) => { ...@@ -1844,7 +1938,7 @@ promise.then((tableName) => {
sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback&lt;Array&lt;[string, number]&gt;&gt;): void sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback&lt;Array&lt;[string, number]&gt;&gt;): void
在设备之间同步数据, 结果以callback形式返回 在设备之间同步数据, 使用callback异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
...@@ -1878,7 +1972,7 @@ rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, resul ...@@ -1878,7 +1972,7 @@ rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, resul
sync(mode: SyncMode, predicates: RdbPredicates): Promise&lt;Array&lt;[string, number]&gt;&gt; sync(mode: SyncMode, predicates: RdbPredicates): Promise&lt;Array&lt;[string, number]&gt;&gt;
在设备之间同步数据,结果以Promise形式返回 在设备之间同步数据,使用Promise异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
...@@ -1947,7 +2041,7 @@ try { ...@@ -1947,7 +2041,7 @@ try {
off(event:'dataChange', type: SubscribeType, observer: Callback&lt;Array&lt;string&gt;&gt;): void off(event:'dataChange', type: SubscribeType, observer: Callback&lt;Array&lt;string&gt;&gt;): void
从数据库中删除指定类型的指定观察者, 结果以callback形式返回 从数据库中删除指定类型的指定观察者, 使用callback异步回调
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
- 认证和取消认证设备 - 认证和取消认证设备
- 查询可信设备列表 - 查询可信设备列表
- 查询本地设备信息,包括设备名称,设备类型和设备标识 - 查询本地设备信息,包括设备名称,设备类型和设备标识
- 发布设备发现
> **说明:** > **说明:**
> >
> - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...@@ -61,7 +61,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback&lt;DeviceManager ...@@ -61,7 +61,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback&lt;DeviceManager
| deviceName | string | 是 | 设备名称。 | | deviceName | string | 是 | 设备名称。 |
| deviceType | [DeviceType](#devicetype) | 是 | 设备类型。 | | deviceType | [DeviceType](#devicetype) | 是 | 设备类型。 |
| networkId<sup>8+</sup> | string | 是 | 设备网络标识。 | | networkId<sup>8+</sup> | string | 是 | 设备网络标识。 |
| range<sup>9+</sup> | number | 是 | 发现设备的距离。 |
## DeviceType ## DeviceType
...@@ -184,6 +184,18 @@ createDeviceManager(bundleName: string, callback: AsyncCallback&lt;DeviceManager ...@@ -184,6 +184,18 @@ createDeviceManager(bundleName: string, callback: AsyncCallback&lt;DeviceManager
| token | number | 是 | 认证Token。 | | token | number | 是 | 认证Token。 |
| extraInfo | {[key:string] : any} | 否 | 认证信息可扩展字段。 | | extraInfo | {[key:string] : any} | 否 | 认证信息可扩展字段。 |
## PublishInfo
发布设备参数
**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedHardware.DeviceManager
| 名称 | 类型 | 必填 | 描述 |
| ------------- | --------------------------------- | ---- | ----------------- |
| publishId | number | 是 | 发布设备标识,用于标识不同的发布周期。 |
| mode | [DiscoverMode ](#discovermode) | 是 | 发现模式。 |
| freq | [ExchangeFreq](#exchangefreq) | 是 | 发现频率。 |
| ranging | boolean | 是 | 发布的设备是否支持测距能力。 |
## DeviceManager ## DeviceManager
...@@ -359,6 +371,45 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void ...@@ -359,6 +371,45 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
dmInstance.startDeviceDiscovery(subscribeInfo); //当有设备发现时,通过deviceFound回调通知给应用程序 dmInstance.startDeviceDiscovery(subscribeInfo); //当有设备发现时,通过deviceFound回调通知给应用程序
``` ```
### startDeviceDiscovery9+</sup>
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions: string): void
发现周边设备。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| ------------- | ------------------------------- | ---- | ----- |
| subscribeInfo | [SubscribeInfo](#subscribeinfo) | 是 | 发现信息。 |
| filterOptions | [string](#filteroptions) | 否 | 发现设备过滤信息。|
- 示例:
```js
//生成发现标识,随机数确保每次调用发现接口的标识不一致
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": 0xAA, //主动模式
"medium": 0, //自动发现类型,同时支持多种发现类型
"freq": 2, //高频率
"isSameAccount": false,
"isWakeRemote": false,
"capability": 1
};
var filterOptions = {
"filter_op": "OR", // 可选, 默认"OR"
"filters": [
{
"type": "range",
"value": 50 // 需过滤发现设备的距离,单位(cm)
}
]
};
dmInstance.startDeviceDiscovery(subscribeInfo, JSON.stringify(filterOptions)); //当有设备发现时,通过deviceFound回调通知给应用程序
```
### stopDeviceDiscovery ### stopDeviceDiscovery
stopDeviceDiscovery(subscribeId: number): void stopDeviceDiscovery(subscribeId: number): void
...@@ -378,6 +429,51 @@ stopDeviceDiscovery(subscribeId: number): void ...@@ -378,6 +429,51 @@ stopDeviceDiscovery(subscribeId: number): void
dmInstance.stopDeviceDiscovery(subscribeId); dmInstance.stopDeviceDiscovery(subscribeId);
``` ```
### publishDeviceDiscovery9+</sup>
publishDeviceDiscovery(publishInfo: PublishInfo): void
发现设备发现。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| ------------- | ------------------------------- | ---- | ----- |
| publishInfo | [PublishInfo](#publishinfo) | 是 | 发布设备发现信息。 |
- 示例:
```js
//生成发布标识,随机数确保每次调用发现接口的标识不一致
var publishId = Math.floor(Math.random() * 10000 + 1000);
var publishInfo = {
"publishId": publishId,
"mode": 0xAA, //主动模式
"freq": 2, //高频率
"ranging": 1 //支持发现时测距
};
dmInstance.publishDeviceDiscovery(publishInfo); //当有发布结果时,通过回调通知给应用程序
```
### unPublishDeviceDiscovery
unPublishDeviceDiscovery(publishId: number): void
停止发布设备发现。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| ----------- | -------- | ---- | ----- |
| publishId | number | 是 | 发布标识。 |
- 示例:
```js
//入参需要和publishDeviceDiscovery接口传入的publishId配对使用
dmInstance.unPublishDeviceDiscovery(publishId);
```
### authenticateDevice ### authenticateDevice
authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void
...@@ -599,6 +695,93 @@ off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason: ...@@ -599,6 +695,93 @@ off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason:
); );
``` ```
### on('publishSuccess')
on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): void
注册发布设备发现回调监听。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------------- |
| type | string | 是 | 注册发布设备发现回调,以便将发布结果时通知应用程序。 |
| callback | Callback&lt;{ publishId: number }&gt; | 是 | 注册设备发布的回调方法。 |
- 示例:
```js
dmInstance.on('publishSuccess', (data) => {
console.info("publishSuccess:" + JSON.stringify(data));
}
);
```
### off('publishSuccess')
off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): void
取消注册设备发现回调。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------------------------- |
| type | string | 是 | 取消注册设备发现回调。 |
| callback | Callback&lt;{ publishId: number }&gt; | 是 | 指示要取消注册的设备发布回调。 |
- 示例:
```js
dmInstance.off('publishSuccess', (data) => {
console.info('publishSuccess' + JSON.stringify(data));
}
);
```
### on('publishFail')
on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: number }&gt;): void
注册设备发布失败回调监听。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------- | ---- | ------------------------------ |
| type | string | 是 | 注册设备发布失败回调,以便在发布设备失败时通知应用程序。 |
| callback | Callback&lt;{ publishId: number, reason: number }&gt; | 是 | 注册设备发布失败的回调方法。 |
- 示例:
```js
dmInstance.on('publishFail', (data) => {
this.log("publishFail on:" + JSON.stringify(data));
}
);
```
### off('publishFail')
off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: number }&gt;): void
取消注册设备发现失败回调。
**系统能力**:SystemCapability.DistributedHardware.DeviceManager
- 参数:
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------- | ---- | ----------------- |
| type | string | 是 | 取消注册设备发布失败回调。 |
| callback | Callback&lt;{ publishId: number, reason: number }&gt; | 是 | 指示要取消注册的设备发布失败回调。 |
- 示例:
```js
dmInstance.off('publishFail', (data) => {
console.info('publishFail' + JSON.stringify(data));
}
);
```
### on('serviceDie') ### on('serviceDie')
......
...@@ -174,6 +174,42 @@ getAllDisplay(): Promise&lt;Array&lt;Display&gt;&gt; ...@@ -174,6 +174,42 @@ getAllDisplay(): Promise&lt;Array&lt;Display&gt;&gt;
}); });
``` ```
## display.hasPrivateWindow<sup>9+</sup>
hasPrivateWindow(displayId: number): boolean
查询指定display对象上是否有可见的隐私窗口。可通过[setPrivacyMode](js-apis-window.md#setprivacymode7)接口设置隐私窗口。隐私窗口内容将无法被截屏或录屏。
此接口为系统接口。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------- | ---- |----------|
| id | number | 是 | 显示设备的id。 |
**返回值:**
| 类型 | 说明 |
| -------------------------------- |-----------------------------------------------------------------------|
|boolean | 查询的display对象上是否有可见的隐私窗口。<br>true表示此display对象上有可见的隐私窗口,false表示此display对象上没有可见的隐私窗口。</br> |
**示例:**
```js
var ret = display.hasPrivateWindow(displayClass.id);
if (ret == undefined) {
console.log("HasPrivateWindow undefined.");
}
if (ret) {
console.log("HasPrivateWindow.");
} else if (!ret) {
console.log("Don't HasPrivateWindow.");
}
```
## display.on('add'|'remove'|'change') ## display.on('add'|'remove'|'change')
on(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void on(type: 'add'|'remove'|'change', callback: Callback&lt;number&gt;): void
...@@ -215,3 +251,4 @@ off(type: 'add'|'remove'|'change', callback?: Callback&lt;number&gt;): void ...@@ -215,3 +251,4 @@ off(type: 'add'|'remove'|'change', callback?: Callback&lt;number&gt;): void
```js ```js
display.off("remove"); display.off("remove");
``` ```
...@@ -22,13 +22,14 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback&lt;Locat ...@@ -22,13 +22,14 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback&lt;Locat
**系统能力**:SystemCapability.Location.Location.Core **系统能力**:SystemCapability.Location.Location.Core
**参数** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“locationChange”,表示位置变化。 | | type | string | 是 | 设置事件类型。type为“locationChange”,表示位置变化。 |
| request | LocationRequest | 是 | 设置位置请求参数。 | | request | LocationRequest | 是 | 设置位置请求参数。 |
| callback | Callback&lt;[Location](#location)&gt; | 是 | 接收位置变化状态变化监听。 | | callback | Callback&lt;[Location](#location)&gt; | 是 | 接收位置变化状态变化监听。 |
**示例** **示例**
...@@ -52,9 +53,9 @@ off(type: 'locationChange', callback?: Callback&lt;Location&gt;) : void ...@@ -52,9 +53,9 @@ off(type: 'locationChange', callback?: Callback&lt;Location&gt;) : void
**系统能力**:SystemCapability.Location.Location.Core **系统能力**:SystemCapability.Location.Location.Core
**参数** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“locationChange”,表示位置变化。 | | type | string | 是 | 设置事件类型。type为“locationChange”,表示位置变化。 |
| callback | Callback&lt;[Location](#location)&gt; | 否 | 接收位置变化状态变化监听。 | | callback | Callback&lt;[Location](#location)&gt; | 否 | 接收位置变化状态变化监听。 |
...@@ -82,9 +83,9 @@ on(type: 'locationServiceState', callback: Callback&lt;boolean&gt;) : void ...@@ -82,9 +83,9 @@ on(type: 'locationServiceState', callback: Callback&lt;boolean&gt;) : void
**系统能力**:SystemCapability.Location.Location.Core **系统能力**:SystemCapability.Location.Location.Core
**参数** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“locationServiceState”,表示位置服务状态。 | | type | string | 是 | 设置事件类型。type为“locationServiceState”,表示位置服务状态。 |
| callback | Callback&lt;boolean&gt; | 是 | 接收位置服务状态变化监听。 | | callback | Callback&lt;boolean&gt; | 是 | 接收位置服务状态变化监听。 |
...@@ -112,7 +113,7 @@ off(type: 'locationServiceState', callback?: Callback&lt;boolean&gt;) : void; ...@@ -112,7 +113,7 @@ off(type: 'locationServiceState', callback?: Callback&lt;boolean&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“locationServiceState”,表示位置服务状态。 | | type | string | 是 | 设置事件类型。type为“locationServiceState”,表示位置服务状态。 |
| callback | Callback&lt;boolean&gt; | 否 | 接收位置服务状态变化监听。 | | callback | Callback&lt;boolean&gt; | 否 | 接收位置服务状态变化监听。 |
...@@ -141,7 +142,7 @@ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, ca ...@@ -141,7 +142,7 @@ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, ca
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 | | type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 |
| request | CachedGnssLocationsRequest | 是 | GNSS缓存功能配置参数 | | request | CachedGnssLocationsRequest | 是 | GNSS缓存功能配置参数 |
...@@ -171,7 +172,7 @@ off(type: 'cachedGnssLocationsReporting', callback?: Callback&lt;Array&lt;Locati ...@@ -171,7 +172,7 @@ off(type: 'cachedGnssLocationsReporting', callback?: Callback&lt;Array&lt;Locati
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 | | type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 |
| callback | Callback&lt;boolean&gt; | 否 | 接收GNSS缓存位置上报。 | | callback | Callback&lt;boolean&gt; | 否 | 接收GNSS缓存位置上报。 |
...@@ -201,7 +202,7 @@ on(type: 'gnssStatusChange', callback: Callback&lt;SatelliteStatusInfo&gt;) : vo ...@@ -201,7 +202,7 @@ on(type: 'gnssStatusChange', callback: Callback&lt;SatelliteStatusInfo&gt;) : vo
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“gnssStatusChange”,表示订阅GNSS卫星状态信息上报。 | | type | string | 是 | 设置事件类型。type为“gnssStatusChange”,表示订阅GNSS卫星状态信息上报。 |
| callback | Callback&lt;SatelliteStatusInfo&gt; | 是 | 接收GNSS卫星状态信息上报。 | | callback | Callback&lt;SatelliteStatusInfo&gt; | 是 | 接收GNSS卫星状态信息上报。 |
...@@ -229,7 +230,7 @@ off(type: 'gnssStatusChange', callback?: Callback&lt;SatelliteStatusInfo&gt;) : ...@@ -229,7 +230,7 @@ off(type: 'gnssStatusChange', callback?: Callback&lt;SatelliteStatusInfo&gt;) :
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“gnssStatusChange”,表示订阅GNSS卫星状态信息上报。 | | type | string | 是 | 设置事件类型。type为“gnssStatusChange”,表示订阅GNSS卫星状态信息上报。 |
| callback | Callback&lt;SatelliteStatusInfo&gt; | 否 | 接收GNSS卫星状态信息上报。 | | callback | Callback&lt;SatelliteStatusInfo&gt; | 否 | 接收GNSS卫星状态信息上报。 |
...@@ -257,7 +258,7 @@ on(type: 'nmeaMessageChange', callback: Callback&lt;string&gt;) : void; ...@@ -257,7 +258,7 @@ on(type: 'nmeaMessageChange', callback: Callback&lt;string&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“nmeaMessageChange”,表示订阅GNSS&nbsp;NMEA信息上报。 | | type | string | 是 | 设置事件类型。type为“nmeaMessageChange”,表示订阅GNSS&nbsp;NMEA信息上报。 |
| callback | Callback&lt;string&gt; | 是 | 接收GNSS&nbsp;NMEA信息上报。 | | callback | Callback&lt;string&gt; | 是 | 接收GNSS&nbsp;NMEA信息上报。 |
...@@ -285,7 +286,7 @@ off(type: 'nmeaMessageChange', callback?: Callback&lt;string&gt;) : void; ...@@ -285,7 +286,7 @@ off(type: 'nmeaMessageChange', callback?: Callback&lt;string&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“nmeaMessageChange”,表示订阅GNSS&nbsp;NMEA信息上报。 | | type | string | 是 | 设置事件类型。type为“nmeaMessageChange”,表示订阅GNSS&nbsp;NMEA信息上报。 |
| callback | Callback&lt;string&gt; | 否 | 接收GNSS&nbsp;NMEA信息上报。 | | callback | Callback&lt;string&gt; | 否 | 接收GNSS&nbsp;NMEA信息上报。 |
...@@ -314,7 +315,7 @@ on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; ...@@ -314,7 +315,7 @@ on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“fenceStatusChange”,表示订阅围栏事件上报。 | | type | string | 是 | 设置事件类型。type为“fenceStatusChange”,表示订阅围栏事件上报。 |
| request | GeofenceRequest | 是 | 围栏的配置参数。 | | request | GeofenceRequest | 是 | 围栏的配置参数。 |
...@@ -359,7 +360,7 @@ off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void ...@@ -359,7 +360,7 @@ off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“fenceStatusChange”,表示订阅围栏事件上报。 | | type | string | 是 | 设置事件类型。type为“fenceStatusChange”,表示订阅围栏事件上报。 |
| request | GeofenceRequest | 是 | 围栏的配置参数。 | | request | GeofenceRequest | 是 | 围栏的配置参数。 |
...@@ -402,7 +403,7 @@ on(type: 'countryCodeChange', callback: Callback&lt;CountryCode&gt;) : void; ...@@ -402,7 +403,7 @@ on(type: 'countryCodeChange', callback: Callback&lt;CountryCode&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“countryCodeChange”,表示订阅国家码信息上报。 | | type | string | 是 | 设置事件类型。type为“countryCodeChange”,表示订阅国家码信息上报。 |
| callback | Callback&lt;CountryCode&gt; | 是 | 接收国家码信息上报。 | | callback | Callback&lt;CountryCode&gt; | 是 | 接收国家码信息上报。 |
...@@ -428,7 +429,7 @@ off(type: 'countryCodeChange', callback?: Callback&lt;CountryCode&gt;) : void; ...@@ -428,7 +429,7 @@ off(type: 'countryCodeChange', callback?: Callback&lt;CountryCode&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | 是 | 设置事件类型。type为“countryCodeChange”,表示取消订阅国家码信息上报。 | | type | string | 是 | 设置事件类型。type为“countryCodeChange”,表示取消订阅国家码信息上报。 |
| callback | Callback&lt;CountryCode&gt; | 是 | 接收国家码信息上报。 | | callback | Callback&lt;CountryCode&gt; | 是 | 接收国家码信息上报。 |
...@@ -458,7 +459,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;L ...@@ -458,7 +459,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;L
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [CurrentLocationRequest](#currentlocationrequest) | 否 | 设置位置请求参数。 | | request | [CurrentLocationRequest](#currentlocationrequest) | 否 | 设置位置请求参数。 |
| callback | AsyncCallback&lt;[Location](#location)&gt; | 是 | 用来接收位置信息的回调。 | | callback | AsyncCallback&lt;[Location](#location)&gt; | 是 | 用来接收位置信息的回调。 |
...@@ -493,13 +494,13 @@ getCurrentLocation(request?: CurrentLocationRequest) : Promise&lt;Location&gt; ...@@ -493,13 +494,13 @@ getCurrentLocation(request?: CurrentLocationRequest) : Promise&lt;Location&gt;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [CurrentLocationRequest](#currentlocationrequest) | 否 | 设置位置请求参数。 | | request | [CurrentLocationRequest](#currentlocationrequest) | 否 | 设置位置请求参数。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;[Location](#location)&gt; | 返回位置信息。 | | Promise&lt;[Location](#location)&gt; | 返回位置信息。 |
...@@ -526,7 +527,7 @@ getLastLocation(callback: AsyncCallback&lt;Location&gt;) : void ...@@ -526,7 +527,7 @@ getLastLocation(callback: AsyncCallback&lt;Location&gt;) : void
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[Location](#location)&gt; | 是 | 用来接收上次位置的回调。 | | callback | AsyncCallback&lt;[Location](#location)&gt; | 是 | 用来接收上次位置的回调。 |
...@@ -557,7 +558,7 @@ getLastLocation() : Promise&lt;Location&gt; ...@@ -557,7 +558,7 @@ getLastLocation() : Promise&lt;Location&gt;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;[Location](#location)&gt; | 返回上次位置信息。 | | Promise&lt;[Location](#location)&gt; | 返回上次位置信息。 |
...@@ -584,7 +585,7 @@ isLocationEnabled(callback: AsyncCallback&lt;boolean&gt;) : void ...@@ -584,7 +585,7 @@ isLocationEnabled(callback: AsyncCallback&lt;boolean&gt;) : void
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 |
...@@ -614,7 +615,7 @@ isLocationEnabled() : Promise&lt;boolean&gt; ...@@ -614,7 +615,7 @@ isLocationEnabled() : Promise&lt;boolean&gt;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 返回位置服务是否可用的状态。 | | Promise&lt;boolean&gt; | 返回位置服务是否可用的状态。 |
...@@ -640,7 +641,7 @@ requestEnableLocation(callback: AsyncCallback&lt;boolean&gt;) : void ...@@ -640,7 +641,7 @@ requestEnableLocation(callback: AsyncCallback&lt;boolean&gt;) : void
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 |
...@@ -670,7 +671,7 @@ requestEnableLocation() : Promise&lt;boolean&gt; ...@@ -670,7 +671,7 @@ requestEnableLocation() : Promise&lt;boolean&gt;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 返回位置服务是否可用。 | | Promise&lt;boolean&gt; | 返回位置服务是否可用。 |
...@@ -697,7 +698,7 @@ enableLocation(callback: AsyncCallback&lt;boolean&gt;) : void; ...@@ -697,7 +698,7 @@ enableLocation(callback: AsyncCallback&lt;boolean&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 |
...@@ -729,7 +730,7 @@ enableLocation() : Promise&lt;boolean&gt; ...@@ -729,7 +730,7 @@ enableLocation() : Promise&lt;boolean&gt;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 返回位置服务是否可用。 | | Promise&lt;boolean&gt; | 返回位置服务是否可用。 |
...@@ -755,7 +756,7 @@ disableLocation(callback: AsyncCallback&lt;boolean&gt;) : void; ...@@ -755,7 +756,7 @@ disableLocation(callback: AsyncCallback&lt;boolean&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收位置服务状态的回调。 |
...@@ -787,7 +788,7 @@ disableLocation() : Promise&lt;boolean&gt; ...@@ -787,7 +788,7 @@ disableLocation() : Promise&lt;boolean&gt;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 返回位置服务是否可用。 | | Promise&lt;boolean&gt; | 返回位置服务是否可用。 |
...@@ -811,7 +812,7 @@ isGeoServiceAvailable(callback: AsyncCallback&lt;boolean&gt;) : void ...@@ -811,7 +812,7 @@ isGeoServiceAvailable(callback: AsyncCallback&lt;boolean&gt;) : void
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收地理编码服务状态的回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收地理编码服务状态的回调。 |
...@@ -841,7 +842,7 @@ isGeoServiceAvailable() : Promise&lt;boolean&gt; ...@@ -841,7 +842,7 @@ isGeoServiceAvailable() : Promise&lt;boolean&gt;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 返回地理编码服务是否可用的状态。 | | Promise&lt;boolean&gt; | 返回地理编码服务是否可用的状态。 |
...@@ -866,7 +867,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback ...@@ -866,7 +867,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 设置逆地理编码请求的相关参数。 | | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 设置逆地理编码请求的相关参数。 |
| callback | AsyncCallback&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 是 | 设置接收逆地理编码请求的回调参数。 | | callback | AsyncCallback&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 是 | 设置接收逆地理编码请求的回调参数。 |
...@@ -898,13 +899,13 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise&lt;Array&lt;G ...@@ -898,13 +899,13 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise&lt;Array&lt;G
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 设置逆地理编码请求的相关参数。 | | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 设置逆地理编码请求的相关参数。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 返回地理描述信息。 | | Promise&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 返回地理描述信息。 |
...@@ -930,7 +931,7 @@ getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback&lt ...@@ -930,7 +931,7 @@ getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback&lt
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [GeoCodeRequest](#geocoderequest) | 是 | 设置地理编码请求的相关参数。 | | request | [GeoCodeRequest](#geocoderequest) | 是 | 设置地理编码请求的相关参数。 |
| callback | AsyncCallback&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 是 | 设置接收地理编码请求的回调参数。 | | callback | AsyncCallback&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 是 | 设置接收地理编码请求的回调参数。 |
...@@ -962,13 +963,13 @@ getAddressesFromLocationName(request: GeoCodeRequest) : Promise&lt;Array&lt;GeoA ...@@ -962,13 +963,13 @@ getAddressesFromLocationName(request: GeoCodeRequest) : Promise&lt;Array&lt;GeoA
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| request | [GeoCodeRequest](#geocoderequest) | 是 | 设置地理编码请求的相关参数。 | | request | [GeoCodeRequest](#geocoderequest) | 是 | 设置地理编码请求的相关参数。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 设置接收地理编码请求的回调参数。 | | Promise&lt;Array&lt;[GeoAddress](#geoaddress)&gt;&gt; | 设置接收地理编码请求的回调参数。 |
...@@ -994,7 +995,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback&lt;number&gt;) : void; ...@@ -994,7 +995,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback&lt;number&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;number&gt; | 是 | 用来接收GNSS芯片缓存位置个数的回调。 | | callback | AsyncCallback&lt;number&gt; | 是 | 用来接收GNSS芯片缓存位置个数的回调。 |
...@@ -1024,7 +1025,7 @@ getCachedGnssLocationsSize() : Promise&lt;number&gt;; ...@@ -1024,7 +1025,7 @@ getCachedGnssLocationsSize() : Promise&lt;number&gt;;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | 返回GNSS缓存位置的个数。 | | Promise&lt;number&gt; | 返回GNSS缓存位置的个数。 |
...@@ -1049,7 +1050,7 @@ flushCachedGnssLocations(callback: AsyncCallback&lt;boolean&gt;) : void; ...@@ -1049,7 +1050,7 @@ flushCachedGnssLocations(callback: AsyncCallback&lt;boolean&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收清空GNSS芯片缓存位置操作的结果。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收清空GNSS芯片缓存位置操作的结果。 |
...@@ -1079,7 +1080,7 @@ flushCachedGnssLocations() : Promise&lt;boolean&gt;; ...@@ -1079,7 +1080,7 @@ flushCachedGnssLocations() : Promise&lt;boolean&gt;;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 清空所有GNSS缓存位置是否成功。 | | Promise&lt;boolean&gt; | 清空所有GNSS缓存位置是否成功。 |
...@@ -1104,7 +1105,7 @@ sendCommand(command: LocationCommand, callback: AsyncCallback&lt;boolean&gt;) : ...@@ -1104,7 +1105,7 @@ sendCommand(command: LocationCommand, callback: AsyncCallback&lt;boolean&gt;) :
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| command | LocationCommand | 是 | 指定目标场景,和将要发送的命令(字符串)。 | | command | LocationCommand | 是 | 指定目标场景,和将要发送的命令(字符串)。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收命令发送的结果。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 用来接收命令发送的结果。 |
...@@ -1136,13 +1137,13 @@ sendCommand(command: LocationCommand) : Promise&lt;boolean&gt;; ...@@ -1136,13 +1137,13 @@ sendCommand(command: LocationCommand) : Promise&lt;boolean&gt;;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| command | LocationCommand | 是 | 指定目标场景,和将要发送的命令(字符串)。 | | command | LocationCommand | 是 | 指定目标场景,和将要发送的命令(字符串)。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 表示命令发送成功或失败。 | | Promise&lt;boolean&gt; | 表示命令发送成功或失败。 |
...@@ -1170,7 +1171,7 @@ isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback&l ...@@ -1170,7 +1171,7 @@ isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback&l
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 表示用户是否同意定位服务隐私申明。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 表示用户是否同意定位服务隐私申明。 |
...@@ -1203,13 +1204,13 @@ isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise&lt;boolean&gt; ...@@ -1203,13 +1204,13 @@ isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise&lt;boolean&gt;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 表示用户是否同意定位服务隐私申明。 | | Promise&lt;boolean&gt; | 表示用户是否同意定位服务隐私申明。 |
...@@ -1236,7 +1237,7 @@ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed: boolean ...@@ -1236,7 +1237,7 @@ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed: boolean
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 |
| isConfirmed | boolean | 是 | 表示用户是否同意定位服务隐私申明。 | | isConfirmed | boolean | 是 | 表示用户是否同意定位服务隐私申明。 |
...@@ -1270,14 +1271,14 @@ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolea ...@@ -1270,14 +1271,14 @@ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolea
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 |
| isConfirmed | boolean | 是 | 表示用户是否同意定位服务隐私申明。 | | isConfirmed | boolean | 是 | 表示用户是否同意定位服务隐私申明。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 表示操作是否成功。 | | Promise&lt;boolean&gt; | 表示操作是否成功。 |
...@@ -1300,7 +1301,7 @@ getCountryCode(callback: AsyncCallback&lt;CountryCode&gt;) : void; ...@@ -1300,7 +1301,7 @@ getCountryCode(callback: AsyncCallback&lt;CountryCode&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;CountryCode&gt; | 是 | 用来接收国家码。 | | callback | AsyncCallback&lt;CountryCode&gt; | 是 | 用来接收国家码。 |
...@@ -1332,7 +1333,7 @@ getCountryCode() : Promise&lt;CountryCode&gt;; ...@@ -1332,7 +1333,7 @@ getCountryCode() : Promise&lt;CountryCode&gt;;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;CountryCode&gt; | 返回国家码。 | | Promise&lt;CountryCode&gt; | 返回国家码。 |
...@@ -1361,7 +1362,7 @@ enableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback&l ...@@ -1361,7 +1362,7 @@ enableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback&l
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | 否 | 指示在什么场景下使能位置模拟功能。 | | scenario | LocationRequestScenario | 否 | 指示在什么场景下使能位置模拟功能。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1392,14 +1393,14 @@ enableLocationMock(scenario?: LocationRequestScenario) : Promise&lt;void&gt;; ...@@ -1392,14 +1393,14 @@ enableLocationMock(scenario?: LocationRequestScenario) : Promise&lt;void&gt;;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | 否 | 指示使能什么场景的位置模拟功能。如果不携带该参数则表示使能所有场景的位置模拟功能。 | | scenario | LocationRequestScenario | 否 | 指示使能什么场景的位置模拟功能。如果不携带该参数则表示使能所有场景的位置模拟功能。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1433,7 +1434,7 @@ disableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback& ...@@ -1433,7 +1434,7 @@ disableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback&
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | 否 | 指示去使能某个场景的位置模拟功能。如果不携带该参数则表示去使能所有场景的位置模拟功能。 | | scenario | LocationRequestScenario | 否 | 指示去使能某个场景的位置模拟功能。如果不携带该参数则表示去使能所有场景的位置模拟功能。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1465,13 +1466,13 @@ disableLocationMock(scenario?: LocationRequestScenario) : Promise&lt;void&gt;; ...@@ -1465,13 +1466,13 @@ disableLocationMock(scenario?: LocationRequestScenario) : Promise&lt;void&gt;;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| scenario | LocationRequestScenario | 否 | 指示去使能某个场景的位置模拟功能。如果不携带该参数则表示去使能所有场景的位置模拟功能。 | | scenario | LocationRequestScenario | 否 | 指示去使能某个场景的位置模拟功能。如果不携带该参数则表示去使能所有场景的位置模拟功能。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1505,7 +1506,7 @@ setMockedLocations(config: LocationMockConfig, callback: AsyncCallback&lt;void&g ...@@ -1505,7 +1506,7 @@ setMockedLocations(config: LocationMockConfig, callback: AsyncCallback&lt;void&g
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | LocationMockConfig | 是 | 指示位置模拟的配置参数,包含模拟位置上报的时间间隔和模拟位置数组。 | | config | LocationMockConfig | 是 | 指示位置模拟的配置参数,包含模拟位置上报的时间间隔和模拟位置数组。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1543,13 +1544,13 @@ setMockedLocations(config: LocationMockConfig) : Promise&lt;void&gt;; ...@@ -1543,13 +1544,13 @@ setMockedLocations(config: LocationMockConfig) : Promise&lt;void&gt;;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | LocationMockConfig | 是 | 指示位置模拟的配置参数,包含模拟位置上报的时间间隔和模拟位置数组。 | | config | LocationMockConfig | 是 | 指示位置模拟的配置参数,包含模拟位置上报的时间间隔和模拟位置数组。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1591,7 +1592,7 @@ enableReverseGeocodingMock(callback: AsyncCallback&lt;void&gt;) : void; ...@@ -1591,7 +1592,7 @@ enableReverseGeocodingMock(callback: AsyncCallback&lt;void&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1625,7 +1626,7 @@ enableReverseGeocodingMock() : Promise&lt;void&gt;; ...@@ -1625,7 +1626,7 @@ enableReverseGeocodingMock() : Promise&lt;void&gt;;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1658,7 +1659,7 @@ disableReverseGeocodingMock(callback: AsyncCallback&lt;void&gt;) : void; ...@@ -1658,7 +1659,7 @@ disableReverseGeocodingMock(callback: AsyncCallback&lt;void&gt;) : void;
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1692,7 +1693,7 @@ disableReverseGeocodingMock() : Promise&lt;void&gt;; ...@@ -1692,7 +1693,7 @@ disableReverseGeocodingMock() : Promise&lt;void&gt;;
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1725,7 +1726,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;, ca ...@@ -1725,7 +1726,7 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;, ca
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| mockInfos | Array&lt;ReverseGeocodingMockInfo&gt; | 是 | 指示逆地理编码模拟功能的配置参数数组。逆地理编码模拟功能的配置参数包含了一个位置和一个地名。 | | mockInfos | Array&lt;ReverseGeocodingMockInfo&gt; | 是 | 指示逆地理编码模拟功能的配置参数数组。逆地理编码模拟功能的配置参数包含了一个位置和一个地名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1734,11 +1735,11 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;, ca ...@@ -1734,11 +1735,11 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;, ca
```js ```js
var mockInfos = [ var mockInfos = [
{"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}},
]; ];
geolocation.setReverseGeocodingMockInfo(mockInfos, (err, data) => { geolocation.setReverseGeocodingMockInfo(mockInfos, (err, data) => {
if (err) { if (err) {
...@@ -1763,13 +1764,13 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;) : ...@@ -1763,13 +1764,13 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;) :
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| mockInfos | Array&lt;ReverseGeocodingMockInfo&gt; | 是 | 指示逆地理编码模拟功能的配置信息数组。逆地理编码模拟功能的配置信息包含了一个位置和一个地名。 | | mockInfos | Array&lt;ReverseGeocodingMockInfo&gt; | 是 | 指示逆地理编码模拟功能的配置信息数组。逆地理编码模拟功能的配置信息包含了一个位置和一个地名。 |
**返回值** **返回值**
| 参数名 | 说明 | | 参数名 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | | Promise&lt;void&gt; | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 |
...@@ -1777,11 +1778,11 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;) : ...@@ -1777,11 +1778,11 @@ setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;) :
```js ```js
var mockInfos = [ var mockInfos = [
{"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}},
{"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}},
]; ];
geolocation.setReverseGeocodingMockInfo(mockInfos) geolocation.setReverseGeocodingMockInfo(mockInfos)
.then((result) => { .then((result) => {
......
...@@ -276,7 +276,7 @@ Codec MIME类型枚举。 ...@@ -276,7 +276,7 @@ Codec MIME类型枚举。
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------------------- | ----------------------------------- | ---- | ---- | ------------------------------------------------------------ | | ------------------------------- | ----------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| src | string | 是 | 是 | 音频媒体URI,支持当前主流的频格式(m4a、aac、mp3、ogg、wav)。<br>**支持路径示例**<br>1. fd类型播放:fd://xx<br>![](figures/zh-cn_image_url.png)<br>2. http网络播放: http://xx<br/>3. https网络播放: https://xx<br/>4. hls网络播放路径:http://xx或者https://xx<br/>**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 | | src | string | 是 | 是 | 音频媒体URI,支持当前主流的频格式(m4a、aac、mp3、ogg、wav)。<br>**支持路径示例**<br>1. fd类型播放:fd://xx<br>![](figures/zh-cn_image_url.png)<br>2. http网络播放: http://xx<br/>3. https网络播放: https://xx<br/>4. hls网络播放路径:http://xx或者https://xx<br/>**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 |
| fdSrc<sup>9+</sup> | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 音频媒体文件描述,使用场景:应用中的音频资源被连续存储在同一个文件中。<br/>**使用示例**<br/>假设一个连续存储的音乐文件: <br/>音乐1(地址偏移:0,字节长度:100)<br/>音乐2(地址偏移:101,字节长度:50)<br/>音乐3(地址偏移:151,字节长度:150)<br/>1. 播放音乐1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }<br/>2. 播放音乐2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }<br/>3. 播放音乐3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }<br/>假设是一个独立的音乐文件: 请使用src=fd://xx <br/>**注意事项**<br/>**需要权限:** ohos.permission.READ_MEDIA | | fdSrc<sup>9+</sup> | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 音频媒体文件描述,使用场景:应用中的音频资源被连续存储在同一个文件中。<br/>**使用示例**<br/>假设一个连续存储的音乐文件: <br/>音乐1(地址偏移:0,字节长度:100)<br/>音乐2(地址偏移:101,字节长度:50)<br/>音乐3(地址偏移:151,字节长度:150)<br/>1. 播放音乐1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }<br/>2. 播放音乐2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }<br/>3. 播放音乐3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }<br/>假设是一个独立的音乐文件: 请使用src=fd://xx <br/>**注意事项**<br/>**需要权限:** ohos.permission.READ_MEDIA |
| loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 | | loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 |
| audioInterruptMode<sup>9+</sup> | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 | | audioInterruptMode<sup>9+</sup> | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 |
...@@ -651,7 +651,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 ...@@ -651,7 +651,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件
| 名称 | 类型 | 描述 | | 名称 | 类型 | 描述 |
| ------------------ | ------ | ---------------------------------------------- | | ------------------ | ------ | ---------------------------------------------- |
| idle | string | 音频播放空闲,dateload/reset成功后处于此状态。 | | idle | string | 音频播放空闲,dataload/reset成功后处于此状态。 |
| playing | string | 音频正在播放,play成功后处于此状态。 | | playing | string | 音频正在播放,play成功后处于此状态。 |
| paused | string | 音频暂停播放,pause成功后处于此状态。 | | paused | string | 音频暂停播放,pause成功后处于此状态。 |
| stopped | string | 音频播放停止,stop/播放结束后处于此状态。 | | stopped | string | 音频播放停止,stop/播放结束后处于此状态。 |
...@@ -695,7 +695,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 ...@@ -695,7 +695,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ | | ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| url<sup>8+</sup> | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。<br>**支持路径示例**<br>1. fd类型播放:fd://xx<br>![](figures/zh-cn_image_url.png)<br>2. http网络播放: http://xx<br/>3. https网络播放: https://xx<br/>4. hls网络播放路径:http://xx或者https://xx<br/>**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 | | url<sup>8+</sup> | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。<br>**支持路径示例**<br>1. fd类型播放:fd://xx<br>![](figures/zh-cn_image_url.png)<br>2. http网络播放: http://xx<br/>3. https网络播放: https://xx<br/>4. hls网络播放路径:http://xx或者https://xx<br/>**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 |
| fdSrc<sup>9+</sup> | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 音频媒体文件描述,使用场景:应用中的音频资源被连续存储在同一个文件中。<br/>**使用示例**<br/>假设一个连续存储的音乐文件: <br/>音乐1(地址偏移:0,字节长度:100)<br/>音乐2(地址偏移:101,字节长度:50)<br/>音乐3(地址偏移:151,字节长度:150)<br/>1. 播放音乐1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }<br/>2. 播放音乐2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }<br/>3. 播放音乐3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }<br/>假设是一个独立的音乐文件: 请使用src=fd://xx <br/>**注意事项**<br/>**需要权限:** ohos.permission.READ_MEDIA | | fdSrc<sup>9+</sup> | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 视频媒体文件描述,使用场景:应用中的视频资源被连续存储在同一个文件中。<br/>**使用示例**<br/>假设一个连续存储的音乐文件: <br/>视频1(地址偏移:0,字节长度:100)<br/>视频2(地址偏移:101,字节长度:50)<br/>视频3(地址偏移:151,字节长度:150)<br/>1. 播放视频1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }<br/>2. 播放视频2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }<br/>3. 播放视频3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }<br/>假设是一个独立的视频文件: 请使用src=fd://xx <br/>**注意事项**<br/>**需要权限:** ohos.permission.READ_MEDIA |
| loop<sup>8+</sup> | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 | | loop<sup>8+</sup> | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 |
| videoScaleType<sup>9+</sup> | [VideoScaleType](#videoscaletype9) | 是 | 是 | 视频缩放模式。 | | videoScaleType<sup>9+</sup> | [VideoScaleType](#videoscaletype9) | 是 | 是 | 视频缩放模式。 |
| audioInterruptMode<sup>9+</sup> | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 | | audioInterruptMode<sup>9+</sup> | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 |
...@@ -1537,7 +1537,7 @@ videoPlayer.on('error', (error) => { // 设置'error'事件回调 ...@@ -1537,7 +1537,7 @@ videoPlayer.on('error', (error) => { // 设置'error'事件回调
console.info(`video error called, errCode is ${error.code}`); // 打印错误码 console.info(`video error called, errCode is ${error.code}`); // 打印错误码
console.info(`video error called, errMessage is ${error.message}`);// 打印错误类型详细描述 console.info(`video error called, errMessage is ${error.message}`);// 打印错误类型详细描述
}); });
videoPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 videoPlayer.url = 'fd://error'; //设置错误的播放地址,触发'error'事件
``` ```
### on('availableBitratesCollect')<sup>9+</sup> ### on('availableBitratesCollect')<sup>9+</sup>
......
...@@ -257,17 +257,12 @@ createAsset(mediaType: MediaType, displayName: string, relativePath: string): Pr ...@@ -257,17 +257,12 @@ createAsset(mediaType: MediaType, displayName: string, relativePath: string): Pr
**示例:** **示例:**
``` ```
async function example() { let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
// 使用Promise方式创建Image类型文件 media.getPublicDirectory(DIR_CAMERA).then(function(dicResult){
let mediaType = mediaLibrary.MediaType.IMAGE; console.info("getPublicDirectory successfully:"+ JSON.stringify(dicResult));
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; }).catch(function(err){
const path = await media.getPublicDirectory(DIR_IMAGE); console.info("getPublicDirectory failed with error:"+ err);
media.createAsset(mediaType, "image01.jpg", path + 'myPicture/').then (function (asset) { });
console.info("createAsset successfully:"+ JSON.stringify(asset));
}).catch(function(err){
console.info("createAsset failed with error:"+ err);
});
}
``` ```
### getPublicDirectory<sup>8+</sup> ### getPublicDirectory<sup>8+</sup>
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
本模块主要由时间、时区和定时三大功能组成。其中,定时服务用来管理和使用时间、时区。开发者可以通过对系统进行设置、获取等操作管理系统时间、时区,也可以通过定时功能实现定时服务如闹钟服务等。 本模块主要由时间、时区和定时三大功能组成。其中,定时服务用来管理和使用时间、时区。开发者可以通过对系统进行设置、获取等操作管理系统时间、时区,也可以通过定时功能实现定时服务如闹钟服务等。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >- 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>- 本模块接口为系统接口,三方应用不支持调用。
## 导入模块 ## 导入模块
...@@ -22,7 +22,7 @@ setTime(time : number, callback : AsyncCallback&lt;void&gt;) : void ...@@ -22,7 +22,7 @@ setTime(time : number, callback : AsyncCallback&lt;void&gt;) : void
**需要权限:** ohos.permission.SET_TIME **需要权限:** ohos.permission.SET_TIME
**系统能力:** SystemCapability.Miscservices.Time **系统能力:** SystemCapability.MiscServices.Time
**参数:** **参数:**
...@@ -201,7 +201,7 @@ getRealActiveTime(isNano?: boolean): Promise&lt;number&gt; ...@@ -201,7 +201,7 @@ getRealActiveTime(isNano?: boolean): Promise&lt;number&gt;
## systemTime.getRealTime<sup>8+</sup> ## systemTime.getRealTime<sup>8+</sup>
getRealTime(callback: AsyncCallback&lt;number&gt;): void getRealTime(isNano?: boolean, callback: AsyncCallback&lt;number&gt;): void
获取自系统启动以来经过的时间,包括深度睡眠时间,使用callback形式返回结果。 获取自系统启动以来经过的时间,包括深度睡眠时间,使用callback形式返回结果。
...@@ -229,7 +229,7 @@ getRealTime(callback: AsyncCallback&lt;number&gt;): void ...@@ -229,7 +229,7 @@ getRealTime(callback: AsyncCallback&lt;number&gt;): void
## systemTime.getRealTime<sup>8+</sup> ## systemTime.getRealTime<sup>8+</sup>
getRealTime(): Promise&lt;number&gt; getRealTime(isNano?: boolean): Promise&lt;number&gt;
获取自系统启动以来经过的时间,包括深度睡眠时间,使用Promise形式返回结果。 获取自系统启动以来经过的时间,包括深度睡眠时间,使用Promise形式返回结果。
......
# 设置系统时间
本模块主要由时间、时区和定时三大功能组成。其中,定时服务用来管理和使用时间、时区。开发者可以通过对系统进行设置、获取等操作管理系统时间、时区,也可以通过定时功能实现定时服务如闹钟服务等。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
>- 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>- 本模块接口为系统接口,三方应用不支持调用。
## 导入模块
```
import systemTimer from '@ohos.systemTimer';
```
## systemTime.createTimer
createTimer(options: TimerOptions, callback: AsyncCallback&lt;number&gt;): void
创建定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------| ---- | --------------------------------------------------------------------------------------- |
| 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,定时器到期后通知。 |
**返回值:**
| 类型 | 说明 |
| ------------------------- | ------------------------------------------------------------ |
| syncCallback&lt;number&gt;| 以回调函数的形式返回定时器的ID。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.createTimer
createTimer(options: TimerOptions): Promise&lt;number&gt;
创建定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------| ---- | --------------------------------------------------------------------------------------- |
| 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,定时器到期后通知。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------------------------------------------ |
| Promise&lt;number&gt; | 以Promise形式返回定时器的ID。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.startTimer
startTimer(timer: number, triggerTime: number, callback: AsyncCallback&lt;void&gt;): void
开始定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 |
| triggerTime | number | 是 | 定时器的触发时间,单位:毫秒。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.startTimer
startTimer(timer: number, triggerTime: number): Promise&lt;void&gt;
开始定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。
| triggerTime | number | 是 | 定时器的触发时间,单位:毫秒。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.stopTimer
stopTimer(timer: number, callback: AsyncCallback&lt;void&gt;): void
停止定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.stopTimer
stopTimer(timer: number): Promise&lt;void&gt;
停止定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.destroyTimer
destroyTimer(timer: number, callback: AsyncCallback&lt;void&gt;): void
销毁定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
## systemTime.destroyTimer
destroyTimer(timer: number): Promise&lt;void&gt;
销毁定时器。
**系统能力:** SystemCapability.MiscServices.Time
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| timer | number | 是 | 定时器的ID。 |
**示例:**
```js
var options = TimerOptions {
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));
});
```
\ No newline at end of file
...@@ -2724,7 +2724,7 @@ promise.then((data)=> { ...@@ -2724,7 +2724,7 @@ promise.then((data)=> {
setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): void setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback&lt;void&gt;): void
设置窗口是否为隐私模式,使用callback异步回调。 设置窗口是否为隐私模式,使用callback异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core **系统能力:** SystemCapability.WindowManager.WindowManager.Core
...@@ -2753,7 +2753,7 @@ windowClass.setPrivacyMode(isPrivacyMode, (err, data) => { ...@@ -2753,7 +2753,7 @@ windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
setPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt; setPrivacyMode(isPrivacyMode: boolean): Promise&lt;void&gt;
设置窗口是否为隐私模式,使用Promise异步回调。 设置窗口是否为隐私模式,使用Promise异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core **系统能力:** SystemCapability.WindowManager.WindowManager.Core
...@@ -2781,6 +2781,25 @@ promise.then((data)=> { ...@@ -2781,6 +2781,25 @@ promise.then((data)=> {
}); });
``` ```
### setSnapshotSkip<sup>9+</sup>
setSnapshotSkip(isSkip: boolean): void
截屏录屏是否忽略当前窗口。
此接口为系统接口。
**系统能力:** SystemCapability.WindowManager.WindowManager.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ------- | ---- | -------------------- |
| isSkip | boolean | 是 | 截屏录屏是否忽略当前窗口,默认为false。<br>true表示忽略当前窗口,false表示不忽略当前窗口。</br> |
```js
var isSkip = true;
windowClass.setSnapshotSkip(isSkip);
```
### setTouchable<sup>7+</sup> ### setTouchable<sup>7+</sup>
setTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void setTouchable(isTouchable: boolean, callback: AsyncCallback&lt;void&gt;): void
......
...@@ -819,6 +819,7 @@ ...@@ -819,6 +819,7 @@
- [@ohos.screenLock (锁屏管理)](reference/apis/js-apis-screen-lock.md) - [@ohos.screenLock (锁屏管理)](reference/apis/js-apis-screen-lock.md)
- [@ohos.systemTime (设置系统时间)](reference/apis/js-apis-system-time.md) - [@ohos.systemTime (设置系统时间)](reference/apis/js-apis-system-time.md)
- [@ohos.wallpaper (壁纸)](reference/apis/js-apis-wallpaper.md) - [@ohos.wallpaper (壁纸)](reference/apis/js-apis-wallpaper.md)
- [@ohos.systemTimer(设置系统时间)](js-apis-system-timer.md)
- [Timer (定时器)](reference/apis/js-apis-timer.md) - [Timer (定时器)](reference/apis/js-apis-timer.md)
- 设备管理 - 设备管理
- [@ohos.batteryInfo (电量信息)](reference/apis/js-apis-battery-info.md) - [@ohos.batteryInfo (电量信息)](reference/apis/js-apis-battery-info.md)
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
**图 1** **子系统架构图**<a name="fig4460722185514"></a> **图 1** **子系统架构图**<a name="fig4460722185514"></a>
![](figures/zh-1.png) ![](figures/location_zh-1.png)
## 目录<a name="section161941989596"></a> ## 目录<a name="section161941989596"></a>
......
# OpenHarmony启用应用沙箱机制-适配指导
## 验证流程
![](figures\verification-process.png)
1. 取发布版本自验证功能,如果功能正常,则适配流程结束。
2. 取版本验证发现自身应用功能异常,则进行问题定位,通过分析代码识别到问题点,通过[适配流程](#适配流程)中的方法来进行文件访问模型的适配。
3. 适配完毕之后,重新验证功能,功能正常则适配流程结束。功能依旧存在问题则重新回到第二步继续定位,直到问题解决为止。
## 适配流程
![](figures\adaptation-process.png)
1. 定位出app异常的问题点之后,识别该问题是否是app源代码访问路径出错导致的,是否是访问有效文件可以通过下一章节的[沙箱文件访问规格清单](#沙箱文件访问规格清单)自查。
2. 如果是app源码访问无效路径,则可以通过调整访问路径的策略,将原来访问/data目录从绝对路径访问方式调整为使用context接口进行访问,具体请见context接口使用说明:
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ability/context-userguide.md
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-context.md
https://gitee.com/OpenHarmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-Context.md
3. 如果是app调用三方模块,异常调用栈出现在三方模块中,而app源码没有使用绝对路径去访问文件,则适配过程如下:
- 通知三方模块,让其访问文件路径通过context接口进行访问而非使用绝对路径的方式。
- 如果三方模块是个公共模块,除了给appspawn孵化的进程使用之外还给native进程使用,则可以将三方模块抽象成一个服务,应用通过ipc的方式去访问服务。
## 沙箱文件访问规格清单
**应用根目录访问路径清单**
| 路径名 | 备注 |
| --------------------- | ------------------------------------------ |
| bin | 存放着各种二进制文件 |
| config | 配置目录 |
| data | 应用数据目录 |
| dev | 设备节点 |
| etc | /system/etc的软连接 |
| init | /system/bin/init的软连接 |
| lib | /system/lib的软连接 |
| mnt | 挂载目录 |
| proc | proc文件系统目录 |
| sys | sys文件系统目录 |
| sys_prod | 此目录不同设备上存在差异,部分设备无此目录 |
| system/app | 系统目录资源 |
| system/fonts | 系统文字资源 |
| system/lib | 系统库 |
| system/data | 系统目录资源 |
| system/usr | 系统目录资源 |
| system/profile | 系统目录资源 |
| system/bin | 系统程序 |
| system/etc | 系统配置 |
| vendor/lib/chipsetsdk | 芯片组件目录,目前仅挂载chipsetsdk |
**应用数据目录访问路径清单**
| 路径名 | 备注 |
| ---------------------------------- | ------------------------------------------------------------ |
| /data | 应用数据目录 |
| /data/storage | 应用数据 |
| /data/bundles | 所有应用安装目录,仅应用apl权限为BASIC及以上权限的应用可访问 |
| /data/storage/el1 | 应用el1加密级别数据目录 |
| /data/storage/el2 | 应用el2加密级别数据目录 |
| /data/storage/el1/base | 应用el1加密级别数据目录 |
| /data/storage/el1/bundles | 应用el1加密级别应用安装包目录 |
| /data/storage/el1/database | 应用el1加密级别数据库存储目录 |
| /data/storage/el2/base | 应用el2加密级别数据目录 |
| /data/storage/el2/database | 应用el2加密级别数据库存储目录 |
| /data/storage/el2/auth_groups | 应用el2加密级别无账号分布式数据融合目录 |
| /data/storage/el2/distributedfiles | 应用el2加密级别有账号分布式数据融合目录 |
启用应用沙箱之后,应用命名空间内无法再访问物理路径下数据目录的访问方式,而是只能通过context接口来访问应用的数据目录,具体访问应用数据目录的方式可以通过context接口进行访问,参考[适配流程](#适配流程)中的context接口访问链接了解更多细节。
应用的物理数据目录跟沙箱数据目录存储的是同一份应用的数据,通过bind mount技术进行关联,改动任意一处会影响另一处的数据。应用在命名空间下访问数据,只能通过沙箱路径来访问,下面列出应用的数据目录在物理路径跟沙箱路径下的对应关系。
**应用的数据目录在物理路径跟沙箱路径下的对应关系**
| 物理路径 | 沙箱路径 | 备注 |
| ------------------------------------------------------------ | ---------------------------------- | --------------------------------------- |
| /data/app/el1/bundle/public/\<PackageName>\ | /data/storage/el1/bundle | 应用安装包目录 |
| /data/app/el1/\<USERID\>/base/\<PACKAGENAME\> | /data/storage/el1/base | 应用el1级别加密数据目录 |
| /data/app/el2/\<USERID\>/base/\<PACKAGENAME\> | /data/storage/el2/base | 应用el2级别加密数据目录 |
| /data/app/el1/\<USERID\>/database/\<PACKAGENAME\> | /data/storage/el1/database | 应用el1级别加密数据库目录 |
| /data/app/el2/\<USERID\>/database/\<PACKAGENAME\> | /data/storage/el2/database | 应用el2级别加密数据库目录 |
| /mnt/hmdfs/\<USERID\>/account/merge_view/data/\<PACKAGENAME\> | /data/storage/el2/distributedfiles | 应用el2加密级别有账号分布式数据融合目录 |
| /mnt/hmdfs/\<USERID\>/non_account/merge_view/data/ | /data/storage/el2/auth_groups | 应用el2加密级别无账号分布式数据融合目录 |
| /mnt/hmdfs/ | /mnt/hmdfs/ | 分布式文件系统目录 |
> **说明:**<br>\<USERID\>代表当前的用户ID
> \<PACKAGENAME\>代表当前的应用包名
更多物理路径沙箱路径的对应关系,请访问:
https://gitee.com/OpenHarmony/startup_appspawn/blob/master/appdata-sandbox64.json
## 案例:Contacts.hap拨号场景无法触发音频问题
联系人应用沙箱整改前访问资源文件的方式如下,可以看到访问的路径是绝对路径硬编码,为/data/app/el1此类目录,而此类目录在应用沙箱中是访问受限的,所以会造成访问异常。
![](figures\example1.png)
此代码的核心是想通过fileIO接口open固定路径得到fdNumber,使用fdNumber去做接下来的文件访问。FileIO是通过路径得到fdNumber的,而现在路径访问已经被限制了,因此考虑用其他的接口去获取fdNumber即可,
查阅OpenHarmony相关开发手册得知,使用resourceManager可以获取fdNumber。
更改后的代码如下:
![](figures\example2.png)
## 规避方案
如果发现应用异常且定位没有结论,可以使用关闭进程沙箱的方式来规避问题,规避方式如下:
1. 打开OpenHarmony startup_appspawn仓的源码,找到应用沙箱配置文件,根据自己编译类型修改对应的配置代码文件。
32位修改:https://gitee.com/OpenHarmony/startup_appspawn/blob/master/appdata-sandbox.json
64位修改:https://gitee.com/OpenHarmony/startup_appspawn/blob/master/appdata-sandbox.json
2. 在json中文件找到camera的配置,在下方参照camera的配置新建一条自身应用的配置,将包名改为自身应用报名,其他项保持跟camera一致即可,OFF字段代表关闭进程沙箱。
![](figures\example3.png)
\ No newline at end of file
# 3.2 beta2相对3.2 beta1变更详细说明
## 启用应用沙箱机制
基于namespace机制强化OpenHarmony应用数据安全,建立应用沙盒机制,增加目录可见性数据访问防线,减少了应用数据和用户隐私信息泄露,建立了更加严格安全的应用沙盒隔离能力。
同时也解决了目录混乱、文件访问方式多途径造成的文件管理的垃圾文件、文件混乱等体验问题和并发稳定性问题。
**变更影响**
OpenHarmony启用应用沙箱机制后,所有被appspawn进程孵化的应用访问资源会受到应用沙箱的限制。
如果应用没有适配应用沙箱的文件访问模型,则会导致应用功能异常。
应用对于/data目录下文件的访问,需要将所有硬编码路径访问的方式调整为使用context接口访问,具体请见[适配流程](application-sandbox-adaptation-guide.md#适配流程)
**关键的接口/组件变更**
OpenHarmony应用沙箱组件
**适配指导**
请参考[适配指导](application-sandbox-adaptation-guide.md)
## 增加对于自定义组件Struct的编译校验
**变更1**:自定义组件Struct的生命周期函数(比如aboutToAppear)不能使用private修饰。
**变更影响**
旧版本只有编辑器做了校验,新版本编译也加了校验报错。
**关键的接口/组件变更**
**适配指导**
当出现以下情况时,将private修饰去掉,即可通过编译。
![](figures\compile-change1-1.png)
![](figures\compile-change1-2.png)
**变更2:**自定义组件Struct的成员属性不能和内置属性方法名重名。
**变更影响**
与内置属性方法名重名的Struct的成员属性无法通过校验。
**关键的接口/组件变更**
**适配指导**
当出现以下情况时,修改属性名,使其与内置属性方法名不重名。
![](figures\compile-change2-1.png)
![](figures\compile-change2-2.png)
\ No newline at end of file
...@@ -125,7 +125,10 @@ ...@@ -125,7 +125,10 @@
- [资源调度](release-notes/api-change/v3.1-Release/js-apidiff-resource-scheduler_api-9-canary.md) - [资源调度](release-notes/api-change/v3.1-Release/js-apidiff-resource-scheduler_api-9-canary.md)
- [窗口管理](release-notes/api-change/v3.1-Release/js-apidiff-window_api-9-canary.md) - [窗口管理](release-notes/api-change/v3.1-Release/js-apidiff-window_api-9-canary.md)
- [Native API差异报告](release-notes/api-change/v3.1-Release/native-apidiff-v3.1-release.md) - [Native API差异报告](release-notes/api-change/v3.1-Release/native-apidiff-v3.1-release.md)
- 变更说明
- OpenHamrony 3.2 Beta2
- [3.2 beta2相对3.2 beta1变更详细说明](release-notes\changelog\v3.2-beta2\changelog-v3.2-beta2.md)
- [OpenHarmony启用应用沙箱机制-适配指导](release-notes\changelog\v3.2-beta2\application-sandbox-adaptation-guide.md)
- OpenHarmony三方组件 - OpenHarmony三方组件
- [OpenHarmony三方组件简介](third-party-components/third-party-components-introduction.md) - [OpenHarmony三方组件简介](third-party-components/third-party-components-introduction.md)
- [OpenHarmony JS/TS三方组件使用指导](third-party-components/npm-third-party-guide.md) - [OpenHarmony JS/TS三方组件使用指导](third-party-components/npm-third-party-guide.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册