0.1.6 • Published 5 years ago
ts-ssp v0.1.6
Typescript Smiley ® Secure Protocol
NodeJS library to work with coin and bill acceptors under SSP protocol. Based on the work by soulman-is-good.
Supported devices
- NV10
- NV9 (not tested)
You are always welcome to add implementation to another device. Theoritically, you just need to add commands list to src/commands, a device name to SSPType type and check out event codes in src/events.ts.
Installation
npm install ts-ssp
Methods
open: () => Promise<void>- initializes connection to deviceclose: () => Promise<void>- stops connection to deviceenable: () => Promise<void>- enables money receivingdisable: () => Promise<void>- disabled money receivingcommands.exec: (commandName?: string, ...commandArguments: number[]) => Promise<void>- Adds a command to command stack and execute it. If no commandName is passed, just executes the command stackon: (eventName: string, eventHandler: (...args: number[])) => void- Attaches event handleroff: (eventName: string, eventHandler: (...args: number[])) => void- Dettaches event handlerisOpened: () => boolean- is connection to device openedisEnabled: () => boolean- is money receiving enabled
Events
start- emits after device is initializedclose- emits after device is disconnectederror- emits when any error occured- other events supported by SSP protocol like
slave_reset,read_note,credit_note,note_rejecting,note_stacking,disabled
Examples
- Basic example with ILS (
npm run examples:ils-defaultto run it)
TODO
There are a lot of things we need to finish to make this project great again:
- Add support of more devices
- Add support of encrypted layer
- Write some tests and refactoring
Contributions are always welcome!