DEV Community

Gustavo Santos
Gustavo Santos

Posted on • Edited on

How I integrated a 2014 Wi-Fi Scale with C++ and Qt (The ultimate Offline-First ERP

The Context: Digitalizing Chaos
Imagine a business with zero digital footprint. No computers, no legacy software. Just notebooks, paper, and manual calculations.

The only "tech" available? Old weighing scales from 2014 with a Wi-Fi module that was never turned on.

The Challenge: Low-Level Integration
Most modern developers are used to fetching JSON from a REST API. My challenge was different: I had to talk to hardware.

Old Protocols: The scales used an outdated Wi-Fi security standard (WPA-PSK with TKIP). Modern routers hate this. I had to bridge the gap between modern network stability and "legacy" hardware constraints.

Real-Time Data: I implemented a custom ScaleClient using TCP Sockets to pull weight data in real-time. No room for lag when there’s a line of customers waiting.

Barcode Magic: I wrote a custom validator for EAN-13 labels to extract weight and price directly from the thermal printer labels (Toledo Prix 5 protocol).

The Architecture: Built to Never Fail
In a butcher shop, if the internet goes down, the business cannot stop. Period.

Offline-First: Built with C++ and Qt, using a local SQLite engine with a custom migration system (runMigrations()). Data is safe even if the power cuts.

Embedded HTTP Server: I didn't want to manage a separate web server. So, I built a native HTTP Server (QTcpServer) inside the ERP.

Edge Computing: The "cold storage" (backroom) workers use their phones to access the local IP. My C++ backend serves a native Web App directly to them. No cloud, no latency.

The "Art" of the Dashboard
Since I wanted the system to be ultra-lightweight, I avoided heavy charting libraries. I used QPainter to manually render:

Real-time Sales Bar Charts.

Category Pie Charts.

Inventory Alerts.

The result? A system that opens in milliseconds and runs on basically any hardware.

What I Learned
Digital transformation isn't about the newest Javascript framework. It's about observation.

Understand the manual bottleneck (the paper notebook).

Connect the physical world (the scale) to the digital world (the DB).

Build for resilience (Offline-First).

The project is 80% done, and it’s a beast.

Top comments (0)