• 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   * Register the service state changed event.
66   *
67   * @param { 'stateChanged' } type - The type to register.
68   * @param { Callback<ServiceState> } callback - The callback used to listen for the state change event.
69   * @throws { BusinessError } 801 - Capability not supported.
70   * @syscap SystemCapability.Communication.SecureElement
71   * @since 18
72   */
73  function on(type: 'stateChanged', callback: Callback<ServiceState>): void;
74
75  /**
76   * Unsubscribe the service state changed event.
77   *
78   * @param { 'stateChanged' } type - The type to register.
79   * @param { Callback<ServiceState> } callback - The callback used to listen for the state change event.
80   * @throws { BusinessError } 801 - Capability not supported.
81   * @syscap SystemCapability.Communication.SecureElement
82   * @since 18
83   */
84  function off(type: 'stateChanged', callback?: Callback<ServiceState>): void;
85
86  /**
87   * SEService realizes the communication to available SEs on the device.
88   *
89   * @typedef SEService
90   * @syscap SystemCapability.Communication.SecureElement
91   * @since 10
92   */
93  export interface SEService {
94    /**
95     * Returns the list of available SE readers. There must be no duplicated objects in the returned list.
96     * All available readers SHALL be listed even if no card is inserted.
97     *
98     * @returns { Reader[] } The list of available SE readers.
99     * @throws { BusinessError } 801 - Capability not supported.
100     * @syscap SystemCapability.Communication.SecureElement
101     * @since 10
102     */
103    getReaders(): Reader[];
104
105    /**
106     * Checks whether or not the service is connected.
107     *
108     * @returns { boolean } True if the service is connected.
109     * @throws { BusinessError } 801 - Capability not supported.
110     * @syscap SystemCapability.Communication.SecureElement
111     * @since 10
112     */
113    isConnected(): boolean;
114
115    /**
116     * Releases all SE resources allocated by this SEService. As a result isConnected() will return false.
117     *
118     * @throws { BusinessError } 801 - Capability not supported.
119     * @syscap SystemCapability.Communication.SecureElement
120     * @since 10
121     */
122    shutdown(): void;
123
124    /**
125     * Returns the version of the Open Mobile API Specification this implementation is based on.
126     *
127     * @returns { string } The Open Mobile API version (e.g. “3.3” for Open Mobile API Specification version 3.3).
128     * @throws { BusinessError } 801 - Capability not supported.
129     * @syscap SystemCapability.Communication.SecureElement
130     * @since 10
131     */
132    getVersion(): string;
133  }
134
135  /**
136   * Reader represents the SE readers supported by this device.
137   *
138   * @typedef Reader
139   * @syscap SystemCapability.Communication.SecureElement
140   * @since 10
141   */
142  export interface Reader {
143    /**
144     * Returns the name of this reader.
145     * If this reader is a SIM reader, then its name must be "SIM[slot]".
146     * If the reader is an embedded SE reader, then its name must be "eSE[slot]".
147     *
148     * @returns { string } The reader name, as a String.
149     * @throws { BusinessError } 801 - Capability not supported.
150     * @syscap SystemCapability.Communication.SecureElement
151     * @since 10
152     */
153    getName(): string;
154
155    /**
156     * Checks if a SE is present in this reader.
157     *
158     * @returns { boolean } True if the SE is present, false otherwise.
159     * @throws { BusinessError } 801 - Capability not supported.
160     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
161     * @syscap SystemCapability.Communication.SecureElement
162     * @since 10
163     */
164    isSecureElementPresent(): boolean;
165
166    /**
167     * Connects to a SE in this reader.
168     * This method prepares (initializes) the SE for communication before the session object is returned.
169     * There might be multiple sessions opened at the same time on the same reader.
170     *
171     * @returns { Session } A Session object to be used to create channels.
172     * @throws { BusinessError } 801 - Capability not supported.
173     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
174     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
175     * @syscap SystemCapability.Communication.SecureElement
176     * @since 10
177     */
178    openSession(): Session;
179
180    /**
181     * Close all the sessions opened on this reader. All the channels opened by all these sessions will be closed.
182     *
183     * @throws { BusinessError } 801 - Capability not supported.
184     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
185     * @syscap SystemCapability.Communication.SecureElement
186     * @since 10
187     */
188    closeSessions(): void;
189  }
190
191  /**
192   * Session represent a connection session to one of the SEs available on the device. These objects
193   * can be used to get a communication channel with an applet in the SE. This channel can be the basic channel
194   * or a logical channel.
195   *
196   * @typedef Session
197   * @syscap SystemCapability.Communication.SecureElement
198   * @since 10
199   */
200  export interface Session {
201    /**
202     * Get the reader that provides this session.
203     *
204     * @returns { Reader } The Reader object.
205     * @throws { BusinessError } 801 - Capability not supported.
206     * @syscap SystemCapability.Communication.SecureElement
207     * @since 10
208     */
209    getReader(): Reader;
210
211    /**
212     * Get the ATR of this SE.
213     * A empty array SHALL be returned if the ATR for this SE is not available.
214     *
215     * @returns { number[] } The ATR as a number array or empty array.
216     * @throws { BusinessError } 801 - Capability not supported.
217     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
218     * @syscap SystemCapability.Communication.SecureElement
219     * @since 10
220     */
221    getATR(): number[];
222
223    /**
224     * Close the connection with the SE. This will close any channels opened by this application with this SE.
225     *
226     * @throws { BusinessError } 801 - Capability not supported.
227     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
228     * @syscap SystemCapability.Communication.SecureElement
229     * @since 10
230     */
231    close(): void;
232
233    /**
234     * Check if this session is closed.
235     *
236     * @returns { boolean } True if the session is closed, false otherwise.
237     * @throws { BusinessError } 801 - Capability not supported.
238     * @syscap SystemCapability.Communication.SecureElement
239     * @since 10
240     */
241    isClosed(): boolean;
242
243    /**
244     * Close any channels opened on this session.
245     *
246     * @throws { BusinessError } 801 - Capability not supported.
247     * @throws { BusinessError } 3300101 - IllegalStateError, service state exception.
248     * @syscap SystemCapability.Communication.SecureElement
249     * @since 10
250     */
251    closeChannels(): void;
252
253    /**
254     * This method is provided to ease the development of mobile applications and for backward compatibility with
255     * existing applications. This method is equivalent to openBasicChannel(aid, P2=0x00).
256     *
257     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
258     * or Null if no applet is to be selected.
259     * @returns { Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
260     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
261     * <br> 1. Mandatory parameters are left unspecified.
262     * <br> 2. Incorrect parameters types.
263     * <br> 3. Parameter verification failed.
264     * @throws { BusinessError } 801 - Capability not supported.
265     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
266     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
267     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
268     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
269     * @syscap SystemCapability.Communication.SecureElement
270     * @since 10
271     */
272    openBasicChannel(aid: number[]): Promise<Channel>;
273
274    /**
275     * This method is provided to ease the development of mobile applications and for backward compatibility with
276     * existing applications. This method is equivalent to openBasicChannel(aid, P2=0x00).
277     *
278     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
279     * or Null if no applet is to be selected.
280     * @param { AsyncCallback<Channel> } callback - The callback to return the Channel object. Null if the SE is unable to provide.
281     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
282     * <br> 1. Mandatory parameters are left unspecified.
283     * <br> 2. Incorrect parameters types.
284     * <br> 3. Parameter verification failed.
285     * @throws { BusinessError } 801 - Capability not supported.
286     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
287     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
288     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
289     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
290     * @syscap SystemCapability.Communication.SecureElement
291     * @since 10
292     */
293    openBasicChannel(aid: number[], callback: AsyncCallback<Channel>): void;
294
295    /**
296     * Get access to the basic channel, as defined in [ISO 7816-4] (the one that has number 0). The obtained object
297     * is an instance of the channel class.
298     * Once this channel has been opened by a device application, it is considered as ‘locked’ by this device
299     * application, and other calls to this method SHALL return Null, until the channel is closed.
300     * Some SE plug-ins, such as those handling UICC, may prevent the use of the Basic Channel. In these cases,
301     * a Null value SHALL be returned.
302     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
303     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
304     *
305     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
306     * or Null if no applet is to be selected.
307     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
308     * @returns { Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
309     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
310     * <br> 1. Mandatory parameters are left unspecified.
311     * <br> 2. Incorrect parameters types.
312     * <br> 3. Parameter verification failed.
313     * @throws { BusinessError } 801 - Capability not supported.
314     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
315     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
316     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
317     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
318     * @syscap SystemCapability.Communication.SecureElement
319     * @since 10
320     */
321    openBasicChannel(aid: number[], p2: number): Promise<Channel>;
322
323    /**
324     * Get access to the basic channel, as defined in [ISO 7816-4] (the one that has number 0). The obtained object
325     * is an instance of the channel class.
326     * Once this channel has been opened by a device application, it is considered as ‘locked’ by this device
327     * application, and other calls to this method SHALL return Null, until the channel is closed.
328     * Some SE plug-ins, such as those handling UICC, may prevent the use of the Basic Channel. In these cases,
329     * a Null value SHALL be returned.
330     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
331     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
332     *
333     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array,
334     * or Null if no applet is to be selected.
335     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
336     * @param { AsyncCallback<Channel> } callback - The callback to return the Channel object. Null if the SE is unable to provide.
337     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
338     * <br> 1. Mandatory parameters are left unspecified.
339     * <br> 2. Incorrect parameters types.
340     * <br> 3. Parameter verification failed.
341     * @throws { BusinessError } 801 - Capability not supported.
342     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
343     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected.
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    openBasicChannel(aid: number[], p2: number, callback: AsyncCallback<Channel>): void;
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     * @returns {  Promise<Channel> } An instance of channel if available. 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[]): Promise<Channel>;
372
373    /**
374     * This method is provided to ease the development of mobile applications and for backward compatibility with
375     * existing applications. This method is equivalent to openLogicalChannel(aid, P2=0x00).
376     *
377     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
378     * @param { AsyncCallback<Channel> } callback - The callback to return the Channel object. Null if the SE is unable to provide.
379     * A new logical channel or is unable to retrieve Access Control rules due to the lack of an available logical channel.
380     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
381     * <br> 1. Mandatory parameters are left unspecified.
382     * <br> 2. Incorrect parameters types.
383     * <br> 3. Parameter verification failed.
384     * @throws { BusinessError } 801 - Capability not supported.
385     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
386     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
387     *                                     a logical channel is already open to a non-multi-selectable applet.
388     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
389     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
390     * @syscap SystemCapability.Communication.SecureElement
391     * @since 10
392     */
393    openLogicalChannel(aid: number[], callback: AsyncCallback<Channel>): void;
394
395    /**
396     * Open a logical channel with the SE, selecting the applet represented by the given AID (when the AID is not
397     * Null and the length of the AID is not 0).
398     * If the length of the AID is 0, the method will select the Issuer Security Domain of the SE by sending a SELECT
399     * command with 0 length AID as defined in [GPCS].
400     * If the AID is Null, the method SHALL only send a MANAGE CHANNEL Open and SHALL NOT send a
401     * SELECT command. In this case, the default applet associated to the logical channel will be selected by default.
402     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
403     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
404     *
405     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
406     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
407     * @returns { Promise<Channel> } An instance of channel if available. Null if the SE is unable to provide.
408     * A new logical channel or is unable to retrieve Access Control rules due to the lack of an available logical channel.
409     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
410     * <br> 1. Mandatory parameters are left unspecified.
411     * <br> 2. Incorrect parameters types.
412     * <br> 3. Parameter verification failed.
413     * @throws { BusinessError } 801 - Capability not supported.
414     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
415     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
416     *                                     a logical channel is already open to a non-multi-selectable applet.
417     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
418     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
419     * @syscap SystemCapability.Communication.SecureElement
420     * @since 10
421     */
422    openLogicalChannel(aid: number[], p2: number): Promise<Channel>;
423
424    /**
425     * Open a logical channel with the SE, selecting the applet represented by the given AID (when the AID is not
426     * Null and the length of the AID is not 0).
427     * If the length of the AID is 0, the method will select the Issuer Security Domain of the SE by sending a SELECT
428     * command with 0 length AID as defined in [GPCS].
429     * If the AID is Null, the method SHALL only send a MANAGE CHANNEL Open and SHALL NOT send a
430     * SELECT command. In this case, the default applet associated to the logical channel will be selected by default.
431     * P2 is normally 0x00. The device SHOULD allow any value for P2 and SHALL allow the following values:
432     * 0x00, 0x04, 0x08, 0x0C (as defined in [ISO 7816-4]).
433     *
434     * @param { number[] } aid - The AID of the applet to be selected on this channel, as a byte array.
435     * @param { number } p2 - The P2 parameter of the SELECT APDU executed on this channel.
436     * @param { AsyncCallback<Channel> } callback - The callback to return the instance of channel. Null if the SE is unable to provide.
437     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
438     * <br> 1. Mandatory parameters are left unspecified.
439     * <br> 2. Incorrect parameters types.
440     * <br> 3. Parameter verification failed.
441     * @throws { BusinessError } 801 - Capability not supported.
442     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session that has been closed.
443     * @throws { BusinessError } 3300102 - NoSuchElementError, the AID on the SE is not available or cannot be selected or
444     *                                     a logical channel is already open to a non-multi-selectable applet.
445     * @throws { BusinessError } 3300103 - SecurityError, the calling application cannot be granted access to this AID or the default applet on this session.
446     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
447     * @syscap SystemCapability.Communication.SecureElement
448     * @since 10
449     */
450    openLogicalChannel(aid: number[], p2: number, callback: AsyncCallback<Channel>): void;
451  }
452
453  /**
454   * Channel represents an [ISO 7816-4] channel opened to a SE. It can be either a logical channel or the basic channel.
455   *
456   * @typedef Channel
457   * @syscap SystemCapability.Communication.SecureElement
458   * @since 10
459   */
460  export interface Channel {
461    /**
462     * Get the session that has opened this channel.
463     *
464     * @returns { Session } The Session object this channel is bound to.
465     * @throws { BusinessError } 801 - Capability not supported.
466     * @syscap SystemCapability.Communication.SecureElement
467     * @since 10
468     */
469    getSession(): Session;
470
471    /**
472     * Closes this channel to the SE.
473     * If the method is called when the channel is already closed, this method SHALL be ignored.
474     *
475     * @throws { BusinessError } 801 - Capability not supported.
476     * @syscap SystemCapability.Communication.SecureElement
477     * @since 10
478     */
479    close(): void;
480
481    /**
482     * Checks whether this channel is the basic channel.
483     *
484     * @returns { boolean } True if this channel is a basic channel, false otherwise.
485     * @throws { BusinessError } 801 - Capability not supported.
486     * @syscap SystemCapability.Communication.SecureElement
487     * @since 10
488     */
489    isBasicChannel(): boolean;
490
491    /**
492     * Checks if this channel is closed.
493     *
494     * @returns { boolean } True if the channel is closed, false otherwise.
495     * @throws { BusinessError } 801 - Capability not supported.
496     * @syscap SystemCapability.Communication.SecureElement
497     * @since 10
498     */
499    isClosed(): boolean;
500
501    /**
502     * Returns the data as received from the application select command, including the status word received
503     * at applet selection.
504     *
505     * @returns { number[] } The data as returned by the application select command inclusive of the status word.
506     * @throws { BusinessError } 801 - Capability not supported.
507     * @syscap SystemCapability.Communication.SecureElement
508     * @since 10
509     */
510    getSelectResponse(): number[];
511
512    /**
513     * Transmit an APDU command (as per ISO/IEC 7816) to the SE.
514     *
515     * @param { number[] } command - The APDU command to be transmitted, as a byte array.
516     * @returns { Promise<number[]> } The response received, as a byte array.
517     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
518     * <br> 1. Mandatory parameters are left unspecified.
519     * <br> 2. Incorrect parameters types.
520     * <br> 3. Parameter verification failed.
521     * @throws { BusinessError } 801 - Capability not supported.
522     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session or channel that has been closed.
523     * @throws { BusinessError } 3300103 - SecurityError, the command is filtered by the security policy.
524     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
525     * @syscap SystemCapability.Communication.SecureElement
526     * @since 10
527     */
528    transmit(command: number[]): Promise<number[]>;
529
530    /**
531     * Transmit an APDU command (as per ISO/IEC 7816) to the SE.
532     *
533     * @param { number[] } command - The APDU command to be transmitted, as a byte array.
534     * @param { AsyncCallback<number[]> } callback - The callback to return the response received, as a byte array.
535     * @throws { BusinessError } 401 - The parameter check failed. Possible causes:
536     * <br> 1. Mandatory parameters are left unspecified.
537     * <br> 2. Incorrect parameters types.
538     * <br> 3. Parameter verification failed.
539     * @throws { BusinessError } 801 - Capability not supported.
540     * @throws { BusinessError } 3300101 - IllegalStateError, an attempt is made to use an SE session or channel that has been closed.
541     * @throws { BusinessError } 3300103 - SecurityError, the command is filtered by the security policy.
542     * @throws { BusinessError } 3300104 - IOError, there is a communication problem to the reader or the SE.
543     * @syscap SystemCapability.Communication.SecureElement
544     * @since 10
545     */
546    transmit(command: number[], callback: AsyncCallback<number[]>): void;
547  }
548
549  /**
550   * Secure Element service state definition.
551   *
552   * @enum { number }
553   * @syscap SystemCapability.Communication.SecureElement
554   * @since 10
555   */
556  enum ServiceState {
557    /**
558     * Service is disconnected.
559     *
560     * @syscap SystemCapability.Communication.SecureElement
561     * @since 10
562     */
563    DISCONNECTED = 0,
564
565    /**
566     * Service is connected.
567     *
568     * @syscap SystemCapability.Communication.SecureElement
569     * @since 10
570     */
571    CONNECTED = 1
572  }
573}
574export default omapi;