52 }
53
54 /**
55 * Returns the ATR of this card.
56 *
57 * @return the ATR of this card.
58 */
59 public abstract ATR getATR();
60
61 /**
62 * Returns the protocol in use for this card.
63 *
64 * @return the protocol in use for this card, for example "T=0" or "T=1"
65 */
66 public abstract String getProtocol();
67
68 /**
69 * Returns the CardChannel for the basic logical channel. The basic
70 * logical channel has a channel number of 0.
71 *
72 * @throws SecurityException if a SecurityManager exists and the
73 * caller does not have the required
74 * {@linkplain CardPermission permission}
75 * @throws IllegalStateException if this card object has been disposed of
76 * via the {@linkplain #disconnect disconnect()} method
77 */
78 public abstract CardChannel getBasicChannel();
79
80 /**
81 * Opens a new logical channel to the card and returns it. The channel is
82 * opened by issuing a <code>MANAGE CHANNEL</code> command that should use
83 * the format <code>[00 70 00 00 01]</code>.
84 *
85 * @throws SecurityException if a SecurityManager exists and the
86 * caller does not have the required
87 * {@linkplain CardPermission permission}
88 * @throws CardException is a new logical channel could not be opened
89 * @throws IllegalStateException if this card object has been disposed of
90 * via the {@linkplain #disconnect disconnect()} method
91 */
92 public abstract CardChannel openLogicalChannel() throws CardException;
93
94 /**
95 * Requests exclusive access to this card.
96 *
97 * <p>Once a thread has invoked <code>beginExclusive</code>, only this
98 * thread is allowed to communicate with this card until it calls
99 * <code>endExclusive</code>. Other threads attempting communication
100 * will receive a CardException.
101 *
102 * <p>Applications have to ensure that exclusive access is correctly
103 * released. This can be achieved by executing
104 * the <code>beginExclusive()</code> and <code>endExclusive</code> calls
120 *
121 * @throws SecurityException if a SecurityManager exists and the
122 * caller does not have the required
123 * {@linkplain CardPermission permission}
124 * @throws IllegalStateException if the active Thread does not currently have
125 * exclusive access to this card or
126 * if this card object has been disposed of
127 * via the {@linkplain #disconnect disconnect()} method
128 * @throws CardException if the operation failed
129 */
130 public abstract void endExclusive() throws CardException;
131
132 /**
133 * Transmits a control command to the terminal device.
134 *
135 * <p>This can be used to, for example, control terminal functions like
136 * a built-in PIN pad or biometrics.
137 *
138 * @param controlCode the control code of the command
139 * @param command the command data
140 *
141 * @throws SecurityException if a SecurityManager exists and the
142 * caller does not have the required
143 * {@linkplain CardPermission permission}
144 * @throws NullPointerException if command is null
145 * @throws CardException if the card operation failed
146 * @throws IllegalStateException if this card object has been disposed of
147 * via the {@linkplain #disconnect disconnect()} method
148 */
149 public abstract byte[] transmitControlCommand(int controlCode,
150 byte[] command) throws CardException;
151
152 /**
153 * Disconnects the connection with this card. After this method returns,
154 * calling methods on this object or in CardChannels associated with this
155 * object that require interaction with the card will raise an
156 * IllegalStateException.
157 *
158 * @param reset whether to reset the card after disconnecting.
159 *
|
52 }
53
54 /**
55 * Returns the ATR of this card.
56 *
57 * @return the ATR of this card.
58 */
59 public abstract ATR getATR();
60
61 /**
62 * Returns the protocol in use for this card.
63 *
64 * @return the protocol in use for this card, for example "T=0" or "T=1"
65 */
66 public abstract String getProtocol();
67
68 /**
69 * Returns the CardChannel for the basic logical channel. The basic
70 * logical channel has a channel number of 0.
71 *
72 * @return the CardChannel for the basic logical channel
73 * @throws SecurityException if a SecurityManager exists and the
74 * caller does not have the required
75 * {@linkplain CardPermission permission}
76 * @throws IllegalStateException if this card object has been disposed of
77 * via the {@linkplain #disconnect disconnect()} method
78 */
79 public abstract CardChannel getBasicChannel();
80
81 /**
82 * Opens a new logical channel to the card and returns it. The channel is
83 * opened by issuing a <code>MANAGE CHANNEL</code> command that should use
84 * the format <code>[00 70 00 00 01]</code>.
85 *
86 * @return the card to which a logical channel has been opened
87 * @throws SecurityException if a SecurityManager exists and the
88 * caller does not have the required
89 * {@linkplain CardPermission permission}
90 * @throws CardException is a new logical channel could not be opened
91 * @throws IllegalStateException if this card object has been disposed of
92 * via the {@linkplain #disconnect disconnect()} method
93 */
94 public abstract CardChannel openLogicalChannel() throws CardException;
95
96 /**
97 * Requests exclusive access to this card.
98 *
99 * <p>Once a thread has invoked <code>beginExclusive</code>, only this
100 * thread is allowed to communicate with this card until it calls
101 * <code>endExclusive</code>. Other threads attempting communication
102 * will receive a CardException.
103 *
104 * <p>Applications have to ensure that exclusive access is correctly
105 * released. This can be achieved by executing
106 * the <code>beginExclusive()</code> and <code>endExclusive</code> calls
122 *
123 * @throws SecurityException if a SecurityManager exists and the
124 * caller does not have the required
125 * {@linkplain CardPermission permission}
126 * @throws IllegalStateException if the active Thread does not currently have
127 * exclusive access to this card or
128 * if this card object has been disposed of
129 * via the {@linkplain #disconnect disconnect()} method
130 * @throws CardException if the operation failed
131 */
132 public abstract void endExclusive() throws CardException;
133
134 /**
135 * Transmits a control command to the terminal device.
136 *
137 * <p>This can be used to, for example, control terminal functions like
138 * a built-in PIN pad or biometrics.
139 *
140 * @param controlCode the control code of the command
141 * @param command the command data
142 * @return the response from the terminal device
143 *
144 * @throws SecurityException if a SecurityManager exists and the
145 * caller does not have the required
146 * {@linkplain CardPermission permission}
147 * @throws NullPointerException if command is null
148 * @throws CardException if the card operation failed
149 * @throws IllegalStateException if this card object has been disposed of
150 * via the {@linkplain #disconnect disconnect()} method
151 */
152 public abstract byte[] transmitControlCommand(int controlCode,
153 byte[] command) throws CardException;
154
155 /**
156 * Disconnects the connection with this card. After this method returns,
157 * calling methods on this object or in CardChannels associated with this
158 * object that require interaction with the card will raise an
159 * IllegalStateException.
160 *
161 * @param reset whether to reset the card after disconnecting.
162 *
|