1 /*
2  * Copyright (C) 2017, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /*
17  * Contributed by: Giesecke & Devrient GmbH.
18  */
19 
20 package android.se.omapi;
21 
22 import android.se.omapi.ISecureElementSession;
23 
24 /** @hide */
25 interface ISecureElementChannel {
26 
27     /**
28      * Closes the specified connection and frees internal resources.
29      * A logical channel will be closed.
30      */
close()31     void close();
32 
33     /**
34      * Tells if this channel is closed.
35      *
36      * @return <code>true</code> if the channel is closed,
37      *         <code>false</code> otherwise.
38      */
isClosed()39     boolean isClosed();
40 
41     /**
42      * Returns a boolean telling if this channel is the basic channel.
43      *
44      * @return <code>true</code> if this channel is a basic channel.
45      *         <code>false</code> if this channel is a logical channel.
46      */
isBasicChannel()47     boolean isBasicChannel();
48 
49      /**
50      * Returns the data as received from the application select command
51      * inclusively the status word. The returned byte array contains the data
52      * bytes in the following order:
53      * [<first data byte>, ..., <last data byte>, <sw1>, <sw2>]
54      */
getSelectResponse()55     byte[] getSelectResponse();
56 
57     /**
58      * Transmits the specified command APDU and returns the response APDU.
59      * MANAGE channel commands are not supported.
60      * Selection of applets is not supported in logical channels.
61      */
transmit(in byte[] command)62     byte[] transmit(in byte[] command);
63 
64     /**
65      * Performs a selection of the next Applet on this channel that matches to
66      * the partial AID specified in the openBasicChannel(byte[] aid) or
67      * openLogicalChannel(byte[] aid) method. This mechanism can be used by a
68      * device application to iterate through all Applets matching to the same
69      * partial AID.
70      * If selectNext() returns true a new Applet was successfully selected on
71      * this channel.
72      * If no further Applet exists with matches to the partial AID this method
73      * returns false and the already selected Applet stays selected.
74      *
75      * @return <code>true</code> if new Applet was successfully selected.
76      *         <code>false</code> if no further Applet exists which matches the
77      *         partial AID.
78      */
selectNext()79     boolean selectNext();
80 }
81