Package com.sun.jna

Examples of com.sun.jna.NativeLong.longValue()


        NativeLong callStatus = win32PCSC.SCardTransmit(new NativeLong(cardId),
                pioSendPci,
                buf, len,
                (Win32PCSC.SCARD_IO_REQUEST) null,
                pbRecvBuffer, pcbRecvLength);
        if (SCARD_S_SUCCESS != callStatus.longValue()) {
            throw new PcScException("buf.length="+buf.length+", len="+len,callStatus.intValue());
        }
        byte out[] = new byte[pcbRecvLength.getValue()];
        for (int i = 0; i < pcbRecvLength.getValue(); i++) {
            out[i] = pbRecvBuffer[i];
View Full Code Here


        pcbRecvLength.setValue(200);

        NativeLong callStatus = win32PCSC.SCardGetAttrib(new NativeLong(cardId),
                dwAttrId,
                pbRecvBuffer /*null*/, pcbRecvLength);
        if (SCARD_S_SUCCESS != callStatus.longValue()) {
            /*if (ERROR_NOT_SUPPORTED != callStatus.longValue()) {
                throw new PcScException("win32PCSC.SCardGetAttrib: attribute not supported",callStatus.intValue());
            }*/
        throw new PcScException("win32PCSC.SCardGetAttrib",callStatus.intValue());
        }
View Full Code Here

        IntByReference pdwProtocol = new IntByReference();
        byte pbAtr[] = new byte[36];
        IntByReference pcbAtrLen = new IntByReference();
        pcbAtrLen.setValue(36);
        NativeLong callStatus = win32PCSC.SCardStatusW(new NativeLong(cardId), null, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen);
        if (SCARD_S_SUCCESS != callStatus.longValue()) {
            throw new PcScException(callStatus.intValue());
        }
        byte out[] = new byte[pcbAtrLen.getValue()];
        for (int i = 0; i < pcbAtrLen.getValue(); i++) {
            out[i] = pbAtr[i];
View Full Code Here

        return out;
    }

    static void SCardDisconnect(long cardId, int disposition) throws PcScException {
        NativeLong status = win32PCSC.SCardDisconnect(new NativeLong(cardId), disposition);
        if (SCARD_S_SUCCESS != status.longValue()) {
            throw new PcScException(status.intValue());
        }
    }

    static int[] SCardGetStatusChange(long contextId, long timeout, int[] currentState, String[] readerNames) throws ScardException {
View Full Code Here

            readerStates[i].cbAtr = 0;
            readerStates[i].rgbAtr = new byte[36];
        }

        NativeLong status = win32PCSC.SCardGetStatusChangeW(new NativeLong(contextId), (int) timeout, readerStates, readerNames.length);
        if (SCARD_S_SUCCESS != status.longValue()) {
            throw new PcScException(status.intValue());
        }
        int out[] = new int[readerNames.length];
        for (int i = 0; i < readerNames.length; i++) {
            out[i] = readerStates[i].dwEventState;
View Full Code Here

                public void run() {
                    if(0!=contextId)
                        nimpPcscDll.NimpSCardReleaseContext(new NativeLong(contextId));
                }
            });
            if (0 != status.longValue()) {
                throw new PcScException(status.intValue());
            }
      contextId = phContext.getValue().longValue();
  }
    }
View Full Code Here

    @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());
View Full Code Here

        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()) {
View Full Code Here

        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);
View Full Code Here

        NativeLongByReference phCard = new NativeLongByReference();
        IntByReference pdwActiveProtocol = new IntByReference();
        NativeLong status = nimpPcscDll.NimpSCardConnectW(new NativeLong(contextId), new WString(readerName), shareMode, preferredProtocols,
                phCard,
                pdwActiveProtocol);
        if (SCARD_S_SUCCESS != status.longValue()) {
            throw new PcScException(status.intValue());
        }
        return phCard.getValue().longValue();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.