DTTBench

Architecture

Architecture Overview

DTTBench is organized into components responsible for the user interface, script execution, command processing, port communication, logging, data visualization, and utility functions.

The component diagram shows the main application components and their dependencies.

Main Components

UI and Execution Control

The UI layer contains the main application window, mode-specific controllers, command list management, and device-specific tabs.

ViewModeManager manages the transition between modes. Modes use ScriptEngine to execute test scripts, while their controllers manage port access and handle session events.

Script Execution

ScriptEngine coordinates script execution. It obtains command handlers from HandlerRegistry and sends commands through PortSession. It also forwards plot data to PlotterManager.

Command Handling

The handler layer processes device-specific commands and responses through the CommandHandler interface. HandlerRegistry selects an appropriate handler, with DefaultCommandHandler serving as a fallback. Specialized handlers, such as SC18IMHandler and BH1745NUCHandler, provide device-specific processing.
EnumCommandMatcher is a helper class that encapsulates command matching logic for enums implementing CommandDefinition. It allows device-specific enums to reuse the same matching logic.

This design allows support for additional devices to be added by implementing the CommandHandler interface and registering the new handler in HandlerRegistry.

Port Management

PortManager maintains a registry of PortSession instances and manages their lifecycle.
PortSession encapsulates communication with a single serial port using jSerialComm.
SessionListenerManager manages the delivery of session events to registered listeners through the SessionListener interface.

PortID provides identifiers for the supported ports.

Existing bug in Coordinated Mode: An entry in Additional Ports can be removed while its port is still open. The associated PortSession remains bound to the original PortID. To close the port, restore the removed entry at its original position (row number), select the corresponding port, and click Open, followed by Close. Alternatively, use the -close keyword in a script.

Plotting and Utilities

PlotterManager manages plotter instances, while Plotter handles data visualization.
Each port has its own Plotter, containing multiple measurement series named according to command comments added by -c.

Current limitation: In Coordinated Mode, plotting is currently available only for the port displayed in the left panel (PortID.COORDINATED_1).

The utility layer provides reusable functionality shared across the application.

Command Execution Flow

ScriptEngine coordinates execution, while PortManager provides access to port sessions.
The response is processed by the selected command handler, which parses the data and produces a CommandResult. The resulting data is logged, and plot data is forwarded to PlotterManager.

The sequence diagram illustrates the interaction between the main components during command execution.
For more detailed information see the full sequence-diagram.