0

We have this code (probably based on something that is found on the net) which asks the card reader to connect and perform actions but we would like to change it into something which waits for the card to touch the reader to perform an action.

private void checkReaderConnect() {
    boolean bolen = true;
    byte ret[] = {};
    int iret = -1;

    ReaderIndex = this.cboReader.getSelectedIndex();

    if (cardAction == null) {
        cardAction = new ReaderAction();
    }

    do {
        ret = cardAction.powerOnSCard(ReaderIndex);
        iret = cardAction.connectPPSESwipeCard();
        if (ret == null || iret != 36864) {
            continue;
        }
        break;
    } while (bolen);

}
private void btnReadActionPerformed(java.awt.event.ActionEvent evt) {                                        
    // TODO add your handling code here:

    byte[] track = new byte[128];
    txtReadData.setText("");
    checkReaderConnect();

    String trackData = "";
    cardAction.getTrackData(track, (byte) 1);

    trackData = new String(track);

    trackData = byteToString(track);

    txtReadData.setText("[Read] : " + trackData);

}    

We are not looking for complete code. We only want other stackoverflow users to share their insights and experiences with us since we are pretty new to Java Card.

vlp
  • 7,811
  • 2
  • 23
  • 51
Sandah Aung
  • 6,156
  • 15
  • 56
  • 98

0 Answers0