Examples of NFCIPConnection


Examples of org.nfctools.nfcip.NFCIPConnection

    try {
      while (true) {

        log.info("Waiting for connection");
        NFCIPConnection nfcipConnection = nfcipManager.connectAsTarget();

        log.info("Connected, waiting for data...");

        byte[] data = null;
        int runs = 0;
        do {
          log.trace("Start of Run: " + runs);
          data = nfcipConnection.receive();
          log.info("Received: " + data.length + " Runs: " + runs);
          nfcipConnection.send(data);
          log.trace("End of Run: " + runs);
          runs++;
        } while (data != null && data.length > 0);

        log.info("DONE!!!");

        log.info("Closing connection");
        nfcipConnection.close();
        Thread.sleep(500);
      }
    }
    catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.nfctools.nfcip.NFCIPConnection

  public void run() {
    try {

      while (true) {
        log.info("Waiting for connection");
        NFCIPConnection nfcipConnection = nfcipManager.connectAsInitiator();

        log.info("Connected, sending data...");

        long time = System.currentTimeMillis();
        int totalSend = 0;

        byte[] data = new byte[200];
        for (int k = 0; k < data.length; k++)
          data[k] = (byte)(255 - k);

        for (int runs = 0; runs < RUNS; runs++) {

          log.trace("Start of Run: " + runs);
          nfcipConnection.send(data);
          totalSend += data.length;
          log.info("Send: " + data.length + " Runs: " + runs);
          byte[] receive = nfcipConnection.receive();
          log.info("Response: " + receive.length);
          log.trace("End of Run: " + runs);
        }

        nfcipConnection.send(new byte[0]);
        nfcipConnection.receive();

        double timeNeeded = (double)(System.currentTimeMillis() - time) / 1000.0;
        log.info("DONE in " + timeNeeded + "sec, " + df.format(((double)totalSend / 1024) / timeNeeded)
            + " kb/s");

        log.info("Closing connection");
        nfcipConnection.close();
      }
    }
    catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.nfctools.nfcip.NFCIPConnection

        scl3711 = new Scl3711(card);
        notifyStatus(TerminalStatus.WAITING);
        log.info("Waiting...");
        try {
          Scl3711NfcipManager nfcipManager = new Scl3711NfcipManager(scl3711);
          NFCIPConnection nfcipConnection = nfcipManager.connectAsInitiator();
          handleNfcipConnection(nfcipConnection);
        }
        catch (Exception e) {
        }
        finally {
View Full Code Here

Examples of org.nfctools.nfcip.NFCIPConnection

    nfcIpCommunicator.setNfcId(LlcpConstants.nfcId3t);
    nfcIpCommunicator.setFelicaParams(LlcpConstants.felicaParams);
    nfcIpCommunicator.setMifareParams(LlcpConstants.mifareParams);
    nfcIpCommunicator.setGeneralBytes(LlcpConstants.initiatorGeneralBytes);
    try {
      NFCIPConnection nfcipConnection = nfcIpCommunicator.connectAsInitiator();
      log.info("Connection: " + nfcipConnection);
      handleNfcipConnection(nfcipConnection);
    }
    finally {
    }
View Full Code Here

Examples of org.nfctools.nfcip.NFCIPConnection

    TamaNfcIpCommunicator nfcIpCommunicator = new TamaNfcIpCommunicator(apduReaderWriter, apduReaderWriter);
    nfcIpCommunicator.setNfcId(LlcpConstants.nfcId3t);
    nfcIpCommunicator.setFelicaParams(LlcpConstants.felicaParams);
    nfcIpCommunicator.setMifareParams(LlcpConstants.mifareParams);
    nfcIpCommunicator.setGeneralBytes(LlcpConstants.generalBytes);
    NFCIPConnection nfcipConnection = nfcIpCommunicator.connectAsTarget();
    log.info("Connection: " + nfcipConnection);
    handleNfcipConnection(nfcipConnection);
  }
View Full Code Here

Examples of org.nfctools.nfcip.NFCIPConnection

  private void connectAsInitiator(ApduTag tag) {
    ApduTagReaderWriter apduReaderWriter = new ApduTagReaderWriter(tag);
    TamaNfcIpCommunicator nfcIpCommunicator = new TamaNfcIpCommunicator(apduReaderWriter, apduReaderWriter);
    nfcIpCommunicator.setConnectionSetup(LlcpConstants.CONNECTION_SETUP);
    try {
      NFCIPConnection nfcipConnection = nfcIpCommunicator.connectAsInitiator();
      handleNfcipConnection(nfcipConnection);
    }
    catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.nfctools.nfcip.NFCIPConnection

          TamaNfcIpCommunicator nfcIpCommunicator = new TamaNfcIpCommunicator(readerWriter, readerWriter);
          nfcIpCommunicator.setNfcId(LlcpConstants.nfcId3t);
          nfcIpCommunicator.setFelicaParams(LlcpConstants.felicaParams);
          nfcIpCommunicator.setMifareParams(LlcpConstants.mifareParams);
          nfcIpCommunicator.setGeneralBytes(LlcpConstants.generalBytes);
          NFCIPConnection nfcipConnection = nfcIpCommunicator.connectAsTarget();
          handleNfcipConnection(nfcipConnection);

          //          tagListener.onTag(new AcsTag(tagType, historicalBytes, card));
        }
        catch (Exception e1) {
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.