}
@Override
public List<GenericTerminal> list() throws ScardException {
ShortByReference requiredSize = new ShortByReference();
NativeLong status = nimpPcscDll.NimpSCardListReadersW(new NativeLong(contextId), null, null, requiredSize);
List<GenericTerminal> terminalsList;
if (SCARD_E_NO_READERS_AVAILABLE == status.longValue()) {
terminalsList = new ArrayList<GenericTerminal>(0);
return Collections.unmodifiableList(terminalsList);
}
if (SCARD_S_SUCCESS != status.longValue()) {
throw new PcScException(status.intValue());
}
short nativeOut[] = new short[requiredSize.getValue()];
status = nimpPcscDll.NimpSCardListReadersW(new NativeLong(contextId), null, nativeOut, requiredSize);
if (SCARD_S_SUCCESS != status.longValue()) {
throw new PcScException(status.intValue());
}
String[] readerNames=AStringUtilities.shortsToStrings(nativeOut);
terminalsList = new ArrayList<GenericTerminal>(readerNames.length);