Skip to content

PhoneGap plugin for communicating with ACS NFC readers. Currently supports Android and uses version 1.1.2 of the ACR drivers.

License

Notifications You must be signed in to change notification settings

MorningCoffeeDev/ACR-NFC-Reader-PhoneGap-Plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECIATION NOTICE

Please note, we have not used this plugin for many years now and, as such, it is likely that it doesn't work with modern ACR units or Cordova. We will keep the repo online for inspiration but we are unable to provide any support.

create a new plugin

plugman create --name ACR-NFC-Reader-PhoneGap-Plugin --plugin_id com.frankgreen --plugin_version 0.0.1

add a platform

plugman platform add --platform_name android

install to project

git clone [email protected]:MorningCoffeeDev/ACR-NFC-Reader-PhoneGap-Plugin.git
cordova plugin add ../ACR-NFC-Reader-PhoneGap-Plugin/

Usage

ACR.onReady

This method will be invoke when Reader ready.

Example

  ACR.onReady = function (reader) {
     alert("ready " + reader);
  }

ACR.addTagListener

Registers an event listener for Reader

  ACR.addTagListener(success,failure);

Parameters

  • success: on detect a chip successful;
  • failure: on detect a chip failure;

Example

  ACR.addTagListener(
      function(result){
        alert("UID: " + JSON.stringify(result));
      },
      function(result){
        alert("UID Failure: " + JSON.stringify(result));
      }
  );

ACR.readData

Read data from chip

  ACR.readData(block,success,failure);

Parameters

  • block: which block you want to read.
  • success: successful callback;
  • failure: failure callback;

Example

  ACR.readData(4,
      function(result){
        alert("Data: " + JSON.stringify(result));
      },
      function(result){
        alert("Data Failure: " + JSON.stringify(result));
      }
  );

ACR.writeData

write data to chip, maximum 16 character in each block

  ACR.writeData(block,data,success,failure);

Parameters

  • block: which block you want to write.
  • data: the data will be write to chip.
  • success: successful callback;
  • failure: failure callback;

Example

  ACR.writeData(4,
      "test",
      function(result){
        alert("Write Data: " + JSON.stringify(result));
      },
      function(result){
        alert("Write Data Failure: " + JSON.stringify(result));
      }
  );

About

PhoneGap plugin for communicating with ACS NFC readers. Currently supports Android and uses version 1.1.2 of the ACR drivers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published