From eafb78fdae966b2624e80755fea9f4ce539ec618 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 30 Sep 2022 18:01:04 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- .../dfx/hitracemeter-guidelines.md | 6 +- .../reference/apis/js-apis-call.md | 32 ++++---- .../reference/apis/js-apis-contact.md | 18 ++--- .../reference/apis/js-apis-hiappevent.md | 30 +++---- .../reference/apis/js-apis-hitracechain.md | 17 ++-- .../reference/apis/js-apis-intl.md | 2 +- .../reference/apis/js-apis-keycode.md | 2 +- .../reference/apis/js-apis-radio.md | 24 +++--- .../reference/apis/js-apis-sim.md | 78 +++++++++---------- .../reference/apis/js-apis-sms.md | 68 ++++++++-------- en/device-dev/subsystems/Readme-EN.md | 1 + .../subsys-dfx-hisysevent-overview.md | 10 +-- 12 files changed, 143 insertions(+), 145 deletions(-) diff --git a/en/application-dev/dfx/hitracemeter-guidelines.md b/en/application-dev/dfx/hitracemeter-guidelines.md index 316ee1b078..1b45886ca4 100644 --- a/en/application-dev/dfx/hitracemeter-guidelines.md +++ b/en/application-dev/dfx/hitracemeter-guidelines.md @@ -12,7 +12,7 @@ The performance tracing APIs are provided by the **hiTraceMeter** module. For de | API| Return Value| Description| | ---------------------------------------------------------------------------- | --------- | ------------ | -| hiTraceMeter.startTrace(name: string, taskId: number, expectedTime?: number) | void | Starts a trace task. If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same task ID can be used.| +| hiTraceMeter.startTrace(name: string, taskId: number) | void | Starts a trace task. If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same task ID can be used.| | hiTraceMeter.finishTrace(name: string, taskId: number) | void | Stops a trace task. The values of **name** and **taskId** must be the same as those of **hiTraceMeter.startTrace**.| | hiTraceMeter.traceByValue(name: string, value: number) | void | Traces the value changes of a variable.| @@ -31,10 +31,6 @@ In this example, distributed call chain tracing begins when the application star }, onInit() { this.title = this.$t('strings.world'); - - // The expected duration of the trace task is 5 ms. - hiTraceMeter.startTrace("business", 1); - hiTraceMeter.startTrace("business", 1, 5); // Start track tasks with the same name concurrently. hiTraceMeter.startTrace("business", 1); diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md index 9b20ccb9f3..5ea820e616 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -319,7 +319,7 @@ Checks whether the called number is an emergency number based on the specified p **Example** ```js -call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, value) => { +call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -468,9 +468,7 @@ The phone number must match the specified country code. For example, for a China **Example** ```js -call.formatPhoneNumberToE164("138xxxxxxxx",{ - countryCode: "CN" -}, (err, data) => { +call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -504,9 +502,7 @@ All country codes are supported. **Example** ```js -let promise = call.formatPhoneNumberToE164("138xxxxxxxx", { - countryCode: "CN" -}); +let promise = call.formatPhoneNumberToE164("138xxxxxxxx", "CN"); promise.then(data => { console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1700,7 +1696,7 @@ This is a system API. **Example** ```js -isNewCallAllowedcall.on('mmiCodeResult', (err, data) => { +call.on('mmiCodeResult', (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2069,9 +2065,6 @@ This is a system API. **Example** ```js -let callTransferTyp={ - CallTransferType: 1 -} call.getCallTransferInfo(0, callTransferTyp, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); @@ -2104,10 +2097,7 @@ This is a system API. **Example** ```js -let callTransferTyp={ - CallTransferType: 1 -} -let promise = call.getCallTransferInfo(0, callTransferTyp); +let promise = call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY); promise.then(data => { console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -2396,7 +2386,7 @@ This is a system API. let audioDeviceOptions={ bluetoothAddress: "IEEE 802-2014" } -call.setAudioDevice(1, bluetoothAddress, (err, value) => { +call.setAudioDevice(1, audioDeviceOptions, (err, value) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2460,7 +2450,10 @@ This is a system API. **Example** ```js -call.joinConference(1, "138XXXXXXXX", (err, data) => { +let callNumberList: Array = [ + "138XXXXXXXX" +]; +call.joinConference(1, callNumberList, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2491,7 +2484,10 @@ This is a system API. **Example** ```js -let promise = call.joinConference(1, "138XXXXXXXX"); +let callNumberList: Array = [ + "138XXXXXXXX" +]; +let promise = call.joinConference(1, callNumberList); promise.then(data => { console.log(`joinConference success, promise: data->${JSON.stringify(data)}`); }).catch(err => { diff --git a/en/application-dev/reference/apis/js-apis-contact.md b/en/application-dev/reference/apis/js-apis-contact.md index ee5cf3137c..022394ac04 100644 --- a/en/application-dev/reference/apis/js-apis-contact.md +++ b/en/application-dev/reference/apis/js-apis-contact.md @@ -31,7 +31,7 @@ Adds a contact. This API uses an asynchronous callback to return the result. ```js contact.addContact({ - fullName: {fullName: 'xxx'}, + name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, (err, data) => { if (err) { @@ -192,7 +192,7 @@ Updates a contact based on the specified contact information and attributes. Thi ```js contact.updateContact({ - fullName: {fullName: 'xxx'}, + name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] },{ attributes:[contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME] @@ -231,7 +231,7 @@ Updates a contact based on the specified contact information and attributes. Thi ```js let promise = contact.updateContact({ - fullName: {fullName: 'xxx'}, + name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, { attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME] @@ -467,7 +467,7 @@ Selects a contact. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS -**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData +**System capability**: SystemCapability.Applications.ContactsData **Parameters** | Name | Type | Mandatory| Description | @@ -495,7 +495,7 @@ Selects a contact. This API uses a promise to return the result. **Permission required**: ohos.permission.READ_CONTACTS -**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData +**System capability**: SystemCapability.Applications.ContactsData **Return Value** | Type | Description | @@ -1400,7 +1400,7 @@ Queries the key of a contact based on the specified contact ID and application. **Example** ```js - contact.queryKey(id, { + contact.queryKey(/*id*/1, { holderId: 0, bundleName: "", displayName: "" @@ -1438,7 +1438,7 @@ Queries the key of a contact based on the specified contact ID and application. **Example** ```js - let promise = contact.queryKey(id, { + let promise = contact.queryKey(/*id*/1, { holderId: 0, bundleName: "", displayName: "" @@ -1553,7 +1553,7 @@ Or, create data by configuring a **ContactAttributes** object. ```js let contactAttributes = new contact.ContactAttributes(); -contactAttributes.attributes = ["ATTR_EMAIL"]; +contactAttributes.attributes = [contact.Attribute.ATTR_EMAIL]; ``` @@ -2191,4 +2191,4 @@ let website = { ```js let website = new contact.Website(); website.website = "website"; -``` +``` \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiappevent.md index 9f1110f241..cc7d684666 100644 --- a/en/application-dev/reference/apis/js-apis-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiappevent.md @@ -304,11 +304,8 @@ hiAppEvent.addWatcher({ console.error("holder is null"); return; } - while (true) { - let eventPkg = holder.takeNext(); - if (eventPkg == null) { - return; - } + let eventPkg = null; + while ((eventPkg = holder.takeNext()) != null) { console.info("eventPkg.packageId=" + eventPkg.packageId); console.info("eventPkg.row=" + eventPkg.row); console.info("eventPkg.size=" + eventPkg.size); @@ -324,15 +321,14 @@ let holder = hiAppEvent.addWatcher({ name: "watcher2", }); if (holder != null) { - let eventPkg = holder.takeNext(); - if (eventPkg == null) { - return; - } - console.info("eventPkg.packageId=" + eventPkg.packageId); - console.info("eventPkg.row=" + eventPkg.row); - console.info("eventPkg.size=" + eventPkg.size); - for (const eventInfo of eventPkg.data) { - console.info("eventPkg.data=" + eventInfo); + let eventPkg = null; + while ((eventPkg = holder.takeNext()) != null) { + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } } } ``` @@ -417,6 +413,9 @@ Sets the data size threshold for fetching an application event package. The defa **Example** ```js +let holder = hiAppEvent.addWatcher({ + name: "watcher", +}); holder.setSize(1000); ``` @@ -429,6 +428,9 @@ Extracts subscription event data based on the configured data size threshold. If **Example** ```js +let holder = hiAppEvent.addWatcher({ + name: "watcher", +}); let eventPkg = holder.takeNext(); ``` diff --git a/en/application-dev/reference/apis/js-apis-hitracechain.md b/en/application-dev/reference/apis/js-apis-hitracechain.md index cbaf898f75..198615d8bf 100644 --- a/en/application-dev/reference/apis/js-apis-hitracechain.md +++ b/en/application-dev/reference/apis/js-apis-hitracechain.md @@ -71,7 +71,7 @@ Defines a **HiTraceId** object. ## hiTraceChain.begin -begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId +begin(name: string, flags?: number): HiTraceId Starts call chain tracing. This API works in synchronous manner. @@ -82,7 +82,7 @@ Starts call chain tracing. This API works in synchronous manner. | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | | name | string | Yes| Traced service name. | -| flags | number | Yes| Trace flag combination. For details, see [HiTraceFlag](#hitraceflag). | +| flags | number | No| Trace flag combination. For details, see [HiTraceFlag](#hitraceflag). | **Return Value** @@ -113,7 +113,7 @@ Stops call chain tracing. This API works in synchronous manner. **Example** ```js -let asyncTraceId = hiTraceChain.begin("business"); +let asyncTraceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.DEFAULT); // End the call chain tracing after the service logic is executed for several times. hiTraceChain.end(asyncTraceId); ``` @@ -135,7 +135,7 @@ Obtains the trace ID. This API works in synchronous manner. **Example** ```js -let traceId = hiTraceChain.begin("business"); +let traceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.DEFAULT); // Obtain the current trace ID after the service logic is executed for several times. let curTraceId = hiTraceChain.getId(); ``` @@ -158,7 +158,7 @@ Sets a trace ID. This API works in synchronous manner. ```js let asyncTraceId; -let traceId = hiTraceChain.begin("business"); +let traceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.DEFAULT); // Set the current trace ID after the service logic is executed for several times. hiTraceChain.setId(asyncTraceId); ``` @@ -174,7 +174,7 @@ Clears the trace ID. This API works in synchronous manner. **Example** ```js -let traceId = hiTraceChain.begin("business"); +let traceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.DEFAULT); // Clear the current trace ID after the service logic is executed for several times. hiTraceChain.clearId(); ``` @@ -196,7 +196,7 @@ Creates a trace span. This API works in synchronous manner. **Example** ```js -let traceId = hiTraceChain.begin("business"); +let traceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.DEFAULT); // Create a trace span after the service logic is executed for several times. let spanTraceId = hiTraceChain.createSpan(); ``` @@ -249,7 +249,7 @@ Checks whether a **HiTraceId** instance is valid. This API works in synchronous **Example** ```js -let traceId = hiTraceChain.begin("business"); +let traceId = hiTraceChain.begin("business", hiTraceChain.HiTraceFlag.DEFAULT); let traceIdIsvalid = hiTraceChain.isValid(traceId); ``` @@ -291,6 +291,7 @@ Enables the specified trace flag in the **HiTraceId** instance. This API works i **System capability**: SystemCapability.HiviewDFX.HiTrace **Parameters** + | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | | id | [HiTraceId](#hitraceid) | Yes | **HiTraceId** instance. | diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md index fcf2858aa7..3c908fabdc 100644 --- a/en/application-dev/reference/apis/js-apis-intl.md +++ b/en/application-dev/reference/apis/js-apis-intl.md @@ -404,7 +404,7 @@ Provides the device capability. | currencyDisplay | string | Yes | Yes | Currency display mode. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.| | unit | string | Yes | Yes | Unit name, for example, **meter**, **inch**, or **hectare**. | | unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **narrow**.| -| unitUsage8+ | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.| +| unitUsage | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.| | signDisplay | string | Yes | Yes | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**.| | compactDisplay | string | Yes | Yes | Compact display format. The value can be **long** or **short**. | | notation | string | Yes | Yes | Number formatting specification. The value can be **standard**, **scientific**, **engineering**, or **compact**.| diff --git a/en/application-dev/reference/apis/js-apis-keycode.md b/en/application-dev/reference/apis/js-apis-keycode.md index 3a711c0ea1..dd4ac0b22a 100644 --- a/en/application-dev/reference/apis/js-apis-keycode.md +++ b/en/application-dev/reference/apis/js-apis-keycode.md @@ -96,7 +96,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode' | KEYCODE_EQUALS | number | Yes| No| Key =| | KEYCODE_LEFT_BRACKET | number | Yes| No| Key [| | KEYCODE_RIGHT_BRACKET | number | Yes| No| Key ]| -| KEYCODE_BACKSLASH | number | Yes| No| Key \| +| KEYCODE_BACKSLASH | number | Yes| No| Key \\| | KEYCODE_SEMICOLON | number | Yes| No| Key ;| | KEYCODE_APOSTROPHE | number | Yes| No| Key ' | | KEYCODE_SLASH | number | Yes| No| Key /| diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index d094a5c7e3..26d35ffeca 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -1100,12 +1100,12 @@ Sets the network selection mode. This API uses an asynchronous callback to retur let networkInformation={ operatorName: "China Mobile", operatorNumeric: "898600", - state: 1, + state: radio.NetworkInformationState.NETWORK_AVAILABLE, radioTech: "CS" } let networkSelectionModeOptions={ - slotid: 0, - selectMode: 1, + slotId: 0, + selectMode: radio.NetworkSelectionMode.NETWORK_SELECTION_AUTOMATIC, networkInformation: networkInformation, resumeSelection: true } @@ -1144,12 +1144,12 @@ Sets the network selection mode. This API uses a promise to return the result. let networkInformation={ operatorName: "China Mobile", operatorNumeric: "898600", - state: 1, + state: radio.NetworkInformationState.NETWORK_AVAILABLE, radioTech: "CS" } let networkSelectionModeOptions={ - slotid: 0, - selectMode: 1, + slotId: 0, + selectMode: radio.NetworkSelectionMode.NETWORK_SELECTION_AUTOMATIC, networkInformation: networkInformation, resumeSelection: true } @@ -1190,7 +1190,7 @@ radio.getNetworkSearchInformation(0, (err, data) => { ## radio.getNetworkSearchInformation -getNetworkSearchInformation\(slotId: number\): Promise +getNetworkSearchInformation\(slotId: number\): Promise Obtains network search information for the SIM card in the specified slot. This API uses a promise to return the result. @@ -1586,7 +1586,7 @@ radio.getPreferredNetwork(0, (err, data) => { ## radio.getPreferredNetwork8+ -getPreferredNetwork(slotId: number): Promise +getPreferredNetwork(slotId: number): Promise Obtains the preferred network for the SIM card in the specified slot. This API uses a promise to return the result. @@ -1642,7 +1642,7 @@ Obtains the IMS registration status of the specified IMS service type for the SI **Example** ```js -radio.getImsRegInfo(0, 1, (err, data) => { +radio.getImsRegInfo(0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1675,7 +1675,7 @@ Obtains the IMS registration status of the specified IMS service type for the SI **Example** ```js -let promise = radio.getImsRegInfo(0, 1); +let promise = radio.getImsRegInfo(0, radio.ImsServiceType.TYPE_VIDEO); promise.then(data => { console.log(`getImsRegInfo success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1707,7 +1707,7 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci **Example** ```js -radio.on('imsRegStateChange', 0, 1, (err, data) => { +radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1736,7 +1736,7 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec **Example** ```js -radio.off('imsRegStateChange', 0, 1, (err, data) => { +radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index a2d761225c..ae9a1ece9c 100644 --- a/en/application-dev/reference/apis/js-apis-sim.md +++ b/en/application-dev/reference/apis/js-apis-sim.md @@ -589,7 +589,7 @@ Obtains the account information list of the active SIM card. This API uses an as **Example** ```js -sim.getActiveSimAccountInfoList(0, (err, data) => { +sim.getActiveSimAccountInfoList((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -710,7 +710,7 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy **Example** ```js -const name='China Mobile'; +let name = 'China Mobile'; sim.setShowName(0, name, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); @@ -744,7 +744,7 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom **Example** ```js -const name='China Mobile'; +let name = 'China Mobile'; let promise = sim.setShowName(0, name); promise.then(data => { console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); @@ -1096,9 +1096,9 @@ Sets the lock status of the SIM card in the specified slot. This API uses an asy ```js let lockInfo = { - lockType = 1, + lockType: sim.LockType.PIN_LOCK, password = "1234", - state = 0 + state: sim.LockState.LOCK_OFF }; sim.setLockState(0, lockInfo, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -1135,9 +1135,9 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom ```js let lockInfo = { - lockType = 1, + lockType: sim.LockType.PIN_LOCK, password = "1234", - state = 0 + state: sim.LockState.LOCK_OFF }; let promise = sim.setLockState(0, lockInfo); promise.then(data => { @@ -2236,12 +2236,12 @@ Adds contact numbers for the SIM card in the specified slot. This API uses an as ```js let diallingNumbersInof = { - alphaTag = "alpha", - number = "138xxxxxxxx", - recordNumber = 123, - pin2 = "1234" + alphaTag: "alpha", + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -sim.addIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { +sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2277,12 +2277,12 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro ```js let diallingNumbersInof = { - alphaTag = "alpha", - number = "138xxxxxxxx", - recordNumber = 123, - pin2 = "1234" + alphaTag: "alpha", + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -let promise = sim.addIccDiallingNumbers(0, 1, diallingNumbersInof); +let promise = sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); promise.then(data => { console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -2315,12 +2315,12 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a ```js let diallingNumbersInof = { - alphaTag = "alpha", - number = "138xxxxxxxx", - recordNumber = 123, - pin2 = "1234" + alphaTag: "alpha", + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -sim.delIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { +sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2356,12 +2356,12 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a ```js let diallingNumbersInof = { - alphaTag = "alpha", - number = "138xxxxxxxx", - recordNumber = 123, - pin2 = "1234" + alphaTag: "alpha", + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -let promise = sim.delIccDiallingNumbers(0, 1, diallingNumbersInof); +let promise = sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); promise.then(data => { console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -2394,12 +2394,12 @@ Updates contact numbers for the SIM card in the specified slot. This API uses an ```js let diallingNumbersInof = { - alphaTag = "alpha", - number = "138xxxxxxxx", - recordNumber = 123, - pin2 = "1234" + alphaTag: "alpha", + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { +sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2435,12 +2435,12 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a ```js let diallingNumbersInof = { - alphaTag = "alpha", - number = "138xxxxxxxx", - recordNumber = 123, - pin2 = "1234" + alphaTag: "alpha", + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -let promise = sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof); +let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); promise.then(data => { console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -2602,7 +2602,7 @@ Unlocks the SIM card in the specified slot. This API uses an asynchronous callba ```js let persoLockInfo = { - lockType = 0, + lockType = sim.PersoLockType.PN_PIN_LOCK, password = "1234" }; sim.unlockSimLock(0, persoLockInfo, (err, data) => { @@ -2640,7 +2640,7 @@ Unlocks the SIM card in the specified slot. This API uses a promise to return th ```js let persoLockInfo = { - lockType = 0, + lockType = sim.PersoLockType.PN_PIN_LOCK, password = "1234" }; let promise = sim.unlockSimLock(0, persoLockInfo); diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index 5443e18d1b..6920c9dbf3 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -397,7 +397,7 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call **Example** ```js -string content= "long message"; +let content = "long message"; sms.splitMessage(content, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); @@ -431,7 +431,7 @@ Splits an SMS message into multiple segments. This API uses a promise to return **Example** ```js -string content = "long message"; +let content = "long message"; let promise = sms.splitMessage(content); promise.then(data => { console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`); @@ -463,10 +463,10 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. ```js let simMessageOptions = { - slotId = 0, - smsc = "test", - pdu = "xxxxxx", - status = 0 + slotId: 0, + smsc: "test", + pdu: "xxxxxx", + status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; sms.addSimMessage(simMessageOptions, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -502,10 +502,10 @@ Adds a SIM message. This API uses a promise to return the result. ```js let simMessageOptions = { - slotId = 0, - smsc = "test", - pdu = "xxxxxx", - status = 0 + slotId: 0, + smsc: "test", + pdu: "xxxxxx", + status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; let promise = sms.addSimMessage(simMessageOptions); promise.then(data => { @@ -607,9 +607,9 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu ```js let updateSimMessageOptions = { - slotId = 0, - msgIndex = 1, - newStatus = 0, + slotId: 0, + msgIndex: 1, + newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE, pdu = "xxxxxxx", smsc = "test" }; @@ -647,9 +647,9 @@ Updates a SIM message. This API uses a promise to return the result. ```js let updateSimMessageOptions = { - slotId = 0, - msgIndex = 1, - newStatus = 0, + slotId: 0, + msgIndex: 1, + newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE, pdu = "xxxxxxx", smsc = "test" }; @@ -749,10 +749,11 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to ```js let cbConfigOptions = { - slotId = 0, - smsc = "test", - pdu = "xxxxxxxx", - status = 0 + slotId: 0, + enable: true, + startMessageId: 100, + endMessageId: 200, + ranType: sms.RanType.TYPE_GSM }; sms.setCBConfig(cbConfigOptions, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -788,13 +789,14 @@ Sets the cell broadcast configuration. This API uses a promise to return the res ```js let cbConfigOptions = { - slotId = 0, - smsc = "test", - pdu = "xxxxxxxx", - status = 0 + slotId: 0, + enable: true, + startMessageId: 100, + endMessageId: 200, + ranType: sms.RanType.TYPE_GSM }; let promise = sms.setCBConfig(cbConfigOptions); -promise.then(data => +promise.then(data => { console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`); }).catch(err => { console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`); @@ -859,7 +861,7 @@ Obtains SMS message segment information. This API uses a promise to return the r ```js let slotId = 0; let promise = sms.getSmsSegmentsInfo(slotId, "message", false); -promise.then(data => +promise.then(data => { console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`); }).catch(err => { console.error(`getSmsSegmentsInfo failed, promise: err->${JSON.stringify(err)}`); @@ -886,7 +888,7 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t ```js sms.isImsSmsSupported((err, data) => { - console.log(`callback: err->${JSON.(err)}, data->${JSON.stringify(data)}`); + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1023,7 +1025,7 @@ Decodes MMS messages. This API uses a promise to return the result. ```js let mmsFilePathName = "filename"; -let promise = sms.getSmscAddr(mmsFilePathName); +let promise = sms.decodeMms(mmsFilePathName); promise.then(data => { console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1092,13 +1094,13 @@ Encodes MMS messages. This API uses a promise to return the result. ```js let mmsAcknowledgeInd = { - transactionId = "100", - version = 0x10, - reportAllowed = 128 + transactionId: "100", + version: sms.MmsVersionType.MMS_VERSION_1_0, + reportAllowed = sms.ReportType.MMS_YES }; let mmsInformation = { - messageType = 133, - mmsType = mmsAcknowledgeInd + messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND, + mmsType: mmsAcknowledgeInd }; let promise = sms.encodeMms(mmsInformation); promise.then(data => { diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index f3f6df0eb6..a5e233b138 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -106,6 +106,7 @@ - [HiTrace Development](subsys-dfx-hitrace.md) - [HiCollie Development](subsys-dfx-hicollie.md) - HiSysEvent Development + - [HiSysEvent Overview](subsys-dfx-hisysevent-overview.md) - [HiSysEvent Logging Configuration](subsys-dfx-hisysevent-logging-config.md) - [HiSysEvent Logging](subsys-dfx-hisysevent-logging.md) - [HiSysEvent Listening](subsys-dfx-hisysevent-listening.md) diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-overview.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-overview.md index d5ea1ec452..efd5de904f 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent-overview.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-overview.md @@ -7,15 +7,15 @@ HiSysEvent provides event logging APIs for OpenHarmony to record important infor The key modules of HiSysEvent are described as follows: -- Event configuration: enables you to define HiSysEvent events in YAML files. +- [HiSysEvent logging configuration](subsys-dfx-hisysevent-logging-config.md): enables you to define HiSysEvent events in YAML files. -- Trace point configuration: provides trace point APIs and supports flushing of HiSysEvent events to disks. +- [HiSysEvent logging](subsys-dfx-hisysevent-logging.md): provides trace point APIs and supports flushing of HiSysEvent events to disks. -- Event subscription: provides APIs for you to subscribe to HiSysEvent events by event domain and event name. +- [HiSysEvent listening](subsys-dfx-hisysevent-listening.md): provides APIs for you to subscribe to HiSysEvent events by event domain and event name. -- Event query: provides APIs for you to query HiSysEvent events by event domain and event name. +- [HiSysEvent query](subsys-dfx-hisysevent-query.md): provides APIs for you to query HiSysEvent events by event domain and event name. -- Event debugging tool: allows you to subscribe to real-time HiSysEvent events and query historical HiSysEvent events. +- [HiSysEvent tool](subsys-dfx-hisysevent-tool.md): allows you to subscribe to real-time HiSysEvent events and query historical HiSysEvent events. ## Reference -- GitLab