Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
ArnLib - Active Registry Network - Qt 4 & 5
micwik last edited by
"ArnLib Download and Description":http://micwik.github.io/ArnLib
This Qt 4 & 5 based library makes it easy to distribute changing data objects. It also gives a central place to find all your systems current data. By using the ArnBrowser, all data objects are real time presented in a tree view.
ArnLib has proven to be very efficient and stable to work with. My home automation system has now run reliable with ArnLib for many years.
I believe ArnLib could be beneficial in a lot of projects. It should be well suited to the following conditions:
A lot of configurations and changing values. ArnLib helps giving out-of-the-box diagnostics and ability to change values not yet available in the custom application user interface.
Hardware with a lot of sensors and controls. Arnlib helps giving a common interface and diagnostic.
Distributed systems. ArnLib helps giving an out-of-the-box data sharing system that replicates Arn objects.
Networked services by RPC (remote procedure call). Will be quite the same as setting up slots for local calls. Also calling a remote slot can be done via a signal or a direct call. You can find an easy example in the ArnLib package, showing a "simple chat Client and Server":http://micwik.github.io/ArnLib/doxy_html/chatdemo.html.
h2. Example gallery of ArnBrowser
Two ArnBrowsers are available. One native Qt GUI program, and one web based for normal web browsers.
"ArnBrowser example gallery":https://github.com/micwik/ArnBrowser/wiki/Example-gallery
"WebArnBrowser example gallery":https://github.com/micwik/WebArnBrowser/wiki/Example-gallery
h2. The history of ArnLib
My name is Michael Wiklund. I've been doing electronics and programming since 1980. Both on a hobby basis and as a profession. I have a M.Sc.C.E degree from Chalmers University of Technology, Sweden.
Almost 15 years ago I started working on a home automation project for my new house. In focus were controlling of room thermostats, sun shaders, irrigation and some more. Sensors included eather station, sun radiation and a lot of temperature values from the thermostats. All this were spread out to different units and a diverse of buses and interfaces.
My first plan was to gather all values, preferably in a tree structure, like a file system. Traditional databases are focused on storing, not fast changing values. I couldn't find anything suitable and good enough to meet my requirements. It also had to be available for Linux as the system should be robust and running 24/365.
I decided to skip an existing standard system and make my own tree-structured storage system, as this was quite a simple task. This Registry was available via TCP/IP and some simple commands. It was relatively easy to add new kinds of units. Logic controllers had just one API to get and set all values, independently of the target unit type. However, this collection of programs worked by polled loops and all communication details cluttered the overview of the programs main logic.
The next step came with Qt. This is really an awesome library. Its object system and signal slots made a good base for the new Registry. All details were now hidden in a library. My program collection is using a class called ArnItem to represent each data object. The objects are still in a tree structure, but all communication is automatic.
When the ArnItem gets a value assigned, the value will be replicated to all connected programs that have a corresponding ArnItem, i.e. those having the same path in the tree.
The Qt signal slot fits nicely, as the ArnItem will signal any change of its value. Further, any connected slots can act directly on the changed object instead of using a polling loop that iterates all objects.
As my goal was to have programs with a clear main logic without any clutter from inter program communication and likewise, all such issues had to be handled by ArnLib automatically. When TCP/IP connections are broken there should be attempts to restore connection and resync relevant information. This is handled by ArnLib client routines in the background. The result was quite satisfactory. The illusion for the programs is constant connection with blocked communication during a broken connection.
One of the most important pieces for the Arn concept was the making of a browser. Qt offered a tree view widget with a custom modell. This made up the main part of the GUI. The browser connects as any other programs connected to the Arn Registry. It visualized all the changing objects in the Arn Registry. For debugging it was also nice to be able to alter the value of any object.
Many more improvements were made for ArnLib during the years. To mention some major:
Streams were added to promote logging and message sendings between programs. Streams are using normal Arn objects set in pipe mode.
RPC (remote procedure call) made it possible to implement different service API's. The programs could now call each other using "remote signal slot". I.e. just connect Qt signals and slots across programs. I use it both for end-to-end calls and broadcast calling slots in many programs at the same time.