Create extensions interface
Closes #271 (closed).
This MR creates the hooks required to detect, start & stop small helper programs (extensions) from within Ekos.
Detection is handled by querying the file system. An 'extensions' directory is created on first run within the KSPaths::writableLocation eg: ~/.local/share/kstars on a typical Linux install. Any executable program found within that directory that also has a valid configuration file is presented as a runnable option within the new extension controls. Detection is performed each time Ekos is started. If no valid extensions are found then the extension controls are not displayed.
The start/stop/abort control is a single button that toggles between 'Run' & 'Stop', the same as the Ekos Start/Stop and Capture Start/Stop controls. The additional function of abort is enabled if an extension fails to exit within a timeout of the close request triggered by the Stop button. Abort is a second click of the re-enabled Stop button and is also notified by a log message.
Starting, aborting, and message handling of extensions is via a QProcess function. All output from the extension is forwarded to the Ekos log. Gracefully stopping an extension is via an emitted DBus signal that the extension program should handle.
Each extension must have a companion configuration file also located in the extensions directory, named the same as the executable with the addition of a .conf eg: an extension named example must also have a configuration file named example.conf A configuration file is a plain text file that provides configuration settings to the extension program and usage information to the user. A configuration file is only valid if it contains a line starting with: minimum_kstars_version=x.y.z The x.y.z is the minimum release of KStars that the extension is designed/tested against. This value is checked against the current KStars KSTARS_VERSION macro defined in version.h and must be equal or lower for the extension to be considered valid. The extension should also check that this minimum_kstars_version string matches what it expects.
Optionally each extension can also provide an icon file for display in the Extension drop down list. Again the naming should match the extension executable with a valid file extension (.jpg, .bmp, .gif, .png or .svg) and be placed in the same extensions directory. A default icon is used for any extension that does not provide it's own icon.
Several new DBus functions/signals are added to enable general extension use and for a specific upcoming extension. These are:
- ExtensionState function which returns the current Extension state and extensionStateChanged signal which signifies that ExtensionState has changed.
- getJobPlaceholderFormat and getJobPreviewFileName functions which returns the currently set placeholder format and filename - to be used by the upcoming Siril_EAA extension to located the preview image save location.
- setFITSfromFile and previewFile functions which sets whether the Ekos preview viewer received images direct from internal modules (as is current) or from externally passed fits file locations, and passes a file location to be displayed - to be used by the upcoming Sirial_EAA extension to pass the live stacked result back to Ekos.
Two extensions are ready for release (other than final packaging), these being:
- FireCapture launcher (FC_launcher) - disconnects the current primary camera INDI driver and launches FireCapture. Upon close restarts the INDI driver.
- KStars Backup (KS_backup) - provides a GUI for the archiving and restoration of KStars/INDI (and optionally others) configuration directories to/from .tar.gz archives/
Additionally there is a minimal working example extension intended to inform other potential extension authors:
- Minimum skeleton example (example) - just passes a heartbeat message to the log and provides graceful exit.
A third extension is basically complete but requires more extension testing. This is on hold pending the next maintenance release of Siril which should contain my fix for the current intermittent command pipe handling: Merged into Siril 1.2.2, now release, and superseded by 1.2.3.
- Sirial_EEA - provides live stacking of the preview job from the Capture Module and displays it auto-stretched in the Ekos preview window.
All the above extensions are currently hosted in my github at https://github.com/LuckyEddie47/kstars_extensions