Portfolio: POS cash drawer daemon

This page describes a proprietary daemon to provide a file-based interface between point-of-sale software and various models of till cash drawer, which I built while employed as a Linux system administrator and Linux architect.

Key details
Brief description:A daemon which provides a file-based interface for point-of-sale software to control cash drawers without needing to know which model of cash drawer is connected.
Consumer:Retail software developers
Impact to consumer:
  • Reduced software development time
  • Simpler release management due to separation of concerns
Technical features:
  • Compact daemon in C portable to all current Linux variants
  • Supports multiple Linux variants
  • Automatic detection of each supported cash drawer type
  • Minimal overhead with no complicated frameworks or dependencies
Technologies used:C

Expansion of the company's retail estate, and a slow hardware refresh rate, means that there are multiple extant till types with various types of peripherals, all running the same point-of-sale software and all connected to the same ERP.

To allow the POS developers to concentrate on POS features without complicating the software with support for all of the cash drawer types in use, I designed a simple file-based API to interface with a separate daemon, so that the POS would only need to use the API, and its conditional code relating to different peripheral types could be removed.

The file-based API is an area under which the POS creates a file to trigger the cash drawer to open; and another file which the daemon creates or removes according to whether the cash drawer is currently open. As a result, all the POS needs to do to check if the cash drawer is open is to check whether a particular file exists.

The cash drawers connect in various ways - RS-232, third-party kernel driver providing I/O mapping, and USB - all of which this daemon supports. To the POS, they all look the same through the API.

I wrote the daemon in C and packaged it separately to the POS software - this means that a POS feature rollout can remain separate from peripherals support, simplifying management.

The daemon also provides its own audit trail, writing a syslog message whenever the cash drawer changes state. These messages are recorded to the local till and also transmitted to a central location.