Package org.nfctools.spi.tama.response

Examples of org.nfctools.spi.tama.response.DataExchangeResp


      if (inListPassiveTargetResp.getNumberOfTargets() > 0) {
        log.info("TargetData: " + NfcUtils.convertBinToASCII(inListPassiveTargetResp.getTargetData()));
        if (inListPassiveTargetResp.isIsoDepSupported()) {
          log.info("IsoDep Supported");
          byte[] selectAidApdu = createSelectAidApdu(AID_ANDROID);
          DataExchangeResp resp = sendMessage(new DataExchangeReq(inListPassiveTargetResp.getTargetId(),
              false, selectAidApdu, 0, selectAidApdu.length));
          String dataIn = new String(resp.getDataOut());
          log.info("Received: " + dataIn);
          if (dataIn.startsWith("Hello")) {
            exchangeData(inListPassiveTargetResp);
          }
        }
View Full Code Here


      }
    }
  }

  private void exchangeData(InListPassiveTargetResp inListPassiveTargetResp) throws IOException {
    DataExchangeResp resp;
    String dataIn;
    while (true) {
      byte[] dataOut = ("Message from desktop: " + messageCounter++).getBytes();
      resp = sendMessage(new DataExchangeReq(inListPassiveTargetResp.getTargetId(), false, dataOut, 0,
          dataOut.length));
      dataIn = new String(resp.getDataOut());
      log.info("Received: " + dataIn);
    }
  }
View Full Code Here

      if (dataRead < 0) // if data was empty send 0 bytes
        dataRead = 0;

      log.debug("Sending data... " + dataRead + " MI: " + moreInformationToSend);
      DataExchangeResp dataExchangeResponse = tamaCommunicator.sendMessage(new DataExchangeReq(targetId,
          moreInformationToSend, buffer, 0, dataRead));
      if (dataExchangeResponse.getDataOut().length > 0)
        response.write(dataExchangeResponse.getDataOut());
      //        throw new IOException("unexpected data received " + dataExchangeResponse.getDataOut().length);
    } while (in.available() > 0);
  }
View Full Code Here

TOP

Related Classes of org.nfctools.spi.tama.response.DataExchangeResp

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.