Struct TriggerEvent#

Struct Documentation#

struct TriggerEvent#

A single timestamped event from any trigger source.

TriggerEvent is the common currency passed between trigger sources (KeyboardTrigger, SerialTrigger, ParallelPortTrigger), TriggerManager, and TriggerRecorder. It is also emitted by TriggerManager::event_received() so the UI or any downstream consumer can react in real time.

CSV columns

TriggerRecorder writes one row per event. elapsed_ns is the raw, unmodified value shared with timestamps_camN.csv (both come from the same process-wide elapsed_ns() origin — see utils/timestamp.hpp); elapsed_ms is recording-relative (zeroed at TriggerRecorder::start()) and is display-only, NOT safe to compare against timestamps_camN.csv:

elapsed_ms,elapsed_ns,wall_clock,source,label,value,code
1523.004,1523004112000,14:32:06.645,keyboard,Trial onset,0.000000,2
4910.331,4910331889000,14:32:09.032,parallel_port,D3_RISE,1.000000,0

Public Members

int64_t timestampNs = 0#

Monotonic nanosecond timestamp from elapsed_ns() at the moment the event was detected. Use this to align to timestamps_camN.csv.

QString source#

Where the event originated. One of:

  • "keyboard" — a KeyboardTrigger event filter.

  • "parallel_port" — a bit-edge on the LPT data register.

QString label#

Human-readable event name.

  • Keyboard: the user-configured binding name, e.g. "Event A".

  • Parallel: bit and edge, e.g. "D3_RISE" or "D3_FALL".

int code = 0#

Numeric marker identifying which event this is, for lining Mosaic’s markers up against an external system’s own trigger channel (an EEG amplifier’s, typically) where label's free text is useless.

  • Keyboard: the trigger’s user-configured KeyTriggerConfig::code.

  • Serial / parallel: 0 — not yet wired through (a parallel-port bit number is effectively a code already, so this is a natural follow-up, not a design limit).

Distinct from value, which carries a level/sample rather than an identity.

double value = 0.0#

Optional numeric payload.

  • Keyboard / parallel rising edge: 1.0.

  • Parallel falling edge: 0.0.

TriggerAction action = TriggerAction::Log#

The action dispatched by this event. Set by TriggerManager when routing.