• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ConnectivityKit
19 */
20
21import type { AsyncCallback, Callback } from './@ohos.base';
22
23/**
24 * Provides APIs for mobile applications to access different SEs in mobile devices, such as SIMs or embedded SEs.
25 * See "Open Mobile API Specification".
26 *
27 * @namespace omapi
28 * @syscap SystemCapability.Communication.SecureElement
29 * @since 10
30 */
31declare namespace omapi {
32  /**
33   * Establish a new connection that can be used to connect to all the SEs available in the system.
34   * The connection process can be quite long, so it happens in an asynchronous way. It is usable only
35   * if the specified callback is called or if isConnected() returns true.
36   *
37   * @param { 'serviceState' } type nfc serviceState
38   * @param { Callback<ServiceState> } callback - The callback to return the service.
39   * @returns { SEService } The new SEService instance.
40   * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
41   * <br> 1. Mandatory parameters are left unspecified.
42   * <br> 2. Incorrect parameters types.
43   * <br> 3. Parameter verification failed.
44   * @throws { BusinessError } 801 - Capability not supported.
45   * @syscap SystemCapability.Communication.SecureElement
46   * @since 10
47   * @deprecated since 12
48   * @useinstead omapi#createService
49   */
50  function newSEService(type: 'serviceState', callback: Callback<ServiceState>): SEService;
51
52  /**
53   * Establish a new connection that can be used to connect to all the SEs available in the system.
54   * The connection process can be quite long, so it happens in an asynchronous way. It is usable only
55   * if isConnected() returns true.
56   *
57   * @returns { Promise<SEService> } Returns the created SEService instance.
58   * @throws { BusinessError } 801 - Capability not supported.
59   * @syscap SystemCapability.Communication.SecureElement
60   * @since 12
61   */
62  function createService(): Promise<SEService>;
63
64  /**
65   * SEService realizes the communication to available SEs on the device.
66   *
67   * @typedef SEService
68   * @syscap SystemCapability.Communication.SecureElement
69   * @since 10
70   */
71  export interface SEService {
72    /**
73     * Returns the list of available SE readers. There must be no duplicated objects in the returned list.
74     * All available readers SHALL be listed even if no card is inserted.
75     *
76     * @returns { Reader[] } The list of available SE readers.
77     * @throws { BusinessError } 801 - Capability not supported.
78     * @syscap SystemCapability.Communication.SecureElement
79     * @since 10
80     */
81    getReaders(): Reader[];
82
83    /**
84     * Checks whether or not the service is connected.
85     *
86     * @returns { boolean } True if the service is connected.
87     * @throws { BusinessError } 801 - Capability not supported.
88     * @syscap SystemCapability.Communication.SecureElement
89     * @since 10
90     */
91    isConnected(): boolean;
92
93    /**
94     * Releases all SE resources allocated by this SEService. As a result isConnected() will return false.
95     *
96     * @throws { BusinessError } 801 - Capability not supported.
97     * @syscap SystemCapability.Communication.SecureElement
98     * @since 10
99     */
100    shutdown(): void;
101
102    /**
103     * Returns the version of the Open Mobile API Specification this implementation is based on.
104     *
105     * @returns { string } The Open Mobile API version (e.g. “3.3” for Open Mobile API Specification version 3.3).
106     * @throws { BusinessError } 801 - Capability not supported.
107     * @syscap SystemCapability.Communication.SecureElement
108     * @since 10
109     */
110    getVersion(): string;
111  }
112
113  /**
114   * Reader represents the SE readers supported by this device.
115   *
116   * @typedef Reader
117   * @syscap SystemCapability.Communication.SecureElement
118   * @since 10
119   */
120  export interface Reader {
121    /**
122     * Returns the name of this reader.
123     * If this reader is a SIM reader, then its name must be "SIM[slot]".
124     * If the reader is an embedded SE reader, then its name must be "eSE[slot]".
125     *
126     * @returns { string } The reader name, as a String.
127     * @throws { BusinessError } 801 - Capability not supported.
128     * @syscap SystemCapability.Communication.SecureElement
129     * @since 10
130     */
131    getName(): string;
132
133    /**
134     * Checks if a SE is present in this reader.
135     *
136     * @returns { boolean } True if the SE is present, false otherwise.
137     * @throws { BusinessError } 801 - Capability not supported.
138     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
139     * @syscap SystemCapability.Communication.SecureElement
140     * @since 10
141     */
142    isSecureElementPresent(): boolean;
143
144    /**
145     * Connects to a SE in this reader.
146     * This method prepares (initializes) the SE for communication before the session object is returned.
147     * There might be multiple sessions opened at the same time on the same reader.
148     *
149     * @returns { Session } A Session object to be used to create channels.
150     * @throws { BusinessError } 801 - Capability not supported.
151     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
152     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
153     * @syscap SystemCapability.Communication.SecureElement
154     * @since 10
155     */
156    openSession(): Session;
157
158    /**
159     * Close all the sessions opened on this reader. All the channels opened by all these sessions will be closed.
160     *
161     * @throws { BusinessError } 801 - Capability not supported.
162     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
163     * @syscap SystemCapability.Communication.SecureElement
164     * @since 10
165     */
166    closeSessions(): void;
167  }
168
169  /**
170   * Session represent a connection session to one of the SEs available on the device. These objects
171   * can be used to get a communication channel with an applet in the SE. This channel can be the basic channel
172   * or a logical channel.
173   *
174   * @typedef Session
175   * @syscap SystemCapability.Communication.SecureElement
176   * @since 10
177   */
178  export interface Session {
179    /**
180     * Get the reader that provides this session.
181     *
182     * @returns { Reader } The Reader object.
183     * @throws { BusinessError } 801 - Capability not supported.
184     * @syscap SystemCapability.Communication.SecureElement
185     * @since 10
186     */
187    getReader(): Reader;
188
189    /**
190     * Get the ATR of this SE.
191     * A empty array SHALL be returned if the ATR for this SE is not available.
192     *
193     * @returns { number[] } The ATR as a number array or empty array.
194     * @throws { BusinessError } 801 - Capability not supported.
195     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
196     * @syscap SystemCapability.Communication.SecureElement
197     * @since 10
198     */
199    getATR(): number[];
200
201    /**
202     * Close the connection with the SE. This will close any channels opened by this application with this SE.
203     *
204     * @throws { BusinessError } 801 - Capability not supported.
205     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
206     * @syscap SystemCapability.Communication.SecureElement
207     * @since 10
208     */
209    close(): void;
210
211    /**
212     * Check if this session is closed.
213     *
214     * @returns { boolean } True if the session is closed, false otherwise.
215     * @throws { BusinessError } 801 - Capability not supported.
216     * @syscap SystemCapability.Communication.SecureElement
217     * @since 10
218     */
219    isClosed(): boolean;
220
221    /**
222     * Close any channels opened on this session.
223     *
224     * @throws { BusinessError } 801 - Capability not supported.
225     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
226     * @syscap SystemCapability.Communication.SecureElement
227     * @since 10
228     */
229    closeChannels(): void;
230
231    /**
232     * This method is provided to ease the development of mobile applications and for backward compatibility with
233     * existing applications. This method is equivalent to openBasicChannel(aid, P2=0x00).
234     *
235     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
236     * or Null if no applet is to be selected.
237     * @returns { Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
238     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
239     * <br> 1. Mandatory parameters are left unspecified.
240     * <br> 2. Incorrect parameters types.
241     * <br> 3. Parameter verification failed.
242     * @throws { BusinessError } 801 - Capability not supported.
243     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
244     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
245     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
246     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
247     * @syscap SystemCapability.Communication.SecureElement
248     * @since 10
249     */
250    openBasicChannel(aid: number[]): Promise<Channel>;
251
252    /**
253     * This method is provided to ease the development of mobile applications and for backward compatibility with
254     * existing applications. This method is equivalent to openBasicChannel(aid, P2=0x00).
255     *
256     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
257     * or Null if no applet is to be selected.
258     * @param { AsyncCallback<Channel> } callback - The callback to return the Channel object. Null if the SE is unable to provide.
259     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
260     * <br> 1. Mandatory parameters are left unspecified.
261     * <br> 2. Incorrect parameters types.
262     * <br> 3. Parameter verification failed.
263     * @throws { BusinessError } 801 - Capability not supported.
264     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
265     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
266     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
267     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
268     * @syscap SystemCapability.Communication.SecureElement
269     * @since 10
270     */
271    openBasicChannel(aid: number[], callback: AsyncCallback<Channel>): void;
272
273    /**
274     * Get access to the basic channel, as defined in [ISO 7816-4] (the one that has number 0). The obtained object
275     * is an instance of the channel class.
276     * Once this channel has been opened by a device application, it is considered as ‘locked’ by this device
277     * application, and other calls to this method SHALL return Null, until the channel is closed.
278     * Some SE plug-ins, such as those handling UICC, may prevent the use of the Basic Channel. In these cases,
279     * a Null value SHALL be returned.
280     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
281     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
282     *
283     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
284     * or Null if no applet is to be selected.
285     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
286     * @returns { Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
287     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
288     * <br> 1. Mandatory parameters are left unspecified.
289     * <br> 2. Incorrect parameters types.
290     * <br> 3. Parameter verification failed.
291     * @throws { BusinessError } 801 - Capability not supported.
292     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
293     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
294     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
295     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
296     * @syscap SystemCapability.Communication.SecureElement
297     * @since 10
298     */
299    openBasicChannel(aid: number[], p2: number): Promise<Channel>;
300
301    /**
302     * Get access to the basic channel, as defined in [ISO 7816-4] (the one that has number 0). The obtained object
303     * is an instance of the channel class.
304     * Once this channel has been opened by a device application, it is considered as ‘locked’ by this device
305     * application, and other calls to this method SHALL return Null, until the channel is closed.
306     * Some SE plug-ins, such as those handling UICC, may prevent the use of the Basic Channel. In these cases,
307     * a Null value SHALL be returned.
308     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
309     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
310     *
311     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
312     * or Null if no applet is to be selected.
313     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
314     * @param { AsyncCallback<Channel> } callback - The callback to return the Channel object. Null if the SE is unable to provide.
315     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
316     * <br> 1. Mandatory parameters are left unspecified.
317     * <br> 2. Incorrect parameters types.
318     * <br> 3. Parameter verification failed.
319     * @throws { BusinessError } 801 - Capability not supported.
320     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
321     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
322     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
323     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
324     * @syscap SystemCapability.Communication.SecureElement
325     * @since 10
326     */
327    openBasicChannel(aid: number[], p2: number, callback: AsyncCallback<Channel>): void;
328
329    /**
330     * This method is provided to ease the development of mobile applications and for backward compatibility with
331     * existing applications. This method is equivalent to openLogicalChannel(aid, P2=0x00).
332     *
333     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
334     * @returns {  Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
335     * A new logical channel or is unable to retrieve Access Control rules due to the lack of an available logical channel.
336     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
337     * <br> 1. Mandatory parameters are left unspecified.
338     * <br> 2. Incorrect parameters types.
339     * <br> 3. Parameter verification failed.
340     * @throws { BusinessError } 801 - Capability not supported.
341     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
342     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
343     *                                     a logical channel is already open to a non-multi-selectable applet.
344     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
345     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
346     * @syscap SystemCapability.Communication.SecureElement
347     * @since 10
348     */
349    openLogicalChannel(aid: number[]): Promise<Channel>;
350
351    /**
352     * This method is provided to ease the development of mobile applications and for backward compatibility with
353     * existing applications. This method is equivalent to openLogicalChannel(aid, P2=0x00).
354     *
355     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
356     * @param { AsyncCallback<Channel> } callback - The callback to return the Channel object. Null if the SE is unable to provide.
357     * A new logical channel or is unable to retrieve Access Control rules due to the lack of an available logical channel.
358     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
359     * <br> 1. Mandatory parameters are left unspecified.
360     * <br> 2. Incorrect parameters types.
361     * <br> 3. Parameter verification failed.
362     * @throws { BusinessError } 801 - Capability not supported.
363     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
364     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
365     *                                     a logical channel is already open to a non-multi-selectable applet.
366     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
367     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
368     * @syscap SystemCapability.Communication.SecureElement
369     * @since 10
370     */
371    openLogicalChannel(aid: number[], callback: AsyncCallback<Channel>): void;
372
373    /**
374     * Open a logical channel with the SE, selecting the applet represented by the given AID (when the AID is not
375     * Null and the length of the AID is not 0).
376     * If the length of the AID is 0, the method will select the Issuer Security Domain of the SE by sending a SELECT
377     * command with 0 length AID as defined in [GPCS].
378     * If the AID is Null, the method SHALL only send a MANAGE CHANNEL Open and SHALL NOT send a
379     * SELECT command. In this case, the default applet associated to the logical channel will be selected by default.
380     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
381     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
382     *
383     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
384     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
385     * @returns { Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
386     * A new logical channel or is unable to retrieve Access Control rules due to the lack of an available logical channel.
387     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
388     * <br> 1. Mandatory parameters are left unspecified.
389     * <br> 2. Incorrect parameters types.
390     * <br> 3. Parameter verification failed.
391     * @throws { BusinessError } 801 - Capability not supported.
392     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
393     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
394     *                                     a logical channel is already open to a non-multi-selectable applet.
395     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
396     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
397     * @syscap SystemCapability.Communication.SecureElement
398     * @since 10
399     */
400    openLogicalChannel(aid: number[], p2: number): Promise<Channel>;
401
402    /**
403     * Open a logical channel with the SE, selecting the applet represented by the given AID (when the AID is not
404     * Null and the length of the AID is not 0).
405     * If the length of the AID is 0, the method will select the Issuer Security Domain of the SE by sending a SELECT
406     * command with 0 length AID as defined in [GPCS].
407     * If the AID is Null, the method SHALL only send a MANAGE CHANNEL Open and SHALL NOT send a
408     * SELECT command. In this case, the default applet associated to the logical channel will be selected by default.
409     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
410     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
411     *
412     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
413     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
414     * @param { AsyncCallback<Channel> } callback - The callback to return the instance of channel. Null if the SE is unable to provide.
415     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
416     * <br> 1. Mandatory parameters are left unspecified.
417     * <br> 2. Incorrect parameters types.
418     * <br> 3. Parameter verification failed.
419     * @throws { BusinessError } 801 - Capability not supported.
420     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
421     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
422     *                                     a logical channel is already open to a non-multi-selectable applet.
423     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
424     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
425     * @syscap SystemCapability.Communication.SecureElement
426     * @since 10
427     */
428    openLogicalChannel(aid: number[], p2: number, callback: AsyncCallback<Channel>): void;
429  }
430
431  /**
432   * Channel represents an [ISO 7816-4] channel opened to a SE. It can be either a logical channel or the basic channel.
433   *
434   * @typedef Channel
435   * @syscap SystemCapability.Communication.SecureElement
436   * @since 10
437   */
438  export interface Channel {
439    /**
440     * Get the session that has opened this channel.
441     *
442     * @returns { Session } The Session object this channel is bound to.
443     * @throws { BusinessError } 801 - Capability not supported.
444     * @syscap SystemCapability.Communication.SecureElement
445     * @since 10
446     */
447    getSession(): Session;
448
449    /**
450     * Closes this channel to the SE.
451     * If the method is called when the channel is already closed, this method SHALL be ignored.
452     *
453     * @throws { BusinessError } 801 - Capability not supported.
454     * @syscap SystemCapability.Communication.SecureElement
455     * @since 10
456     */
457    close(): void;
458
459    /**
460     * Checks whether this channel is the basic channel.
461     *
462     * @returns { boolean } True if this channel is a basic channel, false otherwise.
463     * @throws { BusinessError } 801 - Capability not supported.
464     * @syscap SystemCapability.Communication.SecureElement
465     * @since 10
466     */
467    isBasicChannel(): boolean;
468
469    /**
470     * Checks if this channel is closed.
471     *
472     * @returns { boolean } True if the channel is closed, false otherwise.
473     * @throws { BusinessError } 801 - Capability not supported.
474     * @syscap SystemCapability.Communication.SecureElement
475     * @since 10
476     */
477    isClosed(): boolean;
478
479    /**
480     * Returns the data as received from the application select command, including the status word received
481     * at applet selection.
482     *
483     * @returns { number[] } The data as returned by the application select command inclusive of the status word.
484     * @throws { BusinessError } 801 - Capability not supported.
485     * @syscap SystemCapability.Communication.SecureElement
486     * @since 10
487     */
488    getSelectResponse(): number[];
489
490    /**
491     * Transmit an APDU command (as per ISO/IEC 7816) to the SE.
492     *
493     * @param { number[] } command - The APDU command to be transmitted, as a byte array.
494     * @returns { Promise<number[]> } The response received, as a byte array.
495     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
496     * <br> 1. Mandatory parameters are left unspecified.
497     * <br> 2. Incorrect parameters types.
498     * <br> 3. Parameter verification failed.
499     * @throws { BusinessError } 801 - Capability not supported.
500     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session or channel that has been closed.
501     * @throws { BusinessError } 3300103 - SecurityError, the command is filtered by the security policy.
502     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
503     * @syscap SystemCapability.Communication.SecureElement
504     * @since 10
505     */
506    transmit(command: number[]): Promise<number[]>;
507
508    /**
509     * Transmit an APDU command (as per ISO/IEC 7816) to the SE.
510     *
511     * @param { number[] } command - The APDU command to be transmitted, as a byte array.
512     * @param { AsyncCallback<number[]> } callback - The callback to return the response received, as a byte array.
513     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
514     * <br> 1. Mandatory parameters are left unspecified.
515     * <br> 2. Incorrect parameters types.
516     * <br> 3. Parameter verification failed.
517     * @throws { BusinessError } 801 - Capability not supported.
518     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session or channel that has been closed.
519     * @throws { BusinessError } 3300103 - SecurityError, the command is filtered by the security policy.
520     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
521     * @syscap SystemCapability.Communication.SecureElement
522     * @since 10
523     */
524    transmit(command: number[], callback: AsyncCallback<number[]>): void;
525  }
526
527  /**
528   * Secure Element service state definition.
529   *
530   * @enum { number }
531   * @syscap SystemCapability.Communication.SecureElement
532   * @since 10
533   */
534  enum ServiceState {
535    /**
536     * Service is disconnected.
537     *
538     * @syscap SystemCapability.Communication.SecureElement
539     * @since 10
540     */
541    DISCONNECTED = 0,
542
543    /**
544     * Service is connected.
545     *
546     * @syscap SystemCapability.Communication.SecureElement
547     * @since 10
548     */
549    CONNECTED = 1
550  }
551}
552export default omapi;