use of org.openecard.common.ifd.PACECapabilities in project open-ecard by ecsec.
the class TerminalInfo method getPACECapabilities.
public List<PACECapabilities.PACECapability> getPACECapabilities() throws SCIOException {
List<PACECapabilities.PACECapability> result = new LinkedList<>();
if (PACECapabilities == null) {
if (isConnected()) {
if (supportsPace()) {
int ctrlCode = getPaceCtrlCode();
ExecutePACERequest.Function paceFunc = ExecutePACERequest.Function.GetReaderPACECapabilities;
byte[] getCapabilityRequest = new ExecutePACERequest(paceFunc).toBytes();
byte[] response = channel.transmitControlCommand(ctrlCode, getCapabilityRequest);
ExecutePACEResponse paceResponse = new ExecutePACEResponse(response);
if (paceResponse.isError()) {
String msg = "PACE is advertised but the result iss errornous.\n";
msg += paceResponse.getResult().getResultMessage().getValue();
throw new SCIOException(msg, SCIOErrorCode.SCARD_F_UNKNOWN_ERROR);
}
PACECapabilities cap = new PACECapabilities(paceResponse.getData());
PACECapabilities = cap.getFeaturesEnum();
result.addAll(PACECapabilities);
}
}
} else {
result.addAll(PACECapabilities);
}
return Collections.unmodifiableList(result);
}
Aggregations