Configuration Subsystem
Relevant source files
The following files were used as context for generating this wiki page:
The Configuration Subsystem is a critical component of the Pulsar Dome Driver, responsible for managing both persistent settings and volatile runtime state. It provides a centralized mechanism for storing, retrieving, and modifying all operational parameters of the driver. The subsystem is built around the ConfigManager class, which acts as a facade over the ASCOM Profile utility for persistence, effectively using the Windows Registry as a backing store.
A dedicated user interface, SettingsForm, allows users to configure the driver's behavior. This includes setting up the serial port, logging levels, MQTT and GNS integration, and parameters for the sophisticated hardware reset routines. The ConfigManager also serves as a state container for the driver's current operational status, such as azimuth, shutter state, and slewing activity, which are updated in real-time by the polling mechanism.
Core Components
The subsystem consists of three main parts: the ConfigManager class for data management, the SettingsForm for user interaction, and the ASCOM Profile for data persistence.
ConfigManager Class
The ConfigManager class is the central hub for all configuration and state data. It is instantiated within the main DomeDriver class and passed to other components that require access to settings or state. It uses an instance of ASCOM.Utilities.Profile to read from and write to the persistent store.
This diagram illustrates the structure of the ConfigManager class and its relationship with the ASCOM Profile and FileLogger.
Sources: Config/ConfigManager.cs
Configuration Persistence and Lifecycle
Settings are persisted using the ASCOM Profile object, which typically stores data in the Windows Registry under the ASCOM device profile path.
- Registration: When the driver is registered with ASCOM, the
RegisterASCOMstatic method inDomeDriveris called. This method creates aConfigManagerinstance and calls itsRegistryEntries()method to pre-populate the registry with default values for all settings. - Loading: When the
DomeDriverorSettingsFormis initialized, aConfigManagerinstance is created. Its properties read values from the ASCOM profile on-demand using_profile.GetValue(). - Saving: When the user clicks "OK" in the
SettingsForm, the values from the UI controls are written to theConfigManagerproperties, which in turn call_profile.WriteValue()to persist the changes.
The following diagram shows the flow of loading and saving settings via the UI.
Configuration Parameters
The driver's behavior is controlled by a set of parameters configured through the SettingsForm. These are stored and managed by ConfigManager.
| Parameter | ConfigManager Property | UI Control (SettingsForm) | Description | Default Value |
|---|---|---|---|---|
| Serial Port | SerialPort | comboBoxSerialPort | The COM port for communicating with the dome controller. | "" (empty) |
| Log File Location | LogLocation | txtBoxLogLocation | The directory where log files will be saved. | "" (empty) |
| Enable MQTT | UseMQTT | chkBoxMQTT | Enables or disables publishing status updates to an MQTT broker. | false |
| Enable Debug Log | DebugLog | chkBoxDebugLog | Enables verbose debug-level logging. | false |
| Enable Trace Log | TraceLog | chkBoxTraceLog | Enables highly verbose trace-level logging for deep diagnostics. | false |
| Enable GNS | UseGNS | chkBoxGNS | Enables or disables sending notifications via the Good Night System (GNS). | false |
| GNS Executable Path | GNSPath | txtBoxGNSLocation | Path to the GNS client executable. | "" (empty) |
| GNS Dispatcher Path | GNSDispatcherPath | txtBoxGNSDispatherLocation | Path to the GNS Dispatcher executable. | "" (empty) |
| Internal (Soft) Reset | SoftReset | checkBoxInternalReset | Enables the software-based reset routine (RESTART command). | false |
| External (Hard) Reset | HardReset | checkBoxExternalReset | Enables the hardware-based power-cycling reset routine. | false |
| Reset Executable | ResetExe | txtBoxExternalExe | Path to the external executable used for the hard reset. | "" (empty) |
| Reset "On" Parameters | ResetOnParameters | txtBoxOnParameters | Command-line arguments for the reset executable to turn power ON. | "" (empty) |
| Reset "Off" Parameters | ResetOffParameters | txtBoxOffParameters | Command-line arguments for the reset executable to turn power OFF. | "" (empty) |
| Shutter Timeout | ShutterTimeout | txtBoxShutterTimeout | Timeout in milliseconds for shutter open/close operations. | 90000 |
| Rotation Timeout | RotationTimeout | txtBoxRotationTimeout | Timeout in milliseconds for dome rotation (slew/home/park) operations. | 90000 |
| Reboot Delay | ResetDelay | txtBoxResetDelay | Delay in milliseconds to wait for the controller to reboot after a hard reset. | 5000 |
| Power Cycle Delay | CycleDelay | txtBoxCycleDelay | Delay in milliseconds between turning power off and on during a hard reset. | 5000 |
Sources: Config/ConfigManager.cs:96-267, UI/SettingsForm.cs:21-81, UI/SettingsForm.Designer.cs
Runtime State Management
In addition to persistent settings, ConfigManager holds the volatile, real-time state of the dome. These properties are not saved to the registry but are continuously updated by the driver's polling loop and are read by ASCOM clients to get the current status.
The following diagram shows how the polling loop updates the runtime state in ConfigManager.
Key State Properties
Azimuth: Current dome azimuth in degrees.SlewingStatus:trueif the dome or shutter is currently moving.ParkStatus:trueif the dome is at the park position.HomeStatus:trueif the dome is at the home position.DomeState: An integer representing the dome's rotational activity (e.g., 0=Idle, 1=Slewing, 9=Going home).ShutterStatus: An integer representing the shutter's state (e.g., 0=Open, 1=Closed, 2=Opening, 3=Closing, 4=Error).Rebooting,Resetting,ForceBusy: Volatile flags used internally to manage the state of the complex reset and command watchdog logic.
Sources: Config/ConfigManager.cs:59-75, Config/ConfigManager.cs:270-302
Conclusion
The Configuration Subsystem provides a robust and flexible way to manage the Pulsar Dome Driver's settings and state. By leveraging the ASCOM Profile for persistence and providing a clear UI via SettingsForm, it separates configuration concerns from the core driver logic. The ConfigManager class acts as an effective central repository for both persistent parameters and dynamic runtime state, making it a cornerstone of the driver's architecture. This design ensures that settings are easily configurable by the user and that the driver's operational state is consistently managed and accessible.