Top-level session object that owns the connection to a running INCA instance. More...
#include <Session.hpp>
Public Member Functions | |
| Session (const Session &)=delete | |
| Copying is deleted; the COM connection must not be duplicated. | |
| Session (Session &&)=delete | |
| Move construction is deleted; the session has a unique identity. | |
| Session & | operator= (const Session &)=delete |
| Copying assignment is deleted; the COM connection must not be duplicated. | |
| Session & | operator= (Session &&)=delete |
| Move assignment is deleted; the session has a unique identity. | |
| ~Session () | |
Destructor; triggers disconnection from INCA via IncaProxy. | |
| auto | add_param (const std::string &name) -> void |
| Registers a calibration parameter for use during the experiment. | |
| auto | set_param (const std::string &name, double value) -> void |
| Sets a registered calibration parameter to the given value. | |
| auto | reset () -> void |
| Resets all registered parameters to their reference-page values and clears the internal parameter table. | |
| auto | start_recording () -> void |
| Starts a new measurement recording in INCA. | |
| auto | stop_recording (const std::filesystem::path &filename) -> void |
| Stops the recording, saves the measurement data, and resets all registered parameters. | |
Static Public Member Functions | |
| static auto | connect (const std::function< IDispatch *(void)> &factory) -> Session |
Factory function that connects to a running INCA instance and returns an initialised Session. | |
| static auto | connect () -> Session |
Factory function that connects to a running INCA instance and returns an initialised Session. | |
Top-level session object that owns the connection to a running INCA instance.
Session is the single entry point for the pacemaker library. It establishes a COM connection to a locally running INCA process, validates that an experiment is open and at least one device is online and exposes the complete measurement workflow, parameter management, recording lifecycle, and teardown, through a single, opaque object.
The session is non-copyable and non-movable. Exactly one Session should exist per INCA automation connection. COM must be initialised on the calling thread before connect() is invoked.
On destruction, Session's destructors calls DisconnectFromTool() on the INCA COMM object, ensuring INCA is cleanly notified of the disconnection.
Definition at line 45 of file Session.hpp.
| ~Session | ( | ) |
Destructor; triggers disconnection from INCA via IncaProxy.
DisconnectFromTool() is called on the Incaproxy object, so INCA is notified of the disconnection. Then the Proxies are destroyed in reverse order.
|
staticnodiscard |
Factory function that connects to a running INCA instance and returns an initialised Session.
The function allows to specify a custom way to initialize Session and its underlying structures.
| factory | Function returning the argument to initialize the underlying IncaProxy member variable |
Session ready for use.| std::runtime_error | if CoCreateInstance fails (INCA not installed or not running). |
| std::runtime_error | if the open experiment has no devices configured or online. |
CoInitialize oir CoInitializeEx)
|
staticnodiscard |
Factory function that connects to a running INCA instance and returns an initialised Session.
The function performs the following steps:
CoCreateInstance(CLSID_Inca, CLSCTX_LOCAL_SERVER) to obtain the root INCA COM object.IncaProxy.Session owning an IncaProxy and the fully initialised Experiment.Session ready for use.| std::runtime_error | if CoCreateInstance fails (INCA not installed or not running). |
| std::runtime_error | if the open experiment has no devices configured or online. |
CoInitialize oir CoInitializeEx) Copying assignment is deleted; the COM connection must not be duplicated.
Move assignment is deleted; the session has a unique identity.
| auto add_param | ( | const std::string & | name | ) | -> void |
Registers a calibration parameter for use during the experiment.
Looks up the named calibration scalar on the primary device via IncaOnlineExperiment_DispatchWrapper::GetCalibrationValueInDevice() and stores the resulting CalibrationScalarDataProxy in the internal parameter table. The parameter can then be updated during the run via set_param().
Calling add_param() a second time with the same naem is a no-op; the parameter is not re-fetched from INCA.
| name | Name of the calibration parameter as it appears in INCA. |
| std::runtime_error | if the parameter cannot be found in the primary device. |
| auto set_param | ( | const std::string & | name, |
| double | value ) -> void |
Sets a registered calibration parameter to the given value.
Looks up name in the internal parameter table and calls SetImplValue(value) vis operator-> on the stored CalibrationScalarDataProxy. The change takes effect immediately in the running INCA measurement session.
| name | Name of the calibration parameter previously registered via add_param(). |
| value | New value to write to the parameter's implementation page. |
name was not registered via add_param(). | auto reset | ( | ) | -> void |
Resets all registered parameters to their reference-page values and clears the internal parameter table.
Iterates over all stored CalibrationScalarDataProxy objects and calls ResetValueToRP() via operator-> on each. After this call the session is in the same state as immediately after connect(...), no parameters are registered and INCA's calibration values are restored to their reference-page baseline.
This method is called automatically by stop_recording() at the end of each run, but may also be called explicitly if an early reset is needed.
| auto start_recording | ( | ) | -> void |
Starts a new measurement recording in INCA.
Delegates to StartRecording() on the internal IncaOnlineExperimentProxy via operator->. The recording captures all online measurement signals configured in the open INCA experiment from this point forward.
Register all calibration parameters via add_param() before calling start_recording().
| auto stop_recording | ( | const std::filesystem::path & | filename | ) | -> void |
Stops the recording, saves the measurement data, and resets all registered parameters.
The method performs the following steps in order:
k_flush_delay (40 ms) to allow INCA to flush any buffered measurement samples.| filename | Output recording filename or filepath passed to INCA. |