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

xc100-rs232

v0.0.2

Published

Node.JS library for TOP Vending Machine

Downloads

3

Readme

XC100 bill dispenser

Node.JS library for TOP Vending Machine XC100 bill dispenser

Supported devices: XC100

Installation

Install from npm:

npm install xc100-rs232
const { XC100 } = require('xc100-rs232');

let xc = new XC100({
  debug: true,
  timeout: 5000
});

Methods

All methods use Promise

  • xc.open('COM1') - Connect device
  • xc.close() - Disconnect device
  • xc.command('COMMAND_NAME') - Execute command and get answer
  • xc.commandHex('COMMAND_NAME', Buffer HEX) - Execute command and get answer
  • xc.enabled - Dispenser status
  • xc.openPort - Port status

Command

await xc.command('CLEAR_ERROR_AND_COUNT')
.then(result => {
    console.log(result)
    return;
})

await xc.command('POWERFUL_OUT_BILL')

See all supported commands

Event

xc.on('RECEIVED', result => {
    console.log(result)
})

See all supported events

Example

const {
  XC100,
  dispensedBillsSlowWithRecord,
  dispensedBillsSlow,
  dispensedBillsPowerFul,
  dispensedBillsFastWithRecord,
  dispensedBillsFast
} = require('xc100-rs232');

let serialPortConfig = {
  baudrate: 9600,
  databits: 8,
  stopbits: 1,
  parity: 'none'
};

let xc = new XC100({
  debug: true,
  timeout: 5000
});

xc.on('OPEN', () => {
  console.log('Port opened!');
});

xc.on('CLOSE', () => {
  console.log('Port closed!');
});

xc.on('RECEIVED', (result) => {
  console.log('RECEIVED');
  console.log(result);
});

xc.open('/dev/tty.usbserial-14410', serialPortConfig)
  .then(async() => {
    console.log('GO!!!');

    console.log(await dispensedBillsSlowWithRecord(xc, 2));
    await xc.sleep(5000);
    console.log(await dispensedBillsSlow(xc, 2));
    await xc.sleep(5000);
    console.log(await dispensedBillsPowerFul(xc, 2));
    await xc.sleep(5000);
    console.log(await dispensedBillsFastWithRecord(xc, 2));
    await xc.sleep(5000);
    console.log(await dispensedBillsFast(xc, 2));

    await xc.command('CLEAR_ERROR_AND_COUNT');
    await xc.command('CLEAR_ERROR_RECORD');

    console.log('FINISH!!!');

  })
  .catch((error) => {
    console.log(error);
  });

Supported Commands:

Command name | Information return | Need promise | Description ------------------------------------|-------------------|-----------------------|------------------- CLEAR_COUNT | yes | yes | Cleans the dispensed bill counter CLEAR_ERROR | yes | yes | Clean dispenser errors CLEAR_ERROR_AND_COUNT | yes | yes | Clears dispenser counter and errors KEY_DISABLE | yes | yes | Disable the key KEY_ENABLE | yes | yes | Enable the key STATUS | yes | yes | Returns device status ERROR_RECORD | yes | yes | Returns device errors CLEAR_ERROR_RECORD | yes | yes | Clean up the bugs TOTAL_COUNT | yes | yes | Returns the total number of tickets dispensed PASSWORD_ENABLE | yes | yes | Enable the password PASSWORD_DISABLE | yes | yes | Disable the password POWERFUL_OUT_BILL | yes | yes | Powerful invoice ALL_BILL_RECORD | yes | yes | Returns the total number of tickets dispensed in their entire life

Example commands with options:

CLEAR_COUNT
xc.command('CLEAR_COUNT').then((result) => console.log(result););
CLEAR_ERROR
xc.command('CLEAR_ERROR').then((result) => console.log(result););
CLEAR_ERROR_AND_COUNT
xc.command('CLEAR_ERROR_AND_COUNT').then((result) => console.log(result););
KEY_DISABLE
xc.command('KEY_DISABLE').then((result) => console.log(result););
KEY_ENABLE
xc.command('KEY_ENABLE').then((result) => console.log(result););
STATUS
xc.command('STATUS').then((result) => console.log(result););
ERROR_RECORD
xc.command('ERROR_RECORD').then((result) => console.log(result););
CLEAR_ERROR_RECORD
xc.command('CLEAR_ERROR_RECORD').then((result) => console.log(result););
TOTAL_COUNT
xc.command('TOTAL_COUNT').then((result) => console.log(result););
PASSWORD_ENABLE
xc.command('PASSWORD_ENABLE').then((result) => console.log(result););
PASSWORD_DISABLE
xc.command('PASSWORD_DISABLE').then((result) => console.log(result););
POWERFUL_OUT_BILL
xc.command('POWERFUL_OUT_BILL').then((result) => console.log(result););
ALL_BILL_RECORD
xc.command('ALL_BILL_RECORD').then((result) => console.log(result););

Supported Events:

Event name | Description ------------------------------------|------------------ OPEN | Event that detects that the device was opened successfully CLOSE | Event that detects that the device was closed RECEIVED | Receive a 10-byte buffer with the response of the last command

Errors and contributions

For an error write the problem directly on github issues or submit it to the mail [email protected]. If you want to contribute to the project please send an email.

#xc100 , #BillDispenser , #Bill Dispenser , #TOP Vending Machine