提交 5f5dffa9 编写于 作者: D donglin

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: Ndonglin <donglin9@huawei.com>
Change-Id: I5dd709a9333c23b93a2e58579be121c6e3faa3e2
...@@ -17,7 +17,7 @@ The application recovery APIs are provided by the **appRecovery** module, which ...@@ -17,7 +17,7 @@ The application recovery APIs are provided by the **appRecovery** module, which
| API | Description | | API | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; | Enables the application recovery function. | | enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; | Enables the application recovery function. |
| saveAppState(): boolean; | Saves the ability status of an application. | | saveAppState(): boolean; | Saves the ability status of an application. |
| restartApp(): void; | Restarts the current process. If there is saved ability status, it will be passed to the **want** parameter's **wantParam** attribute of the **onCreate** lifecycle callback of the ability.| | restartApp(): void; | Restarts the current process. If there is saved ability status, it will be passed to the **want** parameter's **wantParam** attribute of the **onCreate** lifecycle callback of the ability.|
......
...@@ -6,7 +6,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5 ...@@ -6,7 +6,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5
1. Locate the crash-related code based on the service log. 1. Locate the crash-related code based on the service log.
2. View the error information in the crash file. The crash file is located at **/data/log/faultlog/faultlogger/**. 2. View the error information in the crash file, which is located at **/data/log/faultlog/faultlogger/**.
## Why cannot access controls in the UiTest test framework? ## Why cannot access controls in the UiTest test framework?
......
...@@ -51,9 +51,9 @@ build() { ...@@ -51,9 +51,9 @@ build() {
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
1. Obtain data in Uint8Array format by calling the **RawFile** API of **resourceManager**. 1. Obtain Uint8Array data by calling the **RawFile** API of **resourceManager**.
2. Convert data in Uint8Array format to the string type by calling the **String.fromCharCode** API. 2. Convert the Uint8Array data to strings by calling the **String.fromCharCode** API.
Reference: [Resource Manager](../reference/apis/js-apis-resource-manager.md) Reference: [Resource Manager](../reference/apis/js-apis-resource-manager.md)
......
...@@ -19,112 +19,121 @@ const color = new ArrayBuffer(96); // Create a buffer to store image pixel data. ...@@ -19,112 +19,121 @@ const color = new ArrayBuffer(96); // Create a buffer to store image pixel data.
let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } // Image pixel data. let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } // Image pixel data.
// Create a PixelMap object. // Create a PixelMap object.
const color = new ArrayBuffer(96);
let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } }
image.createPixelMap(color, opts, (err, pixelmap) => { image.createPixelMap(color, opts, (err, pixelmap) => {
console.log('Succeeded in creating pixelmap.'); console.log('Succeeded in creating pixelmap.');
}) // Failed to create the PixelMap object.
if (err) {
// Read pixels. console.info('create pixelmap failed, err' + err);
const area = { return
pixels: new ArrayBuffer(8),
offset: 0,
stride: 8,
region: { size: { height: 1, width: 2 }, x: 0, y: 0 }
}
pixelmap.readPixels(area,() => {
var bufferArr = new Uint8Array(area.pixels);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
console.info(' buffer ' + bufferArr[i]);
if(res) {
if(bufferArr[i] == 0) {
res = false;
console.log('readPixels end.');
break;
}
}
} }
})
// Read pixels.
// Store pixels. const area = {
const readBuffer = new ArrayBuffer(96); pixels: new ArrayBuffer(8),
pixelmap.readPixelsToBuffer(readBuffer,() => { offset: 0,
var bufferArr = new Uint8Array(readBuffer); stride: 8,
var res = true; region: { size: { height: 1, width: 2 }, x: 0, y: 0 }
for (var i = 0; i < bufferArr.length; i++) {
if(res) {
if (bufferArr[i] !== 0) {
res = false;
console.log('readPixelsToBuffer end.');
break;
}
}
} }
}) pixelmap.readPixels(area,() => {
let bufferArr = new Uint8Array(area.pixels);
// Write pixels. let res = true;
pixelmap.writePixels(area,() => { for (let i = 0; i < bufferArr.length; i++) {
const readArea = { pixels: new ArrayBuffer(20), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} console.info(' buffer ' + bufferArr[i]);
pixelmap.readPixels(readArea,() => {
var readArr = new Uint8Array(readArea.pixels);
var res = true;
for (var i = 0; i < readArr.length; i++) {
if(res) { if(res) {
if (readArr[i] !== 0) { if(bufferArr[i] == 0) {
res = false; res = false;
console.log('readPixels end.please check buffer'); console.log('readPixels end.');
break; break;
} }
} }
} }
}) })
})
// Store pixels.
// Write pixels to the buffer.
pixelmap.writeBufferToPixels(writeColor).then(() => {
const readBuffer = new ArrayBuffer(96); const readBuffer = new ArrayBuffer(96);
pixelmap.readPixelsToBuffer(readBuffer).then (() => { pixelmap.readPixelsToBuffer(readBuffer,() => {
var bufferArr = new Uint8Array(readBuffer); let bufferArr = new Uint8Array(readBuffer);
var res = true; let res = true;
for (var i = 0; i < bufferArr.length; i++) { for (let i = 0; i < bufferArr.length; i++) {
if(res) { if(res) {
if (bufferArr[i] !== i) { if (bufferArr[i] !== 0) {
res = false; res = false;
console.log('readPixels end.please check buffer'); console.log('readPixelsToBuffer end.');
break; break;
} }
} }
} }
}) })
})
// Write pixels.
pixelmap.writePixels(area,() => {
const readArea = { pixels: new ArrayBuffer(20), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 }}
pixelmap.readPixels(readArea,() => {
let readArr = new Uint8Array(readArea.pixels);
let res = true;
for (let i = 0; i < readArr.length; i++) {
if(res) {
if (readArr[i] !== 0) {
res = false;
console.log('readPixels end.please check buffer');
break;
}
}
}
})
})
// Obtain image information. const writeColor = new ArrayBuffer(96); // Pixel data of the image.
pixelmap.getImageInfo((error, imageInfo) => { // Write pixels to the buffer.
if (imageInfo !== null) { pixelmap.writeBufferToPixels(writeColor).then(() => {
console.log('Succeeded in getting imageInfo'); const readBuffer = new ArrayBuffer(96);
} pixelmap.readPixelsToBuffer(readBuffer).then (() => {
}) let bufferArr = new Uint8Array(readBuffer);
let res = true;
for (let i = 0; i < bufferArr.length; i++) {
if(res) {
if (bufferArr[i] !== i) {
res = false;
console.log('readPixels end.please check buffer');
break;
}
}
}
})
})
// Release the PixelMap object. // Obtain image information.
pixelmap.release(()=>{ pixelmap.getImageInfo((err, imageInfo) => {
console.log('Succeeded in releasing pixelmap'); // Failed to obtain the image information.
if (err || imageInfo == null) {
console.info('getImageInfo failed, err' + err);
return
}
if (imageInfo !== null) {
console.log('Succeeded in getting imageInfo');
}
})
// Release the PixelMap object.
pixelmap.release(()=>{
console.log('Succeeded in releasing pixelmap');
})
}) })
// Create an image source (uri). // Create an image source (uri).
let path = '/data/local/tmp/test.jpg'; let path = '/data/local/tmp/test.jpg';
const imageSourceApi = image.createImageSource(path); const imageSourceApi1 = image.createImageSource(path);
// Create an image source (fd). // Create an image source (fd).
let fd = 29; let fd = 29;
const imageSourceApi = image.createImageSource(fd); const imageSourceApi2 = image.createImageSource(fd);
// Create an image source (data). // Create an image source (data).
const data = new ArrayBuffer(96); const data = new ArrayBuffer(96);
const imageSourceApi = image.createImageSource(data); const imageSourceApi3 = image.createImageSource(data);
// Release the image source. // Release the image source.
imageSourceApi.release(() => { imageSourceApi3.release(() => {
console.log('Succeeded in releasing imagesource'); console.log('Succeeded in releasing imagesource');
}) })
...@@ -133,6 +142,10 @@ const imagePackerApi = image.createImagePacker(); ...@@ -133,6 +142,10 @@ const imagePackerApi = image.createImagePacker();
const imageSourceApi = image.createImageSource(0); const imageSourceApi = image.createImageSource(0);
let packOpts = { format:"image/jpeg", quality:98 }; let packOpts = { format:"image/jpeg", quality:98 };
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
if (err) {
console.info('packing from imagePackerApi failed, err' + err);
return
}
console.log('Succeeded in packing'); console.log('Succeeded in packing');
}) })
...@@ -161,36 +174,33 @@ let decodingOptions = { ...@@ -161,36 +174,33 @@ let decodingOptions = {
// Create a pixel map in callback mode. // Create a pixel map in callback mode.
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
// Failed to create the PixelMap object.
if (err) {
console.info('create pixelmap failed, err' + err);
return
}
console.log('Succeeded in creating pixelmap.'); console.log('Succeeded in creating pixelmap.');
}) })
// Create a pixel map in promise mode. // Create a pixel map in promise mode.
imageSourceApi.createPixelMap().then(pixelmap => { imageSourceApi.createPixelMap().then(pixelmap => {
console.log('Succeeded in creating pixelmap.'); console.log('Succeeded in creating pixelmap.');
})
// Capture error information when an exception occurs during function invoking.
catch(error => {
console.log('Failed in creating pixelmap.' + error);
})
// Obtain the number of bytes in each line of pixels. // Obtain the number of bytes in each line of pixels.
var num = pixelmap.getBytesNumberPerRow(); let num = pixelmap.getBytesNumberPerRow();
// Obtain the total number of pixel bytes. // Obtain the total number of pixel bytes.
var pixelSize = pixelmap.getPixelBytesNumber(); let pixelSize = pixelmap.getPixelBytesNumber();
// Obtain the pixel map information. // Obtain the pixel map information.
pixelmap.getImageInfo().then( imageInfo => {}); pixelmap.getImageInfo().then( imageInfo => {});
// Release the PixelMap object. // Release the PixelMap object.
pixelmap.release(()=>{ pixelmap.release(()=>{
console.log('Succeeded in releasing pixelmap'); console.log('Succeeded in releasing pixelmap');
}) })
}).catch(error => {
// Capture release failure information. console.log('Failed in creating pixelmap.' + error);
catch(error => {
console.log('Failed in releasing pixelmap.' + error);
}) })
``` ```
...@@ -216,7 +226,7 @@ if (imagePackerApi == null) { ...@@ -216,7 +226,7 @@ if (imagePackerApi == null) {
} }
// Set encoding parameters if the image packer is successfully created. // Set encoding parameters if the image packer is successfully created.
let packOpts = { format:["image/jpeg"], // The supported encoding format is jpg. let packOpts = { format:"image/jpeg", // The supported encoding format is jpg.
quality:98 } // Image quality, which ranges from 0 to 100. quality:98 } // Image quality, which ranges from 0 to 100.
// Encode the image. // Encode the image.
...@@ -233,8 +243,9 @@ imageSourceApi.getImageInfo((err, imageInfo) => { ...@@ -233,8 +243,9 @@ imageSourceApi.getImageInfo((err, imageInfo) => {
console.log('Succeeded in getting imageInfo'); console.log('Succeeded in getting imageInfo');
}) })
const array = new ArrayBuffer(100); // Incremental data.
// Update incremental data. // Update incremental data.
imageSourceIncrementalSApi.updateData(array, false, 0, 10,(error, data)=> {}) imageSourceApi.updateData(array, false, 0, 10,(error, data)=> {})
``` ```
...@@ -246,10 +257,15 @@ Example scenario: The camera functions as the client to transmit image data to t ...@@ -246,10 +257,15 @@ Example scenario: The camera functions as the client to transmit image data to t
public async init(surfaceId: any) { public async init(surfaceId: any) {
// (Server code) Create an ImageReceiver object. // (Server code) Create an ImageReceiver object.
var receiver = image.createImageReceiver(8 * 1024, 8, image.ImageFormat.JPEG, 1); let receiver = image.createImageReceiver(8 * 1024, 8, image.ImageFormat.JPEG, 1);
// Obtain the surface ID. // Obtain the surface ID.
receiver.getReceivingSurfaceId((err, surfaceId) => { receiver.getReceivingSurfaceId((err, surfaceId) => {
// Failed to obtain the surface ID.
if (err) {
console.info('getReceivingSurfaceId failed, err' + err);
return
}
console.info("receiver getReceivingSurfaceId success"); console.info("receiver getReceivingSurfaceId success");
}); });
// Register a surface listener, which is triggered after the buffer of the surface is ready. // Register a surface listener, which is triggered after the buffer of the surface is ready.
......
...@@ -15,7 +15,7 @@ In ArkTS, you define a custom component by using decorators **@Component** and * ...@@ -15,7 +15,7 @@ In ArkTS, you define a custom component by using decorators **@Component** and *
} }
``` ```
- **build** function: a function that complies with the **Builder** API definition and is used to define the declarative UI description of components. A **build** function must be defined for custom components, and custom constructors are prohibited for custom components. - **build** function: A custom component must implement the **build** function and must implement no constructor. The **build** function meets the definition of the **Builder** API and is used to define the declarative UI description of components.
```ts ```ts
interface Builder { interface Builder {
...@@ -49,9 +49,9 @@ Column() { ...@@ -49,9 +49,9 @@ Column() {
} }
``` ```
### Structs with Mandatory Parameters ### Structs with Parameters
A struct with mandatory parameters is a component whose API definition expects parameters enclosed in the parentheses. You can use constants to assign values to the parameters. A struct with parameters is a component whose API definition expects parameters enclosed in the parentheses. You can use constants to assign values to the parameters.
Sample code: Sample code:
...@@ -61,7 +61,7 @@ Sample code: ...@@ -61,7 +61,7 @@ Sample code:
Image('https://xyz/test.jpg') Image('https://xyz/test.jpg')
``` ```
- Set the mandatory parameter **content** of the **\<Text>** component as follows: - Set the optional parameter **content** of the **\<Text>** component as follows:
```ts ```ts
Text('test') Text('test')
...@@ -83,35 +83,35 @@ Component attributes are configured using an attribute method, which follows the ...@@ -83,35 +83,35 @@ Component attributes are configured using an attribute method, which follows the
```ts ```ts
Text('test') Text('test')
.fontSize(12) .fontSize(12)
``` ```
- Example of configuring multiple attributes at the same time by using the "**.**" operator to implement chain call: - Example of configuring multiple attributes at the same time by using the "**.**" operator to implement chain call:
```ts ```ts
Image('test.jpg') Image('test.jpg')
.alt('error.jpg') .alt('error.jpg')
.width(100) .width(100)
.height(100) .height(100)
``` ```
- Example of passing variables or expressions in addition to constants: - Example of passing variables or expressions in addition to constants:
```ts ```ts
Text('hello') Text('hello')
.fontSize(this.size) .fontSize(this.size)
Image('test.jpg') Image('test.jpg')
.width(this.count % 2 === 0 ? 100 : 200) .width(this.count % 2 === 0 ? 100 : 200)
.height(this.offset + 100) .height(this.offset + 100)
``` ```
- For attributes of built-in components, ArkUI also provides some predefined [enumeration types](../reference/arkui-ts/ts-appendix-enums.md), which you can pass as parameters to methods if they meet the parameter type requirements. For example, you can configure the font color and weight attributes of the **\<Text>** component as follows: - For attributes of built-in components, ArkUI also provides some predefined [enumeration types](../reference/arkui-ts/ts-appendix-enums.md), which you can pass as parameters to methods if they meet the parameter type requirements. For example, you can configure the font color and weight attributes of the **\<Text>** component as follows:
```ts ```ts
Text('hello') Text('hello')
.fontSize(20) .fontSize(20)
.fontColor(Color.Red) .fontColor(Color.Red)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
``` ```
### Event Configuration ### Event Configuration
...@@ -123,7 +123,7 @@ Events supported by components are configured using event methods, which each fo ...@@ -123,7 +123,7 @@ Events supported by components are configured using event methods, which each fo
```ts ```ts
Button('add counter') Button('add counter')
.onClick(() => { .onClick(() => {
this.counter += 2 this.counter += 2;
}) })
``` ```
...@@ -132,7 +132,7 @@ Events supported by components are configured using event methods, which each fo ...@@ -132,7 +132,7 @@ Events supported by components are configured using event methods, which each fo
```ts ```ts
Button('add counter') Button('add counter')
.onClick(function () { .onClick(function () {
this.counter += 2 this.counter += 2;
}.bind(this)) }.bind(this))
``` ```
...@@ -140,13 +140,13 @@ Events supported by components are configured using event methods, which each fo ...@@ -140,13 +140,13 @@ Events supported by components are configured using event methods, which each fo
```ts ```ts
myClickHandler(): void { myClickHandler(): void {
this.counter += 2 this.counter += 2;
} }
... ...
Button('add counter') Button('add counter')
.onClick(this.myClickHandler) .onClick(this.myClickHandler.bind(this))
``` ```
### Child Component Configuration ### Child Component Configuration
...@@ -158,11 +158,11 @@ For a component that supports child components, for example, a container compone ...@@ -158,11 +158,11 @@ For a component that supports child components, for example, a container compone
```ts ```ts
Column() { Column() {
Text('Hello') Text('Hello')
.fontSize(100) .fontSize(100)
Divider() Divider()
Text(this.myText) Text(this.myText)
.fontSize(100) .fontSize(100)
.fontColor(Color.Red) .fontColor(Color.Red)
} }
``` ```
...@@ -176,10 +176,10 @@ For a component that supports child components, for example, a container compone ...@@ -176,10 +176,10 @@ For a component that supports child components, for example, a container compone
.height(100) .height(100)
Button('click +1') Button('click +1')
.onClick(() => { .onClick(() => {
console.info('+1 clicked!') console.info('+1 clicked!');
}) })
} }
Divider() Divider()
Row() { Row() {
Image('test2.jpg') Image('test2.jpg')
...@@ -187,10 +187,10 @@ For a component that supports child components, for example, a container compone ...@@ -187,10 +187,10 @@ For a component that supports child components, for example, a container compone
.height(100) .height(100)
Button('click +2') Button('click +2')
.onClick(() => { .onClick(() => {
console.info('+2 clicked!') console.info('+2 clicked!');
}) })
} }
Divider() Divider()
Row() { Row() {
Image('test3.jpg') Image('test3.jpg')
...@@ -198,7 +198,7 @@ For a component that supports child components, for example, a container compone ...@@ -198,7 +198,7 @@ For a component that supports child components, for example, a container compone
.height(100) .height(100)
Button('click +3') Button('click +3')
.onClick(() => { .onClick(() => {
console.info('+3 clicked!') console.info('+3 clicked!');
}) })
} }
} }
......
...@@ -230,27 +230,27 @@ When referencing resources in the **rawfile** subdirectory, use the **"$rawfile( ...@@ -230,27 +230,27 @@ When referencing resources in the **rawfile** subdirectory, use the **"$rawfile(
> >
> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md) API. > The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md) API.
In the **.ets** file, you can use the resources defined in the **resources** directory. In the **.ets** file, you can use the resources defined in the **resources** directory. The following is a resource usage example based on the resource file examples in [Resource Group Sub-directories](#resource-group-subdirectories):
```ts ```ts
Text($r('app.string.string_hello')) Text($r('app.string.string_hello'))
.fontColor($r('app.color.color_hello')) .fontColor($r('app.color.color_hello'))
.fontSize($r('app.float.font_hello')) .fontSize($r('app.float.font_hello'))
}
Text($r('app.string.string_world')) Text($r('app.string.string_world'))
.fontColor($r('app.color.color_world')) .fontColor($r('app.color.color_world'))
.fontSize($r('app.float.font_world')) .fontSize($r('app.float.font_world'))
}
// Reference string resources. The second parameter of $r is used to replace %s, and value is "We will arrive at five'o clock".
Text($r('app.string.message_arrive', "five of the clock")) // Reference string resources. The second parameter of $r is used to replace %s. Text($r('app.string.message_arrive', "five'o clock"))
.fontColor($r('app.color.color_hello')) .fontColor($r('app.color.color_hello'))
.fontSize($r('app.float.font_hello')) .fontSize($r('app.float.font_hello'))
}
// Reference plural resources. The first parameter indicates the plural resource, the second parameter indicates the number of plural resources, and the third parameter indicates the substitute of %d.
Text($r('app.plural.eat_apple', 5, 5)) // Reference plural resources. The first parameter indicates the plural resource, the second parameter indicates the number of plural resources, and the third parameter indicates the substitute of %d. // The value is "5 apple" in singular form and "5 apples" in plural form.
.fontColor($r('app.color.color_world')) Text($r('app.plural.eat_apple', 5, 5))
.fontSize($r('app.float.font_world')) .fontColor($r('app.color.color_world'))
.fontSize($r('app.float.font_world'))
} }
Image($r('app.media.my_background_image')) // Reference media resources. Image($r('app.media.my_background_image')) // Reference media resources.
...@@ -274,14 +274,20 @@ To reference a system resource, use the **"$r('sys.type.resource_id')"** format. ...@@ -274,14 +274,20 @@ To reference a system resource, use the **"$r('sys.type.resource_id')"** format.
```ts ```ts
Text('Hello') Text('Hello')
.fontColor($r('sys.color.ohos_id_color_emphasize')) .fontColor($r('sys.color.ohos_id_color_emphasize'))
.fontSize($r('sys.float.ohos_id_text_size_headline1')) .fontSize($r('sys.float.ohos_id_text_size_headline1'))
.fontFamily($r('sys.string.ohos_id_text_font_family_medium')) .fontFamily($r('sys.string.ohos_id_text_font_family_medium'))
.backgroundColor($r('sys.color.ohos_id_color_palette_aux1')) .backgroundColor($r('sys.color.ohos_id_color_palette_aux1'))
Image($r('sys.media.ohos_app_icon')) Image($r('sys.media.ohos_app_icon'))
.border({color: $r('sys.color.ohos_id_color_palette_aux1'), radius: $r('sys.float.ohos_id_corner_radius_button'), width: 2}) .border({
.margin({top: $r('sys.float.ohos_id_elements_margin_horizontal_m'), bottom: $r('sys.float.ohos_id_elements_margin_horizontal_l')}) color: $r('sys.color.ohos_id_color_palette_aux1'),
.height(200) radius: $r('sys.float.ohos_id_corner_radius_button'), width: 2
.width(300) })
.margin({
top: $r('sys.float.ohos_id_elements_margin_horizontal_m'),
bottom: $r('sys.float.ohos_id_elements_margin_horizontal_l')
})
.height(200)
.width(300)
``` ```
...@@ -55,7 +55,7 @@ Initiates a call based on the specified options. This API uses an asynchronous c ...@@ -55,7 +55,7 @@ Initiates a call based on the specified options. This API uses an asynchronous c
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- | | ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | | options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example** **Example**
...@@ -313,7 +313,7 @@ Checks whether the called number is an emergency number based on the specified p ...@@ -313,7 +313,7 @@ Checks whether the called number is an emergency number based on the specified p
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- | | ----------- | -------------------------------------------------- | ---- | -------------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. | | options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number options. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
**Example** **Example**
...@@ -397,7 +397,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100. ...@@ -397,7 +397,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ------------------------------------ | | ----------- | -------------------------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | | options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -566,33 +566,6 @@ promise.then(data => { ...@@ -566,33 +566,6 @@ promise.then(data => {
}); });
``` ```
## call.answer<sup>7+</sup>
answer\(callback: AsyncCallback<void\>\): void
Answers a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```js
call.answer((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.answer<sup>7+</sup> ## call.answer<sup>7+</sup>
answer\(callId: number, callback: AsyncCallback<void\>\): void answer\(callId: number, callback: AsyncCallback<void\>\): void
...@@ -658,7 +631,7 @@ promise.then(data => { ...@@ -658,7 +631,7 @@ promise.then(data => {
## call.hangup<sup>7+</sup> ## call.hangup<sup>7+</sup>
hangup\(callback: AsyncCallback<void\>\): void hangup\(callId: number, callback: AsyncCallback<void\>\): void
Ends a call. This API uses an asynchronous callback to return the result. Ends a call. This API uses an asynchronous callback to return the result.
...@@ -672,22 +645,23 @@ This is a system API. ...@@ -672,22 +645,23 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example** **Example**
```js ```js
call.hangup((err, data) => { call.hangup(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.hangup<sup>7+</sup> ## call.answer<sup>9+</sup>
hangup\(callId: number, callback: AsyncCallback<void\>\): void answer\(callback: AsyncCallback<void\>\): void
Ends a call based on the specified call ID. This API uses an asynchronous callback to return the result. Answers a call.This API uses an asynchronous callback to return the result.
This is a system API. This is a system API.
...@@ -699,13 +673,12 @@ This is a system API. ...@@ -699,13 +673,12 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------------------------- | | -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
```js ```js
call.hangup(1, (err, data) => { call.answer((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -746,11 +719,11 @@ promise.then(data => { ...@@ -746,11 +719,11 @@ promise.then(data => {
}); });
``` ```
## call.reject<sup>7+</sup> ## call.hangup<sup>9+</sup>
reject\(callback: AsyncCallback<void\>\): void hangup\(callback: AsyncCallback<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Ends a call. This API uses an asynchronous callback to return the result.
This is a system API. This is a system API.
...@@ -767,38 +740,7 @@ This is a system API. ...@@ -767,38 +740,7 @@ This is a system API.
**Example** **Example**
```js ```js
call.reject((err, data) => { call.hangup((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject<sup>7+</sup>
reject\(options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
Rejects a call based on the specified options. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | -------------- |
| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
call.reject(rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -903,6 +845,65 @@ promise.then(data => { ...@@ -903,6 +845,65 @@ promise.then(data => {
}); });
``` ```
## call.reject<sup>9+</sup>
reject\(callback: AsyncCallback<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example:**
```js
call.reject((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject<sup>9+</sup>
reject\(options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | -------------- |
| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example:**
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
call.reject(rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.holdCall<sup>7+</sup> ## call.holdCall<sup>7+</sup>
holdCall\(callId: number, callback: AsyncCallback<void\>\): void holdCall\(callId: number, callback: AsyncCallback<void\>\): void
...@@ -1344,8 +1345,8 @@ This is a system API. ...@@ -1344,8 +1345,8 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.<br><br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.| | callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.<br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.|
**Example** **Example**
...@@ -2399,7 +2400,7 @@ promise.then(data => { ...@@ -2399,7 +2400,7 @@ promise.then(data => {
}); });
``` ```
## call.setAudioDevice<sup>8+</sup> ## call.setAudioDevice<sup>9+</sup>
setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): void setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): void
...@@ -2425,7 +2426,7 @@ call.setAudioDevice(1, (err, data) => { ...@@ -2425,7 +2426,7 @@ call.setAudioDevice(1, (err, data) => {
``` ```
## call.setAudioDevice<sup>8+</sup> ## call.setAudioDevice<sup>9+</sup>
setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback<void\>\): void setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback<void\>\): void
......
# Internationalization – I18N # Internationalization – I18N
This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. The I18N module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402.
The [Intl](js-apis-intl.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities. The [Intl](js-apis-intl.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities.
> **NOTE** > **NOTE**
> - The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. For details about the basic I18N capabilities, see [Intl](js-apis-intl.md).
## Modules to Import ## Modules to Import
...@@ -247,9 +244,9 @@ This is a system API. ...@@ -247,9 +244,9 @@ This is a system API.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Mandatory | Description |
| -------- | ------ | ----- | | -------- | ------ | ----- | ----- |
| language | string | Language ID.| | language | string | Yes | Language ID.|
**Error codes** **Error codes**
...@@ -313,9 +310,9 @@ This is a system API. ...@@ -313,9 +310,9 @@ This is a system API.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ----- | | -------- | ------ | ----- | ----- |
| region | string | Region ID.| | region | string | Yes | Region ID.|
**Error codes** **Error codes**
...@@ -379,9 +376,9 @@ This is a system API. ...@@ -379,9 +376,9 @@ This is a system API.
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | --------------- | | -------- | ------ | ----- | ----- |
| locale | string | System locale ID, for example, **zh-CN**.| | locale | string | Yes | System locale ID, for example, **zh-CN**.|
**Error codes** **Error codes**
...@@ -713,9 +710,9 @@ Checks whether the localized script for the specified language is displayed from ...@@ -713,9 +710,9 @@ Checks whether the localized script for the specified language is displayed from
**Parameters** **Parameters**
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ------- | | -------- | ------ | ----- | ----- |
| locale | string | Locale ID.| | locale | string | Yes | Locale ID.|
**Return value** **Return value**
...@@ -905,7 +902,7 @@ Sets the start day of a week for this **Calendar** object. ...@@ -905,7 +902,7 @@ Sets the start day of a week for this **Calendar** object.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | --------------------- | | ----- | ------ | ---- | --------------------- |
| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.| | value | number | Yes | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
**Example** **Example**
```js ```js
...@@ -947,7 +944,7 @@ Sets the minimum number of days in the first week of a year. ...@@ -947,7 +944,7 @@ Sets the minimum number of days in the first week of a year.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ------------ | | ----- | ------ | ---- | ------------ |
| value | number | No | Minimum number of days in the first week of a year.| | value | number | Yes | Minimum number of days in the first week of a year.|
**Example** **Example**
```js ```js
......
# Input Method Subtype # @ohos.inputmethodsubtype
The **inputMethodEngine** module provides APIs for managing the attributes of input method subtypes. Different attribute settings result in different subtypes. The **inputMethodSubtype** module provides APIs for managing the attributes of input method subtypes. Different attribute settings result in different subtypes.
> **NOTE** > **NOTE**
> >
......
# Internationalization – Intl # Internationalization – Intl
This module provides basic I18N capabilities, such as time and date formatting, number formatting, and string sorting, through the standard I18N APIs defined in ECMA 402. The Intl module provides basic I18N capabilities, such as time and date formatting, number formatting, and string sorting, through the standard I18N APIs defined in ECMA 402.
The [I18N](js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary APIs that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. The [I18N](js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary APIs that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities.
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
The Keycode module provides keycodes for a key device. The Keycode module provides keycodes for a key device.
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 9. 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -337,7 +338,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode'; ...@@ -337,7 +338,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode';
| KEYCODE_WWAN_WIMAX | number | Yes| No| WWAN WiMAX key| | KEYCODE_WWAN_WIMAX | number | Yes| No| WWAN WiMAX key|
| KEYCODE_RFKILL | number | Yes| No| RF Kill key| | KEYCODE_RFKILL | number | Yes| No| RF Kill key|
| KEYCODE_CHANNEL | number | Yes| No| Channel key| | KEYCODE_CHANNEL | number | Yes| No| Channel key|
| KEYCODE_BTN_0 | number | Yes| No| Key 0| | KEYCODE_BTN_0 | number | Yes| No| Button 0|
| KEYCODE_BTN_1 | number | Yes| No| Button 1| | KEYCODE_BTN_1 | number | Yes| No| Button 1|
| KEYCODE_BTN_2 | number | Yes| No| Button 2| | KEYCODE_BTN_2 | number | Yes| No| Button 2|
| KEYCODE_BTN_3 | number | Yes| No| Button 3| | KEYCODE_BTN_3 | number | Yes| No| Button 3|
......
...@@ -332,7 +332,6 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -332,7 +332,6 @@ connection.getDefaultNet().then(function (netHandle) {
}); });
``` ```
## connection.reportNetConnected ## connection.reportNetConnected
reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt; reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt;
...@@ -490,7 +489,6 @@ connection.getAddressesByName(host).then(function (addresses) { ...@@ -490,7 +489,6 @@ connection.getAddressesByName(host).then(function (addresses) {
}) })
``` ```
## connection.enableAirplaneMode ## connection.enableAirplaneMode
enableAirplaneMode(callback: AsyncCallback\<void>): void enableAirplaneMode(callback: AsyncCallback\<void>): void
...@@ -539,7 +537,6 @@ connection.enableAirplaneMode().then(function (error) { ...@@ -539,7 +537,6 @@ connection.enableAirplaneMode().then(function (error) {
}) })
``` ```
## connection.disableAirplaneMode ## connection.disableAirplaneMode
disableAirplaneMode(callback: AsyncCallback\<void>): void disableAirplaneMode(callback: AsyncCallback\<void>): void
...@@ -588,7 +585,6 @@ connection.disableAirplaneMode().then(function (error) { ...@@ -588,7 +585,6 @@ connection.disableAirplaneMode().then(function (error) {
}) })
``` ```
## connection.createNetConnection ## connection.createNetConnection
createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection
...@@ -825,7 +821,7 @@ Before invoking NetHandle APIs, call **getNetHandle** to obtain a **NetHandle** ...@@ -825,7 +821,7 @@ Before invoking NetHandle APIs, call **getNetHandle** to obtain a **NetHandle**
| Name| Type | Description | | Name| Type | Description |
| ------ | ------ | ------------------------- | | ------ | ------ | ------------------------- |
| netId | number | Network ID. The value must be greater than or equal to 100.| | netId | number | Network ID. The value **0** indicates no default network. Any other value must be greater than or equal to 100.|
### bindSocket ### bindSocket
...@@ -847,33 +843,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses ...@@ -847,33 +843,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
**Example** **Example**
```js ```js
connection.getDefaultNet().then(function (netHandle) { import socket from "@ohos.net.socket";
connection.getDefaultNet().then((netHandle)=>{
var tcp = socket.constructTCPSocketInstance(); var tcp = socket.constructTCPSocketInstance();
var udp = socket.constructUDPSocketInstance(); var udp = socket.constructUDPSocketInstance();
let socketType = "xxxx"; let socketType = "TCPSocket";
if (socketType == "TCPSocket") { if (socketType == "TCPSocket") {
tcp.bind({ tcp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
netHandle.bindSocket(tcp, function (error, data) { if (err) {
console.log(JSON.stringify(error)) console.log('bind fail');
console.log(JSON.stringify(data)) }
netHandle.bindSocket(tcp, (error, data)=>{
if (error) {
console.log(JSON.stringify(error));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} else { } else {
let callback = value => {
console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
}
udp.on('message', callback); udp.on('message', callback);
udp.bind({ udp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
if (err) {
console.log('bind fail');
}
udp.on('message', (data) => { udp.on('message', (data) => {
console.log(JSON.stringify(data)) console.log(JSON.stringify(data))
});
netHandle.bindSocket(udp, function (error, data) {
console.log(JSON.stringify(error))
console.log(JSON.stringify(data))
}); });
netHandle.bindSocket(udp,(error, data)=>{
if (error) {
console.log(JSON.stringify(error));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} }
} })
``` ```
### bindSocket ### bindSocket
...@@ -901,31 +914,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses ...@@ -901,31 +914,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
**Example** **Example**
```js ```js
connection.getDefaultNet().then(function (netHandle) { import socket from "@ohos.net.socket";
connection.getDefaultNet().then((netHandle)=>{
var tcp = socket.constructTCPSocketInstance(); var tcp = socket.constructTCPSocketInstance();
var udp = socket.constructUDPSocketInstance(); var udp = socket.constructUDPSocketInstance();
let socketType = "xxxx"; let socketType = "TCPSocket";
if(socketType == "TCPSocket") { if (socketType == "TCPSocket") {
tcp.bind({ tcp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
netHandle.bindSocket(tcp).then(err, data) { if (err) {
console.log(JSON.stringify(data)) console.log('bind fail');
}
netHandle.bindSocket(tcp).then((err, data) => {
if (err) {
console.log(JSON.stringify(err));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} else { } else {
let callback = value => {
console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
}
udp.on('message', callback); udp.on('message', callback);
udp.bind({ udp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
if (err) {
console.log('bind fail');
}
udp.on('message', (data) => { udp.on('message', (data) => {
console.log(JSON.stringify(data)) console.log(JSON.stringify(data));
}); })
netHandle.bindSocket(tcp).then(err, data) { netHandle.bindSocket(udp).then((err, data) => {
console.log(JSON.stringify(data)) if (err) {
}); console.log(JSON.stringify(err));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} }
} })
``` ```
......
# Network Sharing Management # Network Sharing Management
The Network Sharing Management module allows you to share your device's Internet connection with other connected devices by means of Wi-Fi hotspot, Bluetooth, and USB sharing. It also allows you to query the network sharing state and shared mobile data volume. The Network Sharing Management module allows you to share your device's Internet connection with other connected devices by means of Wi-Fi hotspot, and Bluetooth sharing. It also allows you to query the network sharing state and shared mobile data volume.
> **NOTE** > **NOTE**
> >
...@@ -405,7 +405,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses ...@@ -405,7 +405,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses
**Example** **Example**
```js ```js
import SharingIfaceState from '@ohos.net.sharing' import SharingIfaceType from '@ohos.net.sharing'
sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => { sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
...@@ -498,7 +498,7 @@ Obtains the network sharing state of the specified type. This API uses a promise ...@@ -498,7 +498,7 @@ Obtains the network sharing state of the specified type. This API uses a promise
```js ```js
import SharingIfaceType from '@ohos.net.sharing' import SharingIfaceType from '@ohos.net.sharing'
sharing.getSharingIfaces(SharingIfaceType.SHARING_WIFI).then(data => { sharing.getSharingState(SharingIfaceType.SHARING_WIFI).then(data => {
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
}).catch(error => { }).catch(error => {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
...@@ -525,8 +525,8 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch ...@@ -525,8 +525,8 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch
**Example** **Example**
```js ```js
import SharingIfaceState from '@ohos.net.sharing' import SharingIfaceType from '@ohos.net.sharing'
sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => { sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI, (error, data) => {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
}); });
...@@ -565,7 +565,7 @@ sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => { ...@@ -565,7 +565,7 @@ sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => {
}); });
``` ```
## on('sharingStateChange') ## sharing.on('sharingStateChange')
on(type: 'sharingStateChange', callback: Callback\<boolean>): void on(type: 'sharingStateChange', callback: Callback\<boolean>): void
...@@ -591,7 +591,7 @@ sharing.on('sharingStateChange', (error, data) => { ...@@ -591,7 +591,7 @@ sharing.on('sharingStateChange', (error, data) => {
}); });
``` ```
## off('sharingStateChange') ## sharing.off('sharingStateChange')
off(type: 'sharingStateChange', callback?: Callback\<boolean>): void off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
...@@ -617,7 +617,7 @@ sharing.off('sharingStateChange', (error, data) => { ...@@ -617,7 +617,7 @@ sharing.off('sharingStateChange', (error, data) => {
}); });
``` ```
## on('interfaceSharingStateChange') ## sharing.on('interfaceSharingStateChange')
on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
...@@ -643,7 +643,7 @@ sharing.on('interfaceSharingStateChange', (error, data) => { ...@@ -643,7 +643,7 @@ sharing.on('interfaceSharingStateChange', (error, data) => {
}); });
``` ```
## off('interfaceSharingStateChange') ## sharing.off('interfaceSharingStateChange')
off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
...@@ -669,7 +669,7 @@ sharing.off('interfaceSharingStateChange', (error, data) => { ...@@ -669,7 +669,7 @@ sharing.off('interfaceSharingStateChange', (error, data) => {
}); });
``` ```
## on('sharingUpstreamChange') ## sharing.on('sharingUpstreamChange')
on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
...@@ -695,7 +695,7 @@ sharing.on('sharingUpstreamChange', (error, data) => { ...@@ -695,7 +695,7 @@ sharing.on('sharingUpstreamChange', (error, data) => {
}); });
``` ```
## off('sharingUpstreamChange') ## sharing.off('sharingUpstreamChange')
off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
...@@ -735,12 +735,12 @@ Enumerates the network sharing states of an NIC. ...@@ -735,12 +735,12 @@ Enumerates the network sharing states of an NIC.
## SharingIfaceType ## SharingIfaceType
Enumerates the network sharing types of an NIC. Enumerates the network sharing types of an NIC.
**System capability**: SystemCapability.Communication.NetManager.Core **System capability**: SystemCapability.Communication.NetManager.Core
| Name | Value | Description | | Name | Value | Description |
| ------------------------ | ---- | ---------------------- | | ------------------------ | ---- | ---------------------- |
| SHARING_WIFI | 0 | Wi-Fi hotspot sharing.| | SHARING_WIFI | 0 | Wi-Fi hotspot sharing.|
| SHARING_USB | 1 | USB sharing.| | SHARING_USB | 1 | USB sharing (not supported currently).|
| SHARING_BLUETOOTH | 2 | Bluetooth sharing.| | SHARING_BLUETOOTH | 2 | Bluetooth sharing.|
...@@ -531,8 +531,8 @@ Enumerates SIM card types and states. ...@@ -531,8 +531,8 @@ Enumerates SIM card types and states.
**System capability**: SystemCapability.Telephony.StateRegistry **System capability**: SystemCapability.Telephony.StateRegistry
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ----------------- | --------------------- | ------------------------------------------------------------ | | -------- | ------- | --------- | ----------- |
| type | [CardType](js-apis-sim.md#cardtype) | SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| | type | [CardType](js-apis-sim.md#cardtype) | Yes| SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).|
| state | [SimState](js-apis-sim.md#simstate) | SIM card status. For details, see [SimState](js-apis-sim.md#simstate).| | state | [SimState](js-apis-sim.md#simstate) | Yes| SIM card status. For details, see [SimState](js-apis-sim.md#simstate).|
| reason<sup>8+</sup> | [LockReason](#lockreason8) | SIM card lock type.| | reason<sup>8+</sup> | [LockReason](#lockreason8) | Yes| SIM card lock type.|
...@@ -142,7 +142,7 @@ Sets the mouse movement speed. This API uses an asynchronous callback to return ...@@ -142,7 +142,7 @@ Sets the mouse movement speed. This API uses an asynchronous callback to return
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- | | -------- | ------------------------- | ---- | ------------------------------------- |
| speed | number | Yes | Mouse movement speed. The value ranges from **1** to **11**. The default value is **5**. | | speed | number | Yes | Mouse movement speed. The value ranges from **1** to **11**. The default value is **5**. |
| callback | AysncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -349,7 +349,7 @@ Sets the mouse pointer style. This API uses an asynchronous callback to return t ...@@ -349,7 +349,7 @@ Sets the mouse pointer style. This API uses an asynchronous callback to return t
| ------------ | ------------------------------ | ---- | ----------------------------------- | | ------------ | ------------------------------ | ---- | ----------------------------------- |
| windowId | number | Yes | Window ID. | | windowId | number | Yes | Window ID. |
| pointerStyle | [PointerStyle](#pointerstyle9) | Yes | Mouse pointer style ID. | | pointerStyle | [PointerStyle](#pointerstyle9) | Yes | Mouse pointer style ID. |
| callback | AysncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example** **Example**
......
...@@ -1734,8 +1734,8 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci ...@@ -1734,8 +1734,8 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci
**Example** **Example**
```js ```js
radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1763,8 +1763,8 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec ...@@ -1763,8 +1763,8 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec
**Example** **Example**
```js ```js
radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1797,10 +1797,10 @@ Defines the signal strength. ...@@ -1797,10 +1797,10 @@ Defines the signal strength.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ------------------ | | -------- | ------- | --------- | ----------- |
| signalType | [NetworkType](#networktype) | Signal strength type.| | signalType | [NetworkType](#networktype) | Yes| Signal strength type.|
| signalLevel | number | Signal strength level.| | signalLevel | number | Yes| Signal strength level.|
## NetworkType ## NetworkType
...@@ -1825,17 +1825,17 @@ Defines the network status. ...@@ -1825,17 +1825,17 @@ Defines the network status.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ----------------- | --------------------- | ------------------------------------------------------------ | | -------- | ------- | --------- | ----------- |
| longOperatorName | string | Long carrier name of the registered network.| | longOperatorName | string | Yes | Long carrier name of the registered network.|
| shortOperatorName | string | Short carrier name of the registered network.| | shortOperatorName | string | Yes | Short carrier name of the registered network.|
| plmnNumeric | string | PLMN code of the registered network.| | plmnNumeric | string | Yes | PLMN code of the registered network.|
| isRoaming | boolean | Whether the user is roaming.| | isRoaming | boolean | Yes | Whether the user is roaming.|
| regState | [RegState](#regstate) | Network registration status of the device.| | regState | [RegState](#regstate) | Yes | Network registration status of the device.|
| cfgTech<sup>8+</sup> | [RadioTechnology](#radiotechnology) | RAT of the device.| | cfgTech<sup>8+</sup> | [RadioTechnology](#radiotechnology) | Yes | RAT of the device.|
| nsaState | [NsaState](#nsastate) | NSA network registration status of the device.| | nsaState | [NsaState](#nsastate) | Yes | NSA network registration status of the device.|
| isCaActive | boolean | CA status.| | isCaActive | boolean | Yes | CA status.|
| isEmergency | boolean | Whether only emergency calls are allowed.| | isEmergency | boolean | Yes | Whether only emergency calls are allowed.|
## RegState ## RegState
...@@ -1933,13 +1933,13 @@ Defines the cell information. ...@@ -1933,13 +1933,13 @@ Defines the cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | -------- | ------- | --------- | ----------- |
| networkType | [NetworkType](#networktype) | Network type of the cell. | | networkType | [NetworkType](#networktype) | Yes | Network type of the cell. |
| isCamped | boolean | Status of the cell. | | isCamped | boolean | Yes | Status of the cell. |
| timeStamp | number | Timestamp when cell information is obtained. | | timeStamp | number | Yes | Timestamp when cell information is obtained. |
| signalInformation | [SignalInformation](#signalinformation) | Signal information. | | signalInformation | [SignalInformation](#signalinformation) | Yes | Signal information. |
| data | [CdmaCellInformation](#cdmacellinformation8) \| [GsmCellInformation](#gsmcellinformation8) \| [LteCellInformation](#ltecellinformation8) \| [NrCellInformation](#nrcellinformation8) \| [TdscdmaCellInformation](#tdscdmacellinformation8) | CDMA cell information \|GSM cell information \|LTE cell information \|NR cell information \|TD-SCDMA cell information| | data | [CdmaCellInformation](#cdmacellinformation8) \| [GsmCellInformation](#gsmcellinformation8) \| [LteCellInformation](#ltecellinformation8) \| [NrCellInformation](#nrcellinformation8) \| [TdscdmaCellInformation](#tdscdmacellinformation8) | Yes | CDMA cell information \|GSM cell information \|LTE cell information \|NR cell information \|TD-SCDMA cell information|
## CdmaCellInformation<sup>8+</sup> ## CdmaCellInformation<sup>8+</sup>
...@@ -1949,13 +1949,13 @@ Defines the CDMA cell information. ...@@ -1949,13 +1949,13 @@ Defines the CDMA cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ------------ | | -------- | ------- | --------- | ----------- |
| baseId | number | Base station ID. | | baseId | number | Yes | Base station ID. |
| latitude | number | Longitude. | | latitude | number | Yes | Longitude. |
| longitude | number | Latitude. | | longitude | number | Yes | Latitude. |
| nid | number | Network ID.| | nid | number | Yes | Network ID.|
| sid | number | System ID.| | sid | number | Yes | System ID.|
## GsmCellInformation<sup>8+</sup> ## GsmCellInformation<sup>8+</sup>
...@@ -1965,14 +1965,14 @@ Defines the GSM cell information. ...@@ -1965,14 +1965,14 @@ Defines the GSM cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | -------------------- | | -------- | ------- | --------- | ----------- |
| lac | number | Location area code. | | lac | number | Yes | Location area code. |
| cellId | number | Cell ID. | | cellId | number | Yes | Cell ID. |
| arfcn | number | Absolute radio frequency channel number.| | arfcn | number | Yes | Absolute radio frequency channel number.|
| bsic | number | Base station ID. | | bsic | number | Yes | Base station ID. |
| mcc | string | Mobile country code. | | mcc | string | Yes | Mobile country code. |
| mnc | string | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## LteCellInformation<sup>8+</sup> ## LteCellInformation<sup>8+</sup>
...@@ -1982,16 +1982,16 @@ Defines the LTE cell information. ...@@ -1982,16 +1982,16 @@ Defines the LTE cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------------- | ------- | ----------------------- | | -------- | ------- | --------- | ----------- |
| cgi | number | Cell global identification. | | cgi | number | Yes | Cell global identification. |
| pci | number | Physical cell ID. | | pci | number | Yes | Physical cell ID. |
| tac | number | Tracking area code. | | tac | number | Yes | Tracking area code. |
| earfcn | number | Absolute radio frequency channel number. | | earfcn | number | Yes | Absolute radio frequency channel number. |
| bandwidth | number | Bandwidth. | | bandwidth | number | Yes | Bandwidth. |
| mcc | string | Mobile country code. | | mcc | string | Yes | Mobile country code. |
| mnc | string | Mobile network code. | | mnc | string | Yes | Mobile network code. |
| isSupportEndc | boolean | Support New Radio_Dual Connectivity| | isSupportEndc | boolean | Yes | Support for New Radio_Dual Connectivity. |
## NrCellInformation<sup>8+</sup> ## NrCellInformation<sup>8+</sup>
...@@ -2001,14 +2001,14 @@ Defines the NR cell information. ...@@ -2001,14 +2001,14 @@ Defines the NR cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------- | ------ | ---------------- | | -------- | ------- | --------- | ----------- |
| nrArfcn | number | 5G frequency number. | | nrArfcn | number | Yes | 5G frequency number. |
| pci | number | Physical cell ID. | | pci | number | Yes | Physical cell ID. |
| tac | number | Tracking area code. | | tac | number | Yes | Tracking area code. |
| nci | number | 5G network cell ID.| | nci | number | Yes | 5G network cell ID.|
| mcc | string | Mobile country code. | | mcc | string | Yes | Mobile country code. |
| mnc | string | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## TdscdmaCellInformation<sup>8+</sup> ## TdscdmaCellInformation<sup>8+</sup>
...@@ -2018,14 +2018,14 @@ Defines the TD-SCDMA cell information. ...@@ -2018,14 +2018,14 @@ Defines the TD-SCDMA cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ------------ | | -------- | ------- | --------- | ----------- |
| lac | number | Location area code.| | lac | number | Yes | Location area code.|
| cellId | number | Cell ID. | | cellId | number | Yes | Cell ID. |
| cpid | number | Cell parameter ID.| | cpid | number | Yes | Cell parameter ID.|
| uarfcn | number | Absolute radio frequency number.| | uarfcn | number | Yes | Absolute radio frequency number.|
| mcc | string | Mobile country code.| | mcc | string | Yes | Mobile country code.|
| mnc | string | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## WcdmaCellInformation<sup>8+</sup> ## WcdmaCellInformation<sup>8+</sup>
...@@ -2035,14 +2035,14 @@ Defines the WCDMA cell information. ...@@ -2035,14 +2035,14 @@ Defines the WCDMA cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------ | ------ | ------------ | | -------- | ------- | --------- | ----------- |
| lac | number | Location area code.| | lac | number | Yes | Location area code.|
| cellId | number | Cell ID. | | cellId | number | Yes | Cell ID. |
| psc | number | Primary scrambling code. | | psc | number | Yes | Primary scrambling code. |
| uarfcn | number | Absolute radio frequency number.| | uarfcn | number | Yes | Absolute radio frequency number.|
| mcc | string | Mobile country code.| | mcc | string | Yes | Mobile country code.|
| mnc | string | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## NrOptionMode<sup>8+</sup> ## NrOptionMode<sup>8+</sup>
...@@ -2067,10 +2067,10 @@ Defines the network search result. ...@@ -2067,10 +2067,10 @@ Defines the network search result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ---------------------- | ------------------------------------------------- | -------------- | | -------- | ------- | --------- | ----------- |
| isNetworkSearchSuccess | boolean | Successful network search.| | isNetworkSearchSuccess | boolean | Yes | Successful network search.|
| networkSearchResult | Array<[NetworkInformation](#networkinformation)\> | Network search result.| | networkSearchResult | Array<[NetworkInformation](#networkinformation)\> | Yes | Network search result.|
## NetworkInformation ## NetworkInformation
...@@ -2080,12 +2080,12 @@ Defines the network information. ...@@ -2080,12 +2080,12 @@ Defines the network information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| --------------- | ----------------------------------------- | -------------- | | -------- | ------- | --------- | ----------- |
| operatorName | string | Carrier name.| | operatorName | string | Yes | Carrier name.|
| operatorNumeric | string | Carrier number. | | operatorNumeric | string | Yes | Carrier number. |
| state | [NetworkInformation](#networkinformationstate) | Network information status.| | state | [NetworkInformation](#networkinformationstate) | Yes | Network information status.|
| radioTech | string | Radio technology. | | radioTech | string | Yes | Radio technology. |
## NetworkInformationState ## NetworkInformationState
...@@ -2110,12 +2110,12 @@ Defines the network selection mode. ...@@ -2110,12 +2110,12 @@ Defines the network selection mode.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------------------ | --------------------------------------------- | -------------------------------------- | | -------- | ------- | --------- | ----------- |
| slotId | number | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| selectMode | [NetworkSelectionMode](#networkselectionmode) | Network selection mode. | | selectMode | [NetworkSelectionMode](#networkselectionmode) | Yes | Network selection mode. |
| networkInformation | [NetworkInformation](#networkinformation) | Network information. | | networkInformation | [NetworkInformation](#networkinformation) | Yes | Network information. |
| resumeSelection | boolean | Whether to resume selection. | | resumeSelection | boolean | Yes | Whether to resume selection. |
## ImsRegState<sup>9+</sup> ## ImsRegState<sup>9+</sup>
...@@ -2153,10 +2153,10 @@ Defines the IMS registration information. ...@@ -2153,10 +2153,10 @@ Defines the IMS registration information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ------------- | | -------- | ------- | --------- | ----------- |
| imsRegState | [ImsRegState](#imsregstate9) | IMS registration state.| | imsRegState | [ImsRegState](#imsregstate9) | Yes | IMS registration state.|
| imsRegTech | [ImsRegTech](#imsregtech9) | IMS registration technology.| | imsRegTech | [ImsRegTech](#imsregtech9) | Yes | IMS registration technology.|
## ImsServiceType<sup>9+</sup> ## ImsServiceType<sup>9+</sup>
......
...@@ -2847,10 +2847,10 @@ Defines the lock status response. ...@@ -2847,10 +2847,10 @@ Defines the lock status response.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| --------------- | ------ | ------------------ | | -------- | ------- | --------- | ----------- |
| result | number | Operation result. | | result | number | Yes | Operation result. |
| remain?: number | number | Remaining attempts (can be null).| | remain?: number | number | Yes | Remaining attempts (can be null).|
## LockInfo<sup>8+</sup> ## LockInfo<sup>8+</sup>
...@@ -2860,11 +2860,11 @@ Defines the lock information. ...@@ -2860,11 +2860,11 @@ Defines the lock information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------ | ------ | | -------- | ------- | --------- | ----------- |
| lockType | [LockType](#locktype8) | Lock type.| | lockType | [LockType](#locktype8) | Yes | Lock type.|
| password | string | Password. | | password | string | Yes | Password. |
| state | [LockState](#lockstate8) | Lock state.| | state | [LockState](#lockstate8) | Yes | Lock state.|
## PersoLockInfo<sup>8+</sup> ## PersoLockInfo<sup>8+</sup>
...@@ -2874,10 +2874,10 @@ Defines the personalized lock information. ...@@ -2874,10 +2874,10 @@ Defines the personalized lock information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ------------ | | -------- | ------- | --------- | ----------- |
| lockType | [PersoLockType](#persolocktype8) | Personalized lock type.| | lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.|
| password | string | Password. | | password | string | Yes | Password. |
## IccAccountInfo<sup>7+</sup> ## IccAccountInfo<sup>7+</sup>
...@@ -2887,15 +2887,15 @@ Defines the ICC account information. ...@@ -2887,15 +2887,15 @@ Defines the ICC account information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ---------- | ------- | ---------------- | | -------- | ------- | --------- | ----------- |
| simId | number | SIM card ID. | | simId | number | Yes | SIM card ID. |
| slotIndex | number | Card slot ID. | | slotIndex | number | Yes | Card slot ID. |
| isEsim | boolean | Whether the SIM card is an eSim card.| | isEsim | boolean | Yes | Whether the SIM card is an eSim card.|
| isActive | boolean | Whether the card is activated. | | isActive | boolean | Yes | Whether the card is activated. |
| iccId | string | ICCID number. | | iccId | string | Yes | ICCID number. |
| showName | string | SIM card display name. | | showName | string | Yes | SIM card display name. |
| showNumber | string | SIM card display number. | | showNumber | string | Yes | SIM card display number. |
## OperatorConfig<sup>8+</sup> ## OperatorConfig<sup>8+</sup>
...@@ -2905,10 +2905,10 @@ Defines the carrier configuration. ...@@ -2905,10 +2905,10 @@ Defines the carrier configuration.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description| | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | | -------- | ------- | --------- | ----------- |
| field | string | Field| | field | string | Yes | Field. |
| value | string | Value | | value | string | Yes | Value. |
## DiallingNumbersInfo<sup>8+</sup> ## DiallingNumbersInfo<sup>8+</sup>
...@@ -2918,12 +2918,12 @@ Defines the contact number information. ...@@ -2918,12 +2918,12 @@ Defines the contact number information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------------ | ------ | -------- | | -------- | ------- | --------- | ----------- |
| alphaTag | string | Alpha tag. | | alphaTag | string | Yes | Alpha tag. |
| number | string | Contact number. | | number | string | Yes | Contact number. |
| recordNumber | number | Record number.| | recordNumber | number | Yes | Record number.|
| pin2 | string | PIN 2.| | pin2 | string | Yes | PIN 2.|
## ContactType<sup>8+</sup> ## ContactType<sup>8+</sup>
......
...@@ -70,7 +70,7 @@ import {Action,ToolType,SourceType,Touch,TouchEvent} from '@ohos.multimodalInput ...@@ -70,7 +70,7 @@ import {Action,ToolType,SourceType,Touch,TouchEvent} from '@ohos.multimodalInput
| toolHeight | number | Yes| No| Height of the tool area.| | toolHeight | number | Yes| No| Height of the tool area.|
| rawX | number | Yes| No| X coordinate of the input device.| | rawX | number | Yes| No| X coordinate of the input device.|
| rawY | number | Yes| No| Y coordinate of the input device.| | rawY | number | Yes| No| Y coordinate of the input device.|
| toolType | number | Yes| No| Tool type.| | toolType | ToolType | Yes| No| Tool type.|
## TouchEvent ## TouchEvent
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册