Architecture and contributing

How the Tinkerbus source tree is organised, how it is tested, and how to contribute.

Tinkerbus is one Go module (tinkerbus) with a Wails desktop front end. The command line tools and the application call the same packages. Nothing in the source tree is a server: there is no web UI and no HTTP API.

Layout

PathContents
main.go, app*.goThe Wails application. App has the methods the interface calls: catalog, diagnostics, discovery, edits, exchange, feedback reports, network, new projects, online catalog, programming, recording, reports, routing.
catalog.go, onlinecatalog.go, settings*.goLocal catalog store, the client for knxprod-index, and the settings file.
backup.go, downloads.go, feedback.goBackups of project files before Save, the record of which devices were downloaded, and the fixed-field reports to the project.
cmd/The five command line tools.
frontend/React 18, TypeScript and Vite. About thirty components in src/components, plus helper modules for the network layout, routing, place tree, telegram handling and the online catalog.
build/Wails packaging files for Windows and macOS, and the build output.
internal/projectOpening, creating, editing and saving .knxproj: topology, devices, parameters, group objects, locations, network graph, routing, change list, group address exchange, password handling, and an archive package for the zip layers.
internal/knxprod, internal/masterdataReading .knxprod product data and knx_master.xml.
internal/dptDatapoint type decoding and encoding.
internal/falconThe protocol stack: apdu, cemi, knxnetip (search, tunnel, device management, routing, UDP and TCP transports), usb and remote (read and write management services).
internal/downloadBuilds device images, load plans and executes them, per mask family.
internal/programmingThe check, backup, write and verify procedure, shared by the application and knxprogram.
internal/monitorThe telegram recorder.
internal/captureReads pcap and pcapng captures and turns the KNXnet/IP tunnelling traffic of an ETS download into an anonymized transcript of ETS and one device.
internal/reportThe HTML project report.
internal/sendThe send gate: off by default, with a minimum interval.

Design notes

  • Edits stay in memory until asked. The project package loads a project into memory and edits are recorded for undo and for the change list. Save copies the previous file to the backup folder first and replaces it only if that worked; Save as writes another archive and continues on it.
  • Plans are data. internal/download builds a plan (a list of operations) from the project and the device’s facts; the same plan can be printed (knxdownload -plan), compared against the device, or executed. This is how the dry run and the write cannot disagree.
  • Protocol code has no UI. internal/falcon knows nothing about projects or windows, so the tools and the application share it.
  • Gates in code. Sending goes through internal/send; writes go through a client that must be told which device it may write to.
  • Reports are built from a fixed list of fields. feedback.go names every field a report may hold; the open project is never read for it, and the application only shows the text, so the user copies it or opens the issue form.

See also Testing and Contributing.


Testing

How Tinkerbus is tested, including the reference downloads that fix the device load plans.

Contributing

How to report problems, propose changes and add support for more devices.