How to Understand Java API Usage for Felica Cards: Difference between revisions

From wizarPOS
(Created page with "* Get RFCardReaderDevice <syntaxhighlight lang="java" line='line'> device = (RFCardReaderDevice) POSTerminal.getInstance(mContext).getDevice(POSTerminal.DEVICE_NAME_RF_CARD_...")
 
(Replaced content with "{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/card/use-felica-card}}")
Tag: Replaced
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* Get RFCardReaderDevice
{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/card/use-felica-card}}
<syntaxhighlight lang="java" line='line'>
  device = (RFCardReaderDevice) POSTerminal.getInstance(mContext).getDevice(POSTerminal.DEVICE_NAME_RF_CARD_READER);
</syntaxhighlight>
* Open device
<syntaxhighlight lang="java" line='line'>
  device.open();
</syntaxhighlight>
* Search Card
<syntaxhighlight lang="java" line='line'>
  OperationListener listener = new OperationListener() {
    @Override
    public void handleResult(OperationResult arg0) {
      if (arg0.getResultCode() == OperationResult.SUCCESS) {
        sendSuccessLog2(mContext.getString(R.string.find_card_succeed));
        rfCard = ((RFCardReaderOperationResult) arg0).getCard();
      } else {
        sendFailedLog2(mContext.getString(R.string.find_card_failed));
      }
    }
  };
  device.listenForCardPresent(listener, TimeConstants.FOREVER); The result will be returned in the callback listener.
</syntaxhighlight>
* Communicate with Card
<syntaxhighlight lang="java" line='line'>
  if (rfCard instanceof FelicaCard) {
    result = ((FelicaCard) rfCard).transmit(arryAPDU, 0);
  }
</syntaxhighlight>
* Close device
<syntaxhighlight lang="java" line='line'>
  device.close();
</syntaxhighlight>

Latest revision as of 09:20, 7 April 2024

Please visit new link of same subject:

https://smartpossdk.gitbook.io/cloudpossdk/faq/card/use-felica-card

We're making a move! Our site's content is migrating to a new URL, to provide you with an enhanced browsing experience. Please update your bookmarks accordingly. Thank you for your continuous support!