diff --git a/docs-en/readme/utils-library.md b/docs-en/readme/utils-library.md index f1a779ea0fbeb6ecc7f7f36055058385d47360fc..e825caf83791854ea29892aebb240490d234004b 100755 --- a/docs-en/readme/utils-library.md +++ b/docs-en/readme/utils-library.md @@ -6,40 +6,40 @@ The Utils library stores basic components of OpenHarmony. These basic components The Utils library provides the following capabilities on different platforms: -- LiteOS-M platform: KV stores, file operations, timers, and IoT peripheral control -- LiteOS-A platform: KV stores, timers, and ACE JavaScript APIs +- LiteOS Cortex-M \(Hi3861 platform\): KV stores, file operations, timers, and IoT peripheral control +- LiteOS Cortex-A \(Hi3516 and Hi3518 platforms\): KV stores, timers, and ACE JavaScript APIs ## Directory Structure ``` -utils/native/lite/ # Root directory of the Utils library -├── file # Implementation of the file interface -├── hals # HAL directory -│ └── file # Header files of the hardware abstraction layer for file operations -├── include # Files of external interfaces provided by the Utils library +utils/native/lite/ # Root directory of the Utils library +├── file # Implementation of the file interface +├── hals # HAL directory +│ └── file # Header files of the hardware abstraction layer for file operations +├── include # Files of external interfaces provided by the Utils library ├── js # ACE JavaScript API directory │ └── builtin │ ├── common │ ├── deviceinfokit # Device information kit │ ├── filekit # File kit │ └── kvstorekit # KV store kit -├── kal # KAL directory -│ └── timer # KAL implementation of the timer - ├── kv_store # KV store implementation -│ ├── innerkits # Internal KV store interfaces -│ └── src # KV store source file -└── timer_task # Timer implementation - -base/iot_hardware # IoT peripheral control +├── kal # KAL directory +│ └── timer # KAL implementation of the timer +├── kv_store # KV store implementation +│ ├── innerkits # Internal KV store interfaces +│ └── src # KV store source file +└── timer_task # Timer implementation + +base/iot_hardware # IoT peripheral control ├── frameworks -│ └── wifiiot_lite # Implementation of the IoT peripheral control module +│ └── wifiiot_lite # Implementation of the IoT peripheral control module ├── hals -│ └── wifiiot_lite # HAL interfaces +│ └── wifiiot_lite # HAL interfaces └── interfaces - └── kits # Interfaces of the IoT peripheral control module + └── kits # Interfaces of the IoT peripheral control module vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware # HAL for IoT peripheral control -└── wifiiot_lite # Implementation of the interfaces at the HAL +└── wifiiot_lite # Implementation of the interfaces at the HAL ``` ## Constraints @@ -61,7 +61,7 @@ The Utils library is developed using the C language.

KV store

-

LiteOS-M and LiteOS-A platforms

+

LiteOS Cortex-M and LiteOS Cortex-A

Provides KV storage for applications.

@@ -70,7 +70,7 @@ The Utils library is developed using the C language.

File operation

-

LiteOS-M platform

+

LiteOS Cortex-M

Provides unified file operation interfaces that can be used on different underlying chip components.

@@ -79,7 +79,7 @@ The Utils library is developed using the C language.

Timer

-

LiteOS-M and LiteOS-A platforms

+

LiteOS Cortex-M and LiteOS Cortex-A

Provides unified timer operation interfaces that can be used on different underlying chip components.

@@ -88,7 +88,7 @@ The Utils library is developed using the C language.

IoT peripheral control

-

LiteOS-M platform

+

LiteOS Cortex-M

Provides the capability of performing operations for peripherals.

@@ -101,12 +101,12 @@ The Utils library is developed using the C language. - **KV store** - Obtaining an interface - ``` + Obtaining an interface char key1[] = "rw.sys.version"; char value1[32] = {0}; int ret = UtilsGetValue(key1, value1, 32); + Setting the interface char key14[] = "key_14"; ret = UtilsSetValue(key14, defValue); @@ -121,10 +121,12 @@ The Utils library is developed using the C language. printf("file handle = %d\n", fd); int ret = UtilsFileWrite(fd, def, strlen(def)); printf("write ret = %d\n", ret); + // stat int fileLen = 0; ret = UtilsFileStat(fileName, &fileLen); printf("file size = %d\n", fileLen); + // seek int fd1 = UtilsFileOpen(fileName, O_RDWR_FS, 0); ret = UtilsFileSeek(fd1, 5, SEEK_SET_FS); @@ -133,6 +135,7 @@ The Utils library is developed using the C language. int readLen = UtilsFileRead(fd1, buf, 32); ret = UtilsFileClose(fd1); printf("read len = %d : buf = %s\n", readLen, buf); + // delete ret = UtilsFileDelete(fileName); printf("delete ret = %d\n", ret);