Giter Site home page Giter Site logo

jju567 / acr-nfc-reader-phonegap-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from morningcoffeedev/acr-nfc-reader-phonegap-plugin

0.0 1.0 0.0 243 KB

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

Java 96.62% JavaScript 3.38%

acr-nfc-reader-phonegap-plugin's Introduction

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.addTagIdListener

Registers an event listener for Reader

  ACR.addTagIdListener(success,failure);

Parameters

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

Example

  ACR.addTagIdListener(
      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));
      }
  );

acr-nfc-reader-phonegap-plugin's People

Contributors

xueshibing avatar lokyoung avatar darkbaby123 avatar yangxiaomei avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.