提交 2f40310e 编写于 作者: Z zhangxiuping

Merge branch 'master' of https://gitee.com/knpingan/docs

Correct the system capability description error of some interfaces
Signed-off-by: Nzhangxiuping <zhangxiuping@huawei.com>
......@@ -14,49 +14,49 @@ The following table describes APIs available for obtaining device location infor
**Table 1** APIs for obtaining device location information
| API | Description |
| -------- | -------- |
| on(type:&nbsp;'locationChange',&nbsp;request:&nbsp;LocationRequest,&nbsp;callback:&nbsp;Callback&lt;Location&gt;)&nbsp;:&nbsp;void | Registers&nbsp;a&nbsp;listener&nbsp;for&nbsp;location&nbsp;changes&nbsp;with&nbsp;a&nbsp;location&nbsp;request&nbsp;initiated. |
| off(type:&nbsp;'locationChange',&nbsp;callback?:&nbsp;Callback&lt;Location&gt;)&nbsp;:&nbsp;void | Unregisters&nbsp;the&nbsp;listener&nbsp;for&nbsp;location&nbsp;changes&nbsp;with&nbsp;the&nbsp;corresponding&nbsp;location&nbsp;request&nbsp;deleted. |
| on(type:&nbsp;'locationServiceState',&nbsp;callback:&nbsp;Callback&lt;boolean&gt;)&nbsp;:&nbsp;void | Registers&nbsp;a&nbsp;listener&nbsp;for&nbsp;location&nbsp;service&nbsp;status&nbsp;change&nbsp;events. |
| off(type:&nbsp;'locationServiceState',&nbsp;callback:&nbsp;Callback&lt;boolean&gt;)&nbsp;:&nbsp;void | Unregisters&nbsp;the&nbsp;listener&nbsp;for&nbsp;location&nbsp;service&nbsp;status&nbsp;change&nbsp;events. |
| on(type:&nbsp;'cachedGnssLocationsReporting',&nbsp;request:&nbsp;CachedGnssLoactionsRequest,&nbsp;callback:&nbsp;Callback&lt;Array&lt;Location&gt;&gt;)&nbsp;:&nbsp;void; | Registers&nbsp;a&nbsp;listener&nbsp;for&nbsp;cached&nbsp;GNSS&nbsp;location&nbsp;reports. |
| off(type:&nbsp;'cachedGnssLocationsReporting',&nbsp;callback?:&nbsp;Callback&lt;Array&lt;Location&gt;&gt;)&nbsp;:&nbsp;void; | Unregisters&nbsp;the&nbsp;listener&nbsp;for&nbsp;cached&nbsp;GNSS&nbsp;location&nbsp;reports. |
| on(type:&nbsp;'gnssStatusChange',&nbsp;callback:&nbsp;Callback&lt;SatelliteStatusInfo&gt;)&nbsp;:&nbsp;void; | Registers&nbsp;a&nbsp;listener&nbsp;for&nbsp;satellite&nbsp;status&nbsp;change&nbsp;events. |
| off(type:&nbsp;'gnssStatusChange',&nbsp;callback?:&nbsp;Callback&lt;SatelliteStatusInfo&gt;)&nbsp;:&nbsp;void; | Unregisters&nbsp;the&nbsp;listener&nbsp;for&nbsp;satellite&nbsp;status&nbsp;change&nbsp;events. |
| on(type:&nbsp;'nmeaMessageChange',&nbsp;callback:&nbsp;Callback&lt;string&gt;)&nbsp;:&nbsp;void; | Registers&nbsp;a&nbsp;listener&nbsp;for&nbsp;GNSS&nbsp;NMEA&nbsp;message&nbsp;change&nbsp;events. |
| off(type:&nbsp;'nmeaMessageChange',&nbsp;callback?:&nbsp;Callback&lt;string&gt;)&nbsp;:&nbsp;void; | Unregisters&nbsp;the&nbsp;listener&nbsp;for&nbsp;GNSS&nbsp;NMEA&nbsp;message&nbsp;change&nbsp;events. |
| on(type:&nbsp;'fenceStatusChange',&nbsp;request:&nbsp;GeofenceRequest,&nbsp;want:&nbsp;WantAgent)&nbsp;:&nbsp;void; | Registers&nbsp;a&nbsp;listener&nbsp;for&nbsp;status&nbsp;change&nbsp;events&nbsp;of&nbsp;the&nbsp;specified&nbsp;geofence. |
| off(type:&nbsp;'fenceStatusChange',&nbsp;request:&nbsp;GeofenceRequest,&nbsp;want:&nbsp;WantAgent)&nbsp;:&nbsp;void; | Unregisters&nbsp;the&nbsp;listener&nbsp;for&nbsp;status&nbsp;change&nbsp;events&nbsp;of&nbsp;the&nbsp;specified&nbsp;geofence. |
| getCurrentLocation(request:&nbsp;CurrentLocationRequest,&nbsp;callback:&nbsp;AsyncCallback&lt;Location&gt;)&nbsp;:&nbsp;void | Obtains&nbsp;the&nbsp;current&nbsp;location.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| getCurrentLocation(request?:&nbsp;CurrentLocationRequest)&nbsp;:&nbsp;Promise&lt;Location&gt; | Obtains&nbsp;the&nbsp;current&nbsp;location.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| getLastLocation(callback:&nbsp;AsyncCallback&lt;Location&gt;)&nbsp;:&nbsp;void | Obtains&nbsp;the&nbsp;previous&nbsp;location.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| getLastLocation()&nbsp;:&nbsp;Promise&lt;Location&gt; | Obtains&nbsp;the&nbsp;previous&nbsp;location.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| isLocationEnabled(callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void | Checks&nbsp;whether&nbsp;the&nbsp;location&nbsp;service&nbsp;is&nbsp;enabled.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| isLocationEnabled()&nbsp;:&nbsp;Promise&lt;boolean&gt; | Checks&nbsp;whether&nbsp;the&nbsp;location&nbsp;service&nbsp;is&nbsp;enabled.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| requestEnableLocation(callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void | Requests&nbsp;to&nbsp;enable&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| requestEnableLocation()&nbsp;:&nbsp;Promise&lt;boolean&gt; | Requests&nbsp;to&nbsp;enable&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| enableLocation(callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void | Enables&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| enableLocation()&nbsp;:&nbsp;Promise&lt;boolean&gt; | Enables&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| disableLocation(callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void | Disables&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| disableLocation()&nbsp;:&nbsp;Promise&lt;boolean&gt; | Disables&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| getCachedGnssLocationsSize(callback:&nbsp;AsyncCallback&lt;number&gt;)&nbsp;:&nbsp;void; | Obtains&nbsp;the&nbsp;number&nbsp;of&nbsp;cached&nbsp;GNSS&nbsp;locations.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| getCachedGnssLocationsSize()&nbsp;:&nbsp;Promise&lt;number&gt;; | Obtains&nbsp;the&nbsp;number&nbsp;of&nbsp;cached&nbsp;GNSS&nbsp;locations.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| flushCachedGnssLocations(callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void; | Obtains&nbsp;all&nbsp;cached&nbsp;GNSS&nbsp;locations&nbsp;and&nbsp;clears&nbsp;the&nbsp;GNSS&nbsp;cache&nbsp;queue.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| flushCachedGnssLocations()&nbsp;:&nbsp;Promise&lt;boolean&gt;; | Obtains&nbsp;all&nbsp;cached&nbsp;GNSS&nbsp;locations&nbsp;and&nbsp;clears&nbsp;the&nbsp;GNSS&nbsp;cache&nbsp;queue.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| sendCommand(command:&nbsp;LocationCommand,&nbsp;callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void; | Sends&nbsp;extended&nbsp;commands&nbsp;to&nbsp;the&nbsp;location&nbsp;subsystem.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| sendCommand(command:&nbsp;LocationCommand)&nbsp;:&nbsp;Promise&lt;boolean&gt;; | Sends&nbsp;extended&nbsp;commands&nbsp;to&nbsp;the&nbsp;location&nbsp;subsystem.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| isLocationPrivacyConfirmed(type&nbsp;:&nbsp;LocationPrivacyType,&nbsp;callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void; | Checks&nbsp;whether&nbsp;a&nbsp;user&nbsp;agrees&nbsp;with&nbsp;the&nbsp;privacy&nbsp;statement&nbsp;of&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| isLocationPrivacyConfirmed(type&nbsp;:&nbsp;LocationPrivacyType,)&nbsp;:&nbsp;Promise&lt;boolean&gt;; | Checks&nbsp;whether&nbsp;a&nbsp;user&nbsp;agrees&nbsp;with&nbsp;the&nbsp;privacy&nbsp;statement&nbsp;of&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| setLocationPrivacyConfirmStatus(type&nbsp;:&nbsp;LocationPrivacyType,&nbsp;isConfirmed&nbsp;:&nbsp;boolean,&nbsp;callback:&nbsp;AsyncCallback&lt;boolean&gt;)&nbsp;:&nbsp;void; | Sets&nbsp;the&nbsp;user&nbsp;confirmation&nbsp;status&nbsp;for&nbsp;the&nbsp;privacy&nbsp;statement&nbsp;of&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;an&nbsp;asynchronous&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| setLocationPrivacyConfirmStatus(type&nbsp;:&nbsp;LocationPrivacyType,&nbsp;isConfirmed&nbsp;:&nbsp;boolean)&nbsp;:&nbsp;Promise&lt;boolean&gt;; | Sets&nbsp;the&nbsp;user&nbsp;confirmation&nbsp;status&nbsp;for&nbsp;the&nbsp;privacy&nbsp;statement&nbsp;of&nbsp;the&nbsp;location&nbsp;service.&nbsp;This&nbsp;function&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| API | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| on(type: 'locationChange', request: LocationRequest, callback: Callback&lt;Location&gt;) : void | Registers a listener for location changes with a location request initiated. |
| off(type: 'locationChange', callback?: Callback&lt;Location&gt;) : void | Unregisters the listener for location changes with the corresponding location request deleted. |
| on(type: 'locationServiceState', callback: Callback&lt;boolean&gt;) : void | Registers a listener for location service status change events. |
| off(type: 'locationServiceState', callback: Callback&lt;boolean&gt;) : void | Unregisters the listener for location service status change events. |
| on(type: 'cachedGnssLocationsReporting', request: CachedGnssLoactionsRequest, callback: Callback&lt;Array&lt;Location&gt;&gt;) : void; | Registers a listener for cached GNSS location reports. |
| off(type: 'cachedGnssLocationsReporting', callback?: Callback&lt;Array&lt;Location&gt;&gt;) : void; | Unregisters the listener for cached GNSS location reports. |
| on(type: 'gnssStatusChange', callback: Callback&lt;SatelliteStatusInfo&gt;) : void; | Registers a listener for satellite status change events. |
| off(type: 'gnssStatusChange', callback?: Callback&lt;SatelliteStatusInfo&gt;) : void; | Unregisters the listener for satellite status change events. |
| on(type: 'nmeaMessageChange', callback: Callback&lt;string&gt;) : void; | Registers a listener for GNSS NMEA message change events. |
| off(type: 'nmeaMessageChange', callback?: Callback&lt;string&gt;) : void; | Unregisters the listener for GNSS NMEA message change events. |
| on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; | Registers a listener for status change events of the specified geofence. |
| off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; | Unregisters the listener for status change events of the specified geofence. |
| getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;Location&gt;) : void | Obtains the current location. This API uses an asynchronous callback to return the result. |
| getCurrentLocation(request?: CurrentLocationRequest) : Promise&lt;Location&gt; | Obtains the current location. This API uses a promise to return the result. |
| getLastLocation(callback: AsyncCallback&lt;Location&gt;) : void | Obtains the previous location. This API uses an asynchronous callback to return the result. |
| getLastLocation() : Promise&lt;Location&gt; | Obtains the previous location. This API uses a promise to return the result. |
| isLocationEnabled(callback: AsyncCallback&lt;boolean&gt;) : void | Checks whether the location service is enabled. This API uses an asynchronous callback to return the result. |
| isLocationEnabled() : Promise&lt;boolean&gt; | Checks whether the location service is enabled. This API uses a promise to return the result. |
| requestEnableLocation(callback: AsyncCallback&lt;boolean&gt;) : void | Requests to enable the location service. This API uses an asynchronous callback to return the result. |
| requestEnableLocation() : Promise&lt;boolean&gt; | Requests to enable the location service. This API uses a promise to return the result. |
| enableLocation(callback: AsyncCallback&lt;boolean&gt;) : void | Enables the location service. This API uses an asynchronous callback to return the result. |
| enableLocation() : Promise&lt;boolean&gt; | Enables the location service. This API uses a promise to return the result. |
| disableLocation(callback: AsyncCallback&lt;boolean&gt;) : void | Disables the location service. This API uses an asynchronous callback to return the result. |
| disableLocation() : Promise&lt;boolean&gt; | Disables the location service. This API uses a promise to return the result. |
| getCachedGnssLocationsSize(callback: AsyncCallback&lt;number&gt;) : void; | Obtains the number of cached GNSS locations. This API uses an asynchronous callback to return the result. |
| getCachedGnssLocationsSize() : Promise&lt;number&gt;; | Obtains the number of cached GNSS locations. This API uses a promise to return the result. |
| flushCachedGnssLocations(callback: AsyncCallback&lt;boolean&gt;) : void; | Obtains all cached GNSS locations and clears the GNSS cache queue. This API uses an asynchronous callback to return the result.|
| flushCachedGnssLocations() : Promise&lt;boolean&gt;; | Obtains all cached GNSS locations and clears the GNSS cache queue. This API uses a promise to return the result.|
| sendCommand(command: LocationCommand, callback: AsyncCallback&lt;boolean&gt;) : void; | Sends extended commands to the location subsystem. This API uses an asynchronous callback to return the result.|
| sendCommand(command: LocationCommand) : Promise&lt;boolean&gt;; | Sends extended commands to the location subsystem. This API uses a promise to return the result. |
| isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback&lt;boolean&gt;) : void; | Checks whether a user agrees with the privacy statement of the location service. This API uses an asynchronous callback to return the result.|
| isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise&lt;boolean&gt;; | Checks whether a user agrees with the privacy statement of the location service. This API uses a promise to return the result.|
| setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean, callback: AsyncCallback&lt;boolean&gt;) : void; | Sets the user confirmation status for the privacy statement of the location service. This API uses an asynchronous callback to return the result.|
| setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean) : Promise&lt;boolean&gt;; | Sets the user confirmation status for the privacy statement of the location service. This API uses a promise to return the result.|
## How to Develop
To learn more about the APIs for obtaining device location information, see [Geolocation](../reference/apis/js-apis-geolocation.md).
1. Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user. For details, see the following section.
1. Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user as described below.
The system provides the following location permissions:
- ohos.permission.LOCATION
......@@ -64,9 +64,9 @@ To learn more about the APIs for obtaining device location information, see [Geo
The **ohos.permission.LOCATION** permission is a must if your application needs to access the device location information.
If your application needs to access the device location information when running on the background, it must be allowed to run on the background in the configuration file and also granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information even when your application moves to the background.
If your application needs to access the device location information when running on the background, it must be configured to be able to run on the background and be granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information after your application moves to the background.
To allow your application to access device location information, you can declare the required permissions in the **config.json** file of your application. The sample code is as follows:
To allow your application to access device location information, declare the required permissions in the **module.json** file of your application. The sample code is as follows:
```
......@@ -83,8 +83,8 @@ To learn more about the APIs for obtaining device location information, see [Geo
}
}
```
For details about the fields, see .
For details about the fields, see [Application Package Structure Configuration File](../quick-start/stage-structure.md).
2. Import the **geolocation** module by which you can implement all APIs related to the basic location capabilities.
......@@ -92,7 +92,7 @@ To learn more about the APIs for obtaining device location information, see [Geo
import geolocation from '@ohos.geolocation';
```
3. Instantiate the **LocationRequest** object. This object provides APIs to notify the system of the location service type and the interval of reporting location information.
3. Instantiate the **LocationRequest** object. This object provides APIs to notify the system of the location service type and the interval of reporting location information.<br>
**Method 1:**
To better serve your needs for using APIs, the system has categorized APIs into different packages to match your common use cases of the location function. In this way, you can directly use the APIs specific to a certain use case, making application development much easier. The following table lists the use cases currently supported.
......@@ -112,15 +112,15 @@ To learn more about the APIs for obtaining device location information, see [Geo
**Table 2** Common use cases of the location function
| Use&nbsp;Case | Constant | Description |
| -------- | -------- | -------- |
| Navigation | NAVIGATION | Applicable&nbsp;when&nbsp;your&nbsp;application&nbsp;needs&nbsp;to&nbsp;obtain&nbsp;the&nbsp;real-time&nbsp;location&nbsp;of&nbsp;a&nbsp;mobile&nbsp;device&nbsp;outdoors,&nbsp;such&nbsp;as&nbsp;navigation&nbsp;for&nbsp;driving&nbsp;or&nbsp;walking.&nbsp;In&nbsp;this&nbsp;scenario,&nbsp;the&nbsp;GNSS&nbsp;positioning&nbsp;technology&nbsp;is&nbsp;mainly&nbsp;used&nbsp;to&nbsp;ensure&nbsp;the&nbsp;location&nbsp;accuracy.&nbsp;However,&nbsp;due&nbsp;to&nbsp;its&nbsp;limitations,&nbsp;the&nbsp;technology&nbsp;may&nbsp;be&nbsp;unable&nbsp;to&nbsp;provide&nbsp;the&nbsp;location&nbsp;service&nbsp;when&nbsp;navigation&nbsp;is&nbsp;just&nbsp;started&nbsp;or&nbsp;when&nbsp;the&nbsp;user&nbsp;moves&nbsp;into&nbsp;a&nbsp;shielded&nbsp;environment&nbsp;such&nbsp;as&nbsp;indoors&nbsp;or&nbsp;a&nbsp;garage.&nbsp;To&nbsp;resolve&nbsp;this&nbsp;issue,&nbsp;the&nbsp;system&nbsp;uses&nbsp;the&nbsp;network&nbsp;positioning&nbsp;technology&nbsp;as&nbsp;an&nbsp;alternative&nbsp;to&nbsp;provide&nbsp;the&nbsp;location&nbsp;service&nbsp;for&nbsp;your&nbsp;application&nbsp;until&nbsp;the&nbsp;GNSS&nbsp;can&nbsp;provide&nbsp;stable&nbsp;location&nbsp;results.&nbsp;This&nbsp;helps&nbsp;achieve&nbsp;a&nbsp;smooth&nbsp;navigation&nbsp;experience&nbsp;for&nbsp;users.<br/>By&nbsp;default,&nbsp;the&nbsp;system&nbsp;reports&nbsp;location&nbsp;results&nbsp;at&nbsp;a&nbsp;minimal&nbsp;interval&nbsp;of&nbsp;1s.&nbsp;To&nbsp;adopt&nbsp;this&nbsp;use&nbsp;case,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Trajectory&nbsp;tracking | TRAJECTORY_TRACKING | Applicable&nbsp;when&nbsp;your&nbsp;application&nbsp;needs&nbsp;to&nbsp;record&nbsp;user&nbsp;trajectories,&nbsp;for&nbsp;example,&nbsp;the&nbsp;track&nbsp;recording&nbsp;function&nbsp;of&nbsp;sports&nbsp;applications.&nbsp;In&nbsp;this&nbsp;scenario,&nbsp;the&nbsp;GNSS&nbsp;positioning&nbsp;technology&nbsp;is&nbsp;mainly&nbsp;used&nbsp;to&nbsp;ensure&nbsp;the&nbsp;location&nbsp;accuracy.<br/>By&nbsp;default,&nbsp;the&nbsp;system&nbsp;reports&nbsp;location&nbsp;results&nbsp;at&nbsp;a&nbsp;minimal&nbsp;interval&nbsp;of&nbsp;1s.&nbsp;To&nbsp;adopt&nbsp;this&nbsp;use&nbsp;case,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Ride&nbsp;hailing | CAR_HAILING | Applicable&nbsp;when&nbsp;your&nbsp;application&nbsp;needs&nbsp;to&nbsp;obtain&nbsp;the&nbsp;current&nbsp;location&nbsp;of&nbsp;a&nbsp;user&nbsp;who&nbsp;is&nbsp;hailing&nbsp;a&nbsp;taxi.<br/>By&nbsp;default,&nbsp;the&nbsp;system&nbsp;reports&nbsp;location&nbsp;results&nbsp;at&nbsp;a&nbsp;minimal&nbsp;interval&nbsp;of&nbsp;1s.&nbsp;To&nbsp;adopt&nbsp;this&nbsp;use&nbsp;case,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Life&nbsp;service | DAILY_LIFE_SERVICE | Applicable&nbsp;when&nbsp;your&nbsp;application&nbsp;only&nbsp;needs&nbsp;the&nbsp;approximate&nbsp;user&nbsp;location&nbsp;for&nbsp;recommendations&nbsp;and&nbsp;push&nbsp;notifications&nbsp;in&nbsp;scenarios&nbsp;such&nbsp;as&nbsp;when&nbsp;the&nbsp;user&nbsp;is&nbsp;browsing&nbsp;news,&nbsp;shopping&nbsp;online,&nbsp;and&nbsp;ordering&nbsp;food.<br/>By&nbsp;default,&nbsp;the&nbsp;system&nbsp;reports&nbsp;location&nbsp;results&nbsp;at&nbsp;a&nbsp;minimal&nbsp;interval&nbsp;of&nbsp;1s.&nbsp;To&nbsp;adopt&nbsp;this&nbsp;use&nbsp;case,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Power&nbsp;efficiency | NO_POWER | Applicable&nbsp;when&nbsp;your&nbsp;application&nbsp;does&nbsp;not&nbsp;proactively&nbsp;start&nbsp;the&nbsp;location&nbsp;service&nbsp;for&nbsp;a&nbsp;higher&nbsp;battery&nbsp;efficiency.&nbsp;When&nbsp;responding&nbsp;to&nbsp;another&nbsp;application&nbsp;requesting&nbsp;the&nbsp;same&nbsp;location&nbsp;service,&nbsp;the&nbsp;system&nbsp;marks&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;location&nbsp;result&nbsp;to&nbsp;your&nbsp;application.&nbsp;In&nbsp;this&nbsp;way,&nbsp;your&nbsp;application&nbsp;will&nbsp;not&nbsp;consume&nbsp;extra&nbsp;power&nbsp;for&nbsp;obtaining&nbsp;the&nbsp;user&nbsp;location.<br/>By&nbsp;default,&nbsp;the&nbsp;system&nbsp;reports&nbsp;location&nbsp;results&nbsp;at&nbsp;a&nbsp;minimal&nbsp;interval&nbsp;of&nbsp;1s.&nbsp;To&nbsp;adopt&nbsp;this&nbsp;use&nbsp;case,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
The following example instantiates the **RequestParam** object for navigation:
| Use Case | Constant | Description |
| ------------ | ------------------- | ------------------------------------------------------------ |
| Navigation | NAVIGATION | Applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy. However, due to its limitations, the technology may be unable to provide the location service when navigation is just started or when the user moves into a shielded environment such as indoors or a garage. To resolve this issue, the system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. This helps achieve a smooth navigation experience for users.<br>By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
| Trajectory tracking| TRAJECTORY_TRACKING | Applicable when your application needs to record user trajectories, for example, the track recording function of sports applications. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy.<br>By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
| Ride hailing| CAR_HAILING | Applicable when your application needs to obtain the current location of a user who is hailing a taxi.<br>By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
| Life service| DAILY_LIFE_SERVICE | Applicable when your application only needs the approximate user location for recommendations and push notifications in scenarios such as when the user is browsing news, shopping online, and ordering food.<br>By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
| Power efficiency | NO_POWER | Applicable when your application does not proactively start the location service for a higher battery efficiency. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.<br>By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
Sample code for initializing **requestInfo** for navigation:
```
var requestInfo = {'scenario': geolocation.LocationRequestScenario.NAVIGATION, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
......@@ -143,20 +143,20 @@ To learn more about the APIs for obtaining device location information, see [Geo
**Table 3** Location priority policies
| Policy | Constant | Description |
| -------- | -------- | -------- |
| Location&nbsp;accuracy&nbsp;priority | ACCURACY | This&nbsp;policy&nbsp;mainly&nbsp;uses&nbsp;the&nbsp;GNSS&nbsp;positioning&nbsp;technology.&nbsp;In&nbsp;an&nbsp;open&nbsp;area,&nbsp;the&nbsp;technology&nbsp;can&nbsp;achieve&nbsp;the&nbsp;meter-level&nbsp;location&nbsp;accuracy,&nbsp;depending&nbsp;on&nbsp;the&nbsp;hardware&nbsp;performance&nbsp;of&nbsp;the&nbsp;device.&nbsp;However,&nbsp;in&nbsp;a&nbsp;shielded&nbsp;environment,&nbsp;the&nbsp;location&nbsp;accuracy&nbsp;may&nbsp;significantly&nbsp;decrease.<br/>To&nbsp;use&nbsp;this&nbsp;policy,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Fast&nbsp;location&nbsp;priority | FAST_FIRST_FIX | This&nbsp;policy&nbsp;uses&nbsp;the&nbsp;GNSS&nbsp;positioning,&nbsp;base&nbsp;station&nbsp;positioning,&nbsp;WLAN&nbsp;positioning,&nbsp;and&nbsp;Bluetooth&nbsp;positioning&nbsp;technologies&nbsp;simultaneously&nbsp;to&nbsp;obtain&nbsp;the&nbsp;device&nbsp;location&nbsp;in&nbsp;both&nbsp;the&nbsp;indoor&nbsp;and&nbsp;outdoor&nbsp;scenarios.&nbsp;When&nbsp;all&nbsp;positioning&nbsp;technologies&nbsp;provide&nbsp;a&nbsp;location&nbsp;result,&nbsp;the&nbsp;system&nbsp;provides&nbsp;the&nbsp;most&nbsp;accurate&nbsp;location&nbsp;result&nbsp;for&nbsp;your&nbsp;application.&nbsp;This&nbsp;policy&nbsp;can&nbsp;lead&nbsp;to&nbsp;significant&nbsp;hardware&nbsp;resource&nbsp;consumption&nbsp;and&nbsp;power&nbsp;consumption.<br/>To&nbsp;use&nbsp;this&nbsp;policy,&nbsp;you&nbsp;must&nbsp;declare&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Power&nbsp;efficiency&nbsp;priority | LOW_POWER | This&nbsp;policy&nbsp;mainly&nbsp;uses&nbsp;the&nbsp;base&nbsp;station&nbsp;positioning,&nbsp;WLAN&nbsp;positioning,&nbsp;and&nbsp;Bluetooth&nbsp;positioning&nbsp;technologies&nbsp;to&nbsp;obtain&nbsp;device&nbsp;location&nbsp;in&nbsp;both&nbsp;indoor&nbsp;and&nbsp;outdoor&nbsp;scenarios.&nbsp;The&nbsp;location&nbsp;accuracy&nbsp;depends&nbsp;on&nbsp;the&nbsp;distribution&nbsp;of&nbsp;surrounding&nbsp;base&nbsp;stations,&nbsp;visible&nbsp;WLANs,&nbsp;and&nbsp;Bluetooth&nbsp;devices&nbsp;and&nbsp;therefore&nbsp;may&nbsp;fluctuate&nbsp;greatly.&nbsp;This&nbsp;policy&nbsp;is&nbsp;recommended&nbsp;and&nbsp;can&nbsp;reduce&nbsp;power&nbsp;consumption&nbsp;when&nbsp;your&nbsp;application&nbsp;does&nbsp;not&nbsp;require&nbsp;high&nbsp;location&nbsp;accuracy&nbsp;or&nbsp;when&nbsp;base&nbsp;stations,&nbsp;visible&nbsp;WLANs,&nbsp;and&nbsp;Bluetooth&nbsp;devices&nbsp;are&nbsp;densely&nbsp;distributed.<br/>To&nbsp;use&nbsp;this&nbsp;policy,&nbsp;you&nbsp;must&nbsp;declare&nbsp;at&nbsp;least&nbsp;the&nbsp;**ohos.permission.LOCATION**&nbsp;permission&nbsp;and&nbsp;obtain&nbsp;users'&nbsp;authorization. |
| Policy | Constant | Description |
| ------------------ | -------------- | ------------------------------------------------------------ |
| Location accuracy priority | ACCURACY | This policy mainly uses the GNSS positioning technology. In an open area, the technology can achieve the meter-level location accuracy, depending on the hardware performance of the device. However, in a shielded environment, the location accuracy may significantly decrease.<br>To use this policy, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
| Fast location priority | FAST_FIRST_FIX | This policy uses the GNSS positioning, base station positioning, WLAN positioning, and Bluetooth positioning technologies simultaneously to obtain the device location in both the indoor and outdoor scenarios. When all positioning technologies provide a location result, the system provides the most accurate location result for your application. This policy can lead to significant hardware resource consumption and power consumption.<br>To use this policy, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
| Power efficiency priority| LOW_POWER | This policy mainly uses the base station positioning, WLAN positioning, and Bluetooth positioning technologies to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption when your application does not require high location accuracy or when base stations, visible WLANs, and Bluetooth devices are densely distributed.<br>To use this policy, you must declare at least the **ohos.permission.LOCATION** permission and obtain users' authorization.|
The following example instantiates the **RequestParam** object for the location accuracy priority policy:
Sample code for initializing **requestInfo** for the location accuracy priority policy:
```
var requestInfo = {'priority': geolocation.LocationRequestPriority.ACCURACY, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
```
4. Instantiate the **Callback** object for the system to report location results.
Your application needs to implement the callback interface defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
Your application needs to implement the callback defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
```
var locationChange = (location) => {
......@@ -176,8 +176,8 @@ To learn more about the APIs for obtaining device location information, see [Geo
geolocation.off('locationChange', locationChange);
```
If your application does not need the real-time device location, it can use the last known device location cached in the system instead.
If your application does not need the real-time device location, it can use the last known device location cached in the system instead.
```
geolocation.getLastLocation((err, data) => {
if (err) {
......
......@@ -1913,8 +1913,7 @@ Checks whether the input value is of the **native external** type.
**Example**
```js
var that = new util.types();
const data = util.createExternalType();
var result = that.isExternal(data);
var result = that.isExternal(true);
```
......
......@@ -38,7 +38,7 @@
在工程中,通过 "$r('app.type.name')" 的形式引用应用资源。app代表是应用内resources目录中定义的资源;type 代表资源类型(或资源的存放位置),可以取 color、float、string、plural和media,name代表资源命名,由开发者定义资源时确定。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 可以查看[声明式开发范式资源访问](../../ui/ts-application-resource-access.md),了解资源访问的更多细节。
> - 可以查看[声明式开发范式资源访问](../../ui/ts-resource-access.md),了解资源访问的更多细节。
>
> - 类Web开发范式的资源文件路径及资源限定词的使用与声明式范式不同,详情请参考[类Web开发范式资源限定与访问](../../ui/js-framework-resource-restriction.md)及[类Web开发范式文件组织](../../ui/js-framework-file.md)。
......
......@@ -104,7 +104,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFl
授予应用user grant权限,使用Promise方式异步返回结果。
此接口为系统接口,三方应用不支持调用
此接口为系统接口。
**需要权限:** ohos.permission.GRANT_SENSITIVE_PERMISSIONS
......@@ -142,7 +142,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFl
授予应用user grant权限,使用callback回调异步返回结果。
此接口为系统接口,三方应用不支持调用
此接口为系统接口。
**需要权限:** ohos.permission.GRANT_SENSITIVE_PERMISSIONS
......@@ -178,7 +178,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionF
撤销应用user grant权限,使用Promise方式异步返回结果。
此接口为系统接口,三方应用不支持调用
此接口为系统接口。
**需要权限:** ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
......@@ -216,7 +216,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionF
撤销应用user grant权限,使用callback回调异步返回结果。
此接口为系统接口,三方应用不支持调用
此接口为系统接口。
**需要权限:** ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
......@@ -252,7 +252,7 @@ getPermissionFlags(tokenID: number, permissionName: string): Promise&lt;number&g
获取指定应用的指定权限的flag,使用Promise方式异步返回结果。
此接口为系统接口,三方应用不支持调用
此接口为系统接口。
**需要权限:** ohos.permission.GET_SENSITIVE_PERMISSIONS or ohos.permission.GRANT_SENSITIVE_PERMISSIONS or ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
......
......@@ -25,9 +25,9 @@ abilitymanager.getAbilityRunningInfos((err,data) => {
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| ability | ElementName | 是 | 否 | Ability匹配信息 |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| startTime | number | 是 | 否 | Ability启动时间。 |
| abilityState | [abilityManager.AbilityState](js-apis-abilityManager.md#abilityState) | 是 | 否 | Ability状态。 |
\ No newline at end of file
| ability | ElementName | 是 | 否 | Ability匹配信息 |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| startTime | number | 是 | 否 | Ability启动时间。 |
| abilityState | [abilityManager.AbilityState](js-apis-application-abilityManager.md#abilitystate) | 是 | 否 | Ability状态。 |
\ No newline at end of file
......@@ -1952,11 +1952,11 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------- | ---- | ----------------- |
| authType | string | 是 | 令牌的鉴权类型。 |
| token | string | 是 | 令牌的取值。 |
| account | AppAccountInfo | 否 | 令牌所属的帐号信息。|
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | -------------- | ----- | ---------------- |
| authType | string | 是 | 令牌的鉴权类型。 |
| token | string | 是 | 令牌的取值。 |
| account<sup>9+</sup> | AppAccountInfo | 否 | 令牌所属的帐号信息。|
## AuthenticatorInfo<sup>8+</sup>
......
......@@ -1864,7 +1864,7 @@ promise.then(data => {
separateConference\(callId: number, callback: AsyncCallback<void\>\): void
断开会议电话。使用callback异步回调。
分离会议电话。使用callback异步回调。
此接口为系统接口。
......@@ -1890,7 +1890,7 @@ call.separateConference(1, (err, data) => {
separateConference\(callId: number\): Promise<void\>
断开会议电话。使用Promise异步回调。
分离会议电话。使用Promise异步回调。
此接口为系统接口。
......
......@@ -19,7 +19,7 @@ isSupported(feature: number): boolean
是否支持某种类型的卡模拟
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -39,7 +39,7 @@ startHCE(aidList: string[]): boolean
**需要权限**:ohos.permission.NFC_CARD_EMULATION
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**参数:**
......@@ -55,7 +55,7 @@ stopHCE(): boolean
**需要权限**:ohos.permission.NFC_CARD_EMULATION
**系统能力:** SystemCapability.Communication.NFC
**系统能力:** SystemCapability.Communication.NFC.Core
### on
......@@ -65,7 +65,7 @@ on(type: "hceCmd", callback: AsyncCallback<number[]>): void;
**需要权限**:ohos.permission.NFC_CARD_EMULATION
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**参数:**
......@@ -82,7 +82,7 @@ sendResponse(responseApdu: number[]): void;
**需要权限**:ohos.permission.NFC_CARD_EMULATION
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**参数:**
......
......@@ -219,6 +219,8 @@ off(type: "notify", callback?: Callback&lt;number&gt;): void
表示NFC场强状态的枚举。
**系统能力**:SystemCapability.Communication.ConnectedTag
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| NFC_RF_LEAVE | 0 | NFC离场事件 |
......
......@@ -97,6 +97,7 @@ register(options?: ContinuationExtraParams): Promise\<number>;
**示例:**
```js
let token = -1;
let continuationExtraParams = {
deviceType: ["00E"]
};
......@@ -157,6 +158,7 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
**示例:**
```js
let token = 1;
continuationManager.on("deviceConnect", token, (data) => {
console.info('onDeviceConnect len: ' + data.length);
for (let i = 0; i < data.length; i++) {
......@@ -186,6 +188,7 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
**示例:**
```js
let token = 1;
continuationManager.on("deviceDisconnect", token, (data) => {
console.info('onDeviceDisconnect len: ' + data.length);
for (let i = 0; i < data.length; i++) {
......@@ -213,6 +216,7 @@ off(type: "deviceConnect", token: number): void;
**示例:**
```js
let token = 1;
continuationManager.off("deviceConnect", token);
```
......@@ -234,6 +238,7 @@ off(type: "deviceDisconnect", token: number): void;
**示例:**
```js
let token = 1;
continuationManager.off("deviceDisconnect", token);
```
......@@ -255,6 +260,7 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
**示例:**
```js
let token = 1;
continuationManager.startDeviceManager(token, (err, data) => {
if (err.code != 0) {
console.error('startDeviceManager failed, cause: ' + JSON.stringify(err));
......@@ -283,6 +289,7 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
**示例:**
```js
let token = 1;
let continuationExtraParams = {
deviceType: ["00E"]
};
......@@ -319,6 +326,7 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
**示例:**
```js
let token = 1;
let continuationExtraParams = {
deviceType: ["00E"]
};
......@@ -351,6 +359,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
**示例:**
```js
let token = 1;
let deviceId: string = "test deviceId";
continuationManager.updateConnectStatus(token, deviceId, continuationManager.DeviceConnectState.CONNECTED, (err, data) => {
if (err.code != 0) {
......@@ -386,6 +395,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
**示例:**
```js
let token = 1;
let deviceId: string = "test deviceId";
continuationManager.updateConnectStatus(token, deviceId, continuationManager.DeviceConnectState.CONNECTED)
.then((data) => {
......@@ -414,6 +424,7 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
**示例:**
```js
let token = 1;
continuationManager.unregister(token, (err, data) => {
if (err.code != 0) {
console.error('unregister failed, cause: ' + JSON.stringify(err));
......@@ -446,6 +457,7 @@ unregister(token: number): Promise\<void>;
**示例:**
```js
let token = 1;
continuationManager.unregister(token)
.then((data) => {
console.info('unregister finished, ' + JSON.stringify(data));
......
......@@ -20,7 +20,7 @@ import { ValuesBucket } from '@ohos.data.ValuesBucket';
**系统能力:** SystemCapability.DistributedDataManager.DataShare.Core
| 名称 | 说明 |
| 类型 | 说明 |
| ------- | -------------------- |
| number | 表示字段类型为数字。 |
| string | 表示字段类型为字符串。 |
......@@ -28,11 +28,10 @@ import { ValuesBucket } from '@ohos.data.ValuesBucket';
## ValuesBucket
该类型用于存储一系列键值对
用于存储键值对的类型
**系统能力:** SystemCapability.DistributedDataManager.DataShare.Core
| 名称 | 参数类型 | 必填 | 说明 |
| ------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | 是 | 键的类型为字符串型;值的类型可以为数字、字符串、布尔值、无符号整型8位数组、空值。 |
| 键类型 | 值类型 |
| ------------- | --------------------------------------------- |
| string | [ValueType](#valuetype)\| Uint8Array \| null |
......@@ -789,7 +789,7 @@ notIn(field: string, value: Array&lt;ValueType&gt;): DataAbilityPredicates
**系统能力:** SystemCapability.DistributedDataManager.DataShare.Core。
| 名称 | 说明 |
| 类型 | 说明 |
| ------- | -------------------- |
| number | 表示值类型为数字。 |
| string | 表示值类型为字符。 |
......
......@@ -681,7 +681,7 @@ data_preferences.getPreferences(this.context, 'mystore', function (err, preferen
**系统能力:** SystemCapability.DistributedDataManager.Preferences.Core
| 名称 | 说明 |
| 类型 | 说明 |
| -------------- | ------------------------------ |
| number | 表示值类型为数字。 |
| string | 表示值类型为字符串。 |
......
......@@ -1992,7 +1992,7 @@ try {
**系统能力:** 以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
| 名称 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| number | 表示值类型为数字。 |
| string | 表示值类型为字符。 |
......@@ -2001,14 +2001,13 @@ try {
## ValuesBucket
用于存储键值对。
用于存储键值对的类型
**系统能力:** 以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| [key:&nbsp;string] | [ValueType](#valuetype)\|&nbsp;Uint8Array&nbsp;\|&nbsp;null | 是 | 用于存储键值对。 |
| 键类型 | 值类型 |
| -------- | -------- |
| string | [ValueType](#valuetype)\|&nbsp;Uint8Array&nbsp;\|&nbsp;null |
## SyncMode<sup>8+</sup>
......
......@@ -793,7 +793,7 @@ off(type: 'change', callback: Callback&lt;StorageObserver&gt;): void
**系统能力:** SystemCapability.DistributedDataManager.Preferences.Core
| 名称 | 说明 |
| 类型 | 说明 |
| ------- | -------------------- |
| number | 表示值类型为数字。 |
| string | 表示值类型为字符。 |
......
......@@ -94,7 +94,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
**系统能力:** SystemCapability.Account.OsAccount
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS,该权限仅供系统应用使用
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
......@@ -119,7 +119,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt
**系统能力:** SystemCapability.Account.OsAccount
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS,该权限仅供系统应用使用
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
......
# distributedMissionManager
# 分布式任务管理
distributedMissionManager模块提供跨设备系统任务管理能力,包括注册系统任务状态监听、取消系统任务状态监听、开始同步远端任务列表、停止同步远端任务列表操作。
分布式任务管理模块提供跨设备系统任务管理能力,包括注册系统任务状态监听、取消系统任务状态监听、开始同步远端任务列表、停止同步远端任务列表操作。
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> 本模块接口为系统接口。
## 导入模块
......@@ -12,9 +14,6 @@ distributedMissionManager模块提供跨设备系统任务管理能力,包括
import distributedMissionManager from '@ohos.distributedMissionManager'
```
## 权限列表
ohos.permission.MANAGE_MISSIONS
## distributedMissionManager.registerMissionListener
......@@ -26,14 +25,12 @@ registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback,
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| parameter | <a href="#missiondeviceinfo">MissionDeviceInfo</a> | 是 | 注册监听设备信息。 |
| options | <a href="#missioncallback">MissionCallback</a> | 是 | 注册的回调方法。 |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | 是 | 注册监听设备信息。 |
| options | [MissionCallback](#missioncallback) | 是 | 注册的回调方法。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 执行结果回调函数。 |
**示例:**
......@@ -72,13 +69,11 @@ registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback):
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| parameter | <a href="#missiondeviceinfo">MissionDeviceInfo</a> | 是 | 设备信息。 |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | 是 | 设备信息。 |
| options | <a href="#missioncallback">MissionCallback</a> | 是 | 注册的回调方法。 |
**返回值:**
......@@ -128,14 +123,11 @@ unregisterMissionListener(parameter: MissionDeviceInfo, callback: AsyncCallback&
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| listenerId | number | 是 | 系统任务状态监听方法的index值,和监听方法一一对应,由registerMissionListener方法返回。 |
| parameter | <a href="#missiondeviceinfo">MissionDeviceInfo</a> | 是 | 设备信息。 |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | 是 | 设备信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 执行结果回调函数。 |
**示例:**
......@@ -160,13 +152,11 @@ unregisterMissionListener(parameter: MissionDeviceInfo): Promise&lt;void&gt;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| parameter | <a href="#missiondeviceinfo">MissionDeviceInfo</a> | 是 | 设备信息。 |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | 是 | 设备信息。 |
**返回值:**
......@@ -198,14 +188,11 @@ startSyncRemoteMissions(parameter: MissionParameter, callback: AsyncCallback&lt;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| listenerId | number | 是 | 系统任务状态监听方法的index值,和监听方法一一对应,由registerMissionListener方法返回。 |
| parameter | <a href="#missionparameter">MissionParameter</a> | 是 | 同步信息。 |
| parameter | [MissionParameter](#missionparameter) | 是 | 同步信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 执行结果回调函数。 |
**示例:**
......@@ -231,13 +218,11 @@ startSyncRemoteMissions(parameter: MissionParameter): Promise&lt;void&gt;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| parameter | <a href="#missionparameter">MissionParameter</a> | 是 | 同步信息。 |
| parameter | [MissionParameter](#missionparameter) | 是 | 同步信息。 |
**返回值:**
......@@ -271,14 +256,11 @@ stopSyncRemoteMissions(parameter: MissionDeviceInfo, callback: AsyncCallback&lt;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| listenerId | number | 是 | 系统任务状态监听方法的index值,和监听方法一一对应,由registerMissionListener方法返回。 |
| parameter | <a href="#missiondeviceinfo">MissionDeviceInfo</a> | 是 | 同步信息。 |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | 是 | 同步信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 执行结果回调函数。 |
**示例:**
......@@ -302,13 +284,11 @@ stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise&lt;void&gt;
**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| parameter | <a href="#missiondeviceinfo">MissionDeviceInfo</a> | 是 | 同步信息。 |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | 是 | 同步信息。 |
**返回值:**
......@@ -330,42 +310,36 @@ stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise&lt;void&gt;
})
```
## <a id ="missioncallback">MissionCallback</a>
## MissionCallback
表示开始同步后,建立的回调函数。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| notifyMissionsChanged | function | 是 | 否 | 通知任务变化,返回设备ID。|
| notifySnapshot | function | 是 | 否 | 通知快照变化,返回设备ID,任务ID |
| notifyNetDisconnect | function | 是 | 否 | 通知断开连接,返回设备ID,网络状态 |
## <a id ="missionparameter">MissionParameter</a>
## MissionParameter
表示同步时所需参数的枚举。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| deviceId | string | 是 | 是 | 表示设备ID。|
| fixConflict | boolean | 是 | 是 | 表示是否存在版本冲突。 |
| tag | number | 是 | 是 | 表示特定的标签。 |
## <a id ="missiondeviceinfo">MissionDeviceInfo</a>
## MissionDeviceInfo
表示注册监听时所需参数的枚举。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
**系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| deviceId | string | 是 | 是 | 表示设备ID。|
\ No newline at end of file
# 数据请求
本模块提供http数据请求能力。应用可以通过HTTP发起一个数据请求,支持常见的GET、POST、OPTIONS、HEAD、PUT、DELETE、TRACE、CONNECT方法。
本模块提供HTTP数据请求能力。应用可以通过HTTP发起一个数据请求,支持常见的GET、POST、OPTIONS、HEAD、PUT、DELETE、TRACE、CONNECT方法。
>**说明:**
>
......@@ -18,15 +18,15 @@ import http from '@ohos.net.http';
```js
import http from '@ohos.net.http';
// 每一个httpRequest对应一个http请求任务,不可复用
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅http响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息
// 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息
// 从API 8开始,使用on('headersReceive', Callback)替代on('headerReceive', AsyncCallback)。 8+
httpRequest.on('headersReceive', (header) => {
console.info('header: ' + JSON.stringify(header));
});
httpRequest.request(
// 填写http请求的url地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
// 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
"EXAMPLE_URL",
{
method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET
......@@ -38,14 +38,14 @@ httpRequest.request(
extraData: {
"data": "data to send",
},
connectTimeout: 60000, // 可选,默认为60s
readTimeout: 60000, // 可选,默认为60s
connectTimeout: 60000, // 可选,默认为60000ms
readTimeout: 60000, // 可选,默认为60000ms
}, (err, data) => {
if (!err) {
// data.result为http响应内容,可根据业务需要进行解析
// data.result为HTTP响应内容,可根据业务需要进行解析
console.info('Result:' + data.result);
console.info('code:' + data.responseCode);
// data.header为http响应头,可根据业务需要进行解析
// data.header为HTTP响应头,可根据业务需要进行解析
console.info('header:' + JSON.stringify(data.header));
console.info('cookies:' + data.cookies); // 8+
} else {
......@@ -61,7 +61,7 @@ httpRequest.request(
createHttp\(\): HttpRequest
创建一个http,里面包括发起请求、中断请求、订阅/取消订阅HTTP Response Header 事件。每一个HttpRequest对象对应一个Http请求。如需发起多个Http请求,须为每个Http请求创建对应HttpRequest对象。
创建一个HTTP请求,里面包括发起请求、中断请求、订阅/取消订阅HTTP Response Header事件。每一个HttpRequest对象对应一个HTTP请求。如需发起多个HTTP请求,须为每个HTTP请求创建对应HttpRequest对象。
**系统能力**:SystemCapability.Communication.NetStack
......@@ -81,7 +81,7 @@ let httpRequest = http.createHttp();
## HttpRequest
http请求任务。在调用HttpRequest的方法前,需要先通过[createHttp\(\)](#httpcreatehttp)创建一个任务。
HTTP请求任务。在调用HttpRequest的方法前,需要先通过[createHttp\(\)](#httpcreatehttp)创建一个任务。
### request
......@@ -432,9 +432,9 @@ request方法回调函数的返回值类型。
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| result | string \| Object \| ArrayBuffer<sup>8+</sup> | 是 | Http请求根据响应头中Content-type类型返回对应的响应格式内容:<br />- application/json:返回JSON格式的字符串,如需Http响应具体内容,需开发者自行解析<br />- application/octet-stream:ArrayBuffer<br />- 其他:string |
| result | string \| Object \| ArrayBuffer<sup>8+</sup> | 是 | HTTP请求根据响应头中Content-type类型返回对应的响应格式内容:<br />- application/json:返回JSON格式的字符串,如需HTTP响应具体内容,需开发者自行解析<br />- application/octet-stream:ArrayBuffer<br />- 其他:string |
| responseCode | [ResponseCode](#responsecode) \| number | 是 | 回调函数执行成功时,此字段为[ResponseCode](#responsecode)。若执行失败,错误码将会从AsyncCallback中的err字段返回。错误码参考[Response错误码](#response常用错误码)。 |
| header | Object | 是 | 发起http请求返回来的响应头。当前返回的是JSON格式字符串,如需具体字段内容,需开发者自行解析。常见字段及解析方式如下:<br/>- Content-Type:header['Content-Type'];<br />- Status-Line:header['Status-Line'];<br />- Date:header.Date/header['Date'];<br />- Server:header.Server/header['Server']; |
| header | Object | 是 | 发起HTTP请求返回来的响应头。当前返回的是JSON格式字符串,如需具体字段内容,需开发者自行解析。常见字段及解析方式如下:<br/>- Content-Type:header['Content-Type'];<br />- Status-Line:header['Status-Line'];<br />- Date:header.Date/header['Date'];<br />- Server:header.Server/header['Server']; |
| cookies<sup>8+</sup> | Array\<string\> | 是 | 服务器返回的 cookies。 |
## Response常用错误码
......
......@@ -276,8 +276,8 @@ 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/>**注意事项**<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 |
| 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 |
| loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 |
| audioInterruptMode<sup>9+</sup> | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 |
| currentTime | number | 是 | 否 | 音频的当前播放位置,单位为毫秒(ms)。 |
......@@ -694,8 +694,8 @@ 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/>**注意事项**<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 |
| 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 |
| loop<sup>8+</sup> | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 |
| videoScaleType<sup>9+</sup> | [VideoScaleType](#videoscaletype9) | 是 | 是 | 视频缩放模式。 |
| audioInterruptMode<sup>9+</sup> | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 |
......@@ -1365,7 +1365,7 @@ videoPlayer.setSpeed(speed).then() => {
selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void
通过回调方式设置码率,通过[availableBitratesCollect](#on('availableBitratesCollect')<sup>9+</sup>)获取当前码流支持的Bitrate。
通过回调方式设置码率,通过[availableBitratesCollect](#onavailablebitratescollect9)获取当前码流支持的Bitrate。
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
......@@ -1393,7 +1393,7 @@ videoPlayer.selectBitrate(bitrate, (err, result) => {
selectBitrate(bitrate:number): Promise\<number>
通过Promise方式设置码率,通过[availableBitratesCollect](#on('availableBitratesCollect')<sup>9+</sup>)获取当前码流支持的Bitrate。
通过Promise方式设置码率,通过[availableBitratesCollect](#onavailablebitratescollect9)获取当前码流支持的Bitrate。
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
......@@ -2020,7 +2020,7 @@ prepare(config: VideoRecorderConfig): Promise\<void>;
异步方式进行视频录制的参数设置。通过Promise获取返回值。
**需要权限:** ohos.permission.MICROPHONE,ohos.permission.CAMERA
**需要权限:** ohos.permission.MICROPHONE
**系统能力:** SystemCapability.Multimedia.Media.VideoRecorder
......
......@@ -19,6 +19,8 @@ isNfcAvailable(): boolean
查询是否有NFC功能
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
| **类型** | **说明** |
......@@ -34,7 +36,7 @@ openNfc(): boolean
**需要权限**:ohos.permission.MANAGE_SECURE_SETTINGS
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -50,7 +52,7 @@ closeNfc(): boolean
**需要权限**:ohos.permission.MANAGE_SECURE_SETTINGS
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -64,7 +66,7 @@ isNfcOpen(): boolean
查询NFC是否打开。
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -78,7 +80,7 @@ getNfcState(): NfcState
查询NFC状态。
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -92,7 +94,7 @@ on(type: "nfcStateChange", callback: Callback&lt;NfcState&gt;): void
注册NFC开关状态事件。
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**参数**
......@@ -109,7 +111,7 @@ off(type: "nfcStateChange", callback?: Callback&lt;NfcState&gt;): void
取消NFC开关状态事件的注册。
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**参数**
......@@ -140,6 +142,8 @@ off(type: "nfcStateChange", callback?: Callback&lt;NfcState&gt;): void
表示NFC状态的枚举。
**系统能力**:SystemCapability.Communication.NFC.Core
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| STATE_OFF | 1 | NFC关闭状态 |
......
......@@ -21,7 +21,7 @@ getNfcATag(tagInfo: TagInfo): NfcATag
**需要权限**:ohos.permission.NFC_TAG
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -37,7 +37,7 @@ getNfcBTag(tagInfo: TagInfo): NfcBTag
**需要权限**:ohos.permission.NFC_TAG
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -53,7 +53,7 @@ getNfcFTag(tagInfo: TagInfo): NfcFTag
**需要权限**:ohos.permission.NFC_TAG
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......@@ -69,7 +69,7 @@ getNfcVTag(tagInfo: TagInfo): NfcVTag
**需要权限**:ohos.permission.NFC_TAG
**系统能力**:SystemCapability.Communication.NFC
**系统能力**:SystemCapability.Communication.NFC.Core
**返回值:**
......
......@@ -1886,7 +1886,7 @@ Nr的选择模式。
| 名称 | 类型 | 说明 |
| ---------------------- | ------------------------------------------------- | -------------- |
| isNetworkSearchSuccess | boolean | 网络搜索成功。 |
| networkSearchResult | Array<[NetworkInformation](#networkInformation)\> | 网络搜索结果。 |
| networkSearchResult | Array<[NetworkInformation](#networkinformation)\> | 网络搜索结果。 |
## NetworkInformation
......@@ -1900,7 +1900,7 @@ Nr的选择模式。
| --------------- | ----------------------------------------- | -------------- |
| operatorName | string | 运营商的名称。 |
| operatorNumeric | string | 运营商数字。 |
| state | [NetworkInformation](#networkInformation) | 网络信息状态。 |
| state | [NetworkInformationState](#networkinformationstate) | 网络信息状态。 |
| radioTech | string | 无线电技术。 |
## NetworkInformationState
......
......@@ -18,7 +18,7 @@ import request from '@ohos.request';
在开发FA模型下的应用程序时,需要在config.json配置文件中对应用结构进行声明,在config.json文件中增加network标签,属性标识 "cleartextTraffic": true。即:
```
```js
var config = {
"deviceConfig": {
"default": {
......@@ -341,6 +341,8 @@ remove(callback: AsyncCallback&lt;boolean&gt;): void
## UploadConfig
**需要权限**:ohos.permission.INTERNET
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MiscServices.Upload。
| 名称 | 类型 | 必填 | 说明 |
......@@ -354,7 +356,9 @@ remove(callback: AsyncCallback&lt;boolean&gt;): void
## File
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MiscServices.Upload。
**需要权限**:ohos.permission.INTERNET
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MiscServices.Download
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -366,8 +370,9 @@ remove(callback: AsyncCallback&lt;boolean&gt;): void
## RequestData
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MiscServices.Upload。
**需要权限**:ohos.permission.INTERNET
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MiscServices.Download
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| name | string | 是 | 表示表单元素的名称。 |
......@@ -939,6 +944,8 @@ resume(callback: AsyncCallback&lt;void&gt;): void
## DownloadConfig
**需要权限**:ohos.permission.INTERNET
**系统能力**: SystemCapability.MiscServices.Download
| 名称 | 类型 | 必填 | 说明 |
......@@ -955,6 +962,8 @@ resume(callback: AsyncCallback&lt;void&gt;): void
## DownloadInfo<sup>7+</sup>
**需要权限**:ohos.permission.INTERNET
**系统能力**: SystemCapability.MiscServices.Download
| 名称 | 类型 | 必填 | 说明 |
......
......@@ -133,7 +133,7 @@ back(options?: RouterOptions ): void
**示例:**
```js
router.back({uri:'pages/detail'});
router.back({url:'pages/detail'});
```
## router.clear
......@@ -313,7 +313,7 @@ export default {
// 在detail页面中
export default {
onInit() {
console.info('showData1:' + router.getParams().data1);
console.info('showData1:' + router.getParams()[data1]);
}
}
```
......
......@@ -177,6 +177,8 @@ on(type: 'beginWakeUp' | 'endWakeUp' | 'beginScreenOn' | 'endScreenOn' | 'beginS
**系统能力**: SystemCapability.MiscServices.ScreenLock
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -199,6 +201,8 @@ on(type: 'beginSleep' | 'endSleep' | 'changeUser', callback: Callback\<number\>)
**系统能力**: SystemCapability.MiscServices.ScreenLock
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -220,6 +224,8 @@ on(type: 'screenlockEnabled', callback: Callback\<boolean\>): void
**系统能力**: SystemCapability.MiscServices.ScreenLock
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -243,6 +249,8 @@ off(type: 'beginWakeUp' | 'endWakeUp' | 'beginScreenOn' | 'endScreenOn' | 'begin
**系统能力**: SystemCapability.MiscServices.ScreenLock
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -265,6 +273,8 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback\<b
**系统能力**: SystemCapability.MiscServices.ScreenLock
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -282,12 +292,14 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback\<b
## screenlock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: String, parameter: number): Promise<boolean>
sendScreenLockEvent(event: String, parameter: number): Promise\<boolean\>
应用发送事件到锁屏服务,异步方法。
**系统能力**: SystemCapability.MiscServices.ScreenLock
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......
......@@ -2133,7 +2133,7 @@ getOperatorConfigs(slotId: number): Promise<Array<OperatorConfig\>>
| 类型 | 说明 |
| --------------------------------------------------- | ----------------------------- |
| Promise<Array<[OperatorConfig](#OperatorConfig8)\>> | 以Promise形式返回运营商配置。 |
| Promise<Array<[OperatorConfig](#operatorconfig8)\>> | 以Promise形式返回运营商配置。 |
**示例:**
......@@ -2163,7 +2163,7 @@ queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallba
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | ContactType | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| type | [ContactType](#contactype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| callback | AsyncCallback<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | 是 | 回调函数。 |
**示例:**
......@@ -2192,7 +2192,7 @@ queryIccDiallingNumbers(slotId: number, type: ContactType): Promise<Array<Dialli
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | ContactType | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| type | [ContactType](#contactype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
**返回值:**
......@@ -2829,7 +2829,7 @@ SIM卡状态。
| LOCK_OFF | 0 | 锁关闭状态 |
| LOCK_ON | 1 | 锁开启状态 |
## **PersoLockType**<sup>8+</sup>
## PersoLockType<sup>8+</sup>
定制锁类型。
......@@ -2850,7 +2850,7 @@ SIM卡状态。
| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* |
| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 |
## **LockStatusResponse**<sup>7+</sup>
## LockStatusResponse<sup>7+</sup>
锁状态响应。
......@@ -2863,7 +2863,7 @@ SIM卡状态。
| result | number | 当前操作的结果 |
| remain?: number | number | 剩余次数(可以为空) |
## **LockInfo**<sup>8+</sup>
## LockInfo<sup>8+</sup>
锁状态响应。
......@@ -2877,7 +2877,7 @@ SIM卡状态。
| password | string | 密码 |
| state | [LockState](#lockstate8) | 锁状态 |
## **PersoLockInfo**<sup>8+</sup>
## PersoLockInfo<sup>8+</sup>
锁状态响应。
......@@ -2890,7 +2890,7 @@ SIM卡状态。
| lockType | [PersoLockType](#persolocktype8) | 定制锁的类型 |
| password | string | 密码 |
## **IccAccountInfo**<sup>7+</sup>
## IccAccountInfo<sup>7+</sup>
Icc账户信息。
......@@ -2908,7 +2908,7 @@ Icc账户信息。
| showName | string | SIM卡显示名称 |
| showNumber | string | SIM卡显示号码 |
## **OperatorConfig**<sup>8+</sup>
## OperatorConfig<sup>8+</sup>
运营商配置。
......@@ -2921,7 +2921,7 @@ Icc账户信息。
| field | string | 字段 |
| value | string | 值 |
## **DiallingNumbersInfo**<sup>8+</sup>
## DiallingNumbersInfo<sup>8+</sup>
拨号号码信息。
......@@ -2936,7 +2936,7 @@ Icc账户信息。
| recordNumber | number | 记录编号 |
| pin2 | string | pin2密码 |
## **ContactType**<sup>8+</sup>
## ContactType<sup>8+</sup>
联系人类型。
......
......@@ -818,7 +818,7 @@ getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| message | string | 是 | 消息 |
| force7bit | boolean | 是 | 是否使用7bit编码 |
| callback | AsyncCallback&lt;[SmsSegmentsInfo](#&lt;smssegmentsinfo8)&gt; | 是 | 回调函数 |
| callback | AsyncCallback&lt;[SmsSegmentsInfo](#smssegmentsinfo8)&gt; | 是 | 回调函数 |
**示例:**
......@@ -852,7 +852,7 @@ getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise
| 类型 | 说明 |
| ------------------------------------------------------- | ----------------------------- |
| Promise&lt;[SmsSegmentsInfo](#&lt;smssegmentsinfo8)&gt; | 以Promise形式返回短信段信息。 |
| Promise&lt;[SmsSegmentsInfo](#smssegmentsinfo8)&gt; | 以Promise形式返回短信段信息。 |
**示例:**
......@@ -1209,7 +1209,7 @@ promise.then(data => {
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------------------------------------------ | ---- | --------- |
| messageType | [MessageType](#messagetype8) | 是 | 消息类型 |
| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigInd8)\|[MmsReadRecInd](#mmsreadorigind8) | 是 | pdu头类型 |
| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8) | 是 | pdu头类型 |
| attachment | Array<[MmsAttachment](#mmsattachment8)\> | 否 | 附件 |
## MmsSendReq<sup>8+</sup>
......@@ -1307,7 +1307,7 @@ promise.then(data => {
| from | [MmsAddress](#mmsaddress8) | 否 | 来源 |
| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 |
| subject | string | 否 | 主题 |
| priority | [MmsPriorityType](#mmsPrioritytype8) | 否 | 优先级 |
| priority | [MmsPriorityType](#mmsprioritytype8) | 否 | 优先级 |
| deliveryReport | number | 否 | 状态报告 |
| readReport | number | 否 | 阅读报告 |
| retrieveStatus | number | 否 | 检索状态 |
......
......@@ -40,11 +40,7 @@ matchMedia(condition: string): MediaQueryList
**示例:**
```
export default {
matchMedia() {
var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)');
},
}
var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)');
```
## MediaQueryEvent
......@@ -102,6 +98,11 @@ addListener(callback: (event: MediaQueryEvent) => void): void
**示例:**
```
function maxWidthMatch(e){
if(e.matches){
// do something
}
}
mMediaQueryList.addListener(maxWidthMatch);
```
......@@ -123,6 +124,11 @@ removeListener(callback: (event: MediaQueryEvent) => void): void
**示例:**
```
function maxWidthMatch(e){
if(e.matches){
// do something
}
}
mMediaQueryList.removeListener(maxWidthMatch);
```
......
......@@ -1910,8 +1910,7 @@ isExternal(value: Object): boolean
**示例:**
```js
var that = new util.types();
const data = util.createExternalType();
var result = that.isExternal(data);
var result = that.isExternal(true);
```
......
......@@ -22,7 +22,7 @@ addColorStop(offset: number, color: string): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
<input type="button" style="width: 180px; height: 60px;" value="fillStyle"onclick="handleClick" />
</div>
```
......
......@@ -21,7 +21,7 @@ addPath(path: Object): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -61,7 +61,7 @@ setTransform(scaleX: number, skewX: number, skewY: number, scaleY: number, trans
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -91,7 +91,7 @@ closePath(): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -130,7 +130,7 @@ moveTo(x: number, y: number): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 300px; height: 250px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 300px; height: 250px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -169,7 +169,7 @@ lineTo(x: number, y: number): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 400px; height: 450px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 400px; height: 450px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -213,7 +213,7 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number,
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -252,7 +252,7 @@ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -293,7 +293,7 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number,
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -332,7 +332,7 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -374,7 +374,7 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"></canvas>
</div>
```
......@@ -412,7 +412,7 @@ rect(x: number, y: number, width: number, height: number): void
```html
<!-- xxx.hml -->
<div>
<canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"</canvas>
<canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"></canvas>
</div>
```
......
......@@ -234,8 +234,8 @@ struct ImageExample2 {
@Entry
@Component
struct ImageExample3 {
@State width: number = 0
@State height: number = 0
@State widthValue: number = 0
@State heightValue: number = 0
private on: Resource = $r('app.media.image_on')
private off: Resource = $r('app.media.image_off')
private on2off: Resource = $r('app.media.image_on2off')
......@@ -256,8 +256,8 @@ struct ImageExample3 {
.height(180).width(180)
// 图片加载完成后,获取图片尺寸。
.onComplete((msg: { width: number,height: number }) => {
this.width = msg.width
this.height = msg.height
this.widthValue = msg.width
this.heightValue = msg.height
})
.onError(() => {
console.log('load image fail')
......
......@@ -61,13 +61,15 @@ struct RemoteWindowExample {
@State target: WindowAnimationTarget = undefined // 通过windowAnimationManager获取
build() {
RemoteWindow(this.target)
.translate({x:100, y:200})
.scale({x:0.5, y:0.5})
Column() {
RemoteWindow(this.target)
.translate({x:100, y:200})
.scale({x:0.5, y:0.5})
.opacity(0.8)
.position({x:px2vp(this.target?.windowBounds.left), y:px2vp(this.target?.windowBounds.top)})
.width(px2vp(this.target?.windowBounds.width))
.height(px2vp(this.target?.windowBounds.height))
.position({x:px2vp(this.target?.windowBounds.left), y:px2vp(this.target?.windowBounds.top)})
.width(px2vp(this.target?.windowBounds.width))
.height(px2vp(this.target?.windowBounds.height))
}
}
}
```
\ No newline at end of file
......@@ -48,7 +48,7 @@ RichText\(content:string\)
| \<script>\</script> | 用于定义客户端文本,比如JavaScript。 | \<script>document.write("Hello World!")\</script> |
## 示例
示例效果请以真机运行为准,当前IDE预览器不支持。
```ts
// xxx.ets
@Entry
......
......@@ -23,7 +23,7 @@ Text(content?: string)
- 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| content | string | 否 | '' | 文本内容,包含子组件Span时不生效,显示Span内容。 |
| content | string | 否 | '' | 文本内容。包含子组件Span时不生效,显示Span内容,并且此时text组件的样式不生效。 |
## 属性
......
# XComponent
> **说明:**
> 该组件从API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> 该组件从API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
可用于EGL/OpenGLES和媒体数据写入,并显示在XComponent组件。
......@@ -83,8 +83,8 @@ getXComponentContext(): Object
## 示例
提供surface类型XComponent,支持相机预览等能力。
提供surface类型XComponent,支持相机预览等能力。
示例效果请以真机运行为准,当前IDE预览器不支持。
```ts
// xxx.ets
import camera from '@ohos.multimedia.camera';
......
......@@ -46,21 +46,21 @@ PinchGesture(options?: { fingers?: number, distance?: number })
@Entry
@Component
struct PinchGestureExample {
@State scale: number = 1
@State scaleValue: number = 1
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('PinchGesture scale:' + this.scale)
}
.height(100).width(200).padding(20).border({ width: 1 }).margin(80)
.scale({ x: this.scale, y: this.scale, z: this.scale })
.scale({ x: this.scaleValue, y: this.scaleValue, z: this.scaleValue })
.gesture(
PinchGesture()
.onActionStart((event: GestureEvent) => {
console.info('Pinch start')
})
.onActionUpdate((event: GestureEvent) => {
this.scale = event.scale
this.scaleValue = event.scale
})
.onActionEnd(() => {
console.info('Pinch end')
......
......@@ -258,7 +258,7 @@ struct MiterLimit {
// xxx.ets
@Entry
@Component
struct Font {
struct Fonts {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
......
......@@ -46,13 +46,13 @@ struct GestureGroupExample {
@State count: number = 0
@State offsetX: number = 0
@State offsetY: number = 0
@State borderStyle: BorderStyle = BorderStyle.Solid
@State borderStyles: BorderStyle = BorderStyle.Solid
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY)
}.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyle })
.height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyles })
.gesture(
GestureGroup(GestureMode.Sequence,
LongPressGesture({ repeat: true })
......@@ -65,7 +65,7 @@ struct GestureGroupExample {
}),
PanGesture({})
.onActionStart(() => {
this.borderStyle = BorderStyle.Dashed
this.borderStyles = BorderStyle.Dashed
console.log('pan start')
})
.onActionUpdate((event: GestureEvent) => {
......
......@@ -41,10 +41,10 @@ Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: F
| ColumnReverse | 与Column相反方向进行布局。 |
- FlexWrap枚举说明
| 名称 | 描述 |
| ----------- | --------------------------- |
| NoWrap | Flex容器的元素单行/列布局,子项允许超出容器。 |
| Wrap | Flex容器的元素多行/列排布,子项允许超出容器。 |
| 名称 | 描述 |
| ----------- | ------------------------------------------------- |
| NoWrap | Flex容器的元素单行/列布局,子项允许超出容器。 |
| Wrap | Flex容器的元素多行/列排布,子项允许超出容器。 |
| WrapReverse | Flex容器的元素反向多行/列排布,子项允许超出容器。 |
- FlexAlign枚举说明
......
......@@ -266,7 +266,7 @@ struct MiterLimit {
// xxx.ets
@Entry
@Component
struct Font {
struct Fonts {
private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
......@@ -1920,12 +1920,12 @@ getPixelMap(sx: number, sy: number, sw: number, sh: number): PixelMap
以当前canvas指定区域内的像素创建[PixelMap](../apis/js-apis-image.md#pixelmap7)对象。
- 参数
| 参数 | 类型 | 必填 | 默认值 | 描述 |
| 参数 | 类型 | 必填 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | -------- |
| sx | number | 是 | 0 | 需要输出的区域的左上角x坐标。 |
| sy | number | 是 | 0 | 需要输出的区域的左上角y坐标。 |
| sw | number | 是 | 0 | 需要输出的区域的宽度。 |
| sh | number | 是 | 0 | 需要输出的区域的高度。 |
| sx | number | 是 | 0 | 需要输出的区域的左上角x坐标。 |
| sy | number | 是 | 0 | 需要输出的区域的左上角y坐标。 |
| sw | number | 是 | 0 | 需要输出的区域的宽度。 |
| sh | number | 是 | 0 | 需要输出的区域的高度。 |
### getImageData
......
......@@ -68,8 +68,8 @@ PageTransitionEnter和PageTransitionExit组件支持的事件:
@Entry
@Component
struct PageTransitionExample1 {
@State scale: number = 1
@State opacity: number = 1
@State scale1: number = 1
@State opacity1: number = 1
@State active: boolean = false
build() {
Column() {
......@@ -79,19 +79,19 @@ struct PageTransitionExample1 {
.onClick(() => {
this.active = true
})
}.scale({ x: this.scale }).opacity(this.opacity)
}.scale({ x: this.scale1 }).opacity(this.opacity1)
}
// 自定义方式1:完全自定义转场过程的效果
pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale = 1
this.opacity = progress
this.scale1 = 1
this.opacity1 = progress
}) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%)
PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.onExit((type: RouteType, progress: number) => {
this.scale = 1 - progress
this.opacity = 1
this.scale1 = 1 - progress
this.opacity1 = 1
}) // 退场过程中会逐帧触发onExit回调,入参为动效的归一化进度(0% -- 100%)
}
}
......@@ -102,27 +102,27 @@ struct PageTransitionExample1 {
@Entry
@Component
struct AExample {
@State scale: number = 1
@State opacity: number = 1
@State scale2: number = 1
@State opacity2: number = 1
@State active: boolean = false
build() {
Column() {
Navigator({ target: 'pages/index' ,type: NavigationType.Push}) {
Image($r('app.media.bg2')).width("100%").height("100%")
}
}.height("100%").width("100%").scale({ x: this.scale }).opacity(this.opacity)
}.height("100%").width("100%").scale({ x: this.scale2 }).opacity(this.opacity2)
}
// 自定义方式1:完全自定义转场过程的效果
pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale = 1
this.opacity = progress
this.scale2 = 1
this.opacity2 = progress
}) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%)
PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.onExit((type: RouteType, progress: number) => {
this.scale = 1 - progress
this.opacity = 1
this.scale2 = 1 - progress
this.opacity2 = 1
}) // 退场过程中会逐帧触发onExit回调,入参为动效的归一化进度(0% -- 100%)
}
}
......@@ -137,8 +137,8 @@ struct AExample {
@Entry
@Component
struct PageTransitionExample {
@State scale: number = 1
@State opacity: number = 1
@State scale1: number = 1
@State opacity1: number = 1
@State active: boolean = false
build() {
......@@ -149,7 +149,7 @@ struct PageTransitionExample {
.onClick(() => {
this.active = true
})
}.scale({ x: this.scale }).opacity(this.opacity)
}.scale({ x: this.scale1 }).opacity(this.opacity1)
}
// 自定义方式2:使用系统提供的多种默认效果(平移、缩放、透明度等)
......@@ -168,8 +168,8 @@ struct PageTransitionExample {
@Entry
@Component
struct PageTransitionExample1 {
@State scale: number = 1
@State opacity: number = 1
@State scale2: number = 1
@State opacity2: number = 1
@State active: boolean = false
build() {
......@@ -180,7 +180,7 @@ struct PageTransitionExample1 {
.onClick(() => {
this.active = true
})
}.scale({ x: this.scale }).opacity(this.opacity)
}.scale({ x: this.scale2 }).opacity(this.opacity2)
}
// 自定义方式2:使用系统提供的多种默认效果(平移、缩放、透明度等)
......
......@@ -21,7 +21,7 @@ id为组件的唯一标识,在整个应用内唯一。本模块提供组件标
## 接口
### getInspectorByKey
### getInspectorByKey<sup>9+</sup>
getInspectorByKey(id: string): string
......@@ -37,7 +37,7 @@ getInspectorByKey(id: string): string
| -------- | -------- |
| string | 组件属性列表的JSON字符串。 |
### getInspectorTree
### getInspectorTree<sup>9+</sup>
getInspectorTree(): string
......@@ -49,7 +49,7 @@ getInspectorTree(): string
| ------ | ---------------------------------- |
| string | 组件树及组件属性列表的JSON字符串。 |
### sendEventByKey
### sendEventByKey<sup>9+</sup>
sendEventByKey(id: string, action: number, params: string): boolean
......@@ -67,7 +67,7 @@ sendEventByKey(id: string, action: number, params: string): boolean
| -------- | -------- |
| boolean | 找不到指定id的组件时返回false,其余情况返回true。 |
### sendTouchEvent
### sendTouchEvent<sup>9+</sup>
sendTouchEvent(event: TouchObject): boolean
......@@ -85,7 +85,7 @@ sendTouchEvent(event: TouchObject): boolean
| ------- | ------------------------------------------- |
| boolean | 事件发送失败时返回false,其余情况返回true。 |
### sendKeyEvent
### sendKeyEvent<sup>9+</sup>
sendKeyEvent(event: KeyEvent): boolean
......@@ -103,7 +103,7 @@ sendKeyEvent(event: KeyEvent): boolean
| ------- | --------------------------------------------- |
| boolean | 事件发送失败时时返回false,其余情况返回true。 |
### sendMouseEvent
### sendMouseEvent<sup>9+</sup>
sendMouseEvent(event: MouseEvent): boolean
......
......@@ -70,7 +70,7 @@ struct PopupExample {
@Builder popupBuilder() {
Row({ space: 2 }) {
Image('/resource/ic_public_thumbsup.svg').width(24).height(24).margin({ left: -5 })
Text('Custom Popup').fontSize(12)
Text('Custom Popup').fontSize(10)
}.width(100).height(50).backgroundColor(Color.White)
}
......
......@@ -39,7 +39,7 @@ struct ZIndexExample {
Text('third child, zIndex(1)')
.size({width: '70%', height: '50%'}).backgroundColor(0xc1cbac).align(Alignment.TopStart)
.zIndex(1)
}
}.width('100%').height(200)
}.width('100%').height(200)
}
}
......
......@@ -26,7 +26,7 @@
@Component
struct AreaExample {
@State value: string = 'Text'
@State size: string = ''
@State size1: string = ''
build() {
Column() {
......@@ -37,7 +37,7 @@ struct AreaExample {
})
.onAreaChange((oldValue: Area, newValue: Area) => {
console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} value is ${JSON.stringify(newValue)}`)
this.size = JSON.stringify(newValue)
this.size1 = JSON.stringify(newValue)
})
Text('new area is: \n' + this.size).margin({ right: 30, left: 30 })
}
......
......@@ -57,9 +57,11 @@
| 接口名 | 功能描述 |
| -------------------------------------- | ------------------------------------------------ |
| int32_t StartOnce(uint32_t duration) | 按照指定持续时间触发振动马达,duration为振动持续时长。 |
| int32_t Start(const char *effectType) | 按照指定预置效果启动马达,effectType表示预置的预置效果。 |
| int32_t Stop(enum VibratorMode mode) | 按照指定的振动模式停止马达振动。 |
| int32_t StartOnce(uint32_t duration) | 按照指定持续时间触发振动马达,duration为振动持续时长。 |
| int32_t Start(const char *effectType) | 按照指定预置效果启动马达,effectType表示预置的预置效果。 |
| int32_t Stop(enum VibratorMode mode) | 按照指定的振动模式停止马达振动。 |
| int32_t EnableVibratorModulation(uint32_t duration, int32_t intensity, int32_t frequency) | 按照指定振幅、频率、持续时间触发振动马达。duration为振动持续时长,intensity为振动强度,frequency为振动频率。 |
| int32_t GetVibratorInfo(struct VibratorInfo **vibratorInfo); | 获取马达信息,包括是否支持振幅和频率的设置及振幅和频率的设置范围 。 |
### 开发步骤
......@@ -90,13 +92,13 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
int32_t cmd, struct HdfSBuf *data, struct HdfSBuf *reply)
{
int32_t loop;
for (loop = 0; loop < sizeof(g_vibratorCmdHandle) / sizeof(g_vibratorCmdHandle[0]); ++loop) {
if ((cmd == g_vibratorCmdHandle[loop].cmd) && (g_vibratorCmdHandle[loop].func != NULL)) {
return g_vibratorCmdHandle[loop].func(data, reply);
}
}
return HDF_SUCCESS;
}
......@@ -105,34 +107,34 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
{
struct VibratorDriverData *drvData = NULL;
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(device, HDF_FAILURE);
drvData = (struct VibratorDriverData *)OsalMemCalloc(sizeof(*drvData));
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_ERR_MALLOC_FAIL);
drvData->ioService.Dispatch = DispatchVibrator;
drvData->device = device;
device->service = &drvData->ioService;
g_vibratorDrvData = drvData;
return HDF_SUCCESS;
}
/* 马达驱动初始化入口函数*/
int32_t InitVibratorDriver(struct HdfDeviceObject *device)
{
struct VibratorDriverData *drvData = NULL;
drvData->mode = VIBRATOR_MODE_BUTT;
drvData->state = VIBRATOR_STATE_IDLE;
......
if (CreateVibratorHaptic(device) != HDF_SUCCESS) {
HDF_LOGE("%s: init workQueue fail!", __func__);
HDF_LOGE("%s: init workQueue failed!", __func__);
return HDF_FAILURE;
}
return HDF_SUCCESS;
}
/* 释放马达驱动初始化时分配的资源 */
void ReleaseVibratorDriver(struct HdfDeviceObject *device)
{
......@@ -168,7 +170,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
- 创建马达效果模型。
```hcs
```c
/* 创建马达效果模型,分配资源,解析马达效果HCS配置 */
int32_t CreateVibratorHaptic(struct HdfDeviceObject *device)
{
......@@ -181,7 +183,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
hapticData->supportHaptic = false;
if (OsalMutexInit(&hapticData->mutex) != HDF_SUCCESS) {
HDF_LOGE("%s: fail to init mutex", __func__);
HDF_LOGE("%s: failed to init mutex", __func__);
goto EXIT;
}
......@@ -189,7 +191,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
/* 解析马达效果HCS配置 */
if (ParserVibratorHapticConfig(device->property) != HDF_SUCCESS) {
HDF_LOGE("%s: parser haptic config fail!", __func__);
HDF_LOGE("%s: parser haptic config failed!", __func__);
goto EXIT;
}
......@@ -235,7 +237,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
马达硬件服务调用StartOnce接口动态配置持续振动时间;调用StartEffect接口启动静态配置的振动效果,为驱动开发者提供抽象的配置接口能力。
```c
/* 按照指定持续时间触发振动马达,duration为振动持续时长 */
/* 按照指定持续时间触发振动马达,duration为振动持续时长 */
static int32_t StartOnce(struct HdfSBuf *data, struct HdfSBuf *reply)
{
uint32_t duration;
......@@ -250,14 +252,14 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
/* 根据振动效果的模式创建定时器 */
ret = StartHaptic(&config);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: start haptic fail!", __func__);
HDF_LOGE("%s: start haptic failed!", __func__);
return ret;
}
return HDF_SUCCESS;
}
/* 按照预置效果启动马达,effectType表示预置的预置效果 */
/* 按照预置效果启动马达,effectType表示预置的预置效果 */
static int32_t StartEffect(struct HdfSBuf *data, struct HdfSBuf *reply)
{
int32_t ret;
......@@ -272,7 +274,7 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
ret = StartHaptic(&config);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: start haptic fail!", __func__);
HDF_LOGE("%s: start haptic failed!", __func__);
return ret;
}
......@@ -287,10 +289,10 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
struct VibratorDriverData *drvData = GetVibratorDrvData();
(void)reply;
......
/* 停止马达效果振动,销毁马达定时器 */
/* 停止马达效果振动,销毁马达定时器 */
ret = StopHaptic();
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: stop haptic fail!", __func__);
HDF_LOGE("%s: stop haptic failed!", __func__);
return ret;
}
......@@ -300,6 +302,58 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
return HDF_SUCCESS;
}
/* 按照指定振幅、频率、持续时间触发振动马达。duration为振动持续时长,intensity为振动强度,frequency为振动频率。 */
static int32_t EnableModulationParameter(struct HdfSBuf *data, struct HdfSBuf *reply)
{
(void)reply;
struct VibratorEffectCfg config;
struct VibratorDriverData *drvData;
uint32_t duration;
int32_t intensity;
int32_t frequency;
int32_t ret;
.....
(void)OsalMutexLock(&drvData->mutex);
drvData->mode = VIBRATOR_MODE_ONCE;
(void)OsalMutexUnlock(&drvData->mutex);
/* 设置振幅和频率 */
ret = drvData->ops.SetParameter(intensity, frequency);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: set parameter failed", __func__);
return HDF_FAILURE;
}
config.cfgMode = VIBRATOR_MODE_ONCE;
config.duration = duration;
config.effect = NULL;
ret = StartHaptic(&config);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: start haptic failed", __func__);
return HDF_FAILURE;
}
return HDF_SUCCESS;
}
/* 获取马达信息,包括是否支持振幅和频率的设置及振幅和频率的设置范围。 */
static int32_t GetVibratorInfo(struct HdfSBuf *data, struct HdfSBuf *reply)
{
(void)data;
struct VibratorDriverData *drvData;
drvData = GetVibratorDrvData();
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_ERR_INVALID_PARAM);
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(reply, HDF_ERR_INVALID_PARAM);
if (!HdfSbufWriteBuffer(reply, &drvData->vibratorInfo, sizeof(drvData->vibratorInfo))) {
HDF_LOGE("%s: write sbuf failed", __func__);
return HDF_FAILURE;
}
return HDF_SUCCESS;
}
```
4. 马达驱动模型提供给开发者马达驱动差异化接口,开发者实现差异化接口。
......@@ -319,50 +373,181 @@ Vibrator驱动模型为上层马达硬件服务层提供稳定的马达控制能
drvData->ops.Start = ops->Start;
drvData->ops.StartEffect = ops->StartEffect;
drvData->ops.Stop = ops->Stop;
drvData->ops.SetParameter = ops->SetParameter;
(void)OsalMutexUnlock(&drvData->mutex);
return HDF_SUCCESS;
}
/* 注册马达信息接口 */
int32_t RegisterVibratorInfo(struct VibratorInfo *vibratorInfo)
{
struct VibratorDriverData *drvData = GetVibratorDrvData();
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(vibratorInfo, HDF_FAILURE);
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE);
(void)OsalMutexLock(&drvData->mutex);
if (memcpy_s(&drvData->vibratorInfo, sizeof(drvData->vibratorInfo), vibratorInfo, sizeof(*vibratorInfo)) != EOK) {
HDF_LOGE("%s: Memcpy vibrator config failed", __func__);
return HDF_FAILURE;
}
(void)OsalMutexUnlock(&drvData->mutex);
return HDF_SUCCESS;
}
```
- 马达驱动模型提供给开发者马达驱动差异化接口,具体实现如下:
```c
/* 按照指定持续时间触发线性马达的振动 */
static int32_t StartLinearVibrator()
/* 按照指定的振动模式停止马达的振动 */
static int32_t StopModulationParameter()
{
int32_t ret;
struct VibratorLinearDriverData *drvData = GetLinearVibratorData();
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE);
......
ret = GpioWrite(drvData->gpioNum, GPIO_VAL_LOW);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: pull gpio%d to %d level failed", __func__, drvData->gpioNum, GPIO_VAL_LOW);
return ret;
uint8_t value[DRV2605L_VALUE_BUTT];
struct Drv2605lDriverData *drvData = NULL;
drvData = GetDrv2605lDrvData();
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE);
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData->drv2605lCfgData, HDF_FAILURE);
value[DRV2605L_ADDR_INDEX] = (uint8_t)DRV2605_REG_MODE;
value[DRV2605L_VALUE_INDEX] = (uint8_t)DRV2605_MODE_STANDBY;
if (WriteDrv2605l(&drvData->drv2605lCfgData->vibratorBus.i2cCfg, value, sizeof(value)) != HDF_SUCCESS) {
HDF_LOGE("%s: i2c addr [%0X] write failed", __func__, value[DRV2605L_ADDR_INDEX]);
return HDF_FAILURE;
}
value[DRV2605L_ADDR_INDEX] = (uint8_t)DRV2605_REG_RTPIN;
value[DRV2605L_VALUE_INDEX] = (uint8_t)&drvData->drv2605lCfgData->vibratorAttr.defaultIntensity;
if (WriteDrv2605l(&drvData->drv2605lCfgData->vibratorBus.i2cCfg, value, sizeof(value)) != HDF_SUCCESS) {
HDF_LOGE("%s: i2c addr [%0X] write failed", __func__, value[DRV2605L_ADDR_INDEX]);
}
value[DRV2605L_ADDR_INDEX] = (uint8_t)DRV2605_REG_LRARESON;
value[DRV2605L_VALUE_INDEX] = (uint8_t)&drvData->drv2605lCfgData->vibratorAttr.defaultFrequency;
if (WriteDrv2605l(&drvData->drv2605lCfgData->vibratorBus.i2cCfg, value, sizeof(value)) != HDF_SUCCESS) {
HDF_LOGE("%s: i2c addr [%0X] write failed", __func__, value[DRV2605L_ADDR_INDEX]);
}
return HDF_SUCCESS;
}
/* 按照预置振动效果触发线性马达的振动 */
static int32_t StartEffectLinearVibrator(uint32_t effectType)
{
(void)effectType;
HDF_LOGE("%s: vibrator set build-in effect no support!", __func__);
return HDF_SUCCESS;
}
/* 按照指定的振动模式停止线性马达的振动 */
static int32_t StopLinearVibrator()
/* 设置马达振幅和频率 */
static void SetModulationParameter(int32_t intensity, int32_t frequency)
{
int32_t ret;
struct VibratorLinearDriverData *drvData = GetLinearVibratorData();
uint8_t value[DRV2605L_VALUE_BUTT];
struct Drv2605lDriverData *drvData = NULL;
drvData = GetDrv2605lDrvData();
CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE);
......
ret = GpioWrite(drvData->gpioNum, GPIO_VAL_HIGH);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: pull gpio%d to %d level failed", __func__, drvData->gpioNum, GPIO_VAL_HIGH);
return ret;
if (intensity != 0) {
value[DRV2605L_ADDR_INDEX] = (uint8_t)DRV2605_REG_RTPIN;
value[DRV2605L_VALUE_INDEX] = (uint8_t)INTENSITY_MAPPING_VALUE(intensity);
if (WriteDrv2605l(&drvData->drv2605lCfgData->vibratorBus.i2cCfg, value, sizeof(value)) != HDF_SUCCESS) {
HDF_LOGE("%s: i2c addr [%0X] write failed", __func__, value[DRV2605L_ADDR_INDEX]);
return;
}
} else {
HDF_LOGD("%s: the setting of intensity 0 is not supported and \
will be set as the system default intensity", __func__);
}
if (frequency != 0) {
value[DRV2605L_ADDR_INDEX] = (uint8_t)DRV2605_REG_LRARESON;
value[DRV2605L_VALUE_INDEX] = (uint8_t)FREQUENCY_MAPPING_VALUE(frequency);
if (WriteDrv2605l(&drvData->drv2605lCfgData->vibratorBus.i2cCfg, value, sizeof(value)) != HDF_SUCCESS) {
HDF_LOGE("%s: i2c addr [%0X] write failed", __func__, value[DRV2605L_ADDR_INDEX]);
return;
}
} else {
HDF_LOGD("%s: the setting of frequency 0 is not supported and \
will be set as the system default frequency", __func__);
}
return HDF_SUCCESS;
}
```
\ No newline at end of file
```
### 调测验证
驱动开发完成后,在传感器单元测试里面开发自测试用例,验证驱动基本功能。测试环境采用开发者自测试平台。
```
/* 用例执行前,初始化马达接口实例。 */
void HdfVibratorTest::SetUpTestCase()
{
g_vibratorDev = NewVibratorInterfaceInstance();
}
/* 用例资源释放 */
void HdfVibratorTest::TearDownTestCase()
{
if(g_vibratorDev != nullptr){
FreeVibratorInterfaceInstance();
g_vibratorDev = nullptr;
}
}
/* 测试单次振动 */
HWTEST_F(HdfVibratorTest, PerformOneShotVibratorDuration_001, TestSize.Level1)
{
ASSERT_NE(nullptr, g_vibratorDev);
int32_t startRet = g_vibratorDev->StartOnce(g_duration);
EXPECT_EQ(startRet, HDF_SUCCESS);
OsalMSleep(g_sleepTime1);
int32_t endRet = g_vibratorDev->Stop(VIBRATOR_MODE_ONCE);
EXPECT_EQ(endRet, HDF_SUCCESS);
}
/* 测试预置效果振动 */
HWTEST_F(HdfVibratorTest, ExecuteVibratorEffect_002, TestSize.Level1)
{
ASSERT_NE(nullptr, g_vibratorDev);
int32_t startRet = g_vibratorDev->Start(g_builtIn);
EXPECT_EQ(startRet, HDF_SUCCESS);
OsalMSleep(g_sleepTime1);
int32_t endRet = g_vibratorDev->Stop(VIBRATOR_MODE_PRESET);
EXPECT_EQ(endRet, HDF_SUCCESS);
}
/* 获取马达信息,包括是否支持振幅和频率的设置及振幅和频率的设置范围。 */
HWTEST_F(HdfVibratorTest, GetVibratorInfo_001, TestSize.Level1)
{
ASSERT_NE(nullptr, g_vibratorDev);
int32_t startRet = g_vibratorDev->GetVibratorInfo(&g_vibratorInfo);
EXPECT_EQ(startRet, HDF_SUCCESS);
EXPECT_NE(g_vibratorInfo, nullptr);
printf("intensity = %d, intensityMaxValue = %d, intensityMinValue = %d\n\t",
g_vibratorInfo->isSupportIntensity, g_vibratorInfo->intensityMaxValue, g_vibratorInfo->intensityMinValue);
printf("frequency = %d, frequencyMaxValue = %d, frequencyMinValue = %d\n\t",
g_vibratorInfo->isSupportFrequency, g_vibratorInfo->frequencyMaxValue, g_vibratorInfo->frequencyMinValue);
}
/* 按照指定振幅、频率、持续时间触发振动马达。duration为振动持续时长,intensity为振动强度,frequency为振动频率。 */
HWTEST_F(HdfVibratorTest, EnableVibratorModulation_001, TestSize.Level1)
{
int32_t startRet;
ASSERT_NE(nullptr, g_vibratorDev);
EXPECT_GT(g_duration, 0);
if ((g_vibratorInfo->isSupportIntensity == 1) || (g_vibratorInfo->isSupportFrequency == 1)) {
EXPECT_GE(g_intensity1, g_vibratorInfo->intensityMinValue);
EXPECT_LE(g_intensity1, g_vibratorInfo->intensityMaxValue);
EXPECT_GE(g_frequency1, g_vibratorInfo->frequencyMinValue);
EXPECT_LE(g_frequency1, g_vibratorInfo->frequencyMaxValue);
startRet = g_vibratorDev->EnableVibratorModulation(g_duration, g_intensity1, g_frequency1);
EXPECT_EQ(startRet, HDF_SUCCESS);
OsalMSleep(g_sleepTime1);
startRet = g_vibratorDev->Stop(VIBRATOR_MODE_ONCE);
EXPECT_EQ(startRet, HDF_SUCCESS);
}
}
```
......@@ -122,7 +122,6 @@
- [CompVerInfo](_comp_ver_info.md)
- [CredentialInfo](_credential_info.md)
- [DeviceFuncs](_device_funcs.md)
- [DeviceInfo](_device_info.md)
- [DisplayCapability](_display_capability.md)
- [DisplayInfo](_display_info.md)
- [DisplayModeInfo](_display_mode_info.md)
......@@ -130,7 +129,6 @@
- [EnrollParam](_enroll_param.md)
- [EnrollResultInfo](_enroll_resultinfo.md)
- [EventInfo](_event_info.md)
- [EventPackage](_event_package.md)
- [ExecutorInfo](_executor_info.md)
- [ExecutorInfo](_user_executor_info.md)
- [ExecutorRegisterInfo](_executor_register_info.md)
......@@ -154,10 +152,19 @@
- [IInputInterface](_i_input_interface.md)
- [ILine](_i_line.md)
- [InputController](_input_controller.md)
- [InputDevAbility](_input_dev_ability.md)
- [InputDevAttr](_input_dev_attr.md)
- [InputDevDesc](_input_dev_desc.md)
- [InputDevIdentify](_input_dev_identify.md)
- [InputDeviceInfo](_device_info.md)
- [InputDimensionInfo](_input_dimension_info.md)
- [InputEventCb](_input_report_event_cb.md)
- [InputEventPackage](_event_package.md)
- [InputExtraCmd](_input_extra_cmd.md)
- [InputHostCb](_input_host_cb.md)
- [InputHotPlugEvent](_input_hotplug_event.md)
- [InputManager](_input_manager.md)
- [InputReporter](_input_reporter.md)
- [InputReportEventCb](_input_report_event_cb.md)
- [IPinAuthInterface](interface_i_pin_auth_interface.md)
- [IPowerHdiCallback](interface_i_power_hdi_callback.md)
- [IPowerInterface](interface_i_power_interface.md)
......
# DeviceInfo
# InputDeviceInfo
## **概述**
......@@ -15,180 +15,104 @@
| Public&nbsp;属性 | 描述 |
| -------- | -------- |
| [devIndex](#devindex) | 设备索引 |
| [fd](#fd) | 设备对应的文件描述符 |
| [service](#service) | 设备对应的服务 |
| [listener](#listener) | 设备对应的事件监听器 |
| [devType](#devtype) | 设备类型 |
| [powerStatus](#powerstatus) | 电源状态 |
| [devIndex](#devindex) | 设备索引 |
| [devType](#devtype) | 设备类型 |
| [chipInfo](#chipinfo)&nbsp;[CHIP_INFO_LEN] | 驱动芯片编码信息 |
| [vendorName](#vendorname)&nbsp;[VENDOR_NAME_LEN] | 模组厂商名 |
| [vendorName](#vendorname)&nbsp;[VENDOR_NAME_LEN] | 模组厂商名 |
| [chipName](#chipname)&nbsp;[CHIP_NAME_LEN] | 驱动芯片型号 |
| [devNodePath](#devnodepath)&nbsp;[MAX_NODE_PATH_LEN] | 设备文件路径 |
| [solutionX](#solutionx) | x方向分辨率 |
| [solutionY](#solutiony) | y方向分辨率 |
| [callback](#callback) | 数据上报回调函数&nbsp;[InputReportEventCb](_input_report_event_cb.md) |
| [attrSet](#attrset)| 设备属性。 |
| [abilitySet](#abilityset)| 设备能力属性。|
## **详细描述**
input设备基础设备信息
Input设备基础设备信息。
## **类成员变量说明**
### callback
```
InputReportEventCb* DeviceInfo::callback
```
**描述:**
数据上报回调函数 [InputReportEventCb](_input_report_event_cb.md)
### chipInfo
```
char DeviceInfo::chipInfo[CHIP_INFO_LEN]
char InputDeviceInfo::chipInfo[CHIP_INFO_LEN]
```
**描述:**
驱动芯片编码信息
驱动芯片编码信息
### chipName
```
char DeviceInfo::chipName[CHIP_NAME_LEN]
char InputDeviceInfo::chipName[CHIP_NAME_LEN]
```
**描述:**
驱动芯片型号
驱动芯片型号
### devIndex
```
uint32_t DeviceInfo::devIndex
uint32_t InputDeviceInfo::devIndex
```
**描述:**
设备索引
### devNodePath
```
char DeviceInfo::devNodePath[MAX_NODE_PATH_LEN]
```
**描述:**
设备索引。
设备文件路径
### devType
```
uint32_t DeviceInfo::devType
```
**描述:**
设备类型
### fd
```
int32_t DeviceInfo::fd
```
**描述:**
设备对应的文件描述符
### listener
```
void* DeviceInfo::listener
```
**描述:**
设备对应的事件监听器
### powerStatus
```
uint32_t DeviceInfo::powerStatus
```
**描述:**
电源状态
### service
```
void* DeviceInfo::service
uint32_t InputDeviceInfo::devType
```
**描述:**
设备对应的服务
设备类型。
### solutionX
### vendorName
```
uint32_t DeviceInfo::solutionX
char InputDeviceInfo::vendorName[VENDOR_NAME_LEN]
```
**描述:**
x方向分辨率
模组厂商名。
### solutionY
### attrSet
```
uint32_t DeviceInfo::solutionY
InputDevAttr InputDeviceInfo::attrSet
```
**描述:**
y方向分辨率
设备属性。
### vendorName
### abilitySet
```
char DeviceInfo::vendorName[VENDOR_NAME_LEN]
InputDevAbility InputDeviceInfo::abilitySet
```
**描述:**
模组厂商名
设备能力属性。
\ No newline at end of file
......@@ -23,8 +23,15 @@
| [IInputInterface](_i_input_interface.md) | 定义用于提供输入设备驱动能力的接口。[更多...](_i_input_interface.md) |
| [InputReporter](_input_reporter.md) | 提供Input设备数据上报相关的接口。&nbsp;[更多...](_input_reporter.md) |
| [InputEventPackage](_event_package.md) | Input事件数据包结构。&nbsp;[更多...](_event_package.md) |
| [InputReportEventCb](_input_report_event_cb.md) | 此结构体定义了输入事件回调函数并提供给Input服务使用。&nbsp;[更多...](_input_report_event_cb.md) |
| [DeviceInfo](_device_info.md) | Input设备基础设备信息。&nbsp;[更多...](_device_info.md) |
| [InputHotPlugEvent](_input_hotplug_event.md) | 热插拔事件数据包结构。&nbsp;[更多...](_input_hotplug_event.md) |
| [InputDevDesc](_input_dev_desc.md) | Input设备描述信息。&nbsp;[更多...](_input_dev_desc.md) |
| [InputEventCb](_input_report_event_cb.md) | 此结构体定义了输入事件回调函数并提供给Input服务使用。&nbsp;[更多...](_input_report_event_cb.md) |
| [InputHostCb](_input_host_cb.md) | 此结构体定义了热插拔事件上报回调函数并提供给Input服务使用。&nbsp;[更多...](_input_host_cb.md) |
| [InputDevAbility](_input_dev_ability.md) | Input设备的能力属性,存储支持事件的位图。&nbsp;[更多...](_input_dev_ability.md) |
| [InputDimensionInfo](_input_dimension_info.md) | Input设备的维度信息。&nbsp;[更多...](_input_dimension_info.md) |
| [InputDevIdentify](_input_dev_identify.md) | Input设备的识别信息。&nbsp;[更多...](_input_dev_identify.md) |
| [InputDevAttr](_input_dev_attr.md) | Input设备属性。&nbsp;[更多...](_input_dev_attr.md) |
| [InputDeviceInfo](_device_info.md) | Input设备基础设备信息。&nbsp;[更多...](_device_info.md) |
| [InputExtraCmd](_input_extra_cmd.md) | 扩展指令的数据结构。&nbsp;[更多...](_input_extra_cmd.md) |
......@@ -49,10 +56,10 @@
| 枚举 | 描述 |
| -------- | -------- |
| [RetStatus](#retstatus)&nbsp;{&nbsp;INPUT_SUCCESS&nbsp;=&nbsp;0,&nbsp;INPUT_FAILURE&nbsp;=&nbsp;-1,&nbsp;INPUT_INVALID_PARAM&nbsp;=&nbsp;-2,&nbsp;INPUT_NOMEM&nbsp;=&nbsp;-3,&nbsp;&nbsp;&nbsp;INPUT_NULL_PTR&nbsp;=&nbsp;-4,&nbsp;INPUT_TIMEOUT&nbsp;=&nbsp;-5,&nbsp;INPUT_UNSUPPORTED&nbsp;=&nbsp;-6&nbsp;} | 定义返回值类型&nbsp;[更多...](#retstatus) |
| [InputDevType](#inputdevtype)&nbsp;{&nbsp;INDEV_TYPE_TOUCH,&nbsp;INDEV_TYPE_KEY,&nbsp;INDEV_TYPE_KEYBOARD,&nbsp;INDEV_TYPE_MOUSE,&nbsp;&nbsp;&nbsp;INDEV_TYPE_BUTTON,&nbsp;INDEV_TYPE_CROWN,&nbsp;INDEV_TYPE_ENCODER,&nbsp;INDEV_TYPE_UNKNOWN&nbsp;} | 定义Input设备类型&nbsp;[更多...](#inputdevtype) |
| [PowerStatus](#powerstatus)&nbsp;{&nbsp;INPUT_RESUME,&nbsp;INPUT_SUSPEND,&nbsp;INPUT_LOW_POWER,&nbsp;INPUT_POWER_STATUS_UNKNOWN&nbsp;} | 定义电源状态&nbsp;[更多...](#powerstatus) |
| [CapacitanceTest](#capacitancetest)&nbsp;{&nbsp;BASE_TEST,&nbsp;FULL_TEST,&nbsp;MMI_TEST,&nbsp;RUNNING_TEST,&nbsp;&nbsp;&nbsp;TEST_TYPE_UNKNOWN&nbsp;} | 定义容值测试类型&nbsp;[更多...](#capacitancetest) |
| [RetStatus](#retstatus)&nbsp;{&nbsp;INPUT_SUCCESS&nbsp;=&nbsp;0,&nbsp;INPUT_FAILURE&nbsp;=&nbsp;-1,&nbsp;INPUT_INVALID_PARAM&nbsp;=&nbsp;-2,&nbsp;INPUT_NOMEM&nbsp;=&nbsp;-3,&nbsp;&nbsp;&nbsp;INPUT_NULL_PTR&nbsp;=&nbsp;-4,&nbsp;INPUT_TIMEOUT&nbsp;=&nbsp;-5,&nbsp;INPUT_UNSUPPORTED&nbsp;=&nbsp;-6&nbsp;} | 定义返回值类型&nbsp;[更多...](#retstatus) |
| [InputDevType](#inputdevtype)&nbsp;{&nbsp;INDEV_TYPE_TOUCH,&nbsp;INDEV_TYPE_KEY,&nbsp;INDEV_TYPE_KEYBOARD,&nbsp;INDEV_TYPE_MOUSE,&nbsp;&nbsp;&nbsp;INDEV_TYPE_BUTTON,&nbsp;INDEV_TYPE_CROWN,&nbsp;INDEV_TYPE_ENCODER,&nbsp;INDEV_TYPE_UNKNOWN&nbsp;} | 定义Input设备类型&nbsp;[更多...](#inputdevtype) |
| [PowerStatus](#powerstatus)&nbsp;{&nbsp;INPUT_RESUME,&nbsp;INPUT_SUSPEND,&nbsp;INPUT_LOW_POWER,&nbsp;INPUT_POWER_STATUS_UNKNOWN&nbsp;} | 定义电源状态&nbsp;[更多...](#powerstatus) |
| [CapacitanceTest](#capacitancetest)&nbsp;{&nbsp;BASE_TEST,&nbsp;FULL_TEST,&nbsp;MMI_TEST,&nbsp;RUNNING_TEST,&nbsp;&nbsp;&nbsp;TEST_TYPE_UNKNOWN&nbsp;} | 定义容值测试类型&nbsp;[更多...](#capacitancetest) |
### 函数
......
# InputReportEventCb
# InputEventCb
## **概述**
......@@ -15,8 +15,7 @@
| Public&nbsp;属性 | 描述 |
| -------- | -------- |
| (&nbsp;[ReportEventPkgCallback](#reporteventpkgcallback)&nbsp;)(const&nbsp;[InputEventPackage](_event_package.md)&nbsp;\*\*pkgs,&nbsp;uint32_t&nbsp;count,&nbsp;uint32_t&nbsp;devIndex) | 输入事件数据上报的回调函数。&nbsp;[更多...](#reporteventpkgcallback) |
| (&nbsp;[ReportHotPlugEventCallback](#reporthotplugeventcallback)&nbsp;)(const&nbsp;HotPlugEvent&nbsp;\*event) | 热插拔事件上报的回调函数。&nbsp;[更多...](#reporthotplugeventcallback) |
| (&nbsp;[EventPkgCallback](#eventpkgcallback)&nbsp;)(const&nbsp;[InputEventPackage](_event_package.md)&nbsp;\*\*pkgs,&nbsp;uint32_t&nbsp;count,&nbsp;uint32_t&nbsp;devIndex) | 输入事件数据上报的回调函数。&nbsp;[更多...](#eventpkgcallback) |
## **详细描述**
......@@ -27,11 +26,11 @@
## **类成员变量说明**
### ReportEventPkgCallback
### EventPkgCallback
```
void(* InputReportEventCb::ReportEventPkgCallback) (const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex)
void (* InputEventCb::EventPkgCallback)(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex);
```
**描述:**
......@@ -42,24 +41,7 @@ void(* InputReportEventCb::ReportEventPkgCallback) (const InputEventPackage **pk
| 名称 | 描述 |
| -------- | -------- |
| eventData | 驱动上报的Input事件数据。 |
| pkgs| 驱动上报的Input事件数据。 |
| count | Input事件数据包的个数。 |
| devIndex | Input设备索引,用于标志多个Input设备,取值从0开始,最多支持32个设备。 |
### ReportHotPlugEventCallback
```
void(* InputReportEventCb::ReportHotPlugEventCallback) (const HotPlugEvent *event)
```
**描述:**
热插拔事件上报的回调函数。
**参数:**
| 名称 | 描述 |
| -------- | -------- |
| event | 上报的热插拔事件数据 |
......@@ -15,10 +15,17 @@
| 类 | 描述 |
| -------- | -------- |
| [EventPackage](_event_package.md) | Input事件数据包结构&nbsp;[更多...](_event_package.md) |
| [InputReportEventCb](_input_report_event_cb.md) | 此结构体定义了输入事件回调函数并提供给Input服务使用&nbsp;[更多...](_input_report_event_cb.md) |
| [DeviceInfo](_device_info.md) | Input设备基础设备信息&nbsp;[更多...](_device_info.md) |
| [InputExtraCmd](_input_extra_cmd.md) | 扩展指令的数据结构&nbsp;[更多...](_input_extra_cmd.md) |
| [InputEventPackage](_event_package.md) | Input事件数据包结构。&nbsp;[更多...](_event_package.md) |
| [InputHotPlugEvent](_input_hotplug_event.md) | 热插拔事件数据包结构。&nbsp;[更多...](_input_hotplug_event.md) |
| [InputDevDesc](_input_dev_desc.md) | Input设备描述信息。&nbsp;[更多...](_input_dev_desc.md) |
| [InputEventCb](_input_report_event_cb.md) | 此结构体定义了输入事件回调函数并提供给Input服务使用。&nbsp;[更多...](_input_report_event_cb.md) |
| [InputHostCb](_input_host_cb.md) | 此结构体定义了热插拔事件上报回调函数并提供给Input服务使用。&nbsp;[更多...](_input_host_cb.md) |
| [InputDevAbility](_input_dev_ability.md) | Input设备的能力属性,存储支持事件的位图。&nbsp;[更多...](_input_dev_ability.md) |
| [InputDimensionInfo](_input_dimension_info.md) | Input设备的维度信息。&nbsp;[更多...](_input_dimension_info.md) |
| [InputDevIdentify](_input_dev_identify.md) | Input设备的识别信息。&nbsp;[更多...](_input_dev_identify.md) |
| [InputDevAttr](_input_dev_attr.md) | Input设备属性。&nbsp;[更多...](_input_dev_attr.md) |
| [InputDeviceInfo](_device_info.md) | Input设备基础设备信息。&nbsp;[更多...](_device_info.md) |
| [InputExtraCmd](_input_extra_cmd.md) | 扩展指令的数据结构。&nbsp;[更多...](_input_extra_cmd.md) |
### 宏定义
......@@ -42,10 +49,10 @@
| 枚举 | 描述 |
| -------- | -------- |
| [RetStatus](_input.md#retstatus)&nbsp;{&nbsp;INPUT_SUCCESS&nbsp;=&nbsp;0,&nbsp;INPUT_FAILURE&nbsp;=&nbsp;-1,&nbsp;INPUT_INVALID_PARAM&nbsp;=&nbsp;-2,&nbsp;INPUT_NOMEM&nbsp;=&nbsp;-3,&nbsp;&nbsp;&nbsp;INPUT_NULL_PTR&nbsp;=&nbsp;-4,&nbsp;INPUT_TIMEOUT&nbsp;=&nbsp;-5,&nbsp;INPUT_UNSUPPORTED&nbsp;=&nbsp;-6&nbsp;} | 定义返回值类型&nbsp;[更多...](_input.md#retstatus) |
| [InputDevType](_input.md#inputdevtype)&nbsp;{&nbsp;INDEV_TYPE_TOUCH,&nbsp;INDEV_TYPE_KEY,&nbsp;INDEV_TYPE_KEYBOARD,&nbsp;INDEV_TYPE_MOUSE,&nbsp;&nbsp;&nbsp;INDEV_TYPE_BUTTON,&nbsp;INDEV_TYPE_CROWN,&nbsp;INDEV_TYPE_ENCODER,&nbsp;INDEV_TYPE_UNKNOWN&nbsp;} | 定义Input设备类型&nbsp;[更多...](_input.md#inputdevtype) |
| [PowerStatus](_input.md#powerstatus)&nbsp;{&nbsp;INPUT_RESUME,&nbsp;INPUT_SUSPEND,&nbsp;INPUT_LOW_POWER,&nbsp;INPUT_POWER_STATUS_UNKNOWN&nbsp;} | 定义电源状态&nbsp;[更多...](_input.md#powerstatus) |
| [CapacitanceTest](_input.md#capacitancetest)&nbsp;{&nbsp;BASE_TEST,&nbsp;FULL_TEST,&nbsp;MMI_TEST,&nbsp;RUNNING_TEST,&nbsp;&nbsp;&nbsp;TEST_TYPE_UNKNOWN&nbsp;} | 定义容值测试类型&nbsp;[更多...](_input.md#capacitancetest) |
| [RetStatus](_input.md#retstatus)&nbsp;{&nbsp;INPUT_SUCCESS&nbsp;=&nbsp;0,&nbsp;INPUT_FAILURE&nbsp;=&nbsp;-1,&nbsp;INPUT_INVALID_PARAM&nbsp;=&nbsp;-2,&nbsp;INPUT_NOMEM&nbsp;=&nbsp;-3,&nbsp;&nbsp;&nbsp;INPUT_NULL_PTR&nbsp;=&nbsp;-4,&nbsp;INPUT_TIMEOUT&nbsp;=&nbsp;-5,&nbsp;INPUT_UNSUPPORTED&nbsp;=&nbsp;-6&nbsp;} | 定义返回值类型&nbsp;[更多...](_input.md#retstatus) |
| [InputDevType](_input.md#inputdevtype)&nbsp;{&nbsp;INDEV_TYPE_TOUCH,&nbsp;INDEV_TYPE_KEY,&nbsp;INDEV_TYPE_KEYBOARD,&nbsp;INDEV_TYPE_MOUSE,&nbsp;&nbsp;&nbsp;INDEV_TYPE_BUTTON,&nbsp;INDEV_TYPE_CROWN,&nbsp;INDEV_TYPE_ENCODER,&nbsp;INDEV_TYPE_UNKNOWN&nbsp;} | 定义Input设备类型&nbsp;[更多...](_input.md#inputdevtype) |
| [PowerStatus](_input.md#powerstatus)&nbsp;{&nbsp;INPUT_RESUME,&nbsp;INPUT_SUSPEND,&nbsp;INPUT_LOW_POWER,&nbsp;INPUT_POWER_STATUS_UNKNOWN&nbsp;} | 定义电源状态&nbsp;[更多...](_input.md#powerstatus) |
| [CapacitanceTest](_input.md#capacitancetest)&nbsp;{&nbsp;BASE_TEST,&nbsp;FULL_TEST,&nbsp;MMI_TEST,&nbsp;RUNNING_TEST,&nbsp;&nbsp;&nbsp;TEST_TYPE_UNKNOWN&nbsp;} | 定义容值测试类型&nbsp;[更多...](_input.md#capacitancetest) |
## **详细描述**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册