Giter VIP home page Giter VIP logo

sunmi-card-reader's Introduction

Sunmi Card Reader Cordova Plugin

This is a wrapper plugin that allows you to read different cards with a Sunmi device through a Cordova App

Installation

cordova plugin add https://github.com/PirataFrancis/sunmi-card-reader.git

Functions covered

startReadCard(cardsTypeToRead) ๐Ÿ‘

Start reading cards info

Parameters

  • cardsTypeToRead: Array of Integers (one Int for each card type, see Appendix 1)
window.SunmiCardReader.startReadCard([8])
.then(function(payload){
	console.log(payload);
}).catch(function (error) {
	console.log(error);
});

authMifare(cardBlockPassword, cardKey, blockNumber) ๐Ÿ‘

Authenticate a Mifare Cards Should be called after startReadCard

Parameters

  • cardBlockPassword: String
  • cardKey: Integer (0 for Key A || 1 for Key B)
  • blockNumber: Integer
window.SunmiCardReader.authMifare("ffffffffffff",0,5)
.then(function(payload){
	console.log(payload);
}).catch(function (error) {
	console.log(error);
});

readBlockMifare(blockToRead) ๐Ÿ‘

Read a card block Should be called after AuthMifare

Parameters

  • blockToRead: Integer
window.SunmiCardReader.readBlockMifare(5)
.then(function(payload){
	console.log(payload);
}).catch(function (error) {
	console.log(error);
});

writeBlockMifare(blockToWrite,stringToWrite) ๐Ÿ‘

Write Hex into a card block Should be called after AuthMifare

Parameters

  • blockToRead: Integer
  • stringToWrite: String
window.SunmiCardReader.writeBlockMifare(5,"12111100000000000000000000000000")
.then(function(payload){
	console.log(payload);
}).catch(function (error) {
	console.log(error);
});

Release History

  • 0.0.1
    • Work in progress, pushed first 4 functions

About me

I'm Francesco Borrelli an Italian Android Dev, I love coding, software engineering and pizza so feel free contact me about anything ๐Ÿ‘Š Email Facebook

Distributed under the MIT license. See LICENSE for more information.

Contributing

  1. Fork it (https://github.com/PirataFrancis/sunmi-card-reader/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

sunmi-card-reader's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sunmi-card-reader's Issues

Hi This plugin can be integrated with ionic

Great work is appreciated the effort, I want to integrate it with an app in ionic 3 you think this plugin works for me and I can also print using the options to read the device card sunmi thanks

I get an error when built...

Hello
Thank you for a wonderful plugin.

I had my app developed by monaca use a plugin, but I get an error at the built-in and I can not move forward from here. Could you tell me what is the cause?

---------- The following is the log. ----------

  • postBuild -
    Build Error: Error: Sandbox Exec Error: [
    FAILURE: Build failed with an exception.
  • What went wrong:
    Could not resolve all files for configuration ':debugCompileClasspath'.

Could not find :rel:.
Searched in the following locations:
file:/data/android-sdk/extras/m2repository//rel//rel-.pom
file:/data/android-sdk/extras/m2repository//rel//rel-.aar
file:/data/android-sdk/extras/google/m2repository//rel//rel-.pom
file:/data/android-sdk/extras/google/m2repository//rel//rel-.aar
file:/data/android-sdk/extras/android/m2repository//rel//rel-.pom
file:/data/android-sdk/extras/android/m2repository//rel//rel-.aar
https://jcenter.bintray.com//rel//rel-.pom
https://jcenter.bintray.com//rel//rel-.aar
https://maven.google.com//rel//rel-.pom
https://maven.google.com//rel//rel-.aar
file:/private/tmp/monaca/5bc85de0e78885187e92059d/project/platforms/android/src/main/libs/rel-.aar
file:/private/tmp/monaca/5bc85de0e78885187e92059d/project/platforms/android/src/main/libs/rel.aar
Required by:
project :

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 6s
Error: /private/tmp/monaca/5bc85de0e78885187e92059d/project/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all files for configuration ':debugCompileClasspath'.

Could not find :rel:.
Searched in the following locations:
file:/data/android-sdk/extras/m2repository//rel//rel-.pom
file:/data/android-sdk/extras/m2repository//rel//rel-.aar
file:/data/android-sdk/extras/google/m2repository//rel//rel-.pom
file:/data/android-sdk/extras/google/m2repository//rel//rel-.aar
file:/data/android-sdk/extras/android/m2repository//rel//rel-.pom
file:/data/android-sdk/extras/android/m2repository//rel//rel-.aar
https://jcenter.bintray.com//rel//rel-.pom
https://jcenter.bintray.com//rel//rel-.aar
https://maven.google.com//rel//rel-.pom
https://maven.google.com//rel//rel-.aar
file:/private/tmp/monaca/5bc85de0e78885187e92059d/project/platforms/android/src/main/libs/rel-.aar
file:/private/tmp/monaca/5bc85de0e78885187e92059d/project/platforms/android/src/main/libs/rel.aar
Required by:
project :

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 6s
]


Thank you.

importing library to native Android app

Hello,
Thank you very much for wrapper library for card reader on sunmi. I want to use this library on my native Android app but couldn't manage it. Could you please help me resolve this issue.

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.