I write the Host-Based Card Emulation(HCE) Application to do the mobile payment on my smartphone. I also use nfc-tools library to help me in coding both app on my phone and the reader. When I try to run the code on those 2 devices,both of them can connect together but it gives me the error as show belowed:
org.nfctools.scio.TerminalHandler getAvailableTerminal
INFO: Checking terminal: ACS ACR122 0
DEBUG: org.nfctools.spi.acs.AcsDirectChannelTag - command: FF00000004D44A0100
DEBUG: org.nfctools.spi.acs.AcsDirectChannelTag - response: D54B009000
javax.smartcardio.CardException: Cannot connect using direct, connection already established using Unknown protocol 0
at sun.security.smartcardio.TerminalImpl.connect(Unknown Source)
at HCECardScanner.run(HostCardEmulationCardScanner.java:18)
at Reader.run(Reader.java:622)
at Reader$11.actionPerformed(Reader.java:565)
Moreover, When I see in the log of the application,I found that My Application has a problem to start and run the Host-Based Card Emulation Service too.
06-28 14:18:30.083: I/ActivityManager(974): Start proc com.example.nfchcepayment for service com.example.nfchcepayment/.FirstApplet: pid=6068 uid=10268 gids={50268}
06-28 14:18:30.093: E/jdwp(6068): Failed sending reply to debugger: Broken pipe
06-28 14:18:30.093: D/dalvikvm(6068): Debugger has detached; object registry had 1 entries
06-28 14:18:30.103: I/dalvikvm(6068): Could not find method javacard.framework.ISOException.throwIt, referenced from method com.example.nfchcepayment.FirstApplet.processCommandApdu
Both 2 error are also related?