Hello! I'm osi

I build and break things

(and pretend to be a bear on the internet)

osi, a bear with green ears and a purple stripe
← back to works

POS Detodito

for Detodito

Detodito is a small food stand, and POS Detodito is the system that runs its counter. One Android tablet, propped up in landscape, replaces the notepad: categories on the left, a grid of products in the middle, the current order and its total on the right. It tracks stock, records each sale against an open shift, asks for a payment method and prints a ticket on a network thermal printer. There is no account, no cloud service and no subscription behind it.

The detail that makes it distinctive comes after the operator confirms an order. The printer produces two separate receipts from a single job: a short numbered stub for the customer, and a full itemised ticket for the kitchen.

One order, three panels

The catalogue follows the stand: hamburgers, fries, milanesas, empanadas, hot dogs and drinks, in Spanish with prices in pesos. Picking a category filters the grid. Tapping a product with extras opens a second grid of toppings, each priced, plus a free-text note. Cheddar, a fried egg or extra beef all change the price and the kitchen's work.

The order panel merges identical lines, so tapping the same burger four times gives one line of four. A tap removes one unit, a long press removes the line. Products at zero stock disappear from the grid, and confirming an order subtracts what was sold. Payment comes next: cash, card, QR, transfer or other. The order is saved before the app tries to print.

A stub for the customer, a ticket for the kitchen

The printer is an ordinary thermal unit that speaks ESC/POS, the command language receipt printers understand, reached over the local network on port 9100. It has no driver and no notion of a page. The app opens a socket and writes bytes, mixing text with short control sequences for alignment, bold, character size and the cutter. The layout is composed for 48 columns, with product names wrapped by hand and prices at the right edge.

Each sale prints in two parts. The customer's copy comes first, with the order number at triple size, then the cutter fires. The main ticket follows on the same connection: order number at double size, every item with its extras and note, the payment method and the total.

output.writeExtraLargeCentered("[${pedido.id}]")
output.write(ESC_CUT)

The cut command is what turns one print job into two pieces of paper.

A print queue that refuses to give up

A printer on Wi-Fi fails in boring ways: unplugged, out of paper, asleep, or on a different subnet. Orders cannot depend on it. Every print job enters a queue and one worker handles them in order. A failed job is retried after two seconds, then four, then six, up to half a minute between attempts, and it keeps trying until it succeeds.

A status label shows whether the printer is connected, disconnected or printing, and the queue screen lists pending jobs plus the last fifty orders, each with a reprint button. If an attempt fails, the operator sees an error right away, yet the ticket can still come out minutes later.

A shift has a beginning and an end

Sales belong to a turno rather than to a calendar day, which matches how a stand works: lunch and night service are different businesses. Ordering is blocked until a shift is started, and closing it stops new orders without deleting anything. The report screen shows that shift's order count, total and a breakdown by payment method, with every order listed underneath.

An admin page that lives on the tablet

The tablet also runs a small web server on port 8080. Its page manages the same catalogue and reports, behind a browser password prompt. Prices and stock can be changed from a phone on the same network without moving the tablet.

Reaching it from outside is harder, because the tablet has no public address. Instead of opening a port or running a VPN, the app connects outwards. A small PHP script on a public host stores incoming requests; the tablet polls it once a second, forwards them to its own local server and posts the response back. The browser waits for that round trip, so pages feel slightly delayed, but it works from a phone anywhere, behind any router. Leftover requests are discarded after five minutes.

Built to stay on

The app targets cheap Android hardware, including Amazon Fire tablets. Every screen is locked to landscape and fullscreen, and the display stays awake through a thirty-minute wake lock renewed on each resume. Navigation uses pop-up menus instead of an action bar, because a system bar sliding in over an order screen is a nuisance. The database is local SQLite, there are no Google services, and the app is one module with plain Android views.

It is signed and installed directly, with no public release.