Git Product home page Git Product logo

node-ssp's Introduction

Smiley Secure Protocol nodejs implementation

Introduction

This library allows you to manipulate bill acceptors and note validators under SSP. Written by Innovative Technologies SSP manual

Maintained devices:

  • NV10
  • NV9 //preparing

Installation

npm install ssp

Usage

var ssp = require('ssp');
var notes = {
  1:"200KZT",
  2:"500KZT",
  3:"1000KZT",
  4:"2000KZT",
  5:"5000KZT",
  6:"10000KZT"
};
ssp = new ssp({
  device: '/dev/ttyACM0', //device address
  type: "nv10usb", //device type
  currencies:[0,1,1,1,1,0] //currencies types acceptable. Here all but 200KZT
});

ssp.init(function(){
  ssp.on('ready', function(){
    console.log("Device is ready");
    ssp.enable();
  });
  ssp.on('read_note', function(note){
    if(note>0) {
      console.log("GOT",notes[note]);
      if(note === 3) {
        // suddenly we decided that we don't need 1000 KZT
        ssp.commands.exec("reject_banknote");
      }
    }
  });
  ssp.on('disable', function(){
    console.log("disabled");
  });
  ssp.on('note_cleared_from_front', function(note){
    console.log("note_cleared_from_front");
  });
  ssp.on('note_cleared_to_cashbox', function(note){
    console.log("note_cleared_to_cashbox");
  });
  ssp.on('credit_note', function(note){
    console.log("CREDIT",notes[note]);
  });
  ssp.on("safe_note_jam", function(note){
    console.log("Jammed",note);
    //TODO: some notifiaction, recording, etc.
  });
  ssp.on("unsafe_note_jam", function(note){
    console.log("Jammed inside",note);
    //TODO: some notifiaction, recording, etc.
  });
  ssp.on("fraud_attempt", function(note){
    console.log("Fraud!",note);
    //TODO: some notifiaction, recording, etc.
  });
  ssp.on("stacker_full", function(note){
    console.log("I'm full, do something!");
    ssp.disable();
    //TODO: some notifiaction, recording, etc.
  });
  ssp.on("note_rejected", function(reason){
    console.log("Rejected!",reason);
  });
  ssp.on("error", function(err){
    console.log(err.code, err.message);
  });
});

Properties

  • commands - Generated on creation command-interface for sending command or stack of commands to device

Methods

  • init([enableOnInit],[callback]) - Initializes device, in case of an error emits error event. Can take boolean as a first argument which defines whether enable or not a device on init, second argument is callback, which has possible exception;
  • enable([callback]) - Enables device. Callback may be as an argument to supply asynchrony
  • disable([callback]) - Disables device. Callback may be as an argument to supply asynchrony
  • commands.{command} - device`s commands binds as a methods to commands interface and can be chained in execution stack like ssp.commands.enable().display_off().event_ack() and then executed via exec method
  • commands.exec([command], [callback]) - executes command stack. Method has optional command parameter which if passed made to the end of command stack, and a callback.

Events

  • ready - emits when device is ready for data.
  • close - emits on device closes. e.g. disconnected
  • error - emits when error occures. Has error object as an argument of a callback
  • other events supported by SSP protocol like slave_reset, read_note, credit_note, note_rejecting, note_stacking, disabled et.c.

Thanks to

Contributors:

node-ssp's People

Contributors

soulman-is-good avatar vandalko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-ssp's Issues

[bug] Parser data collisions

For example
Last Reject Code has response:
7F 80 02 F0 00 12 20
At this time Setup Request has response
7F 80 17 F0 00 30 31 30 30 45 55 52 00 00 01 03 05 0A 14 02 02 02 00 00 64 04 2A 25

As we can see that data starts with 7F 80 XX F0 00, where XX is just its length
But in case of Last Reject Code 00 represents rejection code
In case of Setup Request 00 represents device type
Here https://github.com/soulman-is-good/node-ssp/blob/master/index.js#L154-L343 we catch all the data with length > 1 and if we catch 00 we read it as reject code, but we need to pay attention to data length and differ it or add callbacks for commands to separate events and commands responses.

ssp payout for nv200

Hello,

we have innovative technologies nv200 divice connected to our ATM machine and we have installed the ssp labraries for the device and also its detects correctly.
now we are unable find any solutions for the payout cash from the device or not found any program code for that so we request you please provide us any best code or solution for this.

thank you

example needed

Can you please give a simple example of how to console log something like "get_serial_number"?
I have studied your example code, but I have no idea on how to get these commands back and the example doesn't use it either.
Thanks in advance

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.