npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@xavier.seignard/ssp

v0.1.8

Published

Smiley Secure Protocol, node.js implementation

Downloads

14

Readme

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: