未验证 提交 62ddf600 编写于 作者: O openharmony_ci 提交者: Gitee

!23543 增加同步接口说明

Merge pull request !23543 from dingxiaochen/master
...@@ -394,6 +394,27 @@ promise.then(data => { ...@@ -394,6 +394,27 @@ promise.then(data => {
}); });
``` ```
## call.hasCallSync<sup>10+</sup>
hasCallSync\(\): boolean
判断是否存在通话。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ---------------------- |-------------|
| boolean | 返回判断是否存在通话。 |
**示例:**
```js
let hasCall = call.hasCallSync();
console.log(`hasCallSync success, has call is ' + hasCall);
```
## call.getCallState ## call.getCallState
...@@ -443,6 +464,27 @@ promise.then(data => { ...@@ -443,6 +464,27 @@ promise.then(data => {
}); });
``` ```
## call.getCallStateSync<sup>10+</sup>
getCallStateSync\(\): CallState
获取当前通话状态。
**系统能力**:SystemCapability.Telephony.CallManager
**返回值:**
| 类型 | 说明 |
| ------------------------------------- |-------------|
| [CallState](#callstate) | 返回获取到的通话状态。 |
**示例:**
```js
let callState = call.getCallStateSync();
console.log(`the call state is:` + callState);
```
## call.hasVoiceCapability<sup>7+</sup> ## call.hasVoiceCapability<sup>7+</sup>
hasVoiceCapability\(\): boolean hasVoiceCapability\(\): boolean
......
...@@ -390,6 +390,35 @@ promise.then(data => { ...@@ -390,6 +390,35 @@ promise.then(data => {
}); });
``` ```
## radio.getISOCountryCodeForNetworkSync<sup>10+</sup>
getISOCountryCodeForNetworkSync\(slotId: number\): string
获取注册网络所在国家的ISO国家码。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------------------------ |
| string | 返回注册网络所在国家的ISO国家码,例如CN(中国)。 |
**示例:**
```js
let slotId = 0;
let countryISO = radio.getISOCountryCodeForNetworkSync(slotId);
console.log(`the country ISO is:` + countryISO);
```
## radio.getPrimarySlotId<sup>7+</sup> ## radio.getPrimarySlotId<sup>7+</sup>
...@@ -542,6 +571,35 @@ promise.then(data => { ...@@ -542,6 +571,35 @@ promise.then(data => {
}); });
``` ```
## radio.getSignalInformationSync<sup>10+</sup>
getSignalInformationSync\(slotId: number\): Array\<SignalInformation\>
获取指定SIM卡槽对应的注册网络信号强度信息列表。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Array\<[SignalInformation](#signalinformation)\>| 返回网络信号强度[SignalInformation](#signalinformation)对象的数组。 |
**示例:**
```js
let slotId = 0;
let signalInfo = radio.getSignalInformationSync(slotId);
console.log(`signal information size is:` + signalInfo.size());
```
## radio.isNrSupported<sup>(deprecated)</sup> ## radio.isNrSupported<sup>(deprecated)</sup>
isNrSupported\(\): boolean isNrSupported\(\): boolean
...@@ -858,6 +916,35 @@ promise.then(data => { ...@@ -858,6 +916,35 @@ promise.then(data => {
}); });
``` ```
## radio.getOperatorNameSync<sup>10+</sup>
getOperatorNameSync\(slotId: number\): string
获取运营商名称。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------------------------ |
| string | 返回运营商名称,例如:中国移动。 |
**示例:**
```js
let slotId = 0;
let operatorName = radio.getOperatorNameSync(slotId);
console.log(`operator name is:` + operatorName);
```
## radio.setPrimarySlotId<sup>8+</sup> ## radio.setPrimarySlotId<sup>8+</sup>
setPrimarySlotId\(slotId: number, callback: AsyncCallback\<void\>\): void setPrimarySlotId\(slotId: number, callback: AsyncCallback\<void\>\): void
......
...@@ -68,6 +68,33 @@ promise.then(data => { ...@@ -68,6 +68,33 @@ promise.then(data => {
}); });
``` ```
## sim.isSimActiveSync<sup>10+</sup>
isSimActiveSync\(slotId: number\): boolean
获取指定卡槽SIM卡是否激活。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ---------------------------------- |
| boolean | 返回指定卡槽是否激活,如果激活返回true。 |
**示例:**
```js
let isSimActive = sim.isSimActiveSync(0);
console.log(`the sim is active:` + isSimActive);
```
## sim.getDefaultVoiceSlotId<sup>7+</sup> ## sim.getDefaultVoiceSlotId<sup>7+</sup>
...@@ -276,6 +303,34 @@ promise.then(data => { ...@@ -276,6 +303,34 @@ promise.then(data => {
}); });
``` ```
## sim.getISOCountryCodeForSimSync<sup>10+</sup>
getISOCountryCodeForSimSync\(slotId: number\): string
获取指定卡槽SIM卡的ISO国家码。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------------------------ |
| string | 返回获取指定卡槽SIM卡的ISO国家码,例如:CN(中国)。 |
**示例:**
```js
let countryCode = sim.getISOCountryCodeForSimSync(0);
console.log(`the country ISO is:` + countryCode);
```
## sim.getSimOperatorNumeric ## sim.getSimOperatorNumeric
...@@ -358,6 +413,34 @@ promise.then(data => { ...@@ -358,6 +413,34 @@ promise.then(data => {
}); });
``` ```
## sim.getSimOperatorNumericSync<sup>10+</sup>
getSimOperatorNumericSync\(slotId: number\): string
获取指定卡槽SIM卡的归属PLMN(Public Land Mobile Network)号。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------------ |
| string | 返回获取指定卡槽SIM卡的归属PLMN号。 |
**示例:**
```js
let numeric = sim.getSimOperatorNumericSync(0);
console.log(`the sim operator numeric is:` + numeric);
```
## sim.getSimSpn ## sim.getSimSpn
...@@ -440,6 +523,34 @@ promise.then(data => { ...@@ -440,6 +523,34 @@ promise.then(data => {
}); });
``` ```
## sim.getSimSpnSync<sup>10+</sup>
getSimSpnSync\(slotId: number\): string
获取指定卡槽SIM卡的服务提供商名称(Service Provider Name,SPN)。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ----------------------------------------- |
| string | 返回获取指定卡槽SIM卡的SPN。 |
**示例:**
```js
let spn = sim.getSimSpnSync(0);
console.log(`the sim card spn is:` + spn);
```
## sim.getSimState ## sim.getSimState
...@@ -520,6 +631,34 @@ promise.then(data => { ...@@ -520,6 +631,34 @@ promise.then(data => {
}); });
``` ```
## sim.getSimStateSync<sup>10+</sup>
getSimStateSync\(slotId: number\): SimState
获取指定卡槽的SIM卡状态。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------------------- | ------------------------------------------ |
| [SimState](#simstate) | 返回获取指定卡槽的SIM卡状态。 |
**示例:**
```js
let simState = sim.getSimStateSync(0);
console.log(`The sim state is:` + simState);
```
## sim.getCardType<sup>7+</sup> ## sim.getCardType<sup>7+</sup>
getCardType\(slotId: number, callback: AsyncCallback\<CardType\>\): void getCardType\(slotId: number, callback: AsyncCallback\<CardType\>\): void
...@@ -601,6 +740,34 @@ promise.then(data => { ...@@ -601,6 +740,34 @@ promise.then(data => {
}); });
``` ```
## sim.getCardTypeSync<sup>10+</sup>
getCardTypeSync\(slotId: number\): CardType
获取指定卡槽SIM卡的卡类型。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------------------------ |
| [CardType](#cardtype7) | 返回指定卡槽SIM卡的卡类型。 |
**示例:**
```js
let cardType = sim.getCardTypeSync(0);
console.log(`the card type is:` + cardType);
```
## sim.hasSimCard<sup>7+</sup> ## sim.hasSimCard<sup>7+</sup>
...@@ -681,6 +848,33 @@ promise.then(data => { ...@@ -681,6 +848,33 @@ promise.then(data => {
}); });
``` ```
## sim.hasSimCardSync<sup>10+</sup>
hasSimCardSync\(slotId: number\): boolean
获取指定卡槽SIM卡是否插卡。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ---------------------------------- |
| boolean | 返回指定卡槽是否插卡,如果插卡返回true。 |
**示例:**
```js
let hasSimCard = sim.hasSimCardSync(0);
console.log(`has sim card: ` + hasSimCard);
```
## sim.getSimAccountInfo<sup>10+</sup> ## sim.getSimAccountInfo<sup>10+</sup>
getSimAccountInfo\(slotId: number, callback: AsyncCallback\<IccAccountInfo\>\): void getSimAccountInfo\(slotId: number, callback: AsyncCallback\<IccAccountInfo\>\): void
...@@ -3903,6 +4097,34 @@ try { ...@@ -3903,6 +4097,34 @@ try {
} }
``` ```
## sim.getOpKeySync<sup>10+</sup>
getOpKeySync\(slotId: number\): string
获取指定卡槽中SIM卡的opkey。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ----------------------------------------- |
| string | 返回指定卡槽中SIM卡的opkey。 |
**示例:**
```js
let data = sim.getOpKeySync(0);
console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`);
```
## sim.getOpName<sup>9+</sup> ## sim.getOpName<sup>9+</sup>
getOpName\(slotId: number, callback: AsyncCallback\<string\>\): void getOpName\(slotId: number, callback: AsyncCallback\<string\>\): void
...@@ -3992,6 +4214,34 @@ try { ...@@ -3992,6 +4214,34 @@ try {
} }
``` ```
## sim.getOpNameSync<sup>10+</sup>
getOpNameSync\(slotId: number\): string
获取指定卡槽中SIM卡的OpName。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------------------------ |
| string | 返回指定卡槽中SIM卡的OpName。 |
**示例:**
```js
let data = sim.getOpNameSync(0);
console.log(`getOpName success, promise: data->${JSON.stringify(data)}`);
```
## sim.getDefaultVoiceSimId<sup>10+</sup> ## sim.getDefaultVoiceSimId<sup>10+</sup>
getDefaultVoiceSimId\(callback: AsyncCallback\<number\>\): void getDefaultVoiceSimId\(callback: AsyncCallback\<number\>\): void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册