未验证 提交 9d54144d 编写于 作者: O openharmony_ci 提交者: Gitee

!6661 add telephony system api js docs.

Merge pull request !6661 from clevercong/mysubmit
...@@ -514,6 +514,2228 @@ promise.then(data => { ...@@ -514,6 +514,2228 @@ promise.then(data => {
}); });
``` ```
## call.muteRinger<sup>8+</sup>
muteRinger\(callback: AsyncCallback<void\>\): void
如果来电铃声响起,手机将停止铃声。否则,此方法不起作用。使用callback异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.muteRinger((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.muteRinger<sup>8+</sup>
muteRinger\(\): Promise<void\>
如果来电铃声响起,手机将停止铃声。否则,此方法不起作用。使用Promise异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.muteRinger();
promise.then(data => {
console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.answer<sup>7+</sup>
answer\(callback: AsyncCallback<void\>\): void
接听来电。使用callback异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.ANSWER_CALL
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.answer((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.answer<sup>7+</sup>
answer\(callId: number, callback: AsyncCallback<void\>\): void
接听来电。使用callback异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.ANSWER_CALL
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.answer(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.answer<sup>7+</sup>
answer(callId?: number\): Promise<void\>
接听来电。使用Promise异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.ANSWER_CALL
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| callId | number | 否 | 呼叫Id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.answer(1);
promise.then(data => {
console.log(`answer success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`answer fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.hangup<sup>7+</sup>
hangup\(callback: AsyncCallback<void\>\): void
挂断电话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.hangup((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.hangup<sup>7+</sup>
hangup\(callId: number, callback: AsyncCallback<void\>\): void
挂断电话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | 是 | 呼叫id。可以通过订阅callDetailsChange事件获得。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.hangup(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.hangup<sup>7+</sup>
hangup\(callId?: number\): Promise<void\>
挂断电话。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| callId | number | 否 | 呼叫id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.hangup(1);
promise.then(data => {
console.log(`hangup success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`hangup fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.reject<sup>7+</sup>
reject\(callback: AsyncCallback<void\>\): void
拒绝来电。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.reject((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
拒绝来电。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | -------------- |
| options | [RejectMessageOptions](#rejectmessageoptions7) | 是 | 拒绝消息选项。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let rejectMessageOptions={
messageContent: "拦截陌生号码"
}
call.reject(rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject<sup>7+</sup>
reject(callId: number, callback: AsyncCallback<void\>): <void\>
拒绝来电。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.reject(1);
promise.then(data => {
console.log(`reject success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.reject<sup>7+</sup>
reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback<void\>\): void
拒绝来电。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- |
| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 |
| options | [RejectMessageOptions](#rejectmessageoptions7) | 是 | 拒绝消息选项。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let rejectMessageOptions={
messageContent: "拦截陌生号码"
}
call.reject(1, rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject<sup>7+</sup>
reject(callId?: number, options?: RejectMessageOptions\): Promise<void\>
拒绝来电。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
| callId | number | 否 | 呼叫Id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 |
| options | [RejectMessageOptions](#rejectmessageoptions7) | 否 | 拒绝消息选项。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let rejectMessageOptions={
messageContent: "拦截陌生号码"
}
let promise = call.reject(1, rejectMessageOptions);
promise.then(data => {
console.log(`reject success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.holdCall<sup>7+</sup>
holdCall\(callId: number, callback: AsyncCallback<void\>\): void
保持通话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.holdCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.holdCall<sup>7+</sup>
holdCall\(callId: number\): Promise<void\>
保持通话。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.holdCall(1);
promise.then(data => {
console.log(`holdCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.unHoldCall<sup>7+</sup>
unHoldCall\(callId: number, callback: AsyncCallback<void\>\): void
取消保持通话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.unHoldCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.unHoldCall<sup>7+</sup>
unHoldCall\(callId: number\): Promise<void\>
取消保持通话。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.unHoldCall(1);
promise.then(data => {
console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.switchCall<sup>7+</sup>
switchCall\(callId: number, callback: AsyncCallback<void\>\): void
切换呼叫。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.switchCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.switchCall<sup>7+</sup>
switchCall\(callId: number\): Promise<void\>
切换呼叫。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.switchCall(1);
promise.then(data => {
console.log(`switchCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.combineConference<sup>7+</sup>
combineConference\(callId: number, callback: AsyncCallback<void\>\): void
合并通话,将两通电话合并成会议电话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.combineConference(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.combineConference<sup>7+</sup>
combineConference\(callId: number\): Promise<void\>
合并通话,将两通电话合并成会议电话。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.combineConference(1);
promise.then(data => {
console.log(`combineConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getMainCallId<sup>7+</sup>
getMainCallId\(callId: number, callback: AsyncCallback<number\>\): void
获取主呼叫Id。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------ |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数。返回主呼叫Id。 |
**示例:**
```js
call.getMainCallId(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getMainCallId<sup>7+</sup>
getMainCallId\(callId: number\): Promise<number\>
获取主呼叫Id。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ------------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回主呼叫Id。 |
**示例:**
```js
let promise = call.getMainCallId(1);
promise.then(data => {
console.log(`getMainCallId success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getMainCallId fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getSubCallIdList<sup>7+</sup>
getSubCallIdList\(callId: number, callback: AsyncCallback<Array<string\>\>\): void
获取子呼叫Id列表。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------ | ---- | ---------------------------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback<Array<string\>\> | 是 | 回调函数。返回子呼叫Id列表。 |
**示例:**
```js
call.getSubCallIdList(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getSubCallIdList<sup>7+</sup>
getSubCallIdList\(callId: number\): Promise<Array<string\>\>
获取子呼叫Id列表。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ----------------------------- | ----------------------------------- |
| Promise&lt;Array<string\>&gt; | 以Promise形式异步返回子呼叫Id列表。 |
**示例:**
```js
let promise = call.getSubCallIdList(1);
promise.then(data => {
console.log(`getSubCallIdList success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getSubCallIdList fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallIdListForConference<sup>7+</sup>
getCallIdListForConference\(callId: number, callback: AsyncCallback<Array<string\>>\): void
获取会议的呼叫Id列表。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | ---- | -------------------------------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;Array<string\>&gt; | 是 | 回调函数。返回会议的呼叫Id列表。 |
**示例:**
```js
call.getCallIdListForConference(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallIdListForConference<sup>7+</sup>
getCallIdListForConference\(callId: number\): Promise<Array<string\>\>
获取会议的呼叫Id列表。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ----------------------------- | --------------------------------------- |
| Promise&lt;Array<string\>&gt; | 以Promise形式异步返回会议的呼叫Id列表。 |
**示例:**
```js
let promise = call.getCallIdListForConference(1);
promise.then(data => {
console.log(`getCallIdListForConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallIdListForConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallWaitingStatus<sup>7+</sup>
getCallWaitingStatus\(slotId: number, callback: AsyncCallback<CallWaitingStatus\>\): void
获取呼叫等待状态。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | 是 | 回调函数。<br/>返回呼叫等待状态。<br/>- 0:禁用呼叫等待 <br/>- 1:启用呼叫等待 |
**示例:**
```js
call.getCallWaitingStatus(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallWaitingStatus<sup>7+</sup>
getCallWaitingStatus\(slotId: number\): Promise<CallWaitingStatus\>
获取呼叫等待状态。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| Promise&lt;[CallWaitingStatus](#callwaitingstatus7)&gt; | 以Promise形式异步返回呼叫等待状态。<br/>- 0:禁用呼叫等待 <br/>- 1:启用呼叫等待 |
**示例:**
```js
let promise = call.getCallWaitingStatus(0);
promise.then(data => {
console.log(`getCallWaitingStatus success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallWaitingStatus fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setCallWaiting<sup>7+</sup>
setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback<void\>\): void
设置呼叫等待。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| activate | boolean | 是 | 呼叫等待是否处于启用状态。<br/>- false:禁用呼叫等待<br/>- true:启用呼叫等待 |
| callback | AsyncCallback<void\> | 是 | 回调函数。 |
**示例:**
```js
call.setCallWaiting(0, true, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setCallWaiting<sup>7+</sup>
setCallWaiting\(slotId: number, activate: boolean\): Promise<void\>
设置呼叫等待。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| activate | boolean | 是 | 呼叫等待是否处于启用状态。<br/>- false:禁用呼叫等待<br/>- true:启用呼叫等待 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.setCallWaiting(0, true);
promise.then(data => {
console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.startDTMF<sup>7+</sup>
startDTMF\(callId: number, character: string, callback: AsyncCallback<void\>\): void
启动双音多频。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | -------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| character | string | 是 | DTMF码。 |
| callback | AsyncCallback<void\> | 是 | 回调函数。 |
**示例:**
```js
call.startDTMF(1, "0", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.startDTMF<sup>7+</sup>
startDTMF\(callId: number, character: string\): Promise<void\>
启动双音多频。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
| character | string | 是 | DTMF码。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ----------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回。 |
**示例:**
```js
let promise = call.startDTMF(1, "0");
promise.then(data => {
console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.stopDTMF<sup>7+</sup>
stopDTMF\(callId: number, callback: AsyncCallback<void\>\): void
停止双音多频。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.stopDTMF(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.stopDTMF<sup>7+</sup>
stopDTMF\(callId: number\): Promise<void\>
停止双音多频。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.stopDTMF(1);
promise.then(data => {
console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.isInEmergencyCall<sup>7+</sup>
isInEmergencyCall\(callback: AsyncCallback<boolean\>\): void
判断是否正在处于紧急呼叫。使用callback异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调函数。 |
**示例:**
```js
call.isInEmergencyCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isInEmergencyCall<sup>7+</sup>
isInEmergencyCall\(\): Promise<boolean\>
判断是否正在处于紧急呼叫。使用Promise异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ---------------------- | --------------------------- |
| Promise&lt;boolean&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.isInEmergencyCall();
promise.then(data => {
console.log(`isInEmergencyCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isInEmergencyCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.on('callDetailsChange')<sup>7+</sup>
on\(type: 'callDetailsChange', callback: Callback<CallAttributeOptions\>\): void
订阅callDetailsChange事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------- | ---- | -------------------------- |
| type | string | 是 | 通话时监听通话详情的变化。 |
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 是 | 回调函数。 |
**示例:**
```js
call.on('callDetailsChange', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.on('callEventChange')<sup>8+</sup>
on\(type: 'callEventChange', callback: Callback<CallEventOptions\>\): void
订阅callEventChange事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | -------------------------- |
| type | string | 是 | 通话时监听通话事件的变化。 |
| callback | Callback<[CallEventOptions](#calleventoptions8)> | 是 | 回调函数。 |
**示例:**
```js
call.on('callEventChange', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.on('callDisconnectedCause')<sup>8+</sup>
on\(type: 'callDisconnectedCause', callback: Callback<DisconnectedDetails\>): void
订阅callDisconnectedCause事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------ | ---- | -------------------------- |
| type | string | 是 | 通话时监听断开连接的原因。 |
| callback | Callback<[DisconnectedDetails](#disconnecteddetails8)> | 是 | 回调函数。 |
**示例:**
```js
call.on('callDisconnectedCause', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.on('mmiCodeResult')<sup>9+</sup>
on\(type: 'mmiCodeResult', callback: Callback<MmiCodeResults\>\): void
订阅mmiCodeResult事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------- | ---- | --------------------- |
| type | string | 是 | 通话时监听MMI码结果。 |
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 是 | 回调函数。 |
**示例:**
```js
isNewCallAllowedcall.on('mmiCodeResult', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.off('callDetailsChange')<sup>7+</sup>
off\(type: 'callDetailsChange', callback?: Callback<CallAttributeOptions\>\): void
取消订阅callDetailsChange事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------------- | ---- | ---------------------------------- |
| type | string | 是 | 通话结束时取消监听通话详情的变化。 |
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 否 | 回调函数。 |
**示例:**
```js
call.off('callDetailsChange', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.off('callEventChange')<sup>8+</sup>
off\(type: 'callEventChange', callback?: Callback<CallEventOptions\>\): void
取消订阅callEventChange事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ---------------------------------- |
| type | string | 是 | 通话结束时取消监听通话事件的变化。 |
| callback | Callback<[CallEventOptions](#calleventoptions8)> | 否 | 回调函数。 |
**示例:**
```js
call.off('callEventChange', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.off('callDisconnectedCause')<sup>8+</sup>
off\(type: 'callDisconnectedCause', callback?: Callback<DisconnectedDetails\>\): void
取消订阅callDisconnectedCause事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------------------- | ---- | -------------------- |
| type | 'callDisconnectedCause' | 是 | 调用断开连接的原因。 |
| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails8)> | 否 | 回调函数。 |
**示例:**
```js
call.off('callDisconnectedCause', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.off('mmiCodeResult')<sup>9+</sup>
off\(type: 'mmiCodeResult', callback?: Callback<MmiCodeResults\>\): void
取消订阅mmiCodeResult事件。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ----------- |
| type | 'mmiCodeResult' | 是 | MMI码结果。 |
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 否 | 回调函数。 |
**示例:**
```js
call.off('mmiCodeResult', (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isNewCallAllowed<sup>8+</sup>
isNewCallAllowed\(callback: AsyncCallback<boolean\>\): void
判断是否允许再拨打一通新电话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调函数。 |
**示例:**
```js
call.isNewCallAllowed((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isNewCallAllowed<sup>8+</sup>
isNewCallAllowed\(\): Promise<boolean\>
判断是否允许再拨打一通新电话。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ---------------------- | --------------------------- |
| Promise&lt;boolean&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.isNewCallAllowed();
promise.then(data => {
console.log(`isNewCallAllowed success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isNewCallAllowed fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.separateConference<sup>8+</sup>
separateConference\(callId: number, callback: AsyncCallback<void\>\): void
断开会议电话。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | 是 | 呼叫Id。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.separateConference(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.separateConference<sup>8+</sup>
separateConference\(callId: number\): Promise<void\>
断开会议电话。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------- |
| callId | number | 是 | 呼叫Id。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.separateConference(1);
promise.then(data => {
console.log(`separateConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallRestrictionStatus<sup>8+</sup>
getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback<RestrictionStatus\>\): void
获取呼叫限制状态。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型。 |
| callback | AsyncCallback&lt;[RestrictionStatus](#restrictionstatus8)&gt; | 是 | 回调函数。返回限制状态。 |
**示例:**
```js
call.getCallRestrictionStatus(0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallRestrictionStatus<sup>8+</sup>
getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise<RestrictionStatus\>
获取呼叫限制状态。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型。 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------- | --------------------------- |
| Promise&lt;[RestrictionStatus](#restrictionstatus8)&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.getCallRestrictionStatus(0, 1);
promise.then(data => {
console.log(`getCallRestrictionStatus success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallRestrictionStatus fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setCallRestriction<sup>8+</sup>
setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback<void\>\): void
设置呼叫限制状态。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| info | [CallRestrictionInfo](#callrestrictioninfo8) | 是 | 呼叫限制信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let callRestrictionInfo={
type: 1,
password: "123456",
mode: 1
}
call.setCallRestriction(0, callRestrictionInfo, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setCallRestriction<sup>8+</sup>
setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise<void\>
设置呼叫限制状态。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| info | [CallRestrictionInfo](#callrestrictioninfo8) | 是 | 呼叫限制信息。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let callRestrictionInfo={
type: 1,
password: "123456",
mode: 1
}
let promise = call.setCallRestriction(0, callRestrictionInfo);
promise.then(data => {
console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallTransferInfo<sup>8+</sup>
getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback<CallTransferResult\>\): void
获取呼叫转移信息。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型。 |
| callback | AsyncCallback&lt;[CallTransferResult](#calltransferresult8)&gt; | 是 | 回调函数。返回呼叫转移信息。 |
**示例:**
```js
let callTransferTyp={
CallTransferType: 1
}
call.getCallTransferInfo(0, callTransferTyp, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallTransferInfo<sup>8+</sup>
getCallTransferInfo\(slotId: number, type: CallTransferType): Promise<CallTransferResult\>
获取呼叫转移信息。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型。 |
**返回值:**
| 类型 | 说明 |
| --------------------------------------------------------- | --------------------------- |
| Promise&lt;[CallTransferResult](#calltransferresult8)&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let callTransferTyp={
CallTransferType: 1
}
let promise = call.getCallTransferInfo(0, callTransferTyp);
promise.then(data => {
console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setCallTransfer<sup>8+</sup>
setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback<void\>\): void
设置呼叫转移信息。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| info | [CallTransferInfo](#calltransferinfo8) | 是 | 呼叫转移信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let callTransferInfo={
transferNum: "111",
type: 1,
settingType: 1
}
call.setCallTransfer(0, callTransferInfo, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setCallTransfer<sup>8+</sup>
setCallTransfer\(slotId: number, info: CallTransferInfo): Promise<void\>
设置呼叫转移信息。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| info | [CallTransferInfo](#calltransferinfo8) | 是 | 呼叫转移信息。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let callTransferInfo={
transferNum: "111",
type: 1,
settingType: 1
}
let promise = call.setCallTransfer(0, callTransferInfo);
promise.then(data => {
console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.isRinging<sup>8+</sup>
isRinging\(callback: AsyncCallback<boolean\>\): void
判断是否正在响铃。使用callback异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调函数。 |
**示例:**
```js
call.isRinging((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isRinging<sup>8+</sup>
isRinging\(\): Promise<boolean\>
判断是否正在响铃。使用Promise异步回调。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ---------------------- | --------------------------- |
| Promise&lt;boolean&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.isRinging();
promise.then(data => {
console.log(`isRinging success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isRinging fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setMuted<sup>8+</sup>
setMuted\(callback: AsyncCallback<void\>\): void
设置通话中的静音。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.setMuted((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setMuted<sup>8+</sup>
setMuted\(\): Promise<void\>
设置通话中的静音。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.setMuted();
promise.then(data => {
console.log(`setMuted success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.cancelMuted<sup>8+</sup>
cancelMuted(callback: AsyncCallback<void\>): void
取消通话中的静音。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.cancelMuted((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.cancelMuted<sup>8+</sup>
cancelMuted(): Promise<void\>
取消通话中的静音。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.cancelMuted();
promise.then(data => {
console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setAudioDevice<sup>8+</sup>
setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): void
设置通话音频设备。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------- |
| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.setAudioDevice(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setAudioDevice<sup>8+</sup>
setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback<void\>\): void
设置通话音频设备。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------ | ---- | -------------- |
| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 |
| options | [AudioDeviceOptions](#audiodeviceoptions9) | 是 | 音频设备参数。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let audioDeviceOptions={
bluetoothAddress: "IEEE 802-2014"
}
call.setAudioDevice(1, bluetoothAddress, (err, value) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setAudioDevice<sup>8+</sup>
setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise<void\>
设置通话音频设备。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------------ | ---- | ------------------ |
| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 |
| options | [AudioDeviceOptions](#audiodeviceoptions9) | 否 | 音频设备参数参数。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ------------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回设置结果。 |
**示例:**
```js
let audioDeviceOptions={
bluetoothAddress: "IEEE 802-2014"
}
let promise = call.setAudioDevice(1, audioDeviceOptions);
promise.then(data => {
console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.joinConference<sup>8+</sup>
joinConference(mainCallId: number, callNumberList: Array<string\>, callback: AsyncCallback<void\>): void
加入会议。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------------------------- | ---- | --------------- |
| mainCallId | number | 是 | 主通话Id。 |
| callNumberList | Array<string\> | 是 | 呼叫号码列表。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.joinConference(1, "138XXXXXXXX", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.joinConference<sup>8+</sup>
joinConference(mainCallId: number, callNumberList: Array<string\>): Promise<void\>
加入会议。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | -------------- | ---- | --------------- |
| mainCallId | number | 是 | 主通话Id。 |
| callNumberList | Array<string\> | 是 | 呼叫号码列表。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.joinConference(1, "138XXXXXXXX");
promise.then(data => {
console.log(`joinConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.updateImsCallMode<sup>8+</sup>
updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<void\>): void
更新Ims呼叫模式。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------- |
| callId | number | 是 | 呼叫Id。 |
| mode | [ImsCallMode](#imscallmode8) | 是 | Ims呼叫模式。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.updateImsCallMode(1, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.updateImsCallMode<sup>8+</sup>
updateImsCallMode(callId: number, mode: ImsCallMode): Promise<void\>
更新Ims呼叫模式。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------- | ---- | -------------- |
| callId | number | 是 | 呼叫Id。 |
| mode | [ImsCallMode](#imscallmode8) | 是 | Ims呼叫模式。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.updateImsCallMode(1, 1);
promise.then(data => {
console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.enableImsSwitch<sup>8+</sup>
enableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void
启用Ims开关。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.enableImsSwitch(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.enableImsSwitch<sup>8+</sup>
enableImsSwitch(slotId: number): Promise<void\>
启用Ims开关。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.enableImsSwitch(0);
promise.then(data => {
console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.disableImsSwitch<sup>8+</sup>
disableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void
禁用Ims开关。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
call.disableImsSwitch(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.disableImsSwitch<sup>8+</sup>
disableImsSwitch(slotId: number): Promise<void\>
禁用Ims开关。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.disableImsSwitch(0);
promise.then(data => {
console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.isImsSwitchEnabled<sup>8+</sup>
isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean\>): void
判断Ims开关是否启用。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调函数。 |
**示例:**
```js
call.isImsSwitchEnabled(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isImsSwitchEnabled<sup>8+</sup>
isImsSwitchEnabled(slotId: number): Promise<boolean\>
判断Ims开关是否启用。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CallManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 以Promise形式异步返回结果。 |
**示例:**
```js
let promise = call.isImsSwitchEnabled(0);
promise.then(data => {
console.log(`isImsSwitchEnabled success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isImsSwitchEnabled fail, promise: err->${JSON.stringify(err)}`);
});
```
## DialOptions ## DialOptions
拨打电话的可选参数。 拨打电话的可选参数。
...@@ -521,8 +2743,12 @@ promise.then(data => { ...@@ -521,8 +2743,12 @@ promise.then(data => {
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 **系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ | | ---------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。<br/>- true:视频通话。<br/>- false:语音通话。 | | extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。<br/>- true:视频通话。<br/>- false:语音通话。 |
| accountId | number | 否 | 帐户Id。从API version 8开始支持。此接口为系统接口。 |
| videoState | [VideoStateType](#videostatetype7) | 否 | 视频状态类型。从API version 8开始支持。此接口为系统接口。 |
| dialScene | [DialScene](#dialscene8) | 否 | 拨号场景。从API version 8开始支持。此接口为系统接口。 |
| dialType | [DialType](#dialtype8) | 否 | 拨号类型。从API version 8开始支持。此接口为系统接口。 |
## CallState ## CallState
...@@ -556,3 +2782,395 @@ promise.then(data => { ...@@ -556,3 +2782,395 @@ promise.then(data => {
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | ---------------------------------------------------------- | | ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | 否 | 国家码,支持所有国家的国家码,如:CN(中国)。默认为:CN。 | | countryCode | string | 否 | 国家码,支持所有国家的国家码,如:CN(中国)。默认为:CN。 |
## ImsCallMode<sup>8+</sup>
IP多媒体系统调用模式。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ---------------------- | ---- | ------------------ |
| CALL_MODE_AUDIO_ONLY | 0 | 仅限音频呼叫 |
| CALL_MODE_SEND_ONLY | 1 | 仅发送呼叫 |
| CALL_MODE_RECEIVE_ONLY | 2 | 仅接收呼叫 |
| CALL_MODE_SEND_RECEIVE | 3 | 允许发送和接收呼叫 |
| CALL_MODE_VIDEO_PAUSED | 4 | 暂停视频呼叫 |
## AudioDevice<sup>8+</sup>
音频设备。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| -------------------- | ---- | ------------ |
| DEVICE_EARPIECE | 0 | 耳机设备 |
| DEVICE_SPEAKER | 1 | 扬声器设备 |
| DEVICE_WIRED_HEADSET | 2 | 有线耳机设备 |
| DEVICE_BLUETOOTH_SCO | 3 | 蓝牙SCO设备 |
## CallRestrictionType<sup>8+</sup>
呼叫限制类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| --------------------------------------------- | ---- | -------------------------- |
| RESTRICTION_TYPE_ALL_INCOMING | 0 | 限制所有呼入 |
| RESTRICTION_TYPE_ALL_OUTGOING | 1 | 限制所有呼出 |
| RESTRICTION_TYPE_INTERNATIONAL | 2 | 限制国际通话 |
| RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME | 3 | 限制除归属国以外的国际通话 |
| RESTRICTION_TYPE_ROAMING_INCOMING | 4 | 限制漫游呼入 |
| RESTRICTION_TYPE_ALL_CALLS | 5 | 限制所有通话 |
| RESTRICTION_TYPE_OUTGOING_SERVICES | 6 | 限制传出业务 |
| RESTRICTION_TYPE_INCOMING_SERVICES | 7 | 限制呼入业务 |
## CallTransferInfo<sup>8+</sup>
呼叫转移信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ---------------------------------------------------- | ---- | ---------------- |
| transferNum | string | 是 | 转移编号 |
| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型 |
| settingType | [CallTransferSettingType](#calltransfersettingtype8) | 是 | 设置呼叫转移类型 |
## CallTransferType<sup>8+</sup>
呼叫转移类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| --------------------------- | ---- | ------------ |
| TRANSFER_TYPE_UNCONDITIONAL | 0 | 无条件转移 |
| TRANSFER_TYPE_BUSY | 1 | 忙线转移 |
| TRANSFER_TYPE_NO_REPLY | 2 | 无回复转移 |
| TRANSFER_TYPE_NOT_REACHABLE | 3 | 无法访问转移 |
## CallTransferSettingType<sup>8+</sup>
设置呼叫转移类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| -------------------------- | ---- | ------------ |
| CALL_TRANSFER_DISABLE | 0 | 禁用呼叫转移 |
| CALL_TRANSFER_ENABLE | 1 | 启用呼叫转移 |
| CALL_TRANSFER_REGISTRATION | 3 | 登记呼叫转移 |
| CALL_TRANSFER_ERASURE | 4 | 消除呼叫转移 |
## CallAttributeOptions<sup>7+</sup>
调用属性选项。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ---------------------------------------- | ---- | -------------- |
| accountNumber | string | 是 | 帐号号码 |
| speakerphoneOn | boolean | 是 | 扬声器接通电话 |
| accountId | number | 是 | 帐户Id |
| videoState | [VideoStateType](#videostatetype7) | 是 | 视频状态类型 |
| startTime | number | 是 | 开始时间 |
| isEcc | boolean | 是 | 是否是Ecc |
| callType | [CallType](#calltype7) | 是 | 通话类型 |
| callId | number | 是 | 呼叫Id |
| callState | [DetailedCallState](#detailedcallstate7) | 是 | 详细呼叫状态 |
| conferenceState | [ConferenceState](#conferencestate7) | 是 | 会议状态 |
## ConferenceState<sup>7+</sup>
会议状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ---------------------------- | ---- | -------------- |
| TEL_CONFERENCE_IDLE | 0 | 电话会议空闲 |
| TEL_CONFERENCE_ACTIVE | 1 | 电话会议激活 |
| TEL_CONFERENCE_DISCONNECTING | 2 | 电话会议断开 |
| TEL_CONFERENCE_DISCONNECTED | 3 | 电话会议已断开 |
## CallType<sup>7+</sup>
通话类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ------------- | ---- | ------------ |
| TYPE_CS | 0 | CS通话 |
| TYPE_IMS | 1 | IMS通话 |
| TYPE_OTT | 2 | OTT通话 |
| TYPE_ERR_CALL | 3 | 其他类型通话 |
## VideoStateType<sup>7+</sup>
视频状态类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ---------- | ---- | -------- |
| TYPE_VOICE | 0 | 语音状态 |
| TYPE_VIDEO | 1 | 视频状态 |
## DetailedCallState<sup>7+</sup>
详细的呼叫状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ------------------------- | ---- | -------------- |
| CALL_STATUS_ACTIVE | 0 | 激活呼叫状态 |
| CALL_STATUS_HOLDING | 1 | 保持呼叫状态 |
| CALL_STATUS_DIALING | 2 | 呼叫状态拨号 |
| CALL_STATUS_ALERTING | 3 | 电话报警状态 |
| CALL_STATUS_INCOMING | 4 | 呼叫传入状态 |
| CALL_STATUS_WAITING | 5 | 呼叫等待状态 |
| CALL_STATUS_DISCONNECTED | 6 | 呼叫状态已断开 |
| CALL_STATUS_DISCONNECTING | 7 | 呼叫状态断开 |
| CALL_STATUS_IDLE | 8 | 呼叫状态空闲 |
## CallRestrictionInfo<sup>8+</sup>
呼叫限制信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------- | ---- | ------------ |
| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型 |
| password | string | 是 | 密码 |
| mode | [CallRestrictionMode](#callrestrictionmode8) | 是 | 呼叫限制模式 |
## CallRestrictionMode<sup>8+</sup>
呼叫限制模式。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ----------------------------- | ---- | ------------ |
| RESTRICTION_MODE_DEACTIVATION | 0 | 限制模式停用 |
| RESTRICTION_MODE_ACTIVATION | 1 | 限制模式激活 |
## CallEventOptions<sup>8+</sup>
呼叫事件的可选参数。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------------ | ---- | -------------- |
| eventId | [CallAbilityEventId](#callabilityeventid8) | 是 | 呼叫能力事件Id |
## CallAbilityEventId<sup>8+</sup>
呼叫能力事件Id。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ------------------------ | ---- | --------------- |
| EVENT_DIAL_NO_CARRIER | 1 | 拨号无载波事件 |
| EVENT_INVALID_FDN_NUMBER | 2 | 无效的FDN号事件 |
## DialScene<sup>8+</sup>
拨号场景。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| --------------- | ---- | ------------ |
| CALL_NORMAL | 0 | 呼叫正常 |
| CALL_PRIVILEGED | 1 | 呼叫特权 |
| CALL_EMERGENCY | 2 | 拨打紧急电话 |
## DialType<sup>8+</sup>
拨号类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| -------------------- | ---- | ---------------- |
| DIAL_CARRIER_TYPE | 0 | 载波拨号类型 |
| DIAL_VOICE_MAIL_TYPE | 1 | 语音邮件拨号类型 |
| DIAL_OTT_TYPE | 2 | OTT拨号类型 |
## RejectMessageOptions<sup>7+</sup>
拒绝消息可选参数。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------- |
| messageContent | string | 是 | 消息内容 |
## CallTransferResult<sup>8+</sup>
呼叫转移结果。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------- | ---- | -------- |
| status | [TransferStatus](#transferstatus8) | 是 | 转移状态 |
| number | string | 是 | 号码 |
## CallWaitingStatus<sup>7+</sup>
呼叫等待状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| -------------------- | ---- | ------------ |
| CALL_WAITING_DISABLE | 0 | 禁用呼叫等待 |
| CALL_WAITING_ENABLE | 1 | 启用呼叫等待 |
## RestrictionStatus<sup>8+</sup>
限制状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ------------------- | ---- | -------- |
| RESTRICTION_DISABLE | 0 | 禁用限制 |
| RESTRICTION_ENABLE | 1 | 启用限制 |
## TransferStatus<sup>8+</sup>
转移状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ---------------- | ---- | -------- |
| TRANSFER_DISABLE | 0 | 禁用转移 |
| TRANSFER_ENABLE | 1 | 启用转移 |
## DisconnectedDetails<sup>8+</sup>
断开连接的详细信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| --------------------------- | ---- | ---------------------- |
| UNASSIGNED_NUMBER | 1 | 未分配的号码(空号) |
| NO_ROUTE_TO_DESTINATION | 3 | 无至目的地的路由 |
| CHANNEL_UNACCEPTABLE | 6 | 不可接受的通路 |
| OPERATOR_DETERMINED_BARRING | 8 | 运营商闭锁 |
| NORMAL_CALL_CLEARING | 16 | 清除正常呼叫 |
| USER_BUSY | 17 | 用户忙 |
| NO_USER_RESPONDING | 18 | 无用户响应 |
| USER_ALERTING_NO_ANSWER | 19 | 已有用户提醒,但无应答 |
| CALL_REJECTED | 21 | 呼叫拒绝 |
| NUMBER_CHANGED | 22 | 号码改变 |
| DESTINATION_OUT_OF_ORDER | 27 | 终点故障 |
| INVALID_NUMBER_FORMAT | 28 | 无效号码格式 |
| NETWORK_OUT_OF_ORDER | 38 | 网络故障 |
| TEMPORARY_FAILURE | 41 | 临时故障 |
| INVALID_PARAMETER | 1025 | 无效参数 |
| SIM_NOT_EXIT | 1026 | SIM卡未退出 |
| SIM_PIN_NEED | 1027 | 需要SIM卡PIN码 |
| CALL_NOT_ALLOW | 1029 | 不允许呼叫 |
| SIM_INVALID | 1045 | SIM卡无效 |
| UNKNOWN | 1279 | 未知原因 |
## MmiCodeResults<sup>9+</sup>
MMI码结果。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 类型 | 必填 | 说明 |
| ------- | -------------------------------- | ---- | --------------- |
| result | [MmiCodeResult](#mmicoderesult9) | 是 | MMI码结果 |
| message | string | 是 | MMI码消息 |
## MmiCodeResult<sup>9+</sup>
MMI码结果。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 值 | 说明 |
| ---------------- | ---- | ------------- |
| MMI_CODE_SUCCESS | 0 | 表示MMI码成功 |
| MMI_CODE_FAILED | 1 | 表示MMI码失败 |
## AudioDeviceOptions<sup>9+</sup>
音频设备选项。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。
| 名称 | 类型 | 必填 | 说明 |
| ---------------- | ------ | ---- | -------- |
| bluetoothAddress | string | 否 | 蓝牙地址 |
...@@ -701,7 +701,7 @@ getIMEI(slotId?: number): Promise<string\> ...@@ -701,7 +701,7 @@ getIMEI(slotId?: number): Promise<string\>
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | ------------------------------------------ | | ----------------- | ------------------------------------------ |
| Promise\<string\> | 返回IMEI;如果IMEI不存在,则返回空字符串。 | | Promise\<string\> | 以Promise形式异步返回IMEI;如果IMEI不存在,则返回空字符串。 |
**示例:** **示例:**
...@@ -899,6 +899,693 @@ promise.then(data => { ...@@ -899,6 +899,693 @@ promise.then(data => {
}); });
``` ```
## radio.sendUpdateCellLocationRequest<sup>8+</sup>
sendUpdateCellLocationRequest\(callback: AsyncCallback<void\>\): void
发送更新小区位置请求,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
radio.sendUpdateCellLocationRequest((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.sendUpdateCellLocationRequest<sup>8+</sup>
sendUpdateCellLocationRequest\(\): Promise<void\>
发送更新小区位置请求,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let promise = radio.sendUpdateCellLocationRequest();
promise.then(data => {
console.log(`sendUpdateCellLocationRequest success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`sendUpdateCellLocationRequest fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getCellInformation<sup>8+</sup>
getCellInformation(callback: AsyncCallback<Array<CellInformation\>>): void
获取小区信息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.LOCATION
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------ |
| callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | 是 | 回调函数,返回小区信息。 |
**示例:**
```js
radio.getCellInformation((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getCellInformation<sup>8+</sup>
getCellInformation(slotId: number, callback: AsyncCallback<Array<CellInformation\>\>): void
获取小区信息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.LOCATION
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | 是 | 回调函数,返回小区信息。 |
**示例:**
```js
let slotId = 0;
radio.getCellInformation(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getCellInformation<sup>8+</sup>
getCellInformation(slotId?: number): Promise<Array<CellInformation\>\>
获取小区信息,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.LOCATION
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------- | ----------------------- |
| Promise\<Array<[CellInformation](#cellinformation8)\>\> | 以Promise形式返回结果。 |
**示例:**
```js
let slotId = 0;
let promise = radio.getCellInformation(slotId);
promise.then(data => {
console.log(`getCellInformation success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCellInformation fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.setNetworkSelectionMode
setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback<void\>\): void
设置网络选择模式,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ------------------ |
| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | 是 | 网络选择模式选项。 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
let networkInformation={
operatorName: "中国移动",
operatorNumeric: "898600",
state: 1,
radioTech: "CS"
}
let networkSelectionModeOptions={
slotid: 0,
selectMode: 1,
networkInformation: networkInformation,
resumeSelection: true
}
radio.setNetworkSelectionMode(networkSelectionModeOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.setNetworkSelectionMode
setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise<void\>
设置网络选择模式,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ----------------------------------------------------------- | ---- | ------------------ |
| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | 是 | 网络选择模式选项。 |
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let networkInformation={
operatorName: "中国移动",
operatorNumeric: "898600",
state: 1,
radioTech: "CS"
}
let networkSelectionModeOptions={
slotid: 0,
selectMode: 1,
networkInformation: networkInformation,
resumeSelection: true
}
let promise = radio.setNetworkSelectionMode(networkSelectionModeOptions);
promise.then(data => {
console.log(`setNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`setNetworkSelectionMode fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getNetworkSearchInformation
getNetworkSearchInformation\(slotId: number, callback: AsyncCallback<NetworkSearchResult\>\): void
获取网络搜索信息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | 是 | 回调函数。返回网络搜索信息。 |
**示例:**
```js
radio.getNetworkSearchInformation(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getNetworkSearchInformation
getNetworkSearchInformation\(slotId: number\): Promise<void\>
获取网络搜索信息,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------ | ----------------------- |
| Promise\<[NetworkSearchResult](#networksearchresult)\> | 以Promise形式返回结果。 |
**示例:**
```js
let promise = radio.getNetworkSearchInformation(0);
promise.then(data => {
console.log(`getNetworkSearchInformation success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getNetworkSearchInformation fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getNrOptionMode<sup>8+</sup>
getNrOptionMode(callback: AsyncCallback<NrOptionMode\>): void
获取Nr选项模式 ,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | 是 | 回调函数。 |
**示例:**
```js
radio.getNrOptionMode((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getNrOptionMode<sup>8+</sup>
getNrOptionMode(slotId: number, callback: AsyncCallback<NrOptionMode\>): void
获取Nr选项模式 ,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
radio.getNrOptionMode(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getNrOptionMode<sup>8+</sup>
getNrOptionMode(slotId?: number): Promise<NrOptionMode\>
获取Nr选项模式 ,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------------------------------- | ----------------------- |
| Promise\<[NrOptionMode](#nroptionmode8)\> | 以Promise形式返回结果。 |
**示例:**
```js
let slotId = 0;
let promise = radio.getNrOptionMode(slotId);
promise.then(data => {
console.log(`getNrOptionMode success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getNrOptionMode fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.turnOnRadio<sup>7+</sup>
turnOnRadio(callback: AsyncCallback<void\>): void
打开Radio,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
radio.turnOnRadio((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.turnOnRadio<sup>7+</sup>
turnOnRadio(slotId: number, callback: AsyncCallback<void\>): void
打开Radio,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
radio.turnOnRadio(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.turnOnRadio<sup>7+</sup>
turnOnRadio(slotId?: number): Promise<void\>
打开Radio,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let slotId = 0;
let promise = radio.turnOnRadio(slotId);
promise.then(data => {
console.log(`turnOnRadio success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`turnOnRadio fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.turnOffRadio<sup>7+</sup>
turnOffRadio(callback: AsyncCallback<void\>): void
关闭Radio,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
radio.turnOffRadio((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.turnOffRadio<sup>7+</sup>
turnOffRadio(slotId: number, callback: AsyncCallback<void\>): void
关闭Radio,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
radio.turnOffRadio(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.turnOffRadio<sup>7+</sup>
turnOffRadio(slotId?: number): Promise<void\>
关闭Radio,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 否 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let slotId = 0;
let promise = radio.turnOffRadio(slotId);
promise.then(data => {
console.log(`turnOffRadio success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`turnOffRadio fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.setPreferredNetwork<sup>8+</sup>
setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback<void\>\): void
设置首选网络,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ---------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | 是 | 设置首选网络模式 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
radio.setPreferredNetwork(0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.setPreferredNetwork<sup>8+</sup>
setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise<void\>
设置首选网络,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ---------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | 是 | 设置首选网络模式 |
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let promise = radio.setPreferredNetwork(0, 1);
promise.then(data => {
console.log(`setPreferredNetwork success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`setPreferredNetwork fail, promise: err->${JSON.stringify(err)}`);
});
```
## radio.getPreferredNetwork<sup>8+</sup>
getPreferredNetwork\(slotId: number, callback: AsyncCallback<PreferredNetworkMode\>\): void
获取首选网络,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | 是 | 回调函数。 |
**示例:**
```js
radio.getPreferredNetwork(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getPreferredNetwork<sup>8+</sup>
getPreferredNetwork(slotId: number): Promise<void\>
设置首选网络,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let promise = radio.getPreferredNetwork(0);
promise.then(data => {
console.log(`getPreferredNetwork success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getPreferredNetwork fail, promise: err->${JSON.stringify(err)}`);
});
```
## RadioTechnology ## RadioTechnology
无线接入技术。 无线接入技术。
...@@ -1011,3 +1698,238 @@ promise.then(data => { ...@@ -1011,3 +1698,238 @@ promise.then(data => {
| NETWORK_SELECTION_AUTOMATIC | 1 | 自动选网模式。 | | NETWORK_SELECTION_AUTOMATIC | 1 | 自动选网模式。 |
| NETWORK_SELECTION_MANUAL | 2 | 手动选网模式。 | | NETWORK_SELECTION_MANUAL | 2 | 手动选网模式。 |
## PreferredNetworkMode<sup>8+</sup>
首选网络模式。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| --------------------------------------------------------- | ---- | --------------------------------------------- |
| PREFERRED_NETWORK_MODE_GSM | 1 | 首选GSM网络模式。 |
| PREFERRED_NETWORK_MODE_WCDMA | 2 | 首选WCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE | 3 | 首选LTE网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_WCDMA | 4 | 首选LTE WCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM | 5 | 首选LTE WCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_WCDMA_GSM | 6 | 首选WCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_CDMA | 7 | 首选CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_EVDO | 8 | 首选EVDO网络模式。 |
| PREFERRED_NETWORK_MODE_EVDO_CDMA | 9 | 首选EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA | 10 | 首选WCDMA GSM EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA | 11 | 首选LTE EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA | 12 | 首选LTE WCDMA GSM EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_TDSCDMA | 13 | 首选TDSCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_TDSCDMA_GSM | 14 | 首选TDSCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA | 15 | 首选TDSCDMA_WCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM | 16 | 首选TDSCDMA_WCDMA_GSM网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_TDSCDMA | 17 | 首选LTE TDSCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM | 18 | 首选LTE TDSCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA | 19 | 首选LTE TDSCDMA WCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM | 20 | 首选LTE TDSCDMA WCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 21 | 首选TDSCDMA WCDMA GSM EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 22 | 首选LTE TDSCDMA WCDMA GSM EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_NR | 31 | 首选NR网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE | 32 | 首选NR LTE网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA | 33 | 首选NR LTE WCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM | 34 | 首选NR LTE WCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA | 35 | 首选NR LTE EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA | 36 | 首选NR LTE WCDMA GSM EVDO CDMA网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA | 37 | 首选NR LTE TDSCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM | 38 | 首选NR LTE TDSCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA | 39 | 首选NR LTE TDSCDMA WCDMA网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM | 40 | 首选NR LTE TDSCDMA WCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 41 | 首选NR LTE TDSCDMA WCDMA GSM网络模式。 |
| PREFERRED_NETWORK_MODE_MAX_VALUE | 99 | 首选网络模式最大值。 |
## CellInformation<sup>8+</sup>
小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| networkType | [NetworkType](#networkType) | 获取服务单元的网络类型。 |
| isCamped | boolean | 获取服务单元的状态。 |
| timeStamp | number | 获取单元格信息时获取时间戳。 |
| signalInformation | [SignalInformation](#signalinformation) | 信号信息。 |
| data | [CdmaCellInformation](#cdmacellinformation) \| [GsmCellInformation](#gsmcellinformation) \| [LteCellInformation](#ltecellinformation) \| [NrCellInformation](#nrcellinformation) \| [TdscdmaCellInformation](#tdscdmacellinformation) | Cdma小区信息 \|Gsm小区信息\|Lte小区信息\|Nr小区信息\|Tdscdma小区信息 |
## CdmaCellInformation<sup>8+</sup>
Cdma小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| --------- | ------ | ------------ |
| baseId | number | 基站Id。 |
| latitude | number | 经度。 |
| longitude | number | 纬度。 |
| nid | number | 网络识别码。 |
| sid | number | 系统识别码。 |
## GsmCellInformation<sup>8+</sup>
Gsm小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------ | ------ | -------------------- |
| lac | number | 位置区编号。 |
| cellId | number | 小区号。 |
| arfcn | number | 绝对无线频率信道号。 |
| bsic | number | 基站识别号。 |
| mcc | string | 移动国家码。 |
| mnc | string | 移动网号。 |
## LteCellInformation<sup>8+</sup>
Lte小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------------- | ------- | ----------------------- |
| cgi | number | 小区全球标识。 |
| pci | number | 物理小区识别。 |
| tac | number | 跟踪区域代码。 |
| earfcn | number | 绝对无线频率信道号。 |
| bandwidth | number | 带宽。 |
| mcc | string | 移动国家码。 |
| mnc | string | 移动网号。 |
| isSupportEndc | boolean | 是否支持新无线电_双连接 |
## NrCellInformation<sup>8+</sup>
Nr小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------- | ------ | ---------------- |
| nrArfcn | number | 5G频点号。 |
| pci | number | 物理小区识别。 |
| tac | number | 跟踪区域代码。 |
| nci | number | 5G网络小区标识。 |
| mcc | string | 移动国家码。 |
| mnc | string | 移动网号。 |
## TdscdmaCellInformation<sup>8+</sup>
Tdscdma小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------ | ------ | ------------ |
| lac | number | 位置区编号。 |
| cellId | number | 小区号。 |
| cpid | number | 小区参数Id。 |
| uarfcn | number | 绝对射频号。 |
| mcc | string | 移动国家码。 |
| mnc | string | 移动网号。 |
## WcdmaCellInformation<sup>8+</sup>
Wcdma小区信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------ | ------ | ------------ |
| lac | number | 位置区编号。 |
| cellId | number | 小区号。 |
| psc | number | 主扰码。 |
| uarfcn | number | 绝对射频号。 |
| mcc | string | 移动国家码。 |
| mnc | string | 移动网号。 |
## NrOptionMode<sup>8+</sup>
Nr的选择模式。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| -------------------- | ---- | ---------------------------------- |
| NR_OPTION_UNKNOWN | 0 | 未知的Nr选择模式。 |
| NR_OPTION_NSA_ONLY | 1 | 仅非独立组网的Nr选择模式。 |
| NR_OPTION_SA_ONLY | 2 | 仅独立组网的Nr选择模式。 |
| NR_OPTION_NSA_AND_SA | 3 | 非独立组网和独立组网的Nr选择模式。 |
## NetworkSearchResult
网络搜索结果。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ---------------------- | ------------------------------------------------- | -------------- |
| isNetworkSearchSuccess | boolean | 网络搜索成功。 |
| networkSearchResult | Array<[NetworkInformation](#networkInformation)\> | 网络搜索结果。 |
## NetworkInformation
网络信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| --------------- | ----------------------------------------- | -------------- |
| operatorName | string | 运营商的名称。 |
| operatorNumeric | string | 运营商数字。 |
| state | [NetworkInformation](#networkInformation) | 网络信息状态。 |
| radioTech | string | 无线电技术。 |
## NetworkInformationState
网络信息状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| ----------------- | ---- | ---------------- |
| NETWORK_UNKNOWN | 0 | 网络状态未知。 |
| NETWORK_AVAILABLE | 1 | 网络可用于注册。 |
| NETWORK_CURRENT | 2 | 已在网络中注册。 |
| NETWORK_FORBIDDEN | 3 | 网络无法注册。 |
## NetworkSelectionModeOptions
网络选择模式选项。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------------------ | --------------------------------------------- | -------------------------------------- |
| slotId | number | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| selectMode | [NetworkSelectionMode](#networkselectionmode) | 网络选择模式。 |
| networkInformation | [NetworkInformation](#networkinformation) | 网络信息。 |
| resumeSelection | boolean | 继续选择。 |
...@@ -467,7 +467,7 @@ hasSimCard\(slotId: number, callback: AsyncCallback<boolean\>\): void ...@@ -467,7 +467,7 @@ hasSimCard\(slotId: number, callback: AsyncCallback<boolean\>\): void
**示例:** **示例:**
```jsjs ```js
sim.hasSimCard(0, (err, data) => { sim.hasSimCard(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
...@@ -522,7 +522,7 @@ getSimAccountInfo(slotId: number, callback: AsyncCallback<IccAccountInfo\>): voi ...@@ -522,7 +522,7 @@ getSimAccountInfo(slotId: number, callback: AsyncCallback<IccAccountInfo\>): voi
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------- | ---- | -------------------------------------- | | -------- | --------------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | 是 | 回调函数。 | | callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | 是 | 回调函数。 |
**示例:** **示例:**
...@@ -555,7 +555,7 @@ getSimAccountInfo(slotId: number): Promise<IccAccountInfo\> ...@@ -555,7 +555,7 @@ getSimAccountInfo(slotId: number): Promise<IccAccountInfo\>
| 类型 | 说明 | | 类型 | 说明 |
| -------------------------------------------- | ------------------------------------------ | | -------------------------------------------- | ------------------------------------------ |
| Promise<[IccAccountInfo](#IccAccountInfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 | | Promise<[IccAccountInfo](#iccaccountinfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 |
**示例:** **示例:**
...@@ -584,7 +584,7 @@ getActiveSimAccountInfoList(callback: AsyncCallback<Array<IccAccountInfo\>>): vo ...@@ -584,7 +584,7 @@ getActiveSimAccountInfoList(callback: AsyncCallback<Array<IccAccountInfo\>>): vo
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ---------- | | -------- | ----------------------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<Array<[IccAccountInfo](#IccAccountInfo7)\>\> | 是 | 回调函数。 | | callback | AsyncCallback\<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | 是 | 回调函数。 |
**示例:** **示例:**
...@@ -611,7 +611,7 @@ getActiveSimAccountInfoList(): Promise<Array<IccAccountInfo\>>; ...@@ -611,7 +611,7 @@ getActiveSimAccountInfoList(): Promise<Array<IccAccountInfo\>>;
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | ---------------------------------------------- | | ---------------------------------------------------- | ---------------------------------------------- |
| Promise<Array<[IccAccountInfo](#IccAccountInfo7)\>\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 | | Promise<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 |
**示例:** **示例:**
...@@ -646,7 +646,7 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback<void\>): void ...@@ -646,7 +646,7 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback<void\>): void
**示例:** **示例:**
```js ```js
sim.setDefaultVoiceSlotId(0,(err, data) => { sim.setDefaultVoiceSlotId(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -710,8 +710,8 @@ setShowName\(slotId: number, name: string,callback: AsyncCallback<void\>\): void ...@@ -710,8 +710,8 @@ setShowName\(slotId: number, name: string,callback: AsyncCallback<void\>\): void
**示例:** **示例:**
```js ```js
const name='中国移动'; const name = '中国移动';
sim.setShowName(0, name,(err, data) => { sim.setShowName(0, name, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -744,8 +744,8 @@ setShowName\(slotId: number, name: string\): Promise\<void\> ...@@ -744,8 +744,8 @@ setShowName\(slotId: number, name: string\): Promise\<void\>
**示例:** **示例:**
```js ```js
const name='中国移动'; const name = '中国移动';
let promise = sim.setShowName(0,name); let promise = sim.setShowName(0, name);
promise.then(data => { promise.then(data => {
console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); console.log(`setShowName success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -839,8 +839,8 @@ setShowNumber\(slotId: number, number: string,callback: AsyncCallback<void\>\): ...@@ -839,8 +839,8 @@ setShowNumber\(slotId: number, number: string,callback: AsyncCallback<void\>\):
**示例:** **示例:**
```js ```js
let number='+861xxxxxxxxxx'; let number = '+861xxxxxxxxxx';
sim.setShowNumber(0, number,(err, data) => { sim.setShowNumber(0, number, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -874,8 +874,8 @@ setShowNumber\(slotId: number,number: string\): Promise\<void\> ...@@ -874,8 +874,8 @@ setShowNumber\(slotId: number,number: string\): Promise\<void\>
**示例:** **示例:**
```js ```js
let number='+861xxxxxxxxxx'; let number = '+861xxxxxxxxxx';
let promise = sim.setShowNumber(0,number); let promise = sim.setShowNumber(0, number);
promise.then(data => { promise.then(data => {
console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -1089,16 +1089,18 @@ setLockState(slotId: number, options: LockInfo, callback: AsyncCallback<LockStat ...@@ -1089,16 +1089,18 @@ setLockState(slotId: number, options: LockInfo, callback: AsyncCallback<LockStat
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 |
| options | [LockInfo](#LockInfo8) | 是 | 锁信息。<br/>lockType: [LockType](#LockType8)<br/>password: string<br/>state: [LockState](#LockState8) | | options | [LockInfo](#lockinfo8) | 是 | 锁信息。<br/>lockType: [LockType](#locktype8)<br/>password: string<br/>state: [LockState](#lockstate8) |
**示例:** **示例:**
```js ```js
LockInfo.lockType = 1; let lockInfo = {
LockInfo.password = "1234"; lockType = 1,
LockInfo.state = 0; password = "1234",
sim.setLockState(0, LockInfo, (err, data) => { state = 0
};
sim.setLockState(0, lockInfo, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1121,21 +1123,23 @@ setLockState(slotId: number, options: LockInfo): Promise<LockStatusResponse\> ...@@ -1121,21 +1123,23 @@ setLockState(slotId: number, options: LockInfo): Promise<LockStatusResponse\>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------- | ---- | ------------------------------------------------------------ | | ------- | ---------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| options | [LockInfo](#LockInfo8) | 是 | 锁信息。<br/>lockType: [LockType](#LockType8)<br/>password: string<br/>state: [LockState](#LockState8) | | options | [LockInfo](#lockinfo8) | 是 | 锁信息。<br/>lockType: [LockType](#locktype8)<br/>password: string<br/>state: [LockState](#lockstate8) |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | -------------------------------------------- | | ---------------------------------------------------- | -------------------------------------------- |
| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 |
**示例:** **示例:**
```js ```js
LockInfo.lockType = 1; let lockInfo = {
LockInfo.password = "1234"; lockType = 1,
LockInfo.state = 0; password = "1234",
let promise = sim.setLockState(0, LockInfo); state = 0
};
let promise = sim.setLockState(0, lockInfo);
promise.then(data => { promise.then(data => {
console.log(`setLockState success, promise: data->${JSON.stringify(data)}`); console.log(`setLockState success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -1158,8 +1162,8 @@ getLockState(slotId: number, lockType: LockType, callback: AsyncCallback<LockSta ...@@ -1158,8 +1162,8 @@ getLockState(slotId: number, lockType: LockType, callback: AsyncCallback<LockSta
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | --------------------------------------- | | -------- | ----------------------------------------- | ---- | --------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[LockState](#LockState8)\> | 是 | 回调函数。 | | callback | AsyncCallback\<[LockState](#lockstate8)\> | 是 | 回调函数。 |
| options | [LockType](#LockType8) | 是 | 锁类型。<br/>- 1: PIN锁<br/>- 2: PIN2锁 | | options | [LockType](#locktype8) | 是 | 锁类型。<br/>- 1: PIN锁<br/>- 2: PIN2锁 |
**示例:** **示例:**
...@@ -1185,13 +1189,13 @@ getLockState(slotId: number, lockType: LockType): Promise<LockState\> ...@@ -1185,13 +1189,13 @@ getLockState(slotId: number, lockType: LockType): Promise<LockState\>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------- | ---- | --------------------------------------- | | ------- | ---------------------- | ---- | --------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| options | [LockType](#LockType8) | 是 | 锁类型。<br/>- 1: PIN锁<br/>- 2: PIN2锁 | | options | [LockType](#locktype8) | 是 | 锁类型。<br/>- 1: PIN锁<br/>- 2: PIN2锁 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------- | -------------------------------------------- | | ---------------------------------- | -------------------------------------------- |
| Promise<[LockState](#LockState8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | | Promise<[LockState](#lockstate8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 |
**示例:** **示例:**
...@@ -1221,14 +1225,14 @@ alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback ...@@ -1221,14 +1225,14 @@ alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | | -------- | ----------------------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 |
| newPin | string | 是 | 新密码。 | | newPin | string | 是 | 新密码。 |
| oldPin | string | 是 | 旧密码。 | | oldPin | string | 是 | 旧密码。 |
**示例:** **示例:**
```js ```js
sim.alterPin(0, "1234", "0000"(err, data) => { sim.alterPin(0, "1234", "0000", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1258,7 +1262,7 @@ alterPin(slotId: number, newPin: string, oldPin: string): Promise<LockStatusResp ...@@ -1258,7 +1262,7 @@ alterPin(slotId: number, newPin: string, oldPin: string): Promise<LockStatusResp
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | --------------------------------------------- | | ---------------------------------------------------- | --------------------------------------------- |
| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 |
**示例:** **示例:**
...@@ -1288,7 +1292,7 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallb ...@@ -1288,7 +1292,7 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallb
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | | -------- | ----------------------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 |
| newPin2 | string | 是 | 新密码。 | | newPin2 | string | 是 | 新密码。 |
| oldPin2 | string | 是 | 旧密码。 | | oldPin2 | string | 是 | 旧密码。 |
...@@ -1325,12 +1329,12 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise<LockStatusR ...@@ -1325,12 +1329,12 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise<LockStatusR
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | --------------------------------------------- | | ---------------------------------------------------- | --------------------------------------------- |
| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 |
**示例:** **示例:**
```js ```js
let promise = sim.alterPin2(0, "1234","0000"); let promise = sim.alterPin2(0, "1234", "0000");
promise.then(data => { promise.then(data => {
console.log(`alterPin2 success, promise: data->${JSON.stringify(data)}`); console.log(`alterPin2 success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -1356,13 +1360,13 @@ unlockPin(slotId: number,pin: string ,callback: AsyncCallback<LockStatusResponse ...@@ -1356,13 +1360,13 @@ unlockPin(slotId: number,pin: string ,callback: AsyncCallback<LockStatusResponse
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| pin | string | 是 | SIM卡的密码 | | pin | string | 是 | SIM卡的密码 |
| callback | AsyncCallback&lt;[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 |
**示例:** **示例:**
```js ```js
let pin='1234'; let pin = '1234';
sim.unlockPin(0, pin,(err, data) => { sim.unlockPin(0, pin, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1391,13 +1395,13 @@ unlockPin(slotId: number,pin: string): Promise&lt;LockStatusResponse\> ...@@ -1391,13 +1395,13 @@ unlockPin(slotId: number,pin: string): Promise&lt;LockStatusResponse\>
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | -------------------------------------------------- | | ---------------------------------------------------- | -------------------------------------------------- |
| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 |
**示例:** **示例:**
```js ```js
let pin='1234'; let pin = '1234';
let promise = sim.unlockPin(0,pin); let promise = sim.unlockPin(0, pin);
promise.then(data => { promise.then(data => {
console.log(`unlockPin success, promise: data->${JSON.stringify(data)}`); console.log(`unlockPin success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -1424,14 +1428,14 @@ unlockPuk(slotId: number,newPin: string,puk: string ,callback: AsyncCallback<Loc ...@@ -1424,14 +1428,14 @@ unlockPuk(slotId: number,newPin: string,puk: string ,callback: AsyncCallback<Loc
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| newPin | string | 是 | 重置SIM卡的密码 | | newPin | string | 是 | 重置SIM卡的密码 |
| puk | string | 是 | SIM卡密码的解锁密码 | | puk | string | 是 | SIM卡密码的解锁密码 |
| callback | AsyncCallback&lt;[LockStatusResponse](#LockStatusResponse7)&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | 是 | 回调函数。 |
**示例:** **示例:**
```js ```js
let puk='1xxxxxxx'; let puk = '1xxxxxxx';
let newPin='1235'; let newPin = '1235';
sim.unlockPuk(0, newPin,puk,(err, data) => { sim.unlockPuk(0, newPin, puk, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1461,14 +1465,14 @@ unlockPuk(slotId: number,newPin: string,puk: string): Promise&lt;LockStatusRespo ...@@ -1461,14 +1465,14 @@ unlockPuk(slotId: number,newPin: string,puk: string): Promise&lt;LockStatusRespo
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | -------------------------------------------------- | | ---------------------------------------------------- | -------------------------------------------------- |
| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 |
**示例:** **示例:**
```js ```js
let puk='1xxxxxxx'; let puk = '1xxxxxxx';
let newPin='1235'; let newPin = '1235';
let promise = sim.unlockPuk(0,newPin,puk); let promise = sim.unlockPuk(0, newPin, puk);
promise.then(data => { promise.then(data => {
console.log(`unlockPuk success, promise: data->${JSON.stringify(data)}`); console.log(`unlockPuk success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -1494,13 +1498,13 @@ promise.then(data => { ...@@ -1494,13 +1498,13 @@ promise.then(data => {
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| pin2 | string | 是 | SIM卡的密码 | | pin2 | string | 是 | SIM卡的密码 |
| callback | AsyncCallback&lt;[LockStatusResponse](#LockStatusResponse7)&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | 是 | 回调函数。 |
**示例:** **示例:**
```js ```js
let pin2='1234'; let pin2 = '1234';
sim.unlockPin2(0, pin2,(err, data) => { sim.unlockPin2(0, pin2, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1529,7 +1533,7 @@ unlockPin2(slotId: number,pin2: string): Promise&lt;LockStatusResponse\> ...@@ -1529,7 +1533,7 @@ unlockPin2(slotId: number,pin2: string): Promise&lt;LockStatusResponse\>
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------- | -------------------------------------------------- | | ----------------------------------------------------- | -------------------------------------------------- |
| Promise\<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 |
**示例:** **示例:**
...@@ -1562,14 +1566,14 @@ unlockPuk2(slotId: number,newPin2: string,puk2: string ,callback: AsyncCallback< ...@@ -1562,14 +1566,14 @@ unlockPuk2(slotId: number,newPin2: string,puk2: string ,callback: AsyncCallback<
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| newPin2 | string | 是 | 重置SIM卡的密码 | | newPin2 | string | 是 | 重置SIM卡的密码 |
| puk2 | string | 是 | SIM卡密码的解锁密码 | | puk2 | string | 是 | SIM卡密码的解锁密码 |
| callback | AsyncCallback&lt;[LockStatusResponse](#LockStatusResponse7)&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | 是 | 回调函数。 |
**示例:** **示例:**
```js ```js
let puk2='1xxxxxxx'; let puk2 = '1xxxxxxx';
let newPin2='1235'; let newPin2 = '1235';
sim.unlockPuk2(0, newPin2,puk2,(err, data) => { sim.unlockPuk2(0, newPin2, puk2, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1599,14 +1603,14 @@ unlockPuk2slotId: number,newPin2: string,puk2: string): Promise&lt;LockStatusRes ...@@ -1599,14 +1603,14 @@ unlockPuk2slotId: number,newPin2: string,puk2: string): Promise&lt;LockStatusRes
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------------------- | -------------------------------------------------- | | ---------------------------------------------------- | -------------------------------------------------- |
| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 |
**示例:** **示例:**
```js ```js
let puk2='1xxxxxxx'; let puk2 = '1xxxxxxx';
let newPin2='1235'; let newPin2 = '1235';
let promise = sim.unlockPuk2(0,newPin2,puk2); let promise = sim.unlockPuk2(0, newPin2, puk2);
promise.then(data => { promise.then(data => {
console.log(`unlockPuk2 success, promise: data->${JSON.stringify(data)}`); console.log(`unlockPuk2 success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
...@@ -1634,143 +1638,1313 @@ getMaxSimCount\(\): number ...@@ -1634,143 +1638,1313 @@ getMaxSimCount\(\): number
console.log("Result: "+ sim.getMaxSimCount()) console.log("Result: "+ sim.getMaxSimCount())
``` ```
## sim.getSimIccId<sup>7+</sup>
## SimState getSimIccId(slotId: number, callback: AsyncCallback<string\>): void
SIM卡状态 获取指定卡槽SIM卡的ICCID,使用callback方式作为异步方法
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService 此接口为系统接口
| 名称 | 值 | 说明 | **需要权限**:ohos.permission.GET_TELEPHONY_STATE
| --------------------- | ---- | ---------------------------------------------------------- |
| SIM_STATE_UNKNOWN | 0 | SIM卡状态未知,即无法获取准确的状态。 |
| SIM_STATE_NOT_PRESENT | 1 | 表示SIM卡处于not present状态,即卡槽中没有插入SIM卡。 |
| SIM_STATE_LOCKED | 2 | 表示SIM卡处于locked状态,即SIM卡被PIN、PUK或网络锁锁定。 |
| SIM_STATE_NOT_READY | 3 | 表示SIM卡处于not ready状态,即SIM卡在位但无法正常工作。 |
| SIM_STATE_READY | 4 | 表示SIM卡处于ready状态,即SIM卡在位且工作正常。 |
| SIM_STATE_LOADED | 5 | 表示SIM卡处于loaded状态,即SIM卡在位且所有卡文件加载完毕。 |
## CardType<sup>7+</sup> **系统能力**:SystemCapability.Telephony.CoreService
卡类型。 **参数:**
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<string\> | 是 | 回调函数。 |
| 名称 | 值 | 说明 | **示例:**
| ----- | ----- | ----- |
|UNKNOWN_CARD | -1 | 未知类型 |
|SINGLE_MODE_SIM_CARD | 10 | 单SIM卡 |
|SINGLE_MODE_USIM_CARD | 20 | 单USIM卡 |
|SINGLE_MODE_RUIM_CARD | 30 | 单RUIM卡 |
|DUAL_MODE_CG_CARD | 40 | 双卡模式C+G |
|CT_NATIONAL_ROAMING_CARD | 41 | 中国电信内部漫游卡 |
|CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 |
|DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 |
|DUAL_MODE_UG_CARD | 50 | 双模式UG卡 |
|SINGLE_MODE_ISIM_CARD<sup>8+</sup> | 60 | 单一ISIM卡类型 |
## LockType<sup>8+</sup> ```js
sim.getSimIccId(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
锁类型。
## sim.getSimIccId<sup>7+</sup>
getSimIccId(slotId: number): Promise<string\>
获取指定卡槽SIM卡的ICCID,使用Promise方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE
| 名称 | 值 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| -------- | ---- | ----------- |
| PIN_LOCK | 1 | SIM卡密码锁 |
| FDN_LOCK | 2 | 固定拨号锁 |
## LockState<sup>8+</sup> **参数:**
锁状态。 | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------- |
| Promise<string\> | 以Promise形式返回获取指定卡槽SIM卡的ICCID。 |
**示例:**
```js
let promise = sim.getSimIccId(0);
promise.then(data => {
console.log(`getSimIccId success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getSimIccId fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getVoiceMailIdentifier<sup>8+</sup>
getVoiceMailIdentifier(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡语音信箱的alpha标识符,使用callback方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE
| 名称 | 值 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| -------- | ---- | ---------- |
| LOCK_OFF | 0 | 锁关闭状态 |
| LOCK_ON | 1 | 锁开启状态 |
## **PersoLockType**<sup>8+</sup> **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<string\> | 是 | 回调函数。 |
**示例:**
```js
sim.getVoiceMailIdentifier(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
定制锁类型。
## sim.getVoiceMailIdentifier<sup>8+</sup>
getVoiceMailIdentifier(slotId: number): Promise<string\>
获取指定卡槽中SIM卡语音信箱的alpha标识符,使用Promise方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE
| 名称 | 值 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| ------------ | ---- | ----------------------------------------------- |
| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* |
| PN_PUK_LOCK | 1 | 定制网络PUk锁 |
| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* |
| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 |
| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* |
| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 |
| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* |
| PC_PUK_LOCK | 7 | 定制企业Puk锁 |
| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* |
| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 |
## **LockStatusResponse**<sup>7+</sup> **参数:**
锁状态响应。 | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------------- |
| Promise<string\> | 以Promise形式返回获取指定卡槽SIM卡的alpha标识符。 |
**示例:**
```js
let promise = sim.getVoiceMailIdentifier(0);
promise.then(data => {
console.log(`getVoiceMailIdentifier success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getVoiceMailIdentifier fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getVoiceMailNumber<sup>8+</sup>
getVoiceMailNumber(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡的语音信箱号,使用callback方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE
| 名称 | 类型 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| --------------- | ------ | ------------------ |
| result | number | 当前操作的结果 |
| remain?: number | number | 剩余次数(可以为空) |
## **LockInfo**<sup>8+</sup> **参数:**
锁状态响应。 | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<string\> | 是 | 回调函数。 |
**示例:**
```js
sim.getVoiceMailNumber(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getVoiceMailNumber<sup>8+</sup>
getVoiceMailNumber(slotId: number): Promise<string\>
获取指定卡槽中SIM卡的语音信箱号,使用Promise方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE
| 名称 | 类型 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| -------- | --------- | ------ |
| lockType | LockType | 锁类型 |
| password | string | 密码 |
| state | LockState | 锁状态 |
## **PersoLockInfo**<sup>8+</sup> **参数:**
锁状态响应。 | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------------ |
| Promise<string\> | 以Promise形式返回获取指定卡槽SIM卡的语音信箱号。 |
**示例:**
```js
let promise = sim.getVoiceMailNumber(0);
promise.then(data => {
console.log(`getVoiceMailNumber success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getVoiceMailNumber fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.setVoiceMailInfo<sup>8+</sup>
setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback<void\>): void
设置语音邮件信息,使用callback方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE
| 名称 | 类型 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| -------- | ------------- | ------------ |
| lockType | PersoLockType | 定制锁的类型 |
| password | string | 密码 |
## **IccAccountInfo**<sup>7+</sup> **参数:**
Icc账户信息。 | 参数名 | 类型 | 必填 | 说明 |
| ---------- | -------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| mailName | string | 是 | 邮件名字 |
| mailNumber | string | 是 | 邮件号码 |
| callback | AsyncCallback<void\> | 是 | 回调函数。 |
**示例:**
```js
sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com" , (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.setVoiceMailInfo<sup>8+</sup>
setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise<void\>
设置语音邮件信息,使用Promise方式作为异步方法。
此接口为系统接口。 此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE
| 名称 | 类型 | 说明 | **系统能力**:SystemCapability.Telephony.CoreService
| ---------- | ------- | ---------------- |
| simId | number | SIM卡ID | **参数:**
| slotIndex | number | 卡槽ID |
| isEsim | boolean | 标记卡是否是eSim | | 参数名 | 类型 | 必填 | 说明 |
| isActive | boolean | 卡是否被激活 | | ---------- | ------ | ---- | -------------------------------------- |
| iccId | string | ICCID号码 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| showName | string | SIM卡显示名称 | | mailName | string | 是 | 邮件名字 |
| showNumber | string | SIM卡显示号码 | | mailNumber | string | 是 | 邮件号码 |
**返回值:**
| 类型 | 说明 |
| -------------- | ----------------------- |
| Promise<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let promise = sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com");
promise.then(data => {
console.log(`setVoiceMailInfo success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`setVoiceMailInfo fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getSimTelephoneNumber<sup>8+</sup>
getSimTelephoneNumber(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡的MSISDN,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<string\> | 是 | 回调函数。 |
**示例:**
```js
sim.getSimTelephoneNumber(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getSimTelephoneNumber<sup>8+</sup>
getSimTelephoneNumber(slotId: number): Promise<string\>
获取指定卡槽中SIM卡的MSISDN,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | -------------------------------------------- |
| Promise<string\> | 以Promise形式返回获取指定卡槽SIM卡的MSISDN。 |
**示例:**
```js
let promise = sim.getSimTelephoneNumber(0);
promise.then(data => {
console.log(`getSimTelephoneNumber success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getSimTelephoneNumber fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getSimGid1<sup>7+</sup>
getSimGid1(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡的组标识符级别1(GID1),使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<string\> | 是 | 回调函数。 |
**示例:**
```js
sim.getSimGid1(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getSimGid1<sup>7+</sup>
getSimGid1(slotId: number): Promise<string\>
获取指定卡槽中SIM卡的组标识符级别1(GID1),使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------------- |
| Promise<string\> | 以Promise形式返回获取指定卡槽SIM卡的标识符级别1。 |
**示例:**
```js
let promise = sim.getSimGid1(0);
promise.then(data => {
console.log(`getSimGid1 success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getSimGid1 fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getIMSI
getIMSI(slotId: number, callback: AsyncCallback<string\>): void
获取国际移动用户识别码,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback\<string\> | 是 | 回调函数。 |
**示例:**
```js
sim.getIMSI(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getIMSI
getIMSI(slotId: number): Promise<string\>
获取国际移动用户识别码,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------- |
| Promise<string\> | 以Promise形式返回获取的国际移动用户识别码。 |
**示例:**
```js
let promise = sim.getIMSI(0);
promise.then(data => {
console.log(`getIMSI success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getIMSI fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getOperatorConfigs<sup>8+</sup>
getOperatorConfigs(slotId: number, callback: AsyncCallback<Array<OperatorConfig\>>): void
获取运营商配置,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<Array<[OperatorConfig](#operatorconfig8)\>> | 是 | 回调函数。 |
**示例:**
```js
sim.getOperatorConfigs(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getOperatorConfigs<sup>8+</sup>
getOperatorConfigs(slotId: number): Promise<Array<OperatorConfig\>>
获取运营商配置,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.GET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------------------------------------------- | ----------------------------- |
| Promise<Array<[OperatorConfig](#OperatorConfig8)\>> | 以Promise形式返回运营商配置。 |
**示例:**
```js
let promise = sim.getOperatorConfigs(0);
promise.then(data => {
console.log(`getOperatorConfigs success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getOperatorConfigs fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.queryIccDiallingNumbers<sup>8+</sup>
queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback<Array<DiallingNumbersInfo\>>): void
查询SIM卡联系人号码,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.READ_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | ContactType | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| callback | AsyncCallback<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | 是 | 回调函数。 |
**示例:**
```js
sim.queryIccDiallingNumbers(0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.queryIccDiallingNumbers<sup>8+</sup>
queryIccDiallingNumbers(slotId: number, type: ContactType): Promise<Array<DiallingNumbersInfo\>>
查询SIM卡联系人号码,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.READ_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | ContactType | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------------ | ------------------------------ |
| Promise<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | 以Promise形式返回Icc拨号号码。 |
**示例:**
```js
let promise = sim.queryIccDiallingNumbers(0, 1);
promise.then(data => {
console.log(`queryIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`queryIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.addIccDiallingNumbers<sup>8+</sup>
addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback<void\>): void
添加SIM卡联系人号码,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.WRITE_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [ContactType](#contacttype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 |
| callback | AsyncCallback<void\> | 是 | 回调函数 |
**示例:**
```js
let diallingNumbersInof = {
alphaTag = "alpha",
number = "138xxxxxxxx",
recordNumber = 123,
pin2 = "1234"
};
sim.addIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.addIccDiallingNumbers<sup>8+</sup>
addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void\>
添加SIM卡联系人号码,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.WRITE_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [ContactType](#contacttype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 |
**返回值:**
| 类型 | 说明 |
| -------------- | --------------------------- |
| Promise<void\> | 以Promise形式返回添加结果。 |
**示例:**
```js
let diallingNumbersInof = {
alphaTag = "alpha",
number = "138xxxxxxxx",
recordNumber = 123,
pin2 = "1234"
};
let promise = sim.addIccDiallingNumbers(0, 1, diallingNumbersInof);
promise.then(data => {
console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`addIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.delIccDiallingNumbers<sup>8+</sup>
delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback<void\>): void
删除SIM卡联系人号码,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.WRITE_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [ContactType](#contacttype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 |
| callback | AsyncCallback<void\> | 是 | 回调函数 |
**示例:**
```js
let diallingNumbersInof = {
alphaTag = "alpha",
number = "138xxxxxxxx",
recordNumber = 123,
pin2 = "1234"
};
sim.delIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.delIccDiallingNumbers<sup>8+</sup>
delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void\>
删除SIM卡联系人号码,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.WRITE_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [ContactType](#contacttype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 |
**返回值:**
| 类型 | 说明 |
| -------------- | --------------------------- |
| Promise<void\> | 以Promise形式返回删除结果。 |
**示例:**
```js
let diallingNumbersInof = {
alphaTag = "alpha",
number = "138xxxxxxxx",
recordNumber = 123,
pin2 = "1234"
};
let promise = sim.delIccDiallingNumbers(0, 1, diallingNumbersInof);
promise.then(data => {
console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`delIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.updateIccDiallingNumbers<sup>8+</sup>
updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback<void\>): void
更新SIM卡联系人号码,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.WRITE_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [ContactType](#contacttype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 |
| callback | AsyncCallback<void\> | 是 | 回调函数 |
**示例:**
```js
let diallingNumbersInof = {
alphaTag = "alpha",
number = "138xxxxxxxx",
recordNumber = 123,
pin2 = "1234"
};
sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.updateIccDiallingNumbers<sup>8+</sup>
updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void\>
更新SIM卡联系人号码,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.WRITE_CONTACTS
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| type | [ContactType](#contacttype8) | 是 | 联系人类型。<br/>1 : GENERAL_CONTACT<br/>2 : FIXED_DIALING |
| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 |
**返回值:**
| 类型 | 说明 |
| -------------- | ----------------------------- |
| Promise<void\> | 以Promise形式返回更新的结果。 |
**示例:**
```js
let diallingNumbersInof = {
alphaTag = "alpha",
number = "138xxxxxxxx",
recordNumber = 123,
pin2 = "1234"
};
let promise = sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof);
promise.then(data => {
console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`updateIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.sendEnvelopeCmd<sup>8+</sup>
sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback<void\>): void
发送信封命令,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| cmd | string | 是 | 命令 |
| callback | AsyncCallback<void\> | 是 | 是 |
**示例:**
```js
sim.sendEnvelopeCmd(0, "ls", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.sendEnvelopeCmd<sup>8+</sup>
sendEnvelopeCmd(slotId: number, cmd: string): Promise<void\>
发送信封命令,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| cmd | string | 是 | 命令 |
**返回值:**
| 类型 | 说明 |
| -------------- | --------------------------- |
| Promise<void\> | 以Promise形式返回发送结果。 |
**示例:**
```js
let promise = sim.sendEnvelopeCmd(0, "ls");
promise.then(data => {
console.log(`sendEnvelopeCmd success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`sendEnvelopeCmd fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.sendTerminalResponseCmd<sup>8+</sup>
sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback<void\>): void
发送终端响应命令,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| cmd | string | 是 | 命令 |
| callback | AsyncCallback<void\> | 是 | 回调函数。 |
**示例:**
```js
sim.sendTerminalResponseCmd(0, "ls", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.sendTerminalResponseCmd<sup>8+</sup>
sendTerminalResponseCmd(slotId: number, cmd: string): Promise<void\>
发送终端响应命令,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| cmd | string | 是 | 命令 |
**返回值:**
| 类型 | 说明 |
| -------------- | --------------------------- |
| Promise<void\> | 以Promise形式返回发送结果。 |
**示例:**
```js
let promise = sim.sendTerminalResponseCmd(0, "ls");
promise.then(data => {
console.log(`sendTerminalResponseCmd success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`sendTerminalResponseCmd fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.unlockSimLock<sup>8+</sup>
unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback<LockStatusResponse\>): void
解锁SIM卡锁,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| lockInfo | [PersoLockInfo](#persolockinfo8) | 是 | 定制锁类型信息 |
| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数 |
**示例:**
```js
let persoLockInfo = {
lockType = 0,
password = "1234"
};
sim.unlockSimLock(0, persoLockInfo, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.unlockSimLock<sup>8+</sup>
unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise<LockStatusResponse\>
解锁SIM卡锁,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| lockInfo | [PersoLockInfo](#persolockinfo8) | 是 | 定制锁类型信息 |
**返回值:**
| 类型 | 说明 |
| ---------------------------------------------------- | ------------------------- |
| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回锁状态。 |
**示例:**
```js
let persoLockInfo = {
lockType = 0,
password = "1234"
};
let promise = sim.unlockSimLock(0, persoLockInfo);
promise.then(data => {
console.log(`unlockSimLock success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`unlockSimLock fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getOpKey<sup>9+</sup>
getOpKey(slotId: number, callback: AsyncCallback<number\>): void
获取指定卡槽中SIM卡的opkey,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<number\> | 是 | 回调函数 |
**示例:**
```js
sim.getOpKey(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getOpKey<sup>9+</sup>
getOpKey(slotId: number): Promise<number\>
获取指定卡槽中SIM卡的opkey,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ----------------------------------------- |
| Promise<number\> | 以Promise形式返回指定卡槽中SIM卡的opkey。 |
**示例:**
```js
let promise = sim.getOpKey(0);
promise.then(data => {
console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getOpKey fail, promise: err->${JSON.stringify(err)}`);
});
```
## sim.getOpName<sup>9+</sup>
getOpName(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡的OpName,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<string\> | 是 | 回调函数 |
**示例:**
```js
sim.getOpName(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sim.getOpName<sup>9+</sup>
getOpName(slotId: number): Promise<string\>
获取指定卡槽中SIM卡的OpName,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------ |
| Promise<string\> | 以Promise形式返回指定卡槽中SIM卡的OpName。 |
**示例:**
```js
let promise = sim.getOpName(0);
promise.then(data => {
console.log(`getOpName success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.log(`getOpName fail, promise: err->${JSON.stringify(err)}`);
});
```
## SimState
SIM卡状态。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| --------------------- | ---- | ---------------------------------------------------------- |
| SIM_STATE_UNKNOWN | 0 | SIM卡状态未知,即无法获取准确的状态。 |
| SIM_STATE_NOT_PRESENT | 1 | 表示SIM卡处于not present状态,即卡槽中没有插入SIM卡。 |
| SIM_STATE_LOCKED | 2 | 表示SIM卡处于locked状态,即SIM卡被PIN、PUK或网络锁锁定。 |
| SIM_STATE_NOT_READY | 3 | 表示SIM卡处于not ready状态,即SIM卡在位但无法正常工作。 |
| SIM_STATE_READY | 4 | 表示SIM卡处于ready状态,即SIM卡在位且工作正常。 |
| SIM_STATE_LOADED | 5 | 表示SIM卡处于loaded状态,即SIM卡在位且所有卡文件加载完毕。 |
## CardType<sup>7+</sup>
卡类型。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| ----- | ----- | ----- |
|UNKNOWN_CARD | -1 | 未知类型 |
|SINGLE_MODE_SIM_CARD | 10 | 单SIM卡 |
|SINGLE_MODE_USIM_CARD | 20 | 单USIM卡 |
|SINGLE_MODE_RUIM_CARD | 30 | 单RUIM卡 |
|DUAL_MODE_CG_CARD | 40 | 双卡模式C+G |
|CT_NATIONAL_ROAMING_CARD | 41 | 中国电信内部漫游卡 |
|CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 |
|DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 |
|DUAL_MODE_UG_CARD | 50 | 双模式UG卡 |
|SINGLE_MODE_ISIM_CARD<sup>8+</sup> | 60 | 单一ISIM卡类型 |
## LockType<sup>8+</sup>
锁类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| -------- | ---- | ----------- |
| PIN_LOCK | 1 | SIM卡密码锁 |
| FDN_LOCK | 2 | 固定拨号锁 |
## LockState<sup>8+</sup>
锁状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| -------- | ---- | ---------- |
| LOCK_OFF | 0 | 锁关闭状态 |
| LOCK_ON | 1 | 锁开启状态 |
## **PersoLockType**<sup>8+</sup>
定制锁类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| ------------ | ---- | ----------------------------------------------- |
| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* |
| PN_PUK_LOCK | 1 | 定制网络PUk锁 |
| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* |
| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 |
| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* |
| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 |
| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* |
| PC_PUK_LOCK | 7 | 定制企业Puk锁 |
| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* |
| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 |
## **LockStatusResponse**<sup>7+</sup>
锁状态响应。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| --------------- | ------ | ------------------ |
| result | number | 当前操作的结果 |
| remain?: number | number | 剩余次数(可以为空) |
## **LockInfo**<sup>8+</sup>
锁状态响应。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| -------- | ------------------------ | ------ |
| lockType | [LockType](#locktype8) | 锁类型 |
| password | string | 密码 |
| state | [LockState](#lockstate8) | 锁状态 |
## **PersoLockInfo**<sup>8+</sup>
锁状态响应。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| -------- | -------------------------------- | ------------ |
| lockType | [PersoLockType](#persolocktype8) | 定制锁的类型 |
| password | string | 密码 |
## **IccAccountInfo**<sup>7+</sup>
Icc账户信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ---------- | ------- | ---------------- |
| simId | number | SIM卡ID |
| slotIndex | number | 卡槽ID |
| isEsim | boolean | 标记卡是否是eSim |
| isActive | boolean | 卡是否被激活 |
| iccId | string | ICCID号码 |
| showName | string | SIM卡显示名称 |
| showNumber | string | SIM卡显示号码 |
## **OperatorConfig**<sup>8+</sup>
运营商配置。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ----- | ------ | ---- |
| field | string | 字段 |
| value | string | 值 |
## **DiallingNumbersInfo**<sup>8+</sup>
拨号号码信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 类型 | 说明 |
| ------------ | ------ | -------- |
| alphaTag | string | 标签 |
| number | string | 号码 |
| recordNumber | number | 记录编号 |
| pin2 | string | pin2密码 |
## **ContactType**<sup>8+</sup>
联系人类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。
| 名称 | 值 | 说明 |
| :-------------- | ---- | ---------- |
| GENERAL_CONTACT | 1 | 通用联系人 |
| FIXED_DIALING | 2 | 固定拨号 |
...@@ -375,6 +375,739 @@ let result = sms.hasSmsCapability(); ...@@ -375,6 +375,739 @@ let result = sms.hasSmsCapability();
console.log(`hasSmsCapability: ${JSON.stringify(result)}`); console.log(`hasSmsCapability: ${JSON.stringify(result)}`);
``` ```
## sms.splitMessage<sup>8+</sup>
splitMessage(content: string, callback: AsyncCallback<Array<string\>>): void
将长短信拆分为多个片段,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ----------------------------- |
| content | string | 是 | 指示短消息内容,不能为null。 |
| callback | AsyncCallback<Array<string\>> | 是 | 回调函数。 |
**示例:**
```js
string content= "long message";
sms.splitMessage(content, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.splitMessage<sup>8+</sup>
splitMessage(content: string): Promise<Array<string\>>
将长短信拆分为多个片段,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---------------------------- |
| content | string | 是 | 指示短消息内容,不能为null。 |
**返回值:**
| 类型 | 说明 |
| ----------------------- | ----------------------------------- |
| Promise<Array<string\>> | 以Promise形式返回多个片段的的结果。 |
**示例:**
```js
string content = "long message";
let promise = sms.splitMessage(content);
promise.then(data => {
console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`splitMessage fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.addSimMessage<sup>7+</sup>
addSimMessage(options: SimMessageOptions, callback: AsyncCallback<void\>): void
添加SIM卡消息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------------- |
| options | [SimMessageOptions](#simmessageoptions7) | 是 | SIM卡消息选项。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let simMessageOptions = {
slotId = 0,
smsc = "test",
pdu = "xxxxxx",
status = 0
};
sms.addSimMessage(simMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.addSimMessage<sup>7+</sup>
addSimMessage(options: SimMessageOptions): Promise<void\>
添加SIM卡消息,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------------------------- | ---- | --------------- |
| options | [SimMessageOptions](#simmessageoptions7) | 是 | SIM卡消息选项。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ----------------------------- |
| Promise&lt;void&gt; | 以Promise形式返回添加的结果。 |
**示例:**
```js
let simMessageOptions = {
slotId = 0,
smsc = "test",
pdu = "xxxxxx",
status = 0
};
let promise = sms.addSimMessage(simMessageOptions);
promise.then(data => {
console.log(`addSimMessage success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`addSimMessage fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.delSimMessage<sup>7+</sup>
delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback<void\>): void
删除SIM卡消息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------------------------------------- |
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| msgIndex | number | 是 | 消息索引 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
let msgIndex = 1;
sms.delSimMessage(slotId, msgIndex, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.delSimMessage<sup>7+</sup>
delSimMessage(slotId: number, msgIndex: number): Promise<void\>
删除SIM卡信息,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ----------------------------------------- |
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| msgIndex | number | 是 | 消息索引 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ----------------------------- |
| Promise&lt;void&gt; | 以Promise形式返回删除的结果。 |
**示例:**
```js
let slotId = 0;
let msgIndex = 1;
let promise = sms.delSimMessage(slotId, msgIndex);
promise.then(data => {
console.log(`delSimMessage success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`delSimMessage fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.updateSimMessage<sup>7+</sup>
updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback<void\>): void
更新SIM卡消息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------------- | ---- | ------------------- |
| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | 是 | 更新SIM卡消息选项。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let updateSimMessageOptions = {
slotId = 0,
msgIndex = 1,
newStatus = 0,
pdu = "xxxxxxx",
smsc = "test"
};
sms.updateSimMessage(updateSimMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.updateSimMessage<sup>7+</sup>
updateSimMessage(options: UpdateSimMessageOptions): Promise<void\>
更新SIM卡消息,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------------------------------------- | ---- | ------------------- |
| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | 是 | 更新SIM卡消息选项。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ----------------------------- |
| Promise&lt;void&gt; | 以Promise形式返回更新的结果。 |
**示例:**
```js
let updateSimMessageOptions = {
slotId = 0,
msgIndex = 1,
newStatus = 0,
pdu = "xxxxxxx",
smsc = "test"
};
let promise = sms.updateSimMessage(updateSimMessageOptions);
promise.then(data => {
console.log(`updateSimMessage success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`updateSimMessage fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.getAllSimMessages<sup>7+</sup>
getAllSimMessages(slotId: number, callback: AsyncCallback<Array<SimShortMessage\>>): void
获取所有SIM卡消息,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ----------------------------------------- |
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage8)\>> | 是 | 回调函数。 |
**示例:**
```js
let slotId = 0;
sms.getAllSimMessages(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.getAllSimMessages<sup>7+</sup>
getAllSimMessages(slotId: number): Promise<Array<SimShortMessage\>>
获取所有SIM卡消息,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ----------------------------------------- |
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------- | ---------------------------------- |
| PromiseArray<[SimShortMessage](#simshortmessage8)\>&gt; | 以Promise形式返回获取的SIM短消息。 |
**示例:**
```js
let slotId = 0;
let promise = sms.getAllSimMessages(slotId);
promise.then(data => {
console.log(`getAllSimMessages success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getAllSimMessages fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.setCBConfig<sup>7+</sup>
setCBConfig(options: CBConfigOptions, callback: AsyncCallback<void\>): void
设置小区广播配置,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | ------------ |
| options | [CBConfigOptions](#cbconfigoptions8) | 是 | 小区广播配置选项。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let cbConfigOptions = {
slotId = 0,
smsc = "test",
pdu = "xxxxxxxx",
status = 0
};
sms.setCBConfig(cbConfigOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.setCBConfig<sup>7+</sup>
setCBConfig(options: CBConfigOptions): Promise<void\>
设置小区广播配置,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.RECEIVE_SMS
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------ | ---- | ------------ |
| options | [CBConfigOptions](#cbconfigoptions8) | 是 | 小区广播配置选项。 |
**返回值:**
| 类型 | 说明 |
| ------------------- | ----------------------------- |
| Promise&lt;void&gt; | 以Promise形式返回设置的结果。 |
**示例:**
```js
let cbConfigOptions = {
slotId = 0,
smsc = "test",
pdu = "xxxxxxxx",
status = 0
};
let promise = sms.setCBConfig(cbConfigOptions);
promise.then(data =>
console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCBConfig fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.getSmsSegmentsInfo<sup>8+</sup>
getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback<SmsSegmentsInfo\>): void
获取短信段信息,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------------------------------------ | ---- | ----------------------------------------- |
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| message | string | 是 | 消息 |
| force7bit | boolean | 是 | 是否使用7bit编码 |
| callback | AsyncCallback&lt;[SmsSegmentsInfo](#&lt;smssegmentsinfo8)&gt; | 是 | 回调函数 |
**示例:**
```js
let slotId = 0;
sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.getSmsSegmentsInfo<sup>8+</sup>
getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise<SmsSegmentsInfo\>
获取短信段信息,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------- | ---- | ----------------------------------------- |
| slotId | number | 是 | SIM卡槽ID:<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| message | string | 是 | 消息 |
| force7bit | boolean | 是 | 是否使用7bit编码 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------- | ----------------------------- |
| Promise&lt;[SmsSegmentsInfo](#&lt;smssegmentsinfo8)&gt; | 以Promise形式返回短信段信息。 |
**示例:**
```js
let slotId = 0;
let promise = sms.getSmsSegmentsInfo(slotId, "message", false);
promise.then(data =>
console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getSmsSegmentsInfo fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.isImsSmsSupported<sup>8+</sup>
isImsSmsSupported(callback: AsyncCallback<boolean\>): void
如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调函数。 |
**示例:**
```js
sms.isImsSmsSupported((err, data) => {
console.log(`callback: err->${JSON.(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.isImsSmsSupported<sup>8+</sup>
isImsSmsSupported(): Promise<boolean\>
如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**返回值:**
| 类型 | 说明 |
| ---------------------- | ----------------------- |
| Promise&lt;boolean&gt; | 以Promise形式返回结果。 |
**示例:**
```js
let promise = sms.isImsSmsSupported();
promise.then(data => {
console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isImsSmsSupported fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.getImsShortMessageFormat<sup>8+</sup>
getImsShortMessageFormat(callback: AsyncCallback<string\>): void
获取IMS上支持的SMS格式,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;string&gt; | 是 | 回调函数。 |
**示例:**
```js
sms.getImsShortMessageFormat((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.getImsShortMessageFormat<sup>8+</sup>
getImsShortMessageFormat(): Promise<string\>
获取IMS上支持的SMS格式,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**返回值:**
| 类型 | 说明 |
| --------------------- | -------------------------- |
| Promise&lt;string&gt; | 以Promise形式返回SMS格式。 |
**示例:**
```js
let promise = sms.getImsShortMessageFormat();
promise.then(data => {
console.log(`getImsShortMessageFormat success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getImsShortMessageFormat fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.decodeMms<sup>8+</sup>
decodeMms(mmsFilePathName: string | Array<number\>, callback: AsyncCallback<MmsInformation\>): void
彩信解码,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ------------------------------------------------------- | ---- | -------------- |
| mmsFilePathName | string \|Array<number\> | 是 | 彩信文件路径名 |
| callback | AsyncCallback&lt;[MmsInformation](#mmsinformation8)&gt; | 是 | 回调函数。 |
**示例:**
```js
let mmsFilePathName = "filename";
sms.decodeMms(mmsFilePathName, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.decodeMms<sup>8+</sup>
decodeMms(mmsFilePathName: string | Array<number\>): Promise<MmsInformation\>
彩信解码,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ----------------------- | ---- | -------------- |
| mmsFilePathName | string \|Array<number\> | 是 | 彩信文件路径名 |
**返回值:**
| 类型 | 说明 |
| --------------------------------------------------------- | --------------------------- |
| Promise&lt;&lt;[MmsInformation](#mmsinformation8)&gt;&gt; | 以Promise形式返回彩信信息。 |
**示例:**
```js
let mmsFilePathName = "filename";
let promise = sms.getSmscAddr(mmsFilePathName);
promise.then(data => {
console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`decodeMms fail, promise: err->${JSON.stringify(err)}`);
});
```
## sms.encodeMms<sup>8+</sup>
encodeMms(mms: MmsInformation, callback: AsyncCallback<Array<number\>>): void
彩信编码,使用callback方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | ---- | ---------- |
| mms | [MmsInformation](#mmsinformation8) | 是 | 彩信信息。 |
| callback | AsyncCallback&lt;Array<number\>&gt; | 是 | 回调函数。 |
**示例:**
```js
let mmsAcknowledgeInd = {
transactionId = "100",
version = 0x10,
reportAllowed = 128
};
let mmsInformation = {
messageType = 133,
mmsType = mmsAcknowledgeInd
};
sms.encodeMms(mmsInformation, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## sms.encodeMms<sup>8+</sup>
encodeMms(mms: MmsInformation): Promise<Array<number\>>
彩信编码,使用Promise方式作为异步方法。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.SmsMms
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------- | ---- | ---------- |
| mms | [MmsInformation](#mmsinformation8) | 是 | 彩信信息。 |
**返回值:**
| 类型 | 说明 |
| ----------------------------- | ----------------------------------- |
| Promise&lt;Array<number\>&gt; | 以Promise形式返回彩信编码后的结果。 |
**示例:**
```js
let mmsAcknowledgeInd = {
transactionId = "100",
version = 0x10,
reportAllowed = 128
};
let mmsInformation = {
messageType = 133,
mmsType = mmsAcknowledgeInd
};
let promise = sms.encodeMms(mmsInformation);
promise.then(data => {
console.log(`encodeMms success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`encodeMms fail, promise: err->${JSON.stringify(err)}`);
});
```
## ShortMessage ## ShortMessage
短信实例。 短信实例。
...@@ -464,3 +1197,421 @@ console.log(`hasSmsCapability: ${JSON.stringify(result)}`); ...@@ -464,3 +1197,421 @@ console.log(`hasSmsCapability: ${JSON.stringify(result)}`);
| SEND_SMS_FAILURE_UNKNOWN | 1 | 发送短信失败,原因未知。 | | SEND_SMS_FAILURE_UNKNOWN | 1 | 发送短信失败,原因未知。 |
| SEND_SMS_FAILURE_RADIO_OFF | 2 | 发送短信失败,原因为调制解调器关机。 | | SEND_SMS_FAILURE_RADIO_OFF | 2 | 发送短信失败,原因为调制解调器关机。 |
| SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | 发送短信失败,原因为网络不可用、不支持发送或接收短信。 | | SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | 发送短信失败,原因为网络不可用、不支持发送或接收短信。 |
## MmsInformation<sup>8+</sup>
彩信信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------------------------------------------ | ---- | --------- |
| messageType | [MessageType](#messagetype8) | 是 | 消息类型 |
| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigInd8)\|[MmsReadRecInd](#mmsreadorigind8) | 是 | pdu头类型 |
| attachment | Array<[MmsAttachment](#mmsattachment8)\> | 否 | 附件 |
## MmsSendReq<sup>8+</sup>
彩信发送请求。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ---------------- | ------------------------------------ | ---- | ------------ |
| from | [MmsAddress](#mmsaddress8) | 是 | 彩信来源 |
| transactionId | string | 是 | 事务ID |
| contentType | string | 是 | 内容类型 |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| to | Array<[MmsAddress](#mmsaddress8)\> | 否 | 发送至 |
| date | number | 否 | 日期 |
| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 |
| bcc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 暗抄送 |
| subject | string | 否 | 主题 |
| messageClass | number | 否 | 消息类 |
| expiry | number | 否 | 到期 |
| priority | [MmsPriorityType](#mmsprioritytype8) | 否 | 优先 |
| senderVisibility | number | 否 | 发件人可见性 |
| deliveryReport | number | 否 | 交付报告 |
| readReport | number | 否 | 阅读报告 |
## MmsSendConf<sup>8+</sup>
彩信发送配置。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ---------------------------------- | ---- | -------- |
| responseState | number | 是 | 响应状态 |
| transactionId | string | 是 | 事务ID |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| messageId | string | 否 | 消息ID |
## MmsNotificationInd<sup>8+</sup>
彩信通知索引。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ---------------------------------- | ---- | -------- |
| transactionId | string | 是 | 事务ID |
| messageClass | number | 是 | 消息类 |
| messageSize | number | 是 | 消息大小 |
| expiry | number | 是 | 到期 |
| contentLocation | string | 是 | 内容位置 |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| from | [MmsAddress](#mmsaddress8) | 否 | 来源 |
| subject | string | 否 | 主题 |
| deliveryReport | number | 否 | 状态报告 |
| contentClass | number | 否 | 内容类 |
## MmsAcknowledgeInd<sup>8+</sup>
彩信确认索引。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ---------------------------------- | ---- | -------- |
| transactionId | string | 是 | 事务ID |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| reportAllowed | [ReportType](#reporttype8) | 否 | 允许报告 |
## MmsRetrieveConf<sup>8+</sup>
彩信检索配置。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------------------------------------ | ---- | -------- |
| transactionId | string | 是 | 事务ID |
| messageId | string | 是 | 消息ID |
| date | number | 是 | 日期 |
| contentType | string | 是 | 内容类型 |
| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| from | [MmsAddress](#mmsaddress8) | 否 | 来源 |
| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 |
| subject | string | 否 | 主题 |
| priority | [MmsPriorityType](#mmsPrioritytype8) | 否 | 优先级 |
| deliveryReport | number | 否 | 状态报告 |
| readReport | number | 否 | 阅读报告 |
| retrieveStatus | number | 否 | 检索状态 |
| retrieveText | string | 否 | 检索文本 |
## MmsReadOrigInd<sup>8+</sup>
彩信读取原始索引。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------- | ---- | -------- |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| messageId | string | 是 | 消息ID |
| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 |
| from | [MmsAddress](#mmsaddress8) | 是 | 来源 |
| date | number | 是 | 日期 |
| readStatus | number | 是 | 阅读状态 |
## MmsAttachment<sup>8+</sup>
彩信附件。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ----------------------- | ------------------------------------ | ---- | ------------------ |
| contentId | string | 是 | 内容ID |
| contentLocation | string | 是 | 内容位置 |
| contentDisposition | [DispositionType](#dispositiontype8) | 是 | 内容处理 |
| contentTransferEncoding | string | 是 | 内容传输编码 |
| contentType | string | 是 | 内容类型 |
| isSmil | boolean | 是 | 同步多媒体集成语言 |
| path | string | 否 | 路径 |
| inBuff | Array<number\> | 否 | 缓冲区中 |
| fileName | string | 否 | 文件名 |
| charset | [MmsCharSets](#mmscharsets8) | 否 | 字符集 |
## MmsAddress<sup>8+</sup>
彩信地址。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------------- | ---- | ------ |
| address | string | 是 | 地址 |
| charset | [MmsCharSets](#mmscharsets8) | 是 | 字符集 |
## MessageType<sup>8+</sup>
消息类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| ------------------------- | ---- | -------------------- |
| TYPE_MMS_SEND_REQ | 128 | 彩信发送请求类型 |
| TYPE_MMS_SEND_CONF | 129 | 彩信发送配置类型 |
| TYPE_MMS_NOTIFICATION_IND | 130 | 彩信通知索引类型 |
| TYPE_MMS_RESP_IND | 131 | 彩信回复索引类型 |
| TYPE_MMS_RETRIEVE_CONF | 132 | 彩信检索配置类型 |
| TYPE_MMS_ACKNOWLEDGE_IND | 133 | 彩信确认索引类型 |
| TYPE_MMS_DELIVERY_IND | 134 | 彩信传送索引类型 |
| TYPE_MMS_READ_REC_IND | 135 | 彩信读取接收索引类型 |
| TYPE_MMS_READ_ORIG_IND | 136 | 彩信读取原始索引类型 |
## MmsPriorityType<sup>8+</sup>
彩信优先级类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| ---------- | ---- | -------------- |
| MMS_LOW | 128 | 彩信优先级低 |
| MMS_NORMAL | 129 | 彩信优先级正常 |
| MMS_HIGH | 130 | 彩信优先级高 |
## MmsVersionType<sup>8+</sup>
彩信版本类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| --------------- | ---- | ----------- |
| MMS_VERSION_1_0 | 0x10 | 彩信版本1_0 |
| MMS_VERSION_1_1 | 0x11 | 彩信版本1_1 |
| MMS_VERSION_1_2 | 0x12 | 彩信版本1_2 |
| MMS_VERSION_1_3 | 0x13 | 彩信版本1_3 |
## MmsCharSets<sup>8+</sup>
彩信字符集。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| --------------- | ------ | ------------------- |
| BIG5 | 0X07EA | BIG5格式 |
| ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2格式 |
| ISO_8859_1 | 0X04 | ISO_8859_1格式 |
| ISO_8859_2 | 0X05 | ISO_8859_2格式 |
| ISO_8859_3 | 0X06 | ISO_8859_3格式 |
| ISO_8859_4 | 0X07 | ISO_8859_4格式 |
| ISO_8859_5 | 0X08 | ISO_8859_5格式 |
| ISO_8859_6 | 0X09 | ISO_8859_6格式 |
| ISO_8859_7 | 0X0A | ISO_8859_7格式 |
| ISO_8859_8 | 0X0B | ISO_8859_8格式 |
| ISO_8859_9 | 0X0C | ISO_8859_9格式 |
| SHIFT_JIS | 0X11 | SHIFT_JIS格式 |
| US_ASCII | 0X03 | US_ASCII格式 |
| UTF_8 | 0X6A | UTF_8格式 |
## DispositionType<sup>8+</sup>
处理类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| ---------- | ---- | -------- |
| FROM_DATA | 0 | 数据来源 |
| ATTACHMENT | 1 | 附件 |
| INLINE | 2 | 内联 |
## ReportType<sup>8+</sup>
报告类型。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| ------- | ---- | ---- |
| MMS_YES | 128 | YES |
| MMS_NO | 129 | NO |
## CBConfigOptions<sup>8+</sup>
小区广播配置选项。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | -------------------- | ---- | ------------ |
| slotId | number | 是 | 卡槽ID |
| enable | boolean | 是 | 可行 |
| startMessageId | number | 是 | 消息起始ID |
| endMessageId | number | 是 | 消息结束ID |
| ranType | [RanType](#rantype7) | 是 | 手机网络制式 |
## SimMessageStatus<sup>7+</sup>
SIM卡消息状态。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| ------------------------- | ---- | --------------------------- |
| SIM_MESSAGE_STATUS_FREE | 0 | SIM卡上的状态可用空间 |
| SIM_MESSAGE_STATUS_READ | 1 | 消息已读状态 |
| SIM_MESSAGE_STATUS_UNREAD | 3 | 消息未读状态 |
| SIM_MESSAGE_STATUS_SENT | 5 | 存储发送消息(仅适用于SMS) |
| SIM_MESSAGE_STATUS_UNSENT | 7 | 储未发送消息(仅适用于SMS) |
## RanType<sup>7+</sup>
手机网络制式。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| --------- | ---- | ---- |
| TYPE_GSM | 1 | GSM |
| TYPE_CDMA | 2 | CMDA |
## SmsEncodingScheme<sup>8+</sup>
短信编码方案。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 值 | 说明 |
| -------------------- | ---- | ------------ |
| SMS_ENCODING_UNKNOWN | 0 | 未知短信编码 |
| SMS_ENCODING_7BIT | 1 | 7位短信编码 |
| SMS_ENCODING_8BIT | 2 | 8位短信编码 |
| SMS_ENCODING_16BIT | 3 | 16位短信编码 |
## SimMessageOptions<sup>7+</sup>
SIM卡消息选项。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------------------------- | ---- | -------------- |
| slotId | number | 是 | 卡槽ID |
| smsc | string | 是 | 短消息业务中心 |
| pdu | string | 是 | 协议数据单元 |
| status | [SimMessageStatus](#simmessagestatus7) | 是 | 状态 |
## UpdateSimMessageOptions<sup>7+</sup>
更新SIM卡消息选项。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| --------- | -------------------------------------- | ---- | -------------- |
| slotId | number | 是 | 卡槽ID |
| msgIndex | number | 是 | 消息索引 |
| newStatus | [SimMessageStatus](#simmessagestatus7) | 是 | 新状态 |
| pdu | string | 是 | 协议数据单元 |
| smsc | string | 是 | 短消息业务中心 |
## SimShortMessage<sup>8+</sup>
SIM卡短消息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ---------------- | -------------------------------------- | ---- | ------------- |
| shortMessage | [ShortMessage](#shortmessage) | 是 | 短消息 |
| simMessageStatus | [SimMessageStatus](#simmessagestatus7) | 是 | SIM卡消息状态 |
| indexOnSim | number | 是 | SIM卡索引 |
## MmsDeliveryInd<sup>8+</sup>
彩信发送标识。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ---------------------------------- | ---- | ------ |
| messageId | string | 是 | 消息ID |
| date | number | 是 | 日期 |
| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 |
| status | number | 是 | 状态 |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
## MmsRespInd<sup>8+</sup>
彩信回复标志。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ---------------------------------- | ---- | -------- |
| transactionId | string | 是 | 事件ID |
| status | number | 是 | 状态 |
| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 |
| reportAllowed | [ReportType](#reporttype8) | 否 | 允许报告 |
## SmsSegmentsInfo<sup>8+</sup>
短信段信息。
此接口为系统接口。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ---------------------------------------- | ---- | ------------ |
| splitCount | number | 是 | 拆分计数 |
| encodeCount | number | 是 | 编码计数 |
| encodeCountRemaining | number | 是 | 剩余编码计数 |
| scheme | [SmsEncodingScheme](#smsencodingscheme8) | 是 | 短信编码方案 |
...@@ -328,6 +328,240 @@ promise.then((data) => { ...@@ -328,6 +328,240 @@ promise.then((data) => {
}); });
``` ```
## data.enableCellularData
enableCellularData(callback: AsyncCallback<void\>): void
启用蜂窝数据服务,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
data.enableCellularData((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## data.enableCellularData
enableCellularData(): Promise<void\>
启用蜂窝数据服务,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**返回值:**
| 类型 | 说明 |
| --------------- | ----------------------- |
| Promise\<void\> | 以Promise形式返回结果。 |
**示例:**
```js
let promise = data.enableCellularData();
promise.then((data) => {
console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`);
});
```
## data.disableCellularData
disableCellularData(callback: AsyncCallback<void\>): void
禁用蜂窝数据服务,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
data.disableCellularData((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## data.disableCellularData
disableCellularData(): Promise<void\>
禁用蜂窝数据服务,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**返回值:**
| 类型 | 说明 |
| --------------- | --------------------------- |
| Promise\<void\> | 以Promise形式返回禁用结果。 |
**示例:**
```js
let promise = data.disableCellularData();
promise.then((data) => {
console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`);
});
```
## data.enableCellularDataRoaming
enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void
启用蜂窝数据漫游,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br />0:卡槽1。<br />1:卡槽2。 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
data.enableCellularDataRoaming(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## data.enableCellularDataRoaming
enableCellularDataRoaming(slotId: number): Promise<void\>
启用蜂窝数据漫游,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br />0:卡槽1。<br />1:卡槽2。 |
**返回值:**
| 类型 | 说明 |
| --------------- | ------------------------- |
| Promise\<void\> | 以Promise形式返回启用结果 |
**示例:**
```js
let promise = data.enableCellularDataRoaming(0);
promise.then((data) => {
console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`);
});
```
## data.disableCellularDataRoaming
disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void
禁用蜂窝数据漫游,使用callback方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br />0:卡槽1。<br />1:卡槽2。 |
| callback | AsyncCallback\<void\> | 是 | 回调函数。 |
**示例:**
```js
data.disableCellularDataRoaming(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## data.disableCellularDataRoaming
disableCellularDataRoaming(slotId: number): Promise<void\>
禁用蜂窝数据漫游,使用Promise方式作为异步方法。
此接口为系统接口。
**需要权限**:ohos.permission.SET_TELEPHONY_STATE
**系统能力**:SystemCapability.Telephony.CellularData
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br />0:卡槽1。<br />1:卡槽2。 |
**返回值:**
| 类型 | 说明 |
| --------------- | ------------------------- |
| Promise\<void\> | 以Promise形式返回禁用结果 |
**示例:**
```js
let promise = data.disableCellularDataRoaming(0);
promise.then((data) => {
console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`);
}).catch((err) => {
console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`);
});
```
## DataFlowType ## DataFlowType
描述蜂窝数据流类型。 描述蜂窝数据流类型。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册