blob: 421b28aa89bbd94e7151597eacdc98fcb9a41003 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package org.sufficientlysecure.keychain.javacard;
import java.io.IOException;
import nordpol.IsoCard;
public class NfcTransport implements Transport {
// timeout is set to 100 seconds to avoid cancellation during calculation
private static final int TIMEOUT = 100 * 1000;
private final IsoCard mIsoCard;
public NfcTransport(final IsoCard isoDep) throws IOException {
this.mIsoCard = isoDep;
mIsoCard.setTimeout(TIMEOUT);
mIsoCard.connect();
}
@Override
public byte[] sendAndReceive(final byte[] data) throws TransportIoException, IOException {
return mIsoCard.transceive(data);
}
@Override
public void release() {
}
@Override
public boolean isConnected() {
return mIsoCard.isConnected();
}
}
|