Syntalos
Syntalos
Namespaces
| Name |
|---|
| Syntalos::ipc |
Classes
Types
| Name | |
|---|---|
| enum class uint16_t | ModuleState { UNKNOWN, INITIALIZING, IDLE, PREPARING, DORMANT, READY, RUNNING, ERROR} The ModuleState enum. |
| enum class | ControlCommandKind { UNKNOWN, START, PAUSE, STOP, STEP, CUSTOM} The ControlCommandKind enum. |
| enum class | FirmataCommandKind { UNKNOWN, NEW_DIG_PIN, NEW_ANA_PIN, IO_MODE, WRITE_ANALOG, WRITE_DIGITAL, WRITE_DIGITAL_PULSE, SYSEX} The FirmataCommandKind enum. |
| enum class | SignalDataType { Amplifier, AuxInput, SupplyVoltage, BoardAdc, BoardDigIn, BoardDigOut} Type of a signal from a signal source. |
| enum class | TimeSyncStrategy { NONE = 0, SHIFT_TIMESTAMPS_FWD = 1 « 0, SHIFT_TIMESTAMPS_BWD = 1 « 1, ADJUST_CLOCK = 1 « 2, WRITE_TSYNCFILE = |
| 1 « 3} The time synchronization strategy. | |
| enum class | TSyncFileMode { CONTINUOUS = 0, SYNCPOINTS = 1} Timepoint storage of a TSync file. |
| enum class | TSyncFileTimeUnit { INDEX = 0, NANOSECONDS = 1, MICROSECONDS = 2, MILLISECONDS = 3, SECONDS = 4} Unit types for time representation in a TSync file. |
| enum class | TSyncFileDataType { INVALID = 0, INT16 = 2, INT32 = 3, INT64 = 4, UINT16 = 6, UINT32 = 7, UINT64 = 8} Data types use for storing time values in the data file. |
| enum class | SysInfoCheckResult { UNKNOWN, OK, SUSPICIOUS, ISSUE} |
| enum class | ColorMode { SYSTEM, BRIGHT, DARK} |
| enum class | ModuleWorkerMode { PERSISTENT, TRANSIENT} Worker mode for out-of-process modules. |
| enum class uint8_t | PortAction { UNKNOWN, ADD, REMOVE, CHANGE} Action performed to modify a module port. |
| enum class | ConnectionHeatLevel { NONE, LOW, MEDIUM, HIGH} Connection heat level. |
| enum class | ModuleFeature { NONE = 0, SHOW_SETTINGS = 1 « 0, SHOW_DISPLAY = 1 « 1, REALTIME = 1 « 2, CALL_UI_EVENTS = 1 « 3, REQUEST_CPU_AFFINITY = |
| 1 « 4, PROHIBIT_CPU_AFFINITY = 1 | |
| « 5} The ModuleFeature flags List of basic features this module may or may not support, or may request from the engine to be available. | |
| enum class | ModuleDriverKind { NONE, THREAD_DEDICATED, EVENTS_DEDICATED, EVENTS_SHARED} The ModuleDriverKind enum. |
| enum class | UsbHotplugEventKind { NONE, DEVICE_ARRIVED, DEVICE_LEFT, DEVICES_CHANGE} The UsbHotplugEventKind enum. |
| enum class uint32_t | ModuleCategory { NONE = 0, SYNTALOS_DEV = 1 « 0, EXAMPLES = 1 « 1, DEVICES = 1 « 2, GENERATORS = 1 « 3, SCRIPTING = 1 « 4, DISPLAY = 1 « 5, WRITERS = 1 « 6, PROCESSING = 1 « 7} Categorization for modules. |
| enum class | ModuleModifier { NONE = 0, ENABLED = 1 « 0, STOP_ON_FAILURE = 1 « 1} The ModuleModifier flags Flags set by Syntalos or the user to modify the behavior of the module in the wider context of the running experiment. |
| enum class | PortDirection { NONE, INPUT, OUTPUT} Enum specifying directionality of a port (in or out) |
| enum class | PyVirtualEnvStatus { VALID, MISSING, REQUIREMENTS_CHANGED, INTERPRETER_MISSING} |
| using std::chrono::time_point< symaster_clock > | symaster_timepoint A timepoint on the master clock. |
| using std::chrono::seconds | seconds_t Shorthand for seconds. |
| using std::chrono::milliseconds | milliseconds_t Shorthand for milliseconds. |
| using std::chrono::duration< int64_t, std::micro > | microseconds_t Shorthand for microseconds. |
| using std::chrono::duration< int64_t, std::nano > | nanoseconds_t Shorthand for nanoseconds. |
| typedef Eigen::Matrix< int32_t, Eigen::Dynamic, 1 > | VectorXsi |
| typedef Eigen::Matrix< uint64_t, Eigen::Dynamic, 1 > | VectorXul |
| typedef Eigen::Matrix< int64_t, Eigen::Dynamic, 1 > | VectorXsl |
| typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > | VectorXd |
| typedef Eigen::Matrix< int32_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | MatrixXsi |
| typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | MatrixXd |
| using std::function< void(const std::string &id, const TimeSyncStrategies &strategies, const microseconds_t &tolerance)> | SyncDetailsChangeNotifyFn Function to call when synchronizer details have changed. |
| using std::function< void(const std::string &id, const microseconds_t ¤tOffset)> | OffsetChangeNotifyFn Function to call to notify about an offset change. |
| using void(AbstractModule::*)(int &) | intervalEventFunc_t Event function type for timed callbacks. |
| using void(AbstractModule::*)() | recvDataEventFunc_t Event function type for subscription new data callbacks. |
| using std::pmr::vector< std::byte > | ByteVector ByteVector is a vector of bytes using the polymorphic allocator. |
| using std::function< void(const QString &script, const QString &wdir)> | LoadScriptFn |
| using std::function< void(const ByteVector &settings)> | PrepareStartFn |
| using std::function< void()> | StartFn |
| using std::function< void()> | StopFn |
| using std::function< void()> | ShutdownFn |
| using std::function< void(const void *data, size_t size)> | NewDataRawFn |
| using std::function< void(const ByteVector &settings)> | ShowSettingsFn |
| using std::function< void(void)> | ShowDisplayFn |
Functions
| Name | |
|---|---|
| template <typename T > constexpr int | syDataTypeId() Helper function to get the type ID of a data type. |
| template <typename T > T | deserializeFromMemory(const void * memory, size_t size) Convenience function to deserialize a data type from memory. |
| void | registerStreamMetaTypes() Helper function to register all meta types for stream data. |
| std::vector< std::pair< std::string, int > > | streamTypeIdIndex() Get a mapping of type names to their IDs. |
| template <typename T > std::string | numToString(T x) Convert a numeric value to a string using Syntalos’ default notation. |
| const QString & | qstr(const QString & s) |
| QString | qstr(QStringView s) |
| QString | qstr(const char * s) |
| QString | qstr(std::string_view s) |
| QString | qstr(const std::string & s) |
| auto | usecToMsec(const microseconds_t & usec) Convert microseconds to milliseconds. |
| auto | msecToUsec(const milliseconds_t & msec) Convert milliseconds microseconds. |
| auto | nsecToUsec(const nanoseconds_t & msec) Convert nanoseconds microseconds. |
| auto | timeDiffSec(const symaster_timepoint & timePoint1, const symaster_timepoint & timePoint2) |
| auto | timeDiffMsec(const symaster_timepoint & timePoint1, const symaster_timepoint & timePoint2) |
| auto | timeDiffUsec(const symaster_timepoint & timePoint1, const symaster_timepoint & timePoint2) |
| auto | timeDiffToNowMsec(const std::chrono::time_point< symaster_clock > & timePoint) |
| symaster_timepoint | currentTimePoint() |
| template <typename T > double | vectorMedian(const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec) |
| template <typename T > double | vectorMedianInplace(Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec) |
| template <typename T > double | vectorVariance(const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec, const double & mean, bool unbiased =true) |
| template <typename T > double | vectorVariance(const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec, bool unbiased =true) |
| template <typename EigenType > void | serializeEigen(BinaryStreamWriter & stream, const EigenType & matrix) |
| template <typename EigenType > EigenType | deserializeEigen(BinaryStreamReader & stream) |
| const std::string | timeSyncStrategyToHString(const TimeSyncStrategy & strategy) |
| const std::string | timeSyncStrategiesToHString(const TimeSyncStrategies & strategies) |
| template <typename T > void | safeStopSynchronizer(const T & synchronizerSmartPtr) |
| template <typename T > void | safeStopSynchronizer(const T & synchronizer, const microseconds_t & lastValidMasterTimestamp) |
| std::string | tsyncFileTimeUnitToString(const TSyncFileTimeUnit & tsftunit) |
| std::string | tsyncFileDataTypeToString(const TSyncFileDataType & dtype) |
| std::string | tsyncFileModeToString(const TSyncFileMode & mode) |
| std::optional< QImage > | cvMatToQImage(const cv::Mat & mat) Converts an OpenCV Mat to a QImage. |
| std::optional< QPixmap > | cvMatToQPixmap(const cv::Mat & mat) |
| cv::Rect | qRectToCvRect(const QRect & r) |
| QString | shellQuote(const QString & str) Shell-escape a string. |
| QString | findHostExecutable(const QString & exe) Find executable on the host system (if running in a sandbox) |
| int | runHostExecutable(const QString & exe, const QStringList & args, bool waitForFinished) Run command on the host. |
| int | runInTerminal(const QString & cmd, const QStringList & args, const QString & wdir, const QString & title) |
| bool | launchProgramNC3Fallback(const QString & exePath, int * pidfd_out) |
| bool | launchProgramPidFd(const QString & exePath, int * pidfd_out) Launch a program in a new process, and return the PID of the new process as pidfd. |
| bool | isProcessRunning(int pidfd) Check if a process is still running using a pidfd. |
| QString | colorModeToString(ColorMode mode) |
| ColorMode | colorModeFromString(const QString & str) |
| QString | findSyntalosPyWorkerBinary() |
| void | findSyntalosLibraryPaths(QString & pkgConfigPath, QString & ldLibraryPath, QString & includePath) |
| constexpr IpcServiceTopology | makeIpcServiceTopology(uint senderCount, uint receiverCount) |
| QString | connectionHeatToHumanString(ConnectionHeatLevel heat) |
| QString | toString(ModuleCategory category) |
| ModuleCategory | moduleCategoryFromString(const QString & categoryStr) |
| ModuleCategories | moduleCategoriesFromString(const QString & categoriesStr) |
| uint | qHash(ModuleModifier key, uint seed) |
| VariantDataStream * | newStreamForType(int typeId) Create a new DataStream for the type identified by the given ID. |
| VarStreamInputPort * | newInputPortForType(int typeId, AbstractModule * mod, const QString & id, const QString & title) Create a new Input Port for the type identified by the given ID. |
| QString | pythonVEnvDirForName(const QString & venvName) |
| bool | pythonVirtualEnvExists(const QString & venvName) |
| QString | requirementsHashMetadataPath(const QString & venvDir) |
| bool | writeRequirementsHashMetadata(const QString & venvDir, const QByteArray & requirementsHash) |
| bool | readRequirementsHashMetadata(const QString & venvDir, QString & requirementsHashOut) |
| QString | interpreterPathFromCfg(const QString & venvDir) |
| PyVirtualEnvStatus | pythonVirtualEnvStatus(const QString & venvName, const QString & requirementsFile) |
| void | injectSystemPyModule(const QString & venvDir, const QString & pyModName) |
| bool | injectSystemPyQtBindings(const QString & venvDir) |
| auto | createPythonVirtualEnv(const QString & venvName, const QString & requirementsFile, bool recreate) |
| template <typename T > T | streamDataFromRawMemory(const void * data, size_t size) Convert raw received bytes into their data type. |
| std::unique_ptr< SyntalosLink > | initSyntalosModuleLink() |
| template <typename Sub > auto | safeReceive(Sub & sub) |
Attributes
| Name | |
|---|---|
| constexpr int64_t | US_PER_MS |
| constexpr int64_t | US_PER_S |
| constexpr int64_t | US_PER_MIN |
| constexpr int64_t | US_PER_H |
| constexpr int64_t | NS_PER_US |
| constexpr int64_t | MS_PER_S |
| constexpr int64_t | MS_PER_MIN |
| constexpr auto | SECONDARY_CLOCK_TOLERANCE The amount of time a secondary clock is allowed to deviate from the master. |
| constexpr auto | DEFAULT_CLOCKSYNC_CHECK_INTERVAL Interval at which we check for external clock synchronization. |
| constexpr uint64_t | SY_IOX_QUEUE_CAPACITY |
| constexpr uint64_t | SY_IOX_HISTORY_SIZE |
| constexpr uint64_t | SY_IOX_INITIAL_SLICE_LEN |
| constexpr size_t | SY_IOX_ID_MAX_LEN |
| const std::string | IN_PORT_CHANGE_CHANNEL_ID |
| const std::string | OUT_PORT_CHANGE_CHANNEL_ID |
| const std::string | IN_PORT_UPDATE_METADATA_ID |
| const std::string | WORKER_CTL_EVENT_ID |
| const std::string | MASTER_CTL_EVENT_ID |
| const std::string | ERROR_CHANNEL_ID |
| const std::string | STATE_CHANNEL_ID |
| const std::string | STATUS_MESSAGE_CHANNEL_ID |
| const std::string | API_VERSION_CALL_ID |
| const std::string | SET_NICENESS_CALL_ID |
| const std::string | SET_MAX_RT_PRIORITY_CALL_ID |
| const std::string | SET_CPU_AFFINITY_CALL_ID |
| const std::string | DELETE_PORT_CALL_ID |
| const std::string | CONNECT_INPUT_CALL_ID |
| const std::string | LOAD_SCRIPT_CALL_ID |
| const std::string | SET_PORTS_PRESET_CALL_ID |
| const std::string | PREPARE_START_CALL_ID |
| const std::string | START_CALL_ID |
| const std::string | STOP_CALL_ID |
| const std::string | SHUTDOWN_CALL_ID |
| const std::string | SETTINGS_CHANGE_CHANNEL_ID |
| const std::string | SHOW_SETTINGS_CALL_ID |
| const std::string | SHOW_DISPLAY_CALL_ID |
Types Documentation
enum ModuleState
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | ||
| INITIALIZING | Module is in an unknown state. | |
| IDLE | Module is initializing after being added. | |
| PREPARING | Module is inactive and not started. | |
| DORMANT | Module is preparing a run. | |
| READY | The module is inactive for this run, as it has no work to do. | |
| RUNNING | Everything is prepared, we are ready to start. | |
| ERROR | Module is running. Module failed to run / is in an error state |
The ModuleState enum.
Describes the state a module can be in. The state is usually displayed to the user via a module indicator widget.
enum ControlCommandKind
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | ||
| START | ||
| PAUSE | Start an operation. | |
| STOP | Pause an operation, can be resumed with START. | |
| STEP | Stop an operation. | |
| CUSTOM | Advance operation by one step. |
The ControlCommandKind enum.
Basic operations to control a module from another module.
enum FirmataCommandKind
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | ||
| NEW_DIG_PIN | ||
| NEW_ANA_PIN | ||
| IO_MODE | ||
| WRITE_ANALOG | ||
| WRITE_DIGITAL | ||
| WRITE_DIGITAL_PULSE | ||
| SYSEX | not implemented |
The FirmataCommandKind enum.
Type of change to be be made on a Firmata interface.
enum SignalDataType
| Enumerator | Value | Description |
|---|---|---|
| Amplifier | ||
| AuxInput | ||
| SupplyVoltage | ||
| BoardAdc | ||
| BoardDigIn | ||
| BoardDigOut |
Type of a signal from a signal source.
This is usually set in the metadata of a data stream.
enum TimeSyncStrategy
| Enumerator | Value | Description |
|---|---|---|
| NONE | 0 | |
| SHIFT_TIMESTAMPS_FWD | 1 « 0 | |
| SHIFT_TIMESTAMPS_BWD | 1 « 1 | Move timestamps forward to match the master clock. |
| ADJUST_CLOCK | 1 « 2 | Move timestamps backward to match the master clock. |
| WRITE_TSYNCFILE | = | |
| 1 « 3 | Do not change timestamps by adjust the secondary clocks to match the master clock. |
The time synchronization strategy.
enum TSyncFileMode
| Enumerator | Value | Description |
|---|---|---|
| CONTINUOUS | 0 | |
| SYNCPOINTS | 1 | Continous time-point mapping with no gaps. |
Timepoint storage of a TSync file.
enum TSyncFileTimeUnit
| Enumerator | Value | Description |
|---|---|---|
| INDEX | 0 | |
| NANOSECONDS | 1 | monotonically increasing counter without dimension |
| MICROSECONDS | 2 | |
| MILLISECONDS | 3 | |
| SECONDS | 4 |
Unit types for time representation in a TSync file.
enum TSyncFileDataType
| Enumerator | Value | Description |
|---|---|---|
| INVALID | 0 | |
| INT16 | 2 | |
| INT32 | 3 | |
| INT64 | 4 | |
| UINT16 | 6 | |
| UINT32 | 7 | |
| UINT64 | 8 |
Data types use for storing time values in the data file.
enum SysInfoCheckResult
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | ||
| OK | ||
| SUSPICIOUS | ||
| ISSUE |
enum ColorMode
| Enumerator | Value | Description |
|---|---|---|
| SYSTEM | ||
| BRIGHT | ||
| DARK |
enum ModuleWorkerMode
| Enumerator | Value | Description |
|---|---|---|
| PERSISTENT | ||
| TRANSIENT | Worker is started once, and runs while the module is present on the board. Worker run only for the duration of the experiment, and terminated afterwards |
Worker mode for out-of-process modules.
enum PortAction
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | ||
| ADD | Undefined action. | |
| REMOVE | Add a new port. | |
| CHANGE | Remove an existing port. Change an existing port |
Action performed to modify a module port.
enum ConnectionHeatLevel
| Enumerator | Value | Description |
|---|---|---|
| NONE | ||
| LOW | ||
| MEDIUM | ||
| HIGH |
Connection heat level.
Warning level dependent on how full the buffer that is represented by a connection is. A high heat means lots of pending stuff and potentially a slow receiving module or not enough system resources. This state is managed internally by Syntalos.
enum ModuleFeature
| Enumerator | Value | Description |
|---|---|---|
| NONE | 0 | |
| SHOW_SETTINGS | 1 « 0 | |
| SHOW_DISPLAY | 1 « 1 | Module can display a settings window. |
| REALTIME | 1 « 2 | Module has one or more display window(s) to show. |
| CALL_UI_EVENTS | 1 « 3 | Enable realtime scheduling for the module’s thread. |
| REQUEST_CPU_AFFINITY | = | |
| 1 « 4 | Call direct UI events processing method. | |
| PROHIBIT_CPU_AFFINITY | 1 | |
| « 5 | Pin the module’s thread to a separate CPU core, if possible (even if the user disabled this) |
The ModuleFeature flags List of basic features this module may or may not support, or may request from the engine to be available.
enum ModuleDriverKind
| Enumerator | Value | Description |
|---|---|---|
| NONE | ||
| THREAD_DEDICATED | Module will be run in the main (GUI) thread. | |
| EVENTS_DEDICATED | Module wants to run in a dedicated thread. | |
| EVENTS_SHARED | Module shares a thread(pool) with other modules of its kind, via an event loop. Module shares a thread(pool) with arbitrary other modules, actions are triggered by events |
The ModuleDriverKind enum.
enum UsbHotplugEventKind
| Enumerator | Value | Description |
|---|---|---|
| NONE | ||
| DEVICE_ARRIVED | No USB hotplug event. | |
| DEVICE_LEFT | A new device appeared. | |
| DEVICES_CHANGE | A device has left. Devices have appeared and left |
The UsbHotplugEventKind enum.
enum ModuleCategory
| Enumerator | Value | Description |
|---|---|---|
| NONE | 0 | |
| SYNTALOS_DEV | 1 « 0 | Not categorized. |
| EXAMPLES | 1 « 1 | A development/test tool for Syntalos itself. |
| DEVICES | 1 « 2 | An example / template module. |
| GENERATORS | 1 « 3 | Modules which communicate with hardware devices. |
| SCRIPTING | 1 « 4 | (Test)data generators |
| DISPLAY | 1 « 5 | Scripting & customization. |
| WRITERS | 1 « 6 | Display modules. |
| PROCESSING | 1 « 7 | Modules which write data to disk. |
Categorization for modules.
enum ModuleModifier
| Enumerator | Value | Description |
|---|---|---|
| NONE | 0 | |
| ENABLED | 1 « 0 | |
| STOP_ON_FAILURE | 1 « 1 | The module is enabled. |
The ModuleModifier flags Flags set by Syntalos or the user to modify the behavior of the module in the wider context of the running experiment.
enum PortDirection
| Enumerator | Value | Description |
|---|---|---|
| NONE | ||
| INPUT | ||
| OUTPUT |
Enum specifying directionality of a port (in or out)
enum PyVirtualEnvStatus
| Enumerator | Value | Description |
|---|---|---|
| VALID | ||
| MISSING | ||
| REQUIREMENTS_CHANGED | ||
| INTERPRETER_MISSING |
using symaster_timepoint
using Syntalos::symaster_timepoint = typedef std::chrono::time_point<symaster_clock>;A timepoint on the master clock.
using seconds_t
using Syntalos::seconds_t = typedef std::chrono::seconds;Shorthand for seconds.
using milliseconds_t
using Syntalos::milliseconds_t = typedef std::chrono::milliseconds;Shorthand for milliseconds.
using microseconds_t
using Syntalos::microseconds_t = typedef std::chrono::duration<int64_t, std::micro>;Shorthand for microseconds.
using nanoseconds_t
using Syntalos::nanoseconds_t = typedef std::chrono::duration<int64_t, std::nano>;Shorthand for nanoseconds.
typedef VectorXsi
typedef Eigen::Matrix<int32_t, Eigen::Dynamic, 1> Syntalos::VectorXsi;typedef VectorXul
typedef Eigen::Matrix<uint64_t, Eigen::Dynamic, 1> Syntalos::VectorXul;typedef VectorXsl
typedef Eigen::Matrix<int64_t, Eigen::Dynamic, 1> Syntalos::VectorXsl;typedef VectorXd
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> Syntalos::VectorXd;typedef MatrixXsi
typedef Eigen::Matrix<int32_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Syntalos::MatrixXsi;typedef MatrixXd
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Syntalos::MatrixXd;using SyncDetailsChangeNotifyFn
using Syntalos::SyncDetailsChangeNotifyFn = typedef std::function<void(const std::string &id, const TimeSyncStrategies &strategies, const microseconds_t &tolerance)>;Function to call when synchronizer details have changed.
using OffsetChangeNotifyFn
using Syntalos::OffsetChangeNotifyFn = typedef std::function<void(const std::string &id, const microseconds_t ¤tOffset)>;Function to call to notify about an offset change.
using intervalEventFunc_t
using Syntalos::intervalEventFunc_t = typedef void (AbstractModule::*)(int &);Event function type for timed callbacks.
using recvDataEventFunc_t
using Syntalos::recvDataEventFunc_t = typedef void (AbstractModule::*)();Event function type for subscription new data callbacks.
using ByteVector
using Syntalos::ByteVector = typedef std::pmr::vector<std::byte>;ByteVector is a vector of bytes using the polymorphic allocator.
In Syntalos’ heavily threaded environment, where in the worst case a ton of these vectors may be created and destroyed in quick succession, the default glibc allocator is less than optimal. Mimalloc has shown to perform a lot better for this burst-like, threaded activity, therefore we prefer it. Please try to reuse buffers whenever possible though - while mimalloc is a significant improvement, reusing memory segments is even better.
We do use the C++ polymorphic allocator since datactl is used in places where swapping the allocator is undesirable, e.g. in mlink that may be linked into non-Syntalos processes. These processes may use the default allocator instead of Syntalos’ mimalloc-based one.
using LoadScriptFn
using Syntalos::LoadScriptFn = typedef std::function<void(const QString &script, const QString &wdir)>;using PrepareStartFn
using Syntalos::PrepareStartFn = typedef std::function<void(const ByteVector &settings)>;using StartFn
using Syntalos::StartFn = typedef std::function<void()>;using StopFn
using Syntalos::StopFn = typedef std::function<void()>;using ShutdownFn
using Syntalos::ShutdownFn = typedef std::function<void()>;using NewDataRawFn
using Syntalos::NewDataRawFn = typedef std::function<void(const void *data, size_t size)>;using ShowSettingsFn
using Syntalos::ShowSettingsFn = typedef std::function<void(const ByteVector &settings)>;using ShowDisplayFn
using Syntalos::ShowDisplayFn = typedef std::function<void(void)>;Functions Documentation
function syDataTypeId
template <typename T >
constexpr int syDataTypeId()Helper function to get the type ID of a data type.
function deserializeFromMemory
template <typename T >
T deserializeFromMemory(
const void * memory,
size_t size
)Convenience function to deserialize a data type from memory.
function registerStreamMetaTypes
void registerStreamMetaTypes()Helper function to register all meta types for stream data.
This function registers all types with the meta object system and also creates a global map of all available stream types.
function streamTypeIdIndex
std::vector< std::pair< std::string, int > > streamTypeIdIndex()Get a mapping of type names to their IDs.
function numToString
template <typename T >
inline std::string numToString(
T x
)Convert a numeric value to a string using Syntalos’ default notation.
This function converts arithmetic types to strings in a locale-independent way. For floating-point types, it uses the “general” format (shortest representation). Special values (NaN, infinity) are handled consistently across all types.
function qstr
inline const QString & qstr(
const QString & s
)function qstr
inline QString qstr(
QStringView s
)function qstr
inline QString qstr(
const char * s
)function qstr
inline QString qstr(
std::string_view s
)function qstr
inline QString qstr(
const std::string & s
)function usecToMsec
inline auto usecToMsec(
const microseconds_t & usec
)Convert microseconds to milliseconds.
Shorthand for duration-case to increase code readability.
function msecToUsec
inline auto msecToUsec(
const milliseconds_t & msec
)Convert milliseconds microseconds.
Shorthand for duration-case to increase code readability.
function nsecToUsec
inline auto nsecToUsec(
const nanoseconds_t & msec
)Convert nanoseconds microseconds.
Shorthand for duration-case to increase code readability.
function timeDiffSec
inline auto timeDiffSec(
const symaster_timepoint & timePoint1,
const symaster_timepoint & timePoint2
)function timeDiffMsec
inline auto timeDiffMsec(
const symaster_timepoint & timePoint1,
const symaster_timepoint & timePoint2
)function timeDiffUsec
inline auto timeDiffUsec(
const symaster_timepoint & timePoint1,
const symaster_timepoint & timePoint2
)function timeDiffToNowMsec
inline auto timeDiffToNowMsec(
const std::chrono::time_point< symaster_clock > & timePoint
)function currentTimePoint
inline symaster_timepoint currentTimePoint()function vectorMedian
template <typename T >
double vectorMedian(
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec
)function vectorMedianInplace
template <typename T >
double vectorMedianInplace(
Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec
)function vectorVariance
template <typename T >
double vectorVariance(
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec,
const double & mean,
bool unbiased =true
)function vectorVariance
template <typename T >
double vectorVariance(
const Eigen::Matrix< T, Eigen::Dynamic, 1 > & vec,
bool unbiased =true
)function serializeEigen
template <typename EigenType >
void serializeEigen(
BinaryStreamWriter & stream,
const EigenType & matrix
)function deserializeEigen
template <typename EigenType >
EigenType deserializeEigen(
BinaryStreamReader & stream
)function timeSyncStrategyToHString
const std::string timeSyncStrategyToHString(
const TimeSyncStrategy & strategy
)function timeSyncStrategiesToHString
const std::string timeSyncStrategiesToHString(
const TimeSyncStrategies & strategies
)function safeStopSynchronizer
template <typename T >
void safeStopSynchronizer(
const T & synchronizerSmartPtr
)function safeStopSynchronizer
template <typename T >
void safeStopSynchronizer(
const T & synchronizer,
const microseconds_t & lastValidMasterTimestamp
)function tsyncFileTimeUnitToString
std::string tsyncFileTimeUnitToString(
const TSyncFileTimeUnit & tsftunit
)function tsyncFileDataTypeToString
std::string tsyncFileDataTypeToString(
const TSyncFileDataType & dtype
)function tsyncFileModeToString
std::string tsyncFileModeToString(
const TSyncFileMode & mode
)function cvMatToQImage
std::optional< QImage > cvMatToQImage(
const cv::Mat & mat
)Converts an OpenCV Mat to a QImage.
Parameters:
- mat The OpenCV Mat to convert.
Return: An optional containing the converted QImage, or std::nullopt if conversion fails.
This function attempts to convert the given OpenCV Mat to a QImage. It supports grayscale (1 channel), RGB (3 channels), and RGBA (4 channels) images. If the conversion is successful, it returns a QImage wrapped in std::optional. If the conversion fails (e.g., unsupported number of channels), it returns std::nullopt.
function cvMatToQPixmap
std::optional< QPixmap > cvMatToQPixmap(
const cv::Mat & mat
)function qRectToCvRect
inline cv::Rect qRectToCvRect(
const QRect & r
)Helper to convert a QRect into a cv::Rect
For a cv::Rect, right and bottom edges are exclusive, while they are inclusive for a QRect. This helper just ensures we don’t accidentally make any conversion mistakes.
function shellQuote
QString shellQuote(
const QString & str
)Shell-escape a string.
function findHostExecutable
QString findHostExecutable(
const QString & exe
)Find executable on the host system (if running in a sandbox)
Parameters:
- exe Name of the executable to look for
Return: Executable name, or empty string if not found
function runHostExecutable
int runHostExecutable(
const QString & exe,
const QStringList & args,
bool waitForFinished
)Run command on the host.
Parameters:
- exe The program to run
- args Program arguments
- waitForFinished Wait for the command to finish
Return: Exit status of the program (if waiting for finished)
function runInTerminal
int runInTerminal(
const QString & cmd,
const QStringList & args,
const QString & wdir,
const QString & title
)function launchProgramNC3Fallback
static bool launchProgramNC3Fallback(
const QString & exePath,
int * pidfd_out
)Fallback for launchProgram() if the clone3() syscall was not available or is blocked by seccomp filters.
function launchProgramPidFd
bool launchProgramPidFd(
const QString & exePath,
int * pidfd_out
)Launch a program in a new process, and return the PID of the new process as pidfd.
Parameters:
- exePath The path to the executable to launch.
- pidfd_out A pointer to an integer, which will be set to the PID of the new process.
Return: true if the program was successfully launched, false otherwise.
This function is used to launch a new program in a new process, and return the PID as pidfd.
function isProcessRunning
bool isProcessRunning(
int pidfd
)Check if a process is still running using a pidfd.
Parameters:
- pidfd The PIDFD of the process to check.
Return: true if the process is still running, false otherwise.
This function checks if a process is still running, by checking if the process has exited or not.
function colorModeToString
QString colorModeToString(
ColorMode mode
)function colorModeFromString
ColorMode colorModeFromString(
const QString & str
)function findSyntalosPyWorkerBinary
QString findSyntalosPyWorkerBinary()function findSyntalosLibraryPaths
void findSyntalosLibraryPaths(
QString & pkgConfigPath,
QString & ldLibraryPath,
QString & includePath
)function makeIpcServiceTopology
inline constexpr IpcServiceTopology makeIpcServiceTopology(
uint senderCount,
uint receiverCount
)Helper to create a Syntalos IPC service topology, for setting limits on IOX connections.
function connectionHeatToHumanString
QString connectionHeatToHumanString(
ConnectionHeatLevel heat
)function toString
QString toString(
ModuleCategory category
)function moduleCategoryFromString
ModuleCategory moduleCategoryFromString(
const QString & categoryStr
)function moduleCategoriesFromString
ModuleCategories moduleCategoriesFromString(
const QString & categoriesStr
)function qHash
inline uint qHash(
ModuleModifier key,
uint seed
)function newStreamForType
VariantDataStream * newStreamForType(
int typeId
)Create a new DataStream for the type identified by the given ID.
function newInputPortForType
VarStreamInputPort * newInputPortForType(
int typeId,
AbstractModule * mod,
const QString & id,
const QString & title
)Create a new Input Port for the type identified by the given ID.
function pythonVEnvDirForName
QString pythonVEnvDirForName(
const QString & venvName
)Get the absolute directory path of a virtual environment with the given name.
function pythonVirtualEnvExists
static bool pythonVirtualEnvExists(
const QString & venvName
)function requirementsHashMetadataPath
static QString requirementsHashMetadataPath(
const QString & venvDir
)function writeRequirementsHashMetadata
static bool writeRequirementsHashMetadata(
const QString & venvDir,
const QByteArray & requirementsHash
)function readRequirementsHashMetadata
static bool readRequirementsHashMetadata(
const QString & venvDir,
QString & requirementsHashOut
)function interpreterPathFromCfg
static QString interpreterPathFromCfg(
const QString & venvDir
)function pythonVirtualEnvStatus
PyVirtualEnvStatus pythonVirtualEnvStatus(
const QString & venvName,
const QString & requirementsFile
)function injectSystemPyModule
static void injectSystemPyModule(
const QString & venvDir,
const QString & pyModName
)function injectSystemPyQtBindings
static bool injectSystemPyQtBindings(
const QString & venvDir
)function createPythonVirtualEnv
auto createPythonVirtualEnv(
const QString & venvName,
const QString & requirementsFile,
bool recreate
)function streamDataFromRawMemory
template <typename T >
T streamDataFromRawMemory(
const void * data,
size_t size
)Convert raw received bytes into their data type.
function initSyntalosModuleLink
std::unique_ptr< SyntalosLink > initSyntalosModuleLink()function safeReceive
template <typename Sub >
static auto safeReceive(
Sub & sub
)Safely receive from a subscriber on the client. Returns the inner optional (empty = no data available) and logs a warning instead of crashing when the receive itself fails.
Attributes Documentation
variable US_PER_MS
constexpr int64_t US_PER_MS = 1'000;variable US_PER_S
constexpr int64_t US_PER_S = 1'000 * US_PER_MS;variable US_PER_MIN
constexpr int64_t US_PER_MIN = 60 * US_PER_S;variable US_PER_H
constexpr int64_t US_PER_H = 60 * US_PER_MIN;variable NS_PER_US
constexpr int64_t NS_PER_US = 1'000;variable MS_PER_S
constexpr int64_t MS_PER_S = 1'000;variable MS_PER_MIN
constexpr int64_t MS_PER_MIN = 60 * MS_PER_S;variable SECONDARY_CLOCK_TOLERANCE
static constexpr auto SECONDARY_CLOCK_TOLERANCE = microseconds_t(1000);The amount of time a secondary clock is allowed to deviate from the master.
Since Syntalos uses millisecond time resolution, permitting (slightly more than) half a millisecond deviation for secondary clocks from the master clock is sensible.
IMPORTANT: Modules may override this value for their synchronizers to one that fits their device better. This is just a default for modules which do not change the default setting.
variable DEFAULT_CLOCKSYNC_CHECK_INTERVAL
static constexpr auto DEFAULT_CLOCKSYNC_CHECK_INTERVAL = milliseconds_t(4000);Interval at which we check for external clock synchronization.
IMPORTANT: This is just a default value for modules which do not explicitly define a check interval. Individual modules may choose a different value that fits the device they are communicating with best.
variable SY_IOX_QUEUE_CAPACITY
static constexpr uint64_t SY_IOX_QUEUE_CAPACITY = 12U;variable SY_IOX_HISTORY_SIZE
static constexpr uint64_t SY_IOX_HISTORY_SIZE = 2U;variable SY_IOX_INITIAL_SLICE_LEN
static constexpr uint64_t SY_IOX_INITIAL_SLICE_LEN = 4096;variable SY_IOX_ID_MAX_LEN
static constexpr size_t SY_IOX_ID_MAX_LEN = IOX2_SERVICE_NAME_LENGTH;variable IN_PORT_CHANGE_CHANNEL_ID
static const std::string IN_PORT_CHANGE_CHANNEL_ID = "InPortChange";variable OUT_PORT_CHANGE_CHANNEL_ID
static const std::string OUT_PORT_CHANGE_CHANNEL_ID = "OutPortChange";variable IN_PORT_UPDATE_METADATA_ID
static const std::string IN_PORT_UPDATE_METADATA_ID = "UpdateInputPortMetadata";variable WORKER_CTL_EVENT_ID
static const std::string WORKER_CTL_EVENT_ID = "worker-event";Shared wakeup event service names for the control channel.
WORKER_CTL_EVENT_ID - the worker notifies the master whenever it publishes on a control channel (error, state, port-changes …). The master attaches one listener for this to its WaitSet.
MASTER_CTL_EVENT_ID - the master notifies the worker whenever it sends a request (request-response commands).
variable MASTER_CTL_EVENT_ID
static const std::string MASTER_CTL_EVENT_ID = "master-event";variable ERROR_CHANNEL_ID
static const std::string ERROR_CHANNEL_ID = "Error";variable STATE_CHANNEL_ID
static const std::string STATE_CHANNEL_ID = "State";variable STATUS_MESSAGE_CHANNEL_ID
static const std::string STATUS_MESSAGE_CHANNEL_ID = "StatusMessage";variable API_VERSION_CALL_ID
static const std::string API_VERSION_CALL_ID = "ApiVersion";variable SET_NICENESS_CALL_ID
static const std::string SET_NICENESS_CALL_ID = "SetNiceness";variable SET_MAX_RT_PRIORITY_CALL_ID
static const std::string SET_MAX_RT_PRIORITY_CALL_ID = "SetMaxRealtimePriority";variable SET_CPU_AFFINITY_CALL_ID
static const std::string SET_CPU_AFFINITY_CALL_ID = "SetCPUAffinity";variable DELETE_PORT_CALL_ID
static const std::string DELETE_PORT_CALL_ID = "DeletePort";variable CONNECT_INPUT_CALL_ID
static const std::string CONNECT_INPUT_CALL_ID = "ConnectInputPort";variable LOAD_SCRIPT_CALL_ID
static const std::string LOAD_SCRIPT_CALL_ID = "LoadScript";variable SET_PORTS_PRESET_CALL_ID
static const std::string SET_PORTS_PRESET_CALL_ID = "SetPortsPresetRequest";variable PREPARE_START_CALL_ID
static const std::string PREPARE_START_CALL_ID = "PrepareStart";variable START_CALL_ID
static const std::string START_CALL_ID = "Start";variable STOP_CALL_ID
static const std::string STOP_CALL_ID = "Stop";variable SHUTDOWN_CALL_ID
static const std::string SHUTDOWN_CALL_ID = "Shutdown";variable SETTINGS_CHANGE_CHANNEL_ID
static const std::string SETTINGS_CHANGE_CHANNEL_ID = "SettingsChange";variable SHOW_SETTINGS_CALL_ID
static const std::string SHOW_SETTINGS_CALL_ID = "ShowSettings";variable SHOW_DISPLAY_CALL_ID
static const std::string SHOW_DISPLAY_CALL_ID = "ShowDisplay";Updated on 2026-04-15 at 08:24:00 +0000