file_identifier "TRIG";

namespace dv;

enum TriggerType : int8 {
	/// A timestamp reset occurred.
	TIMESTAMP_RESET                 = 0,
	/// A rising edge was detected (External Input module on device).
	EXTERNAL_SIGNAL_RISING_EDGE     = 1,
	/// A falling edge was detected (External Input module on device).
	EXTERNAL_SIGNAL_FALLING_EDGE    = 2,
	/// A pulse was detected (External Input module on device).
	EXTERNAL_SIGNAL_PULSE           = 3,
	/// A rising edge was generated (External Generator module on device).
	EXTERNAL_GENERATOR_RISING_EDGE  = 4,
	/// A falling edge was generated (External Generator module on device).
	EXTERNAL_GENERATOR_FALLING_EDGE = 5,
	/// An APS frame capture has started (Frame Event will follow).
	APS_FRAME_START                 = 6,
	/// An APS frame capture has completed (Frame Event is contemporary).
	APS_FRAME_END                   = 7,
	/// An APS frame exposure has started (Frame Event will follow).
	APS_EXPOSURE_START              = 8,
	/// An APS frame exposure has completed (Frame Event will follow).
	APS_EXPOSURE_END                = 9
}

table Trigger {
	/// Timestamp (µs).
	timestamp: int64;
	/// Type of trigger that occurred.
	type: TriggerType = TIMESTAMP_RESET;
}

table TriggerPacket {
	elements: [Trigger] (native_inline);
}

root_type TriggerPacket;
