Giter Site home page Giter Site logo

cdpop's Introduction

cdpop

Pop open cash drawer using http or https GET request:

GET /status	Return cash drawer status
GET /open	Request cash drawer open

If authentication is configured, supply user and/or auth as query parameters, eg:

GET /status?auth=Ricim8Knak

Requests to open drawer will return successfully (200) as soon as possible, but will be processed in turn once access to the attached device is available. No feedback is provided for an open request.

Requests for status will block until a valid status can be read from the attached device. In the case of a hardware error, status requests will return Internal Server Error (500).

Usage

$ cdpop [config.json]

Requirements

  • python >= 3.9
  • tornado
  • posiflex-hidcd

Configuration

Copy example config to a new file and edit as required. Available configuration options:

  • port (int) TCP service port, default: 41514 (optional)
  • host (string) Listen address, default: "localhost" (optional)
  • cert (string) TLS certificate path, default: None (optional)
  • key (string) TLS private key path, default: None (optional)
  • auth (string) Authorisation key, default: None (optional)
  • user (string) Authorisation username, default: None (optional)
  • drawer (int) Cash drawer number, default: None (optional)

Notes:

  • If drawer number is not specified, cdpop will connect to the first hid cash drawer found. See related project posiflex-hidcd for details.
  • To listen on all addresses, specify the empty string "" for host.

MacOS Installation

Install xcode developer tools:

$ xcode-select --install

Install brew according to brew website.

Install hidapi using brew:

$ brew install hidapi

Install python3 if not already installed:

$ brew install [email protected]

Using python, create a venv and install cdpop packages using pip:

$ python3 -m venv cdpop --system-site-packages
$ ./cdpop/bin/pip install cdpop

Optionally, create a cdpop config file.

Create launch agent plist file (see example cdpop.plist), copy to ~/Library/LaunchAgents and enable using launchctl:

$ cp cdpop.plist /Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/cdpop.plist
$ launchctl enable xxx/yyy/cdpop
$ launchctl kickstart -k xxx/yyy/cdpop

cdpop's People

Contributors

ndf-zz avatar

Watchers

 avatar

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.