1e41f4b71Sopenharmony_ci# @ohos.telephony.observer (observer)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci本模块提供订阅管理功能,可以订阅/取消订阅的事件包括:网络状态变化、信号状态变化、通话状态变化、蜂窝数据链路连接状态、蜂窝数据业务的上下行数据流状态、SIM状态变化。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>**说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## 导入模块
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci```ts
13e41f4b71Sopenharmony_ciimport { observer } from '@kit.TelephonyKit';
14e41f4b71Sopenharmony_ci```
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## observer.on('networkStateChange')
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_cion\(type: \'networkStateChange\', callback: Callback\<NetworkState\>\): void
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci订阅网络状态变化事件,使用callback方式作为异步方法。
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci**需要权限**:ohos.permission.GET_NETWORK_INFO
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci**参数:**
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci| 参数名   | 类型                                                      | 必填 | 说明                                                              |
29e41f4b71Sopenharmony_ci| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- |
30e41f4b71Sopenharmony_ci| type     | string                                                    | 是   | 网络状态变化事件,参数固定为'networkStateChange'。                 |
31e41f4b71Sopenharmony_ci| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 是   | 以callback形式异步返回结果。参考radio的[NetworkState](js-apis-radio.md#networkstate)。|
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**错误码:**
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
38e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
39e41f4b71Sopenharmony_ci| 201      | Permission denied.                           |
40e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
41e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
42e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
43e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
44e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci**示例:**
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci```ts
49e41f4b71Sopenharmony_ciobserver.on('networkStateChange', (data: observer.NetworkState) => {
50e41f4b71Sopenharmony_ci    console.log("on networkStateChange, data:" + JSON.stringify(data));
51e41f4b71Sopenharmony_ci});
52e41f4b71Sopenharmony_ci```
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci## observer.on('networkStateChange')
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_cion\(type: \'networkStateChange\', options: ObserverOptions, callback: Callback\<NetworkState\>\): void
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci订阅指定卡槽位的网络状态变化事件,使用callback方式作为异步方法。
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci**需要权限**:ohos.permission.GET_NETWORK_INFO
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci**参数:**
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci|  参数名  |                              类型                         | 必填 |                            说明                                   |
68e41f4b71Sopenharmony_ci| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- |
69e41f4b71Sopenharmony_ci| type     | string                                                    | 是   | 网络状态变化事件,参数固定为'networkStateChange'。                 |
70e41f4b71Sopenharmony_ci| options  | [ObserverOptions](#observeroptions11)                     | 是   | 电话相关事件订阅参数可选项。                                        |
71e41f4b71Sopenharmony_ci| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 是   | 以callback形式异步返回结果,参考radio的[NetworkState](js-apis-radio.md#networkstate)。 |
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci**错误码:**
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
78e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
79e41f4b71Sopenharmony_ci| 201      | Permission denied.                           |
80e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
81e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
82e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
83e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
84e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci**示例:**
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci```ts
89e41f4b71Sopenharmony_cilet options: observer.ObserverOptions = {
90e41f4b71Sopenharmony_ci    slotId: 0
91e41f4b71Sopenharmony_ci}
92e41f4b71Sopenharmony_ciobserver.on('networkStateChange', options, (data: observer.NetworkState) => {
93e41f4b71Sopenharmony_ci    console.log("on networkStateChange, data:" + JSON.stringify(data));
94e41f4b71Sopenharmony_ci});
95e41f4b71Sopenharmony_ci```
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci## observer.off('networkStateChange')
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_cioff\(type: \'networkStateChange\', callback?: Callback\<NetworkState\>\): void
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci取消订阅网络状态变化事件,使用callback方式作为异步方法。
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci>**说明:**
105e41f4b71Sopenharmony_ci>
106e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci**参数:**
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci| 参数名   | 类型                                                      | 必填 | 说明                                                         |
113e41f4b71Sopenharmony_ci| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
114e41f4b71Sopenharmony_ci| type     | string                                                    | 是   | 网络状态变化事件,参数固定为'networkStateChange'。                 |
115e41f4b71Sopenharmony_ci| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 否   | 以callback形式异步返回结果,参考radio的[NetworkState](js-apis-radio.md#networkstate)。 |
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci**错误码:**
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
122e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
123e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
124e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
125e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
126e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
127e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci**示例:**
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci```ts
132e41f4b71Sopenharmony_cilet callback: (data: observer.NetworkState) => void = (data: observer.NetworkState) => {
133e41f4b71Sopenharmony_ci    console.log("on networkStateChange, data:" + JSON.stringify(data));
134e41f4b71Sopenharmony_ci}
135e41f4b71Sopenharmony_ciobserver.on('networkStateChange', callback);
136e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
137e41f4b71Sopenharmony_ciobserver.off('networkStateChange', callback);
138e41f4b71Sopenharmony_ciobserver.off('networkStateChange');
139e41f4b71Sopenharmony_ci```
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci## observer.on('signalInfoChange')
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_cion\(type: \'signalInfoChange\', callback: Callback\<Array\<SignalInformation\>\>): void
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ci订阅信号状态变化事件,使用callback方式作为异步方法。
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ci**参数:**
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
152e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
153e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 信号状态变化事件,参数固定为'signalInfoChange'。              |
154e41f4b71Sopenharmony_ci| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | 是   | 以callback形式异步返回结果,参考radio的[SignalInformation](js-apis-radio.md#signalinformation)。 |
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci**错误码:**
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                     |
161e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
162e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
163e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
164e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
165e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
166e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci**示例:**
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci```ts
171e41f4b71Sopenharmony_ciimport { radio } from '@kit.TelephonyKit';
172e41f4b71Sopenharmony_ci
173e41f4b71Sopenharmony_ciobserver.on('signalInfoChange', (data: Array<radio.SignalInformation>) => {
174e41f4b71Sopenharmony_ci    console.log("on signalInfoChange, data:" + JSON.stringify(data));
175e41f4b71Sopenharmony_ci});
176e41f4b71Sopenharmony_ci```
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci## observer.on('signalInfoChange')
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_cion\(type: \'signalInfoChange\', options: ObserverOptions, callback: Callback\<Array\<SignalInformation\>\>): void
182e41f4b71Sopenharmony_ci
183e41f4b71Sopenharmony_ci订阅指定卡槽位的信号状态变化事件,使用callback方式作为异步方法。
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ci**参数:**
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
190e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
191e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 信号状态变化事件,参数固定为'signalInfoChange'。              |
192e41f4b71Sopenharmony_ci| options  | [ObserverOptions](#observeroptions11)                        | 是   | 电话相关事件订阅参数可选项。                                   |
193e41f4b71Sopenharmony_ci| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | 是   | 以callback形式异步返回结果,参考radio的[SignalInformation](js-apis-radio.md#signalinformation)。 |
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci**错误码:**
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
200e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
201e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
202e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
203e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
204e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
205e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_ci**示例:**
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ci```ts
210e41f4b71Sopenharmony_ciimport { radio } from '@kit.TelephonyKit';
211e41f4b71Sopenharmony_ci
212e41f4b71Sopenharmony_cilet options: observer.ObserverOptions = {
213e41f4b71Sopenharmony_ci    slotId: 0
214e41f4b71Sopenharmony_ci}
215e41f4b71Sopenharmony_ciobserver.on('signalInfoChange', options, (data: Array<radio.SignalInformation>) => {
216e41f4b71Sopenharmony_ci    console.log("on signalInfoChange, data:" + JSON.stringify(data));
217e41f4b71Sopenharmony_ci});
218e41f4b71Sopenharmony_ci```
219e41f4b71Sopenharmony_ci
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci## observer.off('signalInfoChange')
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_cioff\(type: \'signalInfoChange\', callback?: Callback\<Array\<SignalInformation\>\>): void
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ci取消订阅信号状态变化事件,使用callback方式作为异步方法。
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci>**说明:**
228e41f4b71Sopenharmony_ci>
229e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ci**参数:**
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
236e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
237e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 信号状态变化事件,参数固定为'signalInfoChange'。              |
238e41f4b71Sopenharmony_ci| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | 否   | 以callback形式异步返回结果,参考radio的[SignalInformation](js-apis-radio.md#signalinformation)。 |
239e41f4b71Sopenharmony_ci
240e41f4b71Sopenharmony_ci**错误码:**
241e41f4b71Sopenharmony_ci
242e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
243e41f4b71Sopenharmony_ci
244e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
245e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
246e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
247e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
248e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
249e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
250e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
251e41f4b71Sopenharmony_ci
252e41f4b71Sopenharmony_ci**示例:**
253e41f4b71Sopenharmony_ci
254e41f4b71Sopenharmony_ci```ts
255e41f4b71Sopenharmony_ciimport { radio } from '@kit.TelephonyKit';
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_cilet callback: (data: Array<radio.SignalInformation>) => void = (data: Array<radio.SignalInformation>) => {
258e41f4b71Sopenharmony_ci    console.log("on signalInfoChange, data:" + JSON.stringify(data));
259e41f4b71Sopenharmony_ci}
260e41f4b71Sopenharmony_ciobserver.on('signalInfoChange', callback);
261e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
262e41f4b71Sopenharmony_ciobserver.off('signalInfoChange', callback);
263e41f4b71Sopenharmony_ciobserver.off('signalInfoChange');
264e41f4b71Sopenharmony_ci```
265e41f4b71Sopenharmony_ci
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci## observer.on('callStateChange')
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_cion(type: 'callStateChange', callback: Callback\<CallStateInfo\>): void
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci订阅通话状态变化事件,使用callback方式作为异步方法。
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci>**说明:**
274e41f4b71Sopenharmony_ci>
275e41f4b71Sopenharmony_ci>获取电话号码时需要ohos.permission.READ_CALL_LOG权限,该权限为系统权限。
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
278e41f4b71Sopenharmony_ci
279e41f4b71Sopenharmony_ci**参数:**
280e41f4b71Sopenharmony_ci
281e41f4b71Sopenharmony_ci| 参数名   | 类型                                           | 必填 | 说明                                                        |
282e41f4b71Sopenharmony_ci| -------- | --------------------------------------------- | ---- | ----------------------------------------------------------- |
283e41f4b71Sopenharmony_ci| type     | string                                        | 是   | 通话状态变化事件,参数固定为'callStateChange'。                |
284e41f4b71Sopenharmony_ci| callback | Callback\<[CallStateInfo](#callstateinfo11)\> | 是   | 以callback形式异步返回结果,参考call的[CallState](js-apis-call.md#callstate)<br />number:电话号码。 |
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ci**错误码:**
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
289e41f4b71Sopenharmony_ci
290e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
291e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
292e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
293e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
294e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
295e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
296e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
297e41f4b71Sopenharmony_ci
298e41f4b71Sopenharmony_ci**示例:**
299e41f4b71Sopenharmony_ci
300e41f4b71Sopenharmony_ci```ts
301e41f4b71Sopenharmony_ciobserver.on('callStateChange', (data: observer.CallStateInfo) => {
302e41f4b71Sopenharmony_ci    console.log("on callStateChange, data:" + JSON.stringify(data));
303e41f4b71Sopenharmony_ci});
304e41f4b71Sopenharmony_ci```
305e41f4b71Sopenharmony_ci
306e41f4b71Sopenharmony_ci
307e41f4b71Sopenharmony_ci## observer.on('callStateChange')
308e41f4b71Sopenharmony_ci
309e41f4b71Sopenharmony_cion(type: 'callStateChange', options: ObserverOptions, callback: Callback\<CallStateInfo\>): void
310e41f4b71Sopenharmony_ci
311e41f4b71Sopenharmony_ci订阅通话状态变化事件,使用callback方式作为异步方法。
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci>**说明:**
314e41f4b71Sopenharmony_ci>
315e41f4b71Sopenharmony_ci>获取电话号码时需要ohos.permission.READ_CALL_LOG权限,该权限为系统权限。
316e41f4b71Sopenharmony_ci
317e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
318e41f4b71Sopenharmony_ci
319e41f4b71Sopenharmony_ci**参数:**
320e41f4b71Sopenharmony_ci
321e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
322e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
323e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 通话状态变化事件,参数固定为'callStateChange'。               |
324e41f4b71Sopenharmony_ci| options  | [ObserverOptions](#observeroptions11)                        | 是   | 电话相关事件订阅参数可选项。                                  |
325e41f4b71Sopenharmony_ci| callback | Callback\<[CallStateInfo](#callstateinfo11)\>                | 是   | 以callback形式异步返回结果,参考call的[CallState](js-apis-call.md#callstate)<br />number:电话号码。 |
326e41f4b71Sopenharmony_ci
327e41f4b71Sopenharmony_ci**错误码:**
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
332e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
333e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
334e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
335e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
336e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
337e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
338e41f4b71Sopenharmony_ci
339e41f4b71Sopenharmony_ci**示例:**
340e41f4b71Sopenharmony_ci
341e41f4b71Sopenharmony_ci```ts
342e41f4b71Sopenharmony_cilet options: observer.ObserverOptions = {
343e41f4b71Sopenharmony_ci    slotId: 0
344e41f4b71Sopenharmony_ci}
345e41f4b71Sopenharmony_ciobserver.on('callStateChange', options, (data: observer.CallStateInfo) => {
346e41f4b71Sopenharmony_ci    console.log("on callStateChange, data:" + JSON.stringify(data));
347e41f4b71Sopenharmony_ci});
348e41f4b71Sopenharmony_ci```
349e41f4b71Sopenharmony_ci
350e41f4b71Sopenharmony_ci
351e41f4b71Sopenharmony_ci## observer.off('callStateChange')
352e41f4b71Sopenharmony_ci
353e41f4b71Sopenharmony_cioff(type: 'callStateChange', callback?: Callback\<CallStateInfo\>): void
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_ci取消订阅通话状态变化事件,使用callback方式作为异步方法。
356e41f4b71Sopenharmony_ci
357e41f4b71Sopenharmony_ci>**说明:**
358e41f4b71Sopenharmony_ci>
359e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
360e41f4b71Sopenharmony_ci
361e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
362e41f4b71Sopenharmony_ci
363e41f4b71Sopenharmony_ci**参数:**
364e41f4b71Sopenharmony_ci
365e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
366e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
367e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 通话状态变化事件,参数固定为'callStateChange'。               |
368e41f4b71Sopenharmony_ci| callback | Callback\<[CallStateInfo](#callstateinfo11)\>                | 否   | 以callback形式异步返回结果,参考call的[CallState](js-apis-call.md#callstate)<br />number:电话号码。 |
369e41f4b71Sopenharmony_ci
370e41f4b71Sopenharmony_ci**错误码:**
371e41f4b71Sopenharmony_ci
372e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
373e41f4b71Sopenharmony_ci
374e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
375e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
376e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
377e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
378e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
379e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
380e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
381e41f4b71Sopenharmony_ci
382e41f4b71Sopenharmony_ci**示例:**
383e41f4b71Sopenharmony_ci
384e41f4b71Sopenharmony_ci```ts
385e41f4b71Sopenharmony_cilet callback: (data: observer.CallStateInfo) => void = (data: observer.CallStateInfo) => {
386e41f4b71Sopenharmony_ci    console.log("on callStateChange, data:" + JSON.stringify(data));
387e41f4b71Sopenharmony_ci}
388e41f4b71Sopenharmony_ciobserver.on('callStateChange', callback);
389e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
390e41f4b71Sopenharmony_ciobserver.off('callStateChange', callback);
391e41f4b71Sopenharmony_ciobserver.off('callStateChange');
392e41f4b71Sopenharmony_ci```
393e41f4b71Sopenharmony_ci
394e41f4b71Sopenharmony_ci
395e41f4b71Sopenharmony_ci## observer.on('cellularDataConnectionStateChange')<sup>7+</sup>
396e41f4b71Sopenharmony_ci
397e41f4b71Sopenharmony_cion\(type: 'cellularDataConnectionStateChange', callback: Callback\<DataConnectionStateInfo\>\): void
398e41f4b71Sopenharmony_ci
399e41f4b71Sopenharmony_ci订阅蜂窝数据链路连接状态,使用callback方式作为异步方法。
400e41f4b71Sopenharmony_ci
401e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
402e41f4b71Sopenharmony_ci
403e41f4b71Sopenharmony_ci**参数:**
404e41f4b71Sopenharmony_ci
405e41f4b71Sopenharmony_ci| 参数名   | 类型                               | 必填 | 说明                                                                 |
406e41f4b71Sopenharmony_ci| -------- | --------------------------------- | ---- | -------------------------------------------------------------------- |
407e41f4b71Sopenharmony_ci| type     | string                            | 是   | 蜂窝数据链路连接状态事件,参数固定为'cellularDataConnectionStateChange'。|
408e41f4b71Sopenharmony_ci| callback | Callback\<[DataConnectionStateInfo](#dataconnectionstateinfo11)\>  | 是   | 以callback形式异步返回结果,参考data的[DataConnectState](js-apis-telephony-data.md#dataconnectstate),radio的[RadioTechnology](js-apis-radio.md#radiotechnology)。 |
409e41f4b71Sopenharmony_ci
410e41f4b71Sopenharmony_ci**错误码:**
411e41f4b71Sopenharmony_ci
412e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
413e41f4b71Sopenharmony_ci
414e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
415e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
416e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
417e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
418e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
419e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
420e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
421e41f4b71Sopenharmony_ci
422e41f4b71Sopenharmony_ci**示例:**
423e41f4b71Sopenharmony_ci
424e41f4b71Sopenharmony_ci```ts
425e41f4b71Sopenharmony_ciobserver.on('cellularDataConnectionStateChange', (data: observer.DataConnectionStateInfo) => {
426e41f4b71Sopenharmony_ci    console.log("on cellularDataConnectionStateChange, data:" + JSON.stringify(data));
427e41f4b71Sopenharmony_ci});
428e41f4b71Sopenharmony_ci```
429e41f4b71Sopenharmony_ci
430e41f4b71Sopenharmony_ci
431e41f4b71Sopenharmony_ci## observer.on('cellularDataConnectionStateChange')<sup>7+</sup>
432e41f4b71Sopenharmony_ci
433e41f4b71Sopenharmony_cion\(type: 'cellularDataConnectionStateChange', options: ObserverOptions, callback: Callback\<DataConnectionStateInfo\>\): void
434e41f4b71Sopenharmony_ci
435e41f4b71Sopenharmony_ci订阅指定卡槽位的蜂窝数据链路连接状态,使用callback方式作为异步方法。
436e41f4b71Sopenharmony_ci
437e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
438e41f4b71Sopenharmony_ci
439e41f4b71Sopenharmony_ci**参数:**
440e41f4b71Sopenharmony_ci
441e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
442e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
443e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 蜂窝数据链路连接状态事件,参数固定为'cellularDataConnectionStateChange'。|
444e41f4b71Sopenharmony_ci| options  | [ObserverOptions](#observeroptions11)                        | 是   | 电话相关事件订阅参数可选项。             |
445e41f4b71Sopenharmony_ci| callback | Callback\<[DataConnectionStateInfo](#dataconnectionstateinfo11)\> | 是   | 以callback形式异步返回结果,参考data的[DataConnectState](js-apis-telephony-data.md#dataconnectstate),radio的[RadioTechnology](js-apis-radio.md#radiotechnology)。 |
446e41f4b71Sopenharmony_ci
447e41f4b71Sopenharmony_ci**错误码:**
448e41f4b71Sopenharmony_ci
449e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
450e41f4b71Sopenharmony_ci
451e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
452e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
453e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
454e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
455e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
456e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
457e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
458e41f4b71Sopenharmony_ci
459e41f4b71Sopenharmony_ci**示例:**
460e41f4b71Sopenharmony_ci
461e41f4b71Sopenharmony_ci```ts
462e41f4b71Sopenharmony_cilet options: observer.ObserverOptions = {
463e41f4b71Sopenharmony_ci    slotId: 0
464e41f4b71Sopenharmony_ci}
465e41f4b71Sopenharmony_ciobserver.on('cellularDataConnectionStateChange', options, (data: observer.DataConnectionStateInfo) => {
466e41f4b71Sopenharmony_ci    console.log("on cellularDataConnectionStateChange, data:" + JSON.stringify(data));
467e41f4b71Sopenharmony_ci});
468e41f4b71Sopenharmony_ci```
469e41f4b71Sopenharmony_ci
470e41f4b71Sopenharmony_ci
471e41f4b71Sopenharmony_ci## observer.off('cellularDataConnectionStateChange')<sup>7+</sup>
472e41f4b71Sopenharmony_ci
473e41f4b71Sopenharmony_cioff\(type: 'cellularDataConnectionStateChange',  callback?: Callback\<DataConnectionStateInfo\>\): void
474e41f4b71Sopenharmony_ci
475e41f4b71Sopenharmony_ci移除订阅蜂窝数据链路连接状态,使用callback方式作为异步方法。
476e41f4b71Sopenharmony_ci
477e41f4b71Sopenharmony_ci>**说明:**
478e41f4b71Sopenharmony_ci>
479e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
480e41f4b71Sopenharmony_ci
481e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
482e41f4b71Sopenharmony_ci
483e41f4b71Sopenharmony_ci**参数:**
484e41f4b71Sopenharmony_ci
485e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
486e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
487e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 蜂窝数据链路连接状态事件,参数固定为'cellularDataConnectionStateChange'。|
488e41f4b71Sopenharmony_ci| callback | Callback\<[DataConnectionStateInfo](#dataconnectionstateinfo11)\> | 否   | 以callback形式异步返回结果,参考data的[DataConnectState](js-apis-telephony-data.md#dataconnectstate),radio的[RadioTechnology](js-apis-radio.md#radiotechnology)。 |
489e41f4b71Sopenharmony_ci
490e41f4b71Sopenharmony_ci**错误码:**
491e41f4b71Sopenharmony_ci
492e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
493e41f4b71Sopenharmony_ci
494e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
495e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
496e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
497e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
498e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
499e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
500e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
501e41f4b71Sopenharmony_ci
502e41f4b71Sopenharmony_ci**示例:**
503e41f4b71Sopenharmony_ci
504e41f4b71Sopenharmony_ci```ts
505e41f4b71Sopenharmony_cilet callback: (data: observer.DataConnectionStateInfo) => void = (data: observer.DataConnectionStateInfo) => {
506e41f4b71Sopenharmony_ci    console.log("on cellularDataConnectionStateChange, data:" + JSON.stringify(data));
507e41f4b71Sopenharmony_ci}
508e41f4b71Sopenharmony_ciobserver.on('cellularDataConnectionStateChange', callback);
509e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
510e41f4b71Sopenharmony_ciobserver.off('cellularDataConnectionStateChange', callback);
511e41f4b71Sopenharmony_ciobserver.off('cellularDataConnectionStateChange');
512e41f4b71Sopenharmony_ci```
513e41f4b71Sopenharmony_ci
514e41f4b71Sopenharmony_ci
515e41f4b71Sopenharmony_ci## observer.on('cellularDataFlowChange')<sup>7+</sup>
516e41f4b71Sopenharmony_ci
517e41f4b71Sopenharmony_cion\(type: 'cellularDataFlowChange', callback: Callback\<DataFlowType\>\): void
518e41f4b71Sopenharmony_ci
519e41f4b71Sopenharmony_ci订阅蜂窝数据业务的上下行数据流状态,使用callback方式作为异步方法。
520e41f4b71Sopenharmony_ci
521e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
522e41f4b71Sopenharmony_ci
523e41f4b71Sopenharmony_ci**参数:**
524e41f4b71Sopenharmony_ci
525e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
526e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
527e41f4b71Sopenharmony_ci| type     | string                                                       | 是  | 蜂窝数据业务的上下行数据流状态状态事件,参数固定为'cellularDataFlowChange'。         |
528e41f4b71Sopenharmony_ci| callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | 是   | 以callback形式异步返回结果,参考data的[DataFlowType](js-apis-telephony-data.md#dataflowtype)。 |
529e41f4b71Sopenharmony_ci
530e41f4b71Sopenharmony_ci**错误码:**
531e41f4b71Sopenharmony_ci
532e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
533e41f4b71Sopenharmony_ci
534e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
535e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
536e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
537e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
538e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
539e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
540e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
541e41f4b71Sopenharmony_ci
542e41f4b71Sopenharmony_ci**示例:**
543e41f4b71Sopenharmony_ci
544e41f4b71Sopenharmony_ci```ts
545e41f4b71Sopenharmony_ciimport { data } from '@kit.TelephonyKit';
546e41f4b71Sopenharmony_ci
547e41f4b71Sopenharmony_ciobserver.on('cellularDataFlowChange', (data: data.DataFlowType) => {
548e41f4b71Sopenharmony_ci    console.log("on cellularDataFlowChange, data:" + JSON.stringify(data));
549e41f4b71Sopenharmony_ci});
550e41f4b71Sopenharmony_ci```
551e41f4b71Sopenharmony_ci
552e41f4b71Sopenharmony_ci
553e41f4b71Sopenharmony_ci## observer.on('cellularDataFlowChange')<sup>7+</sup>
554e41f4b71Sopenharmony_ci
555e41f4b71Sopenharmony_cion\(type: 'cellularDataFlowChange', options: ObserverOptions,  callback: Callback\<DataFlowType\>\): void
556e41f4b71Sopenharmony_ci
557e41f4b71Sopenharmony_ci订阅指定卡槽位的蜂窝数据业务的上下行数据流状态,使用callback方式作为异步方法。
558e41f4b71Sopenharmony_ci
559e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
560e41f4b71Sopenharmony_ci
561e41f4b71Sopenharmony_ci**参数:**
562e41f4b71Sopenharmony_ci
563e41f4b71Sopenharmony_ci| 参数名   | 类型                                                       | 必填 | 说明                                                         |
564e41f4b71Sopenharmony_ci| -------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
565e41f4b71Sopenharmony_ci| type     | string                                                     | 是   | 蜂窝数据业务的上下行数据流状态状态事件,参数固定为'cellularDataFlowChange'。         |
566e41f4b71Sopenharmony_ci| options   | [ObserverOptions](#observeroptions11)                     | 是   | 电话相关事件订阅参数可选项。                                                   |
567e41f4b71Sopenharmony_ci| callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | 是   | 以callback形式异步返回结果,参考data的[DataFlowType](js-apis-telephony-data.md#dataflowtype)。 |
568e41f4b71Sopenharmony_ci
569e41f4b71Sopenharmony_ci**错误码:**
570e41f4b71Sopenharmony_ci
571e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
572e41f4b71Sopenharmony_ci
573e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
574e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
575e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
576e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
577e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
578e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
579e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
580e41f4b71Sopenharmony_ci
581e41f4b71Sopenharmony_ci**示例:**
582e41f4b71Sopenharmony_ci
583e41f4b71Sopenharmony_ci```ts
584e41f4b71Sopenharmony_ciimport { data } from '@kit.TelephonyKit';
585e41f4b71Sopenharmony_ci
586e41f4b71Sopenharmony_cilet options: observer.ObserverOptions = {
587e41f4b71Sopenharmony_ci    slotId: 0
588e41f4b71Sopenharmony_ci}
589e41f4b71Sopenharmony_ciobserver.on('cellularDataFlowChange', options, (data: data.DataFlowType) => {
590e41f4b71Sopenharmony_ci    console.log("on cellularDataFlowChange, data:" + JSON.stringify(data));
591e41f4b71Sopenharmony_ci});
592e41f4b71Sopenharmony_ci```
593e41f4b71Sopenharmony_ci
594e41f4b71Sopenharmony_ci
595e41f4b71Sopenharmony_ci## observer.off('cellularDataFlowChange')<sup>7+</sup>
596e41f4b71Sopenharmony_ci
597e41f4b71Sopenharmony_cioff\(type: 'cellularDataFlowChange', callback?: Callback\<DataFlowType\>\): void
598e41f4b71Sopenharmony_ci
599e41f4b71Sopenharmony_ci移除订阅蜂窝数据业务的上下行数据流状态,使用callback方式作为异步方法。
600e41f4b71Sopenharmony_ci
601e41f4b71Sopenharmony_ci>**说明:**
602e41f4b71Sopenharmony_ci>
603e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
604e41f4b71Sopenharmony_ci
605e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
606e41f4b71Sopenharmony_ci
607e41f4b71Sopenharmony_ci**参数:**
608e41f4b71Sopenharmony_ci
609e41f4b71Sopenharmony_ci| 参数名   | 类型                                                                | 必填 | 说明                                                         |
610e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
611e41f4b71Sopenharmony_ci| type     | string                                                             | 是   | 蜂窝数据业务的上下行数据流状态状态事件,参数固定为'cellularDataFlowChange'。   |
612e41f4b71Sopenharmony_ci| callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | 否   | 以callback形式异步返回结果,参考data的[DataFlowType](js-apis-telephony-data.md#dataflowtype)。 |
613e41f4b71Sopenharmony_ci
614e41f4b71Sopenharmony_ci**错误码:**
615e41f4b71Sopenharmony_ci
616e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
617e41f4b71Sopenharmony_ci
618e41f4b71Sopenharmony_ci| 错误码ID |                  错误信息                    |
619e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
620e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
621e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
622e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
623e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
624e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
625e41f4b71Sopenharmony_ci
626e41f4b71Sopenharmony_ci**示例:**
627e41f4b71Sopenharmony_ci
628e41f4b71Sopenharmony_ci```ts
629e41f4b71Sopenharmony_ciimport { data } from '@kit.TelephonyKit';
630e41f4b71Sopenharmony_ci
631e41f4b71Sopenharmony_cilet callback: (data: data.DataFlowType) => void = (data: data.DataFlowType) => {
632e41f4b71Sopenharmony_ci    console.log("on cellularDataFlowChange, data:" + JSON.stringify(data));
633e41f4b71Sopenharmony_ci}
634e41f4b71Sopenharmony_ciobserver.on('cellularDataFlowChange', callback);
635e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
636e41f4b71Sopenharmony_ciobserver.off('cellularDataFlowChange', callback);
637e41f4b71Sopenharmony_ciobserver.off('cellularDataFlowChange');
638e41f4b71Sopenharmony_ci```
639e41f4b71Sopenharmony_ci
640e41f4b71Sopenharmony_ci
641e41f4b71Sopenharmony_ci## observer.on('simStateChange')<sup>7+</sup>
642e41f4b71Sopenharmony_ci
643e41f4b71Sopenharmony_cion\(type: 'simStateChange', callback: Callback\<SimStateData\>\): void
644e41f4b71Sopenharmony_ci
645e41f4b71Sopenharmony_ci订阅sim状态更改事件,使用callback方式作为异步方法。
646e41f4b71Sopenharmony_ci
647e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
648e41f4b71Sopenharmony_ci
649e41f4b71Sopenharmony_ci**参数:**
650e41f4b71Sopenharmony_ci
651e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
652e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
653e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | sim状态更改事件,参数固定为'simStateChange'。                 |
654e41f4b71Sopenharmony_ci| callback | Callback\<[SimStateData](#simstatedata7)\> | 是   | 以callback形式异步返回结果。 |
655e41f4b71Sopenharmony_ci
656e41f4b71Sopenharmony_ci**错误码:**
657e41f4b71Sopenharmony_ci
658e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
659e41f4b71Sopenharmony_ci
660e41f4b71Sopenharmony_ci| 错误码ID |                 错误信息                     |
661e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
662e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
663e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
664e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
665e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
666e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
667e41f4b71Sopenharmony_ci
668e41f4b71Sopenharmony_ci**示例:**
669e41f4b71Sopenharmony_ci
670e41f4b71Sopenharmony_ci```ts
671e41f4b71Sopenharmony_ciobserver.on('simStateChange', (data: observer.SimStateData) => {
672e41f4b71Sopenharmony_ci    console.log("on simStateChange, data:" + JSON.stringify(data));
673e41f4b71Sopenharmony_ci});
674e41f4b71Sopenharmony_ci```
675e41f4b71Sopenharmony_ci
676e41f4b71Sopenharmony_ci
677e41f4b71Sopenharmony_ci## observer.on('simStateChange')<sup>7+</sup>
678e41f4b71Sopenharmony_ci
679e41f4b71Sopenharmony_cion\(type: 'simStateChange', options: ObserverOptions, callback: Callback\<SimStateData\>\): void
680e41f4b71Sopenharmony_ci
681e41f4b71Sopenharmony_ci订阅指定卡槽位的sim状态更改事件,使用callback方式作为异步方法。
682e41f4b71Sopenharmony_ci
683e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
684e41f4b71Sopenharmony_ci
685e41f4b71Sopenharmony_ci**参数:**
686e41f4b71Sopenharmony_ci
687e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
688e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
689e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | sim状态更改事件,参数固定为'simStateChange'。                 |
690e41f4b71Sopenharmony_ci| options   | [ObserverOptions](#observeroptions11)                       | 是   | 电话相关事件订阅参数可选项。                                  |
691e41f4b71Sopenharmony_ci| callback | Callback\<[SimStateData](#simstatedata7)\> | 是   | 以callback形式异步返回结果。 |
692e41f4b71Sopenharmony_ci
693e41f4b71Sopenharmony_ci**错误码:**
694e41f4b71Sopenharmony_ci
695e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
696e41f4b71Sopenharmony_ci
697e41f4b71Sopenharmony_ci| 错误码ID |                 错误信息                     |
698e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
699e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
700e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
701e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
702e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
703e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
704e41f4b71Sopenharmony_ci
705e41f4b71Sopenharmony_ci**示例:**
706e41f4b71Sopenharmony_ci
707e41f4b71Sopenharmony_ci```ts
708e41f4b71Sopenharmony_cilet options: observer.ObserverOptions = {
709e41f4b71Sopenharmony_ci    slotId: 0
710e41f4b71Sopenharmony_ci}
711e41f4b71Sopenharmony_ciobserver.on('simStateChange', options, (data: observer.SimStateData) => {
712e41f4b71Sopenharmony_ci    console.log("on simStateChange, data:" + JSON.stringify(data));
713e41f4b71Sopenharmony_ci});
714e41f4b71Sopenharmony_ci```
715e41f4b71Sopenharmony_ci
716e41f4b71Sopenharmony_ci
717e41f4b71Sopenharmony_ci## observer.off('simStateChange')<sup>7+</sup>
718e41f4b71Sopenharmony_ci
719e41f4b71Sopenharmony_cioff\(type: 'simStateChange', callback?: Callback\<SimStateData\>\): void
720e41f4b71Sopenharmony_ci
721e41f4b71Sopenharmony_ci移除订阅sim状态更改事件,使用callback方式作为异步方法。
722e41f4b71Sopenharmony_ci
723e41f4b71Sopenharmony_ci>**说明:**
724e41f4b71Sopenharmony_ci>
725e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
726e41f4b71Sopenharmony_ci
727e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
728e41f4b71Sopenharmony_ci
729e41f4b71Sopenharmony_ci**参数:**
730e41f4b71Sopenharmony_ci
731e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
732e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
733e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | sim状态更改事件,参数固定为'simStateChange'。                 |
734e41f4b71Sopenharmony_ci| callback | Callback\<[SimStateData](#simstatedata7)\> | 否   | 以callback形式异步返回结果。 |
735e41f4b71Sopenharmony_ci
736e41f4b71Sopenharmony_ci**错误码:**
737e41f4b71Sopenharmony_ci
738e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
739e41f4b71Sopenharmony_ci
740e41f4b71Sopenharmony_ci| 错误码ID |                 错误信息                     |
741e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
742e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
743e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
744e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
745e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
746e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
747e41f4b71Sopenharmony_ci
748e41f4b71Sopenharmony_ci**示例:**
749e41f4b71Sopenharmony_ci
750e41f4b71Sopenharmony_ci```ts
751e41f4b71Sopenharmony_cilet callback: (data: observer.SimStateData) => void = (data: observer.SimStateData) => {
752e41f4b71Sopenharmony_ci    console.log("on simStateChange, data:" + JSON.stringify(data));
753e41f4b71Sopenharmony_ci}
754e41f4b71Sopenharmony_ciobserver.on('simStateChange', callback);
755e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
756e41f4b71Sopenharmony_ciobserver.off('simStateChange', callback);
757e41f4b71Sopenharmony_ciobserver.off('simStateChange');
758e41f4b71Sopenharmony_ci```
759e41f4b71Sopenharmony_ci
760e41f4b71Sopenharmony_ci## observer.on('iccAccountInfoChange')<sup>10+</sup>
761e41f4b71Sopenharmony_ci
762e41f4b71Sopenharmony_cion\(type: 'iccAccountInfoChange', callback: Callback\<void\>\): void
763e41f4b71Sopenharmony_ci
764e41f4b71Sopenharmony_ci订阅卡帐户变化事件,使用callback方式作为异步方法。
765e41f4b71Sopenharmony_ci
766e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
767e41f4b71Sopenharmony_ci
768e41f4b71Sopenharmony_ci**参数:**
769e41f4b71Sopenharmony_ci
770e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
771e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
772e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 卡帐户变化事件,参数固定为'iccAccountInfoChange'。                 |
773e41f4b71Sopenharmony_ci| callback | Callback\<void\> | 是   | 以callback形式异步返回结果。 |
774e41f4b71Sopenharmony_ci
775e41f4b71Sopenharmony_ci**错误码:**
776e41f4b71Sopenharmony_ci
777e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
778e41f4b71Sopenharmony_ci
779e41f4b71Sopenharmony_ci| 错误码ID |                 错误信息                     |
780e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
781e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
782e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
783e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
784e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
785e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
786e41f4b71Sopenharmony_ci
787e41f4b71Sopenharmony_ci**示例:**
788e41f4b71Sopenharmony_ci
789e41f4b71Sopenharmony_ci```ts
790e41f4b71Sopenharmony_ciobserver.on('iccAccountInfoChange', () => {
791e41f4b71Sopenharmony_ci    console.log("on iccAccountInfoChange success");
792e41f4b71Sopenharmony_ci});
793e41f4b71Sopenharmony_ci```
794e41f4b71Sopenharmony_ci
795e41f4b71Sopenharmony_ci
796e41f4b71Sopenharmony_ci## observer.off('iccAccountInfoChange')<sup>10+</sup>
797e41f4b71Sopenharmony_ci
798e41f4b71Sopenharmony_cioff\(type: 'iccAccountInfoChange', callback?: Callback\<void\>\): void
799e41f4b71Sopenharmony_ci
800e41f4b71Sopenharmony_ci移除订阅卡帐户变化事件,使用callback方式作为异步方法。
801e41f4b71Sopenharmony_ci
802e41f4b71Sopenharmony_ci>**说明:**
803e41f4b71Sopenharmony_ci>
804e41f4b71Sopenharmony_ci>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
805e41f4b71Sopenharmony_ci
806e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
807e41f4b71Sopenharmony_ci
808e41f4b71Sopenharmony_ci**参数:**
809e41f4b71Sopenharmony_ci
810e41f4b71Sopenharmony_ci| 参数名   | 类型                                                         | 必填 | 说明                                                         |
811e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
812e41f4b71Sopenharmony_ci| type     | string                                                       | 是   | 卡帐户变化事件,参数固定为'iccAccountInfoChange'。                 |
813e41f4b71Sopenharmony_ci| callback | Callback\<void\> | 否   | 以callback形式异步返回结果。 |
814e41f4b71Sopenharmony_ci
815e41f4b71Sopenharmony_ci**错误码:**
816e41f4b71Sopenharmony_ci
817e41f4b71Sopenharmony_ci以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](errorcode-telephony.md)。
818e41f4b71Sopenharmony_ci
819e41f4b71Sopenharmony_ci| 错误码ID |                 错误信息                     |
820e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- |
821e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.                             |
822e41f4b71Sopenharmony_ci| 8300001  | Invalid parameter value.                     |
823e41f4b71Sopenharmony_ci| 8300002  | Service connection failed.                   |
824e41f4b71Sopenharmony_ci| 8300003  | System internal error.                       |
825e41f4b71Sopenharmony_ci| 8300999  | Unknown error.                               |
826e41f4b71Sopenharmony_ci
827e41f4b71Sopenharmony_ci**示例:**
828e41f4b71Sopenharmony_ci
829e41f4b71Sopenharmony_ci```ts
830e41f4b71Sopenharmony_cilet callback: () => void = () => {
831e41f4b71Sopenharmony_ci    console.log("on iccAccountInfoChange success");
832e41f4b71Sopenharmony_ci}
833e41f4b71Sopenharmony_ciobserver.on('iccAccountInfoChange', callback);
834e41f4b71Sopenharmony_ci// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
835e41f4b71Sopenharmony_ciobserver.off('iccAccountInfoChange', callback);
836e41f4b71Sopenharmony_ciobserver.off('iccAccountInfoChange');
837e41f4b71Sopenharmony_ci```
838e41f4b71Sopenharmony_ci
839e41f4b71Sopenharmony_ci
840e41f4b71Sopenharmony_ci## LockReason<sup>8+</sup>
841e41f4b71Sopenharmony_ci
842e41f4b71Sopenharmony_ciSIM卡锁类型。
843e41f4b71Sopenharmony_ci
844e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
845e41f4b71Sopenharmony_ci
846e41f4b71Sopenharmony_ci| 名称        | 值   | 说明              |
847e41f4b71Sopenharmony_ci| ----------- | ---- | ----------------- |
848e41f4b71Sopenharmony_ci| SIM_NONE    | 0    | 无锁。            |
849e41f4b71Sopenharmony_ci| SIM_PIN     | 1    | PIN锁。           |
850e41f4b71Sopenharmony_ci| SIM_PUK     | 2    | PUK锁。           |
851e41f4b71Sopenharmony_ci| SIM_PN_PIN  | 3    | 网络PIN锁。       |
852e41f4b71Sopenharmony_ci| SIM_PN_PUK  | 4    | 网络PUK锁。       |
853e41f4b71Sopenharmony_ci| SIM_PU_PIN  | 5    | 子网PIN锁。       |
854e41f4b71Sopenharmony_ci| SIM_PU_PUK  | 6    | 子网PUK锁。       |
855e41f4b71Sopenharmony_ci| SIM_PP_PIN  | 7    | 服务提供商PIN锁。 |
856e41f4b71Sopenharmony_ci| SIM_PP_PUK  | 8    | 服务提供商PUK锁。 |
857e41f4b71Sopenharmony_ci| SIM_PC_PIN  | 9    | 组织PIN锁。       |
858e41f4b71Sopenharmony_ci| SIM_PC_PUK  | 10   | 组织PUK锁。       |
859e41f4b71Sopenharmony_ci| SIM_SIM_PIN | 11   | SIM PIN锁。       |
860e41f4b71Sopenharmony_ci| SIM_SIM_PUK | 12   | SIM PUK锁。       |
861e41f4b71Sopenharmony_ci
862e41f4b71Sopenharmony_ci
863e41f4b71Sopenharmony_ci## SimStateData<sup>7+</sup>
864e41f4b71Sopenharmony_ci
865e41f4b71Sopenharmony_ciSIM卡类型和状态。
866e41f4b71Sopenharmony_ci
867e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
868e41f4b71Sopenharmony_ci
869e41f4b71Sopenharmony_ci|     名称            |                 类型                | 必填 | 说明                                                      |
870e41f4b71Sopenharmony_ci| ------------------- | ----------------------------------- | ---- | --------------------------------------------------------  |
871e41f4b71Sopenharmony_ci| type                | [CardType](js-apis-sim.md#cardtype7) | 是   | SIM卡类型。 |
872e41f4b71Sopenharmony_ci| state               | [SimState](js-apis-sim.md#simstate) | 是   | SIM卡状态。 |
873e41f4b71Sopenharmony_ci| reason<sup>8+</sup> | [LockReason](#lockreason8)          | 是   | SIM卡锁类型。                                             |
874e41f4b71Sopenharmony_ci
875e41f4b71Sopenharmony_ci
876e41f4b71Sopenharmony_ci## CallStateInfo<sup>11+</sup>
877e41f4b71Sopenharmony_ci
878e41f4b71Sopenharmony_ci通话状态相关信息。
879e41f4b71Sopenharmony_ci
880e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
881e41f4b71Sopenharmony_ci
882e41f4b71Sopenharmony_ci|     名称            |                 类型                    | 必填 | 说明     |
883e41f4b71Sopenharmony_ci| ------------------- | -------------------------------------- | ---- | -------- |
884e41f4b71Sopenharmony_ci| state               | [CallState](js-apis-call.md#callstate) | 是   | 通话类型。 |
885e41f4b71Sopenharmony_ci| number              | string                                 | 是   | 电话号码。 |
886e41f4b71Sopenharmony_ci
887e41f4b71Sopenharmony_ci
888e41f4b71Sopenharmony_ci## DataConnectionStateInfo<sup>11+</sup>
889e41f4b71Sopenharmony_ci
890e41f4b71Sopenharmony_ci数据连接状态相关信息。
891e41f4b71Sopenharmony_ci
892e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
893e41f4b71Sopenharmony_ci
894e41f4b71Sopenharmony_ci|     名称            |                 类型                                            | 必填 | 说明         |
895e41f4b71Sopenharmony_ci| ------------------- | ---------------------------------------------------------------| ---- | ------------ |
896e41f4b71Sopenharmony_ci| state               | [DataConnectState](js-apis-telephony-data.md#dataconnectstate) | 是   | 数据连接状态。 |
897e41f4b71Sopenharmony_ci| network             | [RatType](js-apis-radio.md#radiotechnology)                    | 是   | 网络类型。     |
898e41f4b71Sopenharmony_ci
899e41f4b71Sopenharmony_ci
900e41f4b71Sopenharmony_ci## ObserverOptions<sup>11+</sup>
901e41f4b71Sopenharmony_ci
902e41f4b71Sopenharmony_ci电话相关事件订阅参数可选项。
903e41f4b71Sopenharmony_ci
904e41f4b71Sopenharmony_ci**系统能力**:SystemCapability.Telephony.StateRegistry
905e41f4b71Sopenharmony_ci
906e41f4b71Sopenharmony_ci|     名称            |         类型      | 必填  | 说明                                    |
907e41f4b71Sopenharmony_ci| ------------------- | ------------------| ---- | --------------------------------------- |
908e41f4b71Sopenharmony_ci| slotId              | number            | 是   | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2    |
909e41f4b71Sopenharmony_ci
910