Package org.nfctools.spi.tama.nfcip

Examples of org.nfctools.spi.tama.nfcip.TamaNfcIpCommunicator


      ByteArrayWriter writer = new ArygonLowLevelWriter(new ByteArrayOutputStreamWriter(
          ((InputOutputToken)nfcDevice.getConnectionToken()).getOutputStream()));

      byte[] nfcId = { 0x0F, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F };

      TamaNfcIpCommunicator nfcipManager = new TamaNfcIpCommunicator(reader, writer);
      nfcipManager.setNfcId(nfcId);

      NfcInitiator nfcInitiator = new NfcInitiator(nfcipManager);
      Thread thread = new Thread(nfcInitiator);
      thread.start();
View Full Code Here


      ByteArrayWriter writer = new ArygonLowLevelWriter(new ByteArrayOutputStreamWriter(
          ((InputOutputToken)nfcDevice.getConnectionToken()).getOutputStream()));

      byte[] nfcId3t = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

      TamaNfcIpCommunicator nfcipManager = new TamaNfcIpCommunicator(reader, writer);
      nfcipManager.setNfcId(nfcId3t);

      NfcTarget nfcTarget = new NfcTarget(nfcipManager);
      Thread thread = new Thread(nfcTarget);
      thread.start();
      log.info("Target running...");
View Full Code Here

    this.cardDetected(mfCard, mfReaderWriter);
  }

  private void openLlcpStack(Card card) throws IOException {
    ApduReaderWriter apduReaderWriter = new ApduReaderWriter(card, true);
    TamaNfcIpCommunicator nfcIpCommunicator = new TamaNfcIpCommunicator(apduReaderWriter, apduReaderWriter);
    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

      throw new IOException(e);
    }
  }

  private void connectAsTarget(ApduReaderWriter apduReaderWriter) throws IOException {
    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

    }
  }

  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

        ApduTagReaderWriter readerWriter = new ApduTagReaderWriter(new AcsDirectChannelTag(tagType,
            historicalBytes, card));

        try {
          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

  @Override
  public void handleTag(Tag tag) {
    ApduTagReaderWriter apduReaderWriter = new ApduTagReaderWriter((ApduTag)tag);

    TamaNfcIpCommunicator nfcIpCommunicator = new TamaNfcIpCommunicator(apduReaderWriter, apduReaderWriter);
    nfcIpCommunicator.setConnectionSetup(LlcpConstants.CONNECTION_SETUP);
    try {
      NFCIPConnection nfcipConnection = nfcIpCommunicator.connectAsInitiator();
      log.info("Connection: " + nfcipConnection);
      handleNfcipConnection(nfcipConnection);
    }
    catch (IOException e) {
      e.printStackTrace();
View Full Code Here

  @Override
  public void onTarget(Target target, NfcContext nfcContext) throws IOException {

    log.info("New target");
    TamaNfcIpCommunicator nfcIpCommunicator = nfcContext.getAttribute(NfcContext.KEY_COMMUNICATOR);
    //    nfcIpCommunicator.setTimeout(100); // default
    //
    //    List<Object> parameter = extractLlcParameters(target.getNfcId());
    //    nfcContext.setAttribute("llcparameter", parameter);
    //    for (Object object : parameter) {
    //      if (object instanceof LinkTimeOut) {
    //        LinkTimeOut lto = (LinkTimeOut)object;
    //        nfcIpCommunicator.setTimeout(lto.getValue() * 10);
    //      }
    //    }

    // TODO check target general bytes for llc header

    byte[] generalBytes = new byte[llcHeader.length + llcParameters.length];
    System.arraycopy(llcHeader, 0, generalBytes, 0, llcHeader.length);
    System.arraycopy(llcParameters, 0, generalBytes, llcHeader.length, llcParameters.length);

    log.info("reply...");
    Integer statusCode = nfcIpCommunicator.sendMessage(new SetGeneralBytesReq(generalBytes));
    if (statusCode.intValue() != 0)
      throw new IOException("status code: " + statusCode);
  }
View Full Code Here

TOP

Related Classes of org.nfctools.spi.tama.nfcip.TamaNfcIpCommunicator

Copyright © 2018 www.massapicom. 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.