In Depth Unveiling of Gretio
Gretio is an Android application I have been working on and off for the past year. It’s objective is to serve as a standalone replacement for the app I made about two years ago, BiScan. The idea is simply a light weight scan tool for Vehicles people can run on their phone, but this tool would have some advantages.
Most tools on the market follow a simple Request->Response architecture. This is pretty similar to an HTTP Architecture. Although this is very easy to implement, it ends up clogging up the network.
Packages, as shown, are much more optimal. Each package contains multiple pieces of information sent in a single ‘packet’ we will call it. Gretio uses these packages in lieu of the old method, and can receive over 60 hertz of information on average.
Of course there is still another problem, which is that these vehicles only like having one connection at a time. To solve this, I embedded a full web server into the app to server as the ‘host’. Meaning only one Android device needs to talk to the vehicle, and the rest can get their information from that device. It then uses websockets with a custom protocol implemented using Netty (which works almost flawlessly on Android).
The protocol uses an object format known as MessagePack, which is more or less an optimized form of JSON. Additionally all traffic is encrypted using TLS Encryption. Authentication is done by a randomly generated token the server provides.
To help clients find their servers, Gretio also broadcasts on the broadcast channel of its local network. The user simply taps on their target server, and, if they are able, they will connect to it.
This should make setting up from scratch extremely quick. It’s as simple as insuring all your devices are on the same network. A single phone can host hundreds of clients, bandwidth permitting. If you want 100 screens showing your speedometer, you can certainly do so.
Those ‘speedometers’ are also a key part of the app. What good is information if we can’t show it off? So Gretio has a variety of built in gauges in a range of colors and styles. They are all managed by what I call the ‘dashboard’.
The dashboard is very similar to an Android launcher. You can drag and drop your gauges wherever you want. You can even add widgets from other apps.
These gauges are built using Lottie and Adobe After Effects. Meaning they should look crisp and move as smooth as butter.
The app itself is a monumental project. It already contains roughly 40,000 lines of Kotlin, 10,000 line of Java, and another 25,000 wrapped up in HTML, Java Script, and XML files. It has come a long way since its inception, but still has a long ways to go.