未验证 提交 2e59eb68 编写于 作者: O openharmony_ci 提交者: Gitee

!21618 翻译已完成20461+21070+21022+21001+20775+20547+20481

Merge pull request !21618 from shawn_he/20481-d
...@@ -610,8 +610,10 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to ...@@ -610,8 +610,10 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
Call **transform** to obtain the transliterated string. Call **transform** to obtain the transliterated string.
```js ```js
let transliterator = I18n.Transliterator.getInstance("Any-Latn"); // Any-Latn means to convert any text to Latn text. let transliterator = I18n.Transliterator.getInstance("Any-Latin"); // Any-Latin means to convert any text to Latin text.
let transformText = transliterator.transform ("Hello"); // transformText = "nǐ hǎo" let transformText = transliterator.transform ("你好"); // transformText = "nǐ hǎo"
let transliterator2 = I18n.Transliterator.getInstance("Latin-ASCII"); // Latin-ASCII means to convert Latin text to ASCII text.
let transformText = transliterator2.transform(transformText); // transformText = "ni hao"
``` ```
## Obtaining the Character Type ## Obtaining the Character Type
...@@ -730,3 +732,4 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to ...@@ -730,3 +732,4 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
```js ```js
let order = I18n.I18NUtil.getDateOrder("zh-CN"); // order = "y-L-d" indicates that the sequence of year, month, and day in Chinese is year-month-day. let order = I18n.I18NUtil.getDateOrder("zh-CN"); // order = "y-L-d" indicates that the sequence of year, month, and day in Chinese is year-month-day.
``` ```
<!--no_check-->
\ No newline at end of file
...@@ -1757,8 +1757,8 @@ Obtains a list of IDs supported by the **Transliterator** object. ...@@ -1757,8 +1757,8 @@ Obtains a list of IDs supported by the **Transliterator** object.
**Example** **Example**
```ts ```ts
// ids = ["ASCII-Latin", "Accents-Any", "Amharic-Latin/BGN", ...], 671 IDs supported in total // A total of 671 IDs are supported. One ID is comprised of two parts separated by a hyphen (-) in the format of source-destination. For example, in **ids = ["Han-Latin","Latin-ASCII", "Amharic-Latin/BGN","Accents-Any", ...]**, **Han-Latin** indicates conversion from Chinese to Latin, and **Amharic-Latin** indicates conversion from Amharic to Latin.
// Each ID consists of two parts separated by a hyphen (-). The format is source-destination. // For more information, see ISO-15924.
let ids = I18n.Transliterator.getAvailableIDs(); let ids = I18n.Transliterator.getAvailableIDs();
``` ```
......
...@@ -16,7 +16,7 @@ import runningLock from '@ohos.runningLock'; ...@@ -16,7 +16,7 @@ import runningLock from '@ohos.runningLock';
isSupported(type: RunningLockType): boolean; isSupported(type: RunningLockType): boolean;
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. Checks whether the specified type of **RunningLock** is supported.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
...@@ -26,7 +26,7 @@ Checks whether the specified type of **RunningLock** is supported. This API uses ...@@ -26,7 +26,7 @@ Checks whether the specified type of **RunningLock** is supported. This API uses
| ------ | ----------------------------------- | ---- | -------------------- | | ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------- | --------------------------------------- | | ------- | --------------------------------------- |
...@@ -69,14 +69,6 @@ Creates a **RunningLock** object. ...@@ -69,14 +69,6 @@ Creates a **RunningLock** object.
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created. | | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created. |
| callback | AsyncCallback<[RunningLock](#runninglock)> | Yes | Callback used to return the result. If a lock is successfully created, **err** is **undefined** and **data** is the created **RunningLock**. Otherwise, **err** is an error object.| | callback | AsyncCallback<[RunningLock](#runninglock)> | Yes | Callback used to return the result. If a lock is successfully created, **err** is **undefined** and **data** is the created **RunningLock**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| ID | Error Message |
|---------|----------|
| 4900101 | If connecting to the service failed. |
**Example** **Example**
```js ```js
...@@ -106,20 +98,12 @@ Creates a **RunningLock** object. ...@@ -106,20 +98,12 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. | | name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------ | ------------------------------------ | | ------------------------------------------ | ------------------------------------ |
| Promise&lt;[RunningLock](#runninglock)&gt; | Promise used to return the result.| | Promise&lt;[RunningLock](#runninglock)&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| ID | Error Message |
|---------|----------|
| 4900101 | If connecting to the service failed. |
**Example** **Example**
```js ```js
...@@ -138,7 +122,7 @@ isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback&lt;boo ...@@ -138,7 +122,7 @@ isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback&lt;boo
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9). > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses an asynchronous callback to return the result. Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
...@@ -167,7 +151,7 @@ isRunningLockTypeSupported(type: RunningLockType): Promise&lt;boolean> ...@@ -167,7 +151,7 @@ isRunningLockTypeSupported(type: RunningLockType): Promise&lt;boolean>
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9). > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses a promise to return the result. Checks whether the specified type of **RunningLock** is supported. This API uses a promise to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
...@@ -177,7 +161,7 @@ Checks whether the specified type of **RunningLock** is supported. This API uses ...@@ -177,7 +161,7 @@ Checks whether the specified type of **RunningLock** is supported. This API uses
| ------ | ----------------------------------- | ---- | -------------------- | | ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ---------------------------------------------------- | | ---------------------- | ---------------------------------------------------- |
...@@ -246,7 +230,7 @@ Creates a **RunningLock** object. ...@@ -246,7 +230,7 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. | | name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------ | ------------------------------------ | | ------------------------------------------ | ------------------------------------ |
...@@ -354,7 +338,7 @@ Checks the hold status of the **Runninglock** object. ...@@ -354,7 +338,7 @@ Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
...@@ -452,7 +436,7 @@ Checks the hold status of the **Runninglock** object. ...@@ -452,7 +436,7 @@ Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
**Return Value** **Return value**
| Type | Description | | Type | Description |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.| | boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
...@@ -477,6 +461,6 @@ Enumerates the types of **RunningLock** objects. ...@@ -477,6 +461,6 @@ Enumerates the types of **RunningLock** objects.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
| Name | Value | Description | | Name | Value | Description |
| --------------------------------- | ---- | ------------------------------------------------------------ | | ------------------------ | ---- | -------------------------------------- |
| BACKGROUND<sup>(deprecated)</sup> | 1 | A lock that prevents the system from hibernating when the screen is off.<br>**NOTE**<br>This parameter is supported since API version 7 and deprecated since API version 10.| | BACKGROUND | 1 | A lock that prevents the system from hibernating when the screen is off. |
| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen. | | PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen.|
# @ohos.usb (USB Management) # @ohos.usb (USB)
The **usb** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control. The **usb** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md) instead. >
> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md).
## Modules to Import ## Modules to Import
...@@ -25,13 +26,13 @@ Obtains the USB device list. ...@@ -25,13 +26,13 @@ Obtains the USB device list.
| Type | Description | | Type | Description |
| ---------------------------------------------------- | ------- | | ---------------------------------------------------- | ------- |
| Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | Device information list.| | Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | USB device list.|
**Example** **Example**
```js ```js
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
console.log(`devicesList = ${JSON.stringify(devicesList)}`); console.log(`devicesList = ${devicesList}`);
// devicesList is a list of USB devices. // devicesList is a list of USB devices.
// A simple example of devicesList is provided as follows: // A simple example of devicesList is provided as follows:
[ [
...@@ -110,7 +111,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -110,7 +111,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
```js ```js
let devicepipe= usb.connectDevice(device); let devicepipe= usb.connectDevice(device);
console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); console.log(`devicepipe = ${devicepipe}`);
``` ```
## usb.hasRight ## usb.hasRight
...@@ -131,21 +132,21 @@ Checks whether the application has the permission to access the device. ...@@ -131,21 +132,21 @@ Checks whether the application has the permission to access the device.
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | The value **true** indicates that the application has the permission to access the device, and the value **false** indicates the opposite.| | boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
**Example** **Example**
```js ```js
let devicesName="1-1"; let devicesName= "1-1";
let bool = usb.hasRight(devicesName); let bool = usb.hasRight(devicesName);
console.log(bool); console.log(`${bool}`);
``` ```
## usb.requestRight ## usb.requestRight
requestRight(deviceName: string): Promise&lt;boolean&gt; requestRight(deviceName: string): Promise&lt;boolean&gt;
Requests the temporary permission for the application to access the USB device. This API uses a promise to return the result. Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
...@@ -159,14 +160,14 @@ Requests the temporary permission for the application to access the USB device. ...@@ -159,14 +160,14 @@ Requests the temporary permission for the application to access the USB device.
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted, and the value **false** indicates the opposite.| | Promise&lt;boolean&gt; | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted; and the value **false** indicates the opposite.|
**Example** **Example**
```js ```js
let devicesName="1-1"; let devicesName= "1-1";
usb.requestRight(devicesName).then((ret) => { usb.requestRight(devicesName).then((ret) => {
console.log(`requestRight = ${JSON.stringify(ret)}`); console.log(`requestRight = ${ret}`);
}); });
``` ```
...@@ -192,7 +193,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -192,7 +193,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully claimed, and an error code indicates the opposite.| | number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
**Example** **Example**
...@@ -222,7 +223,7 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c ...@@ -222,7 +223,7 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully released, and an error code indicates the opposite.| | number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
**Example** **Example**
...@@ -252,7 +253,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -252,7 +253,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | The value **0** indicates that the USB configuration is successfully set, and an error code indicates the opposite.| | number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
**Example** **Example**
...@@ -282,7 +283,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -282,7 +283,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully set, and an error code indicates the opposite.| | number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
**Example** **Example**
...@@ -311,7 +312,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -311,7 +312,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | The return value is the raw USB descriptor if the operation is successful, or **undefined** if the operation has failed.| | Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.|
**Example** **Example**
...@@ -339,7 +340,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -339,7 +340,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type | Description | | Type | Description |
| ------ | -------------------- | | ------ | -------------------- |
| number | The return value is the file descriptor of the USB device if the operation is successful, or **-1** if the operation has failed.| | number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.|
**Example** **Example**
...@@ -374,9 +375,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -374,9 +375,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Example** **Example**
```js ```js
usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { let param = {
console.log(`controlTransfer = ${JSON.stringify(ret)}`); request: 0,
}) reqType: 0,
target:0,
value: 0,
index: 0,
data: null
};
usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`);
});
``` ```
## usb.bulkTransfer ## usb.bulkTransfer
...@@ -411,7 +420,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -411,7 +420,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
// Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device. // Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device.
// Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer. // Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer.
usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => {
console.log(`bulkTransfer = ${JSON.stringify(ret)}`); console.log(`bulkTransfer = ${ret}`);
}); });
``` ```
...@@ -435,7 +444,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -435,7 +444,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | The value **0** indicates that the USB device pipe is closed successfully, and an error code indicates the opposite.| | number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
**Example** **Example**
...@@ -498,7 +507,7 @@ Converts the USB function list in the numeric mask format to a string in Device ...@@ -498,7 +507,7 @@ Converts the USB function list in the numeric mask format to a string in Device
**Example** **Example**
```js ```js
let funcs = ACM | ECM; let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM;
let ret = usb.usbFunctionsToString(funcs); let ret = usb.usbFunctionsToString(funcs);
``` ```
...@@ -527,8 +536,12 @@ Sets the current USB function list in Device mode. ...@@ -527,8 +536,12 @@ Sets the current USB function list in Device mode.
**Example** **Example**
```js ```js
let funcs = HDC; let funcs = usb.FunctionType.HDC;
let ret = usb.setCurrentFunctions(funcs); usb.setCurrentFunctions(funcs).then(() => {
console.info('usb setCurrentFunctions successfully.');
}).catch(err => {
console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message);
});
``` ```
## usb.getCurrentFunctions<sup>9+</sup> ## usb.getCurrentFunctions<sup>9+</sup>
...@@ -630,7 +643,12 @@ Sets the role types supported by a specified port, which can be **powerRole** (f ...@@ -630,7 +643,12 @@ Sets the role types supported by a specified port, which can be **powerRole** (f
**Example** **Example**
```js ```js
let ret = usb.getSupportedModes(0); let portId = 1;
usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => {
console.info('usb setPortRoles successfully.');
}).catch(err => {
console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message);
});
``` ```
## USBEndpoint ## USBEndpoint
...@@ -640,15 +658,15 @@ Represents the USB endpoint from which data is sent or received. You can obtain ...@@ -640,15 +658,15 @@ Represents the USB endpoint from which data is sent or received. You can obtain
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- | | ------------- | ------------------------------------------- | ------------- |------------ |
| address | number | Yes | Endpoint address. | | address | number | Yes |Endpoint address. |
| attributes | number | Yes | Endpoint attributes. | | attributes | number | Yes |Endpoint attributes. |
| interval | number | Yes | Endpoint interval. | | interval | number | Yes |Endpoint interval. |
| maxPacketSize | number | Yes | Maximum size of data packets on the endpoint. | | maxPacketSize | number | Yes |Maximum size of data packets on the endpoint. |
| direction | [USBRequestDirection](#usbrequestdirection) | Yes | Endpoint direction. | | direction | [USBRequestDirection](#usbrequestdirection) | Yes |Endpoint direction. |
| number | number | Yes | Endpoint number. | | number | number | Yes |Endpoint number. |
| type | number | Yes | Endpoint type. | | type | number | Yes |Endpoint type. |
| interfaceId | number | Yes | Unique ID of the interface to which the endpoint belongs.| | interfaceId | number | Yes |Unique ID of the interface to which the endpoint belongs.|
## USBInterface ## USBInterface
...@@ -656,15 +674,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U ...@@ -656,15 +674,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory |Description |
| -------- | ------- | --------- | ----------- | | ---------------- | ---------------------------------------- | ------------- |--------------------- |
| id | number | Yes | Unique ID of the USB interface. | | id | number | Yes |Unique ID of the USB interface. |
| protocol | number | Yes | Interface protocol. | | protocol | number | Yes |Interface protocol. |
| clazz | number | Yes | Device type. | | clazz | number | Yes |Device type. |
| subClass | number | Yes | Device subclass. | | subClass | number | Yes |Device subclass. |
| alternateSetting | number | Yes | Settings for alternating between descriptors of the same USB interface.| | alternateSetting | number | Yes |Settings for alternating between descriptors of the same USB interface.|
| name | string | Yes | Interface name. | | name | string | Yes |Interface name. |
| endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Yes | Endpoints that belong to the USB interface. | | endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Yes |Endpoints that belong to the USB interface. |
## USBConfig ## USBConfig
...@@ -672,15 +690,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip ...@@ -672,15 +690,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory |Description |
| -------- | ------- | --------- | ----------- | | -------------- | ------------------------------------------------ | --------------- |----------- |
| id | number | Yes | Unique ID of the USB configuration. | | id | number | Yes |Unique ID of the USB configuration. |
| attributes | number | Yes | Configuration attributes. | | attributes | number | Yes |Configuration attributes. |
| maxPower | number | Yes | Maximum power consumption, in mA. | | maxPower | number | Yes |Maximum power consumption, in mA. |
| name | string | Yes | Configuration name, which can be left empty. | | name | string | Yes |Configuration name, which can be left empty. |
| isRemoteWakeup | boolean | Yes | Support for remote wakeup.| | isRemoteWakeup | boolean | Yes |Support for remote wakeup.|
| isSelfPowered | boolean | Yes | Support for independent power supplies.| | isSelfPowered | boolean | Yes |Support for independent power supplies.|
| interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Yes | Supported interface attributes. | | interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Yes |Supported interface attributes. |
## USBDevice ## USBDevice
...@@ -688,21 +706,21 @@ Represents the USB device information. ...@@ -688,21 +706,21 @@ Represents the USB device information.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory |Description |
| -------- | ------- | --------- | ----------- | | ---------------- | ------------------------------------ | ---------- |---------- |
| busNum | number | Yes | Bus address. | | busNum | number | Yes |Bus address. |
| devAddress | number | Yes | Device address. | | devAddress | number | Yes |Device address. |
| serial | string | Yes | Sequence number. | | serial | string | Yes |Sequence number. |
| name | string | Yes | Device name. | | name | string | Yes |Device name. |
| manufacturerName | string | Yes | Device manufacturer. | | manufacturerName | string | Yes |Device manufacturer. |
| productName | string | Yes | Product name. | | productName | string | Yes |Product name. |
| version | string | Yes | Version number. | | version | string | Yes |Version. |
| vendorId | number | Yes | Vendor ID. | | vendorId | number | Yes |Vendor ID. |
| productId | number | Yes | Product ID. | | productId | number | Yes |Product ID. |
| clazz | number | Yes | Device class. | | clazz | number | Yes |Device class. |
| subClass | number | Yes | Device subclass. | | subClass | number | Yes |Device subclass. |
| protocol | number | Yes | Device protocol code. | | protocol | number | Yes |Device protocol code. |
| configs | Array&lt;[USBConfig](#usbconfig)&gt; | Yes | Device configuration descriptor information.| | configs | Array&lt;[USBConfig](#usbconfig)&gt; | Yes |Device configuration descriptor information.|
## USBDevicePipe ## USBDevicePipe
...@@ -710,10 +728,10 @@ Represents a USB device pipe, which is used to determine a USB device. ...@@ -710,10 +728,10 @@ Represents a USB device pipe, which is used to determine a USB device.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory |Description |
| -------- | ------- | --------- | ----------- | | ---------- | ------ | ----- |----- |
| busNum | number | Yes | Bus address.| | busNum | number | Yes |Bus address.|
| devAddress | number | Yes | Device address.| | devAddress | number | Yes |Device address.|
## USBControlParams ## USBControlParams
...@@ -721,14 +739,14 @@ Represents control transfer parameters. ...@@ -721,14 +739,14 @@ Represents control transfer parameters.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory|Description |
| -------- | ------- | --------- | ----------- | | ------- | ----------------------------------------------- | ---------------- |---------------- |
| request | number | Yes | Request type. | | request | number | Yes |Request type. |
| target | [USBRequestTargetType](#usbrequesttargettype) | Yes | Request target type. | | target | [USBRequestTargetType](#usbrequesttargettype) | Yes |Request target type. |
| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes | Control request type. | | reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes |Control request type. |
| value | number | Yes | Request parameter value. | | value | number | Yes |Request parameter value. |
| index | number | Yes | Index of the request parameter value.| | index | number | Yes |Index of the request parameter value.|
| data | Uint8Array | Yes | Buffer for writing or reading data. | | data | Uint8Array | Yes |Buffer for writing or reading data. |
## USBPort<sup>9+</sup> ## USBPort<sup>9+</sup>
...@@ -738,11 +756,11 @@ Represents a USB port. ...@@ -738,11 +756,11 @@ Represents a USB port.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type | Mandatory|Description |
| -------- | ------- | --------- | ----------- | | -------------- | -------------------------------- | -------------- |----------------------------------- |
| id | number | Yes | Unique identifier of a USB port. | | id | number | Yes |Unique identifier of a USB port. |
| supportedModes | [PortModeType](#portmodetype9) | Yes | Numeric mask combination for the supported mode list.| | supportedModes | [PortModeType](#portmodetype9) | Yes |Numeric mask combination for the supported mode list.|
| status | [USBPortStatus](#usbportstatus9) | Yes | USB port role. | | status | [USBPortStatus](#usbportstatus9) | Yes |USB port role. |
## USBPortStatus<sup>9+</sup> ## USBPortStatus<sup>9+</sup>
...@@ -752,11 +770,11 @@ Enumerates USB port roles. ...@@ -752,11 +770,11 @@ Enumerates USB port roles.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Mandatory | Description | | Name | Type| Mandatory|Description |
| -------- | ------- | --------- | ----------- | | ---------------- | -------- | ----------- |---------------------- |
| currentMode | number | Yes | Current USB mode. | | currentMode | number | Yes |Current USB mode. |
| currentPowerRole | number | Yes | Current power role. | | currentPowerRole | number | Yes |Current power role. |
| currentDataRole | number | Yes | Current data role. | | currentDataRole | number | Yes |Current data role.|
## USBRequestTargetType ## USBRequestTargetType
......
...@@ -280,7 +280,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -280,7 +280,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
let device = devicesList[0]; let device = devicesList[0];
...@@ -320,7 +319,6 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c ...@@ -320,7 +319,6 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
let device = devicesList[0]; let device = devicesList[0];
...@@ -361,7 +359,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -361,7 +359,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
let device = devicesList[0]; let device = devicesList[0];
...@@ -401,7 +398,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -401,7 +398,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
let device = devicesList[0]; let device = devicesList[0];
...@@ -441,7 +437,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -441,7 +437,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
usb.requestRight(devicesList[0].name); usb.requestRight(devicesList[0].name);
...@@ -477,7 +472,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -477,7 +472,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
usb.requestRight(devicesList[0].name); usb.requestRight(devicesList[0].name);
...@@ -524,14 +518,13 @@ let param = { ...@@ -524,14 +518,13 @@ let param = {
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
usb.requestRight(devicesList[0].name); usb.requestRight(devicesList[0].name);
let devicepipe = usb.connectDevice(devicesList[0]); let devicepipe = usb.connectDevice(devicesList[0]);
usb.controlTransfer(devicepipe, param).then((ret) => { usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`); console.log(`controlTransfer = ${ret}`);
}) });
``` ```
## usb.bulkTransfer ## usb.bulkTransfer
...@@ -568,7 +561,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -568,7 +561,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
let device = devicesList[0]; let device = devicesList[0];
...@@ -612,7 +604,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -612,7 +604,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices(); let devicesList = usb.getDevices();
if (devicesList.length == 0) { if (devicesList.length == 0) {
console.log(`device list is empty`); console.log(`device list is empty`);
return;
} }
usb.requestRight(devicesList[0].name); usb.requestRight(devicesList[0].name);
......
# Obtaining Source Code<a name="EN-US_TOPIC_0000001150448437"></a> # Obtaining Source Code
## About OpenHarmony<a name="section6370143622110"></a>
OpenHarmony is an open-source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system \(OS\) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era. ## About OpenHarmony
The open-source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com). OpenHarmony is an open source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system (OS) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era.
## Overview of Source Code Acquisition<a name="section12763342204"></a>
The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-about.md), which can be obtained in any of the following ways:
The open source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com).
## Overview of Source Code Acquisition
This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-about.md), which can be obtained in any of the following ways:
- **Method 1**: Acquire the source code from the Gitee code repository. You can use the **repo** or **git** tool to download the latest code from the code repository. - **Method 1**: Acquire the source code from the Gitee code repository. You can use the **repo** or **git** tool to download the latest code from the code repository.
- **Method 2**: Acquire the source code from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home). Visit [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use the **hpm-cli** tool to download and install the bundles and compilation toolchain on your local PC.
- **Method 2**: Acquire the source code from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home). Visit [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), search for your desired open source distribution, and download the component list (or customize components and download the component list). Then use the **hpm-cli** tool to download and install the components and compilation toolchain on your local PC.
- **Method 3**: Download the compressed file of a distribution from a mirror site. This method provides a fast download speed, so you can also use this method for obtaining the source code of an earlier version. - **Method 3**: Download the compressed file of a distribution from a mirror site. This method provides a fast download speed, so you can also use this method for obtaining the source code of an earlier version.
- **Method 4**: Acquire the source code from the GitHub image repository. You can use the **repo** or **git** tool to download the latest code from the code repository. - **Method 4**: Acquire the source code from the GitHub image repository. You can use the **repo** or **git** tool to download the latest code from the code repository.
## Method 1: Acquiring Source Code from the Gitee Code Repository<a name="section537312010229"></a>
### When to Use<a name="section10881513459"></a> ## Method 1: Acquiring Source Code from the Gitee Code Repository
### When to Use
- You want to establish a baseline based on stable OpenHarmony releases and distribute the baseline to your customers. - You want to establish a baseline based on stable OpenHarmony releases and distribute the baseline to your customers.
...@@ -30,11 +39,13 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a ...@@ -30,11 +39,13 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
- You want to learn OpenHarmony source code. - You want to learn OpenHarmony source code.
### Prerequisites<a name="section102871547153314"></a> ### Prerequisites
1. Register your account with Gitee. 1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee. 2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
3. Install the [Git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
```shell ```shell
git config --global user.name "yourname" git config --global user.name "yourname"
...@@ -42,7 +53,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a ...@@ -42,7 +53,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
git config --global credential.helper store git config --global credential.helper store
``` ```
4. Run the following commands to install the **repo** tool: 4. Install the **repo** tool:
In this example, **~/bin** is used as an example installation directory. You can change the directory as needed. In this example, **~/bin** is used as an example installation directory. You can change the directory as needed.
...@@ -62,12 +73,12 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a ...@@ -62,12 +73,12 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
``` ```
### How to Use<a name="section429012478331"></a> ### How to Use
>![](../public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> >
>Download the release code, which is more stable, if you want to develop commercial functionalities. Download the master code if you want to get quick access to the latest features for your development. > Download the release code, which is more stable, if you want to develop commercial functionalities. Download the master code if you want to get quick access to the latest features for your development.
- **Obtaining OpenHarmony release code** - **Obtaining OpenHarmony release code**
...@@ -75,7 +86,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a ...@@ -75,7 +86,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
- **Obtaining OpenHarmony master code** - **Obtaining OpenHarmony master code**
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\) Method 1 (recommended): Use the **repo** tool to download the source code over SSH. (You must have registered an SSH public key for access to Gitee.)
```shell ```shell
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
...@@ -85,6 +96,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a ...@@ -85,6 +96,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
Method 2: Use the **repo** tool to download the source code over HTTPS. Method 2: Use the **repo** tool to download the source code over HTTPS.
```shell ```shell
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c repo sync -c
...@@ -92,25 +104,27 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a ...@@ -92,25 +104,27 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
``` ```
## Method 2: Acquiring Source Code from DevEco Marketplace<a name="section463013147412"></a> ## Method 2: Acquiring Source Code from DevEco Marketplace
### When to Use<a name="section26661067443"></a>
If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), or customize a distribution by adding or deleting bundles of an open-source distribution. Then use the **hpm-cli** tool to download and install the bundles and compilation toolchain on your local PC. ### When to Use
### Prerequisites<a name="section17544943123315"></a> If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open source distribution from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), or customize a distribution by adding or deleting components of an open source distribution. Then use the **hpm-cli** tool to download and install the components and compilation toolchain on your local PC.
### Prerequisites
You must install **Node.js** and HPM on your local PC. The installation procedure is as follows: You must install **Node.js** and HPM on your local PC. The installation procedure is as follows:
1. Install **Node.js**. 1. Install **Node.js**.
Download **Node.js** from its official website and install it on your local PC. Download **Node.js** from its official website, and install it on your local PC.
The [Node.js](https://nodejs.org/) version must be 12.x \(including npm 6.14.4\) or later. An LTS version is recommended. The [Node.js](https://nodejs.org/) version must be 12.x (including npm 6.14.4) or later. An LTS version is recommended.
2. Install the **hpm-cli** tool using **npm** delivered with **Node.js**. 2. Install the **hpm-cli** tool using **npm** delivered with **Node.js**.
Open the CMD window and run the following command: Open the CMD window, and run the following command:
```shell ```shell
npm install -g @ohos/hpm-cli npm install -g @ohos/hpm-cli
...@@ -122,55 +136,59 @@ You must install **Node.js** and HPM on your local PC. The installation procedur ...@@ -122,55 +136,59 @@ You must install **Node.js** and HPM on your local PC. The installation procedur
hpm -V or hpm --version hpm -V or hpm --version
``` ```
4. Run the following command to upgrade the HPM version: 4. Upgrade the HPM version as needed.
```shell ```shell
npm update -g @ohos/hpm-cli npm update -g @ohos/hpm-cli
``` ```
### How to Use<a name="section954619433333"></a> ### How to Use
1. Search for distributions. 1. Search for distributions.
1. Access [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), and click **Equipment Bundle**. Then go to the **Open Source Distribution** page. 1. Access [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), and click **Device**. Then go to the **Open Source Distribution** page.
2. Enter a keyword \(for example: **camera**\) in the search box. All matched distributions are found. 2. Enter a keyword, for example, **camera**, in the search box. All matched distributions are displayed.
3. Specify filter criteria, such as the bundle type \(for example: **Board support** or **Kernel support**\), to further filter the distributions. 3. Specify filter criteria, such as the OS, board, and kernel, to further filter the distributions.
4. Find your desired distribution and click it to view details. 4. Find your desired distribution, and click it to view details.
**Figure 1** HPM page
**Figure 1** HPM page<a name="fig349416264520"></a>
![](figures/hpm-page.png "hpm-page") ![](figures/hpm-page.png "hpm-page")
2. Learn more about the distribution. 2. Learn more about the distribution.
1. Read carefully the information about the distribution to learn its application scenarios, features, components, usage, and customization methods.
1. Read carefully the information about the distribution to learn its application scenarios, features, bundles, usage, and customization methods, as shown in the following figure.
2. Click **Download** if you want to download the distribution to your local PC. 2. Click **Download** if you want to download the distribution to your local PC.
3. Click **Custom** if you want to add or delete bundles of the distribution. 3. Click **Device component tailoring** if you want to add or delete components of the distribution.
**Figure 2** Example distribution
**Figure 2** Example distribution<a name="fig142484411121"></a>
![](figures/example-distribution.png "example-distribution") ![](figures/example-distribution.png "example-distribution")
3. Customize bundles. 3. Customize components.
1. Access the **Custom solution** page, as shown in the following figure. 1. Access the **Device Component Tailoring** page.
2. Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click **Add bundle** to add new bundles. 2. Add or delete components.
3. Enter the basic information about your project, including the bundle name, version, and description, on the right pane. - In the **Customizable Components** pane, click the plus sign. In the displayed dialog box, add required components.
4. Click **Download**. The system generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC. - In the **Customizable Components** pane, click the minus sign next to a component to delete it.
3. Enter the basic information about your project, including the name, version, and description, on the right pane.
4. Click **Download**. The system generates the OpenHarmony code structure file (for example, **my_cust_dist.zip**) and saves it to your local PC.
**Figure 3** Customizing components
**Figure 3** Customizing bundles<a name="fig1256020372197"></a> ![](figures/customizing-components.png "customizing-components")
![](figures/customizing-bundles.png "customizing-bundles")
4. Install bundles. 4. Install components.
1. Decompress the downloaded code structure file using CMD on Windows (or shell in Linux). 1. Decompress the downloaded code structure file using CMD on Windows (or shell in Linux).
2. In the generated directory, run the **hpm install** command to download and install bundles. If the **Install successful** message is displayed, the command has been executed successfully. 2. In the generated directory, run the **hpm install** command to download and install components. If the **Install successful** message is displayed, the command has been executed successfully.
3. Obtain the bundles. The downloaded bundles are stored in the **ohos\_bundles** folder under the project directory. \(The source code of some bundles will be copied to a specified directory after the bundles are installed.\) 3. The downloaded components will be stored in the **ohos_bundles** folder under the project directory. (The source code of some components will be copied to a specified directory after the components are installed.)
## Method 3: Acquiring Source Code from a Mirror Site<a name="section1186691118430"></a> ## Method 3: Acquiring Source Code from a Mirror Site
To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below. To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below.
The table below provides only the sites for downloading the latest OpenHarmony LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes](../../release-notes/Readme.md). The table below provides only the sites for downloading the latest OpenHarmony LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes](../../release-notes/Readme.md).
**Table 1** Sites for acquiring source code **Table 1** Sites for acquiring source code
| **LTS Code**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**| | **LTS Code**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -182,22 +200,23 @@ The table below provides only the sites for downloading the latest OpenHarmony L ...@@ -182,22 +200,23 @@ The table below provides only the sites for downloading the latest OpenHarmony L
| Hi3516 solution-Linux (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB | | Hi3516 solution-Linux (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB |
| RELEASE-NOTES | 3.0 | [Download](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/en/release-notes/OpenHarmony-v3.0-LTS.md)| - | - | | RELEASE-NOTES | 3.0 | [Download](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/en/release-notes/OpenHarmony-v3.0-LTS.md)| - | - |
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**| | **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| Full code base (for mini, small, and standard systems)| 3.2 Release | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256)| 21.8 GB | | Full code beta (for mini, small, and standard systems)| 3.2 Release | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256)| 21.8 GB |
| Hi3861 solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256)| 22.9 MB | | Hi3861 solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256)| 22.9 MB |
| Hi3516 solution-LiteOS (binary)| 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256)| 294.3 MB | | Hi3516 solution-LiteOS (binary)| 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | 294.3 MB |
| Hi3516 solution-Linux (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256)| 174.3 MB | | Hi3516 solution-Linux (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB |
| RK3568 standard system solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz.sha256)| 3.9 GB | | RK3568 standard system solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz.sha256)| 3.9 GB |
| RELEASE-NOTES | 3.2 Release| [Download](../../release-notes/OpenHarmony-v3.2-release.md)| - | - | | RELEASE-NOTES | 3.2 Release| [Download](../../release-notes/OpenHarmony-v3.2-release.md)| - | - |
| **Compiler Toolchain**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**| | **Compiler Toolchain**| **Version**| **Site**| **SHA-256 Checksum**| Software Package Size|
| Compiler toolchain| - | [Download](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/)| - | - | | Compiler toolchain| - | [Download](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/)| - | - |
## Method 4: Acquiring Source Code from the GitHub Image Repository<a name="section23448418360"></a>
>![](../public_sys-resources/icon-note.gif) **NOTE** ## Method 4: Acquiring Source Code from the GitHub Image Repository
>
> **NOTE**<br>
> The image repository is synchronized at 23:00 (UTC +8:00) every day. > The image repository is synchronized at 23:00 (UTC +8:00) every day.
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\)
Method 1 (recommended): Use the **repo** tool to download the source code over SSH. (You must have registered an SSH public key for access to GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).)
```shell ```shell
repo init -u git@github.com:openharmony/manifest.git -b master --no-repo-verify repo init -u git@github.com:openharmony/manifest.git -b master --no-repo-verify
...@@ -207,23 +226,25 @@ repo forall -c 'git lfs pull' ...@@ -207,23 +226,25 @@ repo forall -c 'git lfs pull'
Method 2: Use the **repo** tool to download the source code over HTTPS. Method 2: Use the **repo** tool to download the source code over HTTPS.
```shell ```shell
repo init -u https://github.com/openharmony/manifest.git -b master --no-repo-verify repo init -u https://github.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c repo sync -c
repo forall -c 'git lfs pull' repo forall -c 'git lfs pull'
``` ```
## Source Code Directories<a name="section1072115612811"></a>
## Source Code Directories
The following table describes the OpenHarmony source code directories. The following table describes the OpenHarmony source code directories.
**Table 2** Source code directories **Table 2** Source code directories
| Directory| Description| | **Directory**| **Description**|
| -------- | -------- | | -------- | -------- |
| applications | Application samples, for example, **camera**.| | applications | Application samples, for example, **camera**.|
| base | Basic software service subsystem set and hardware service subsystem set.| | base | Basic software service subsystem set and hardware service subsystem set.|
| build | Bundle-based compilation, building, and configuration scripts.| | build | Component-based compilation, building, and configuration scripts.|
| docs | Reference documents.| | docs | Reference documents.|
| domains | Enhanced software service subsystem set.| | domains | Enhanced software service subsystem set.|
| drivers | Driver subsystem.| | drivers | Driver subsystem.|
...@@ -231,7 +252,7 @@ The following table describes the OpenHarmony source code directories. ...@@ -231,7 +252,7 @@ The following table describes the OpenHarmony source code directories.
| kernel | Kernel subsystem.| | kernel | Kernel subsystem.|
| prebuilts | Compiler and tool chain subsystem.| | prebuilts | Compiler and tool chain subsystem.|
| test | Test subsystem.| | test | Test subsystem.|
| third_party | Open-source third-party software.| | third_party | Open source third-party software.|
| utils | Commonly used development utilities.| | utils | Commonly used development utilities.|
| vendor | Vendor-provided software.| | vendor | Vendor-provided software.|
| build.py | Build script file.| | build.py | Build script file.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册