YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
Loading...
Searching...
No Matches
event.hpp
Go to the documentation of this file.
1#ifndef YODAU_BACKEND_EVENT_HPP
2#define YODAU_BACKEND_EVENT_HPP
3
4#include <chrono>
5#include <optional>
6#include <string>
7
8#include "geometry.hpp"
9
10namespace yodau::backend {
11
12/**
13 * @brief High-level classification of backend events.
14 *
15 * Events are produced by analytics / processing modules and can represent
16 * detections (e.g., motion), logical triggers (tripwire/ROI), or informational
17 * messages.
18 */
19enum class event_kind {
20 /** Motion was detected in the stream. */
22 /** A tripwire (line crossing) condition was triggered. */
24 /** A region-of-interest related event was triggered. */
26 /** Informational / diagnostic event that doesn't fit other categories. */
28};
29
30/**
31 * @brief Generic event produced by the backend.
32 *
33 * The event is associated with a particular stream and time. Depending on
34 * @ref kind, optional spatial or semantic fields may be filled:
35 * - @ref pos_pct may contain a position in **percentage coordinates**
36 * ([0.0; 100.0]) relative to frame dimensions.
37 * - @ref line_name may contain a logical name for a tripwire/ROI/line that
38 * caused the event.
39 *
40 * @note Timestamps are stored as std::chrono::steady_clock::time_point,
41 * which is monotonic and suitable for measuring intervals, not for
42 * wall-clock time.
43 */
44struct event {
45 /**
46 * @brief Type of the event.
47 *
48 * Defaults to @ref event_kind::info.
49 */
51
52 /**
53 * @brief Name/identifier of the stream that produced the event.
54 *
55 * Could be a camera ID, pipeline name, or other unique stream label.
56 */
57 std::string stream_name;
58
59 /**
60 * @brief Human-readable event description or payload.
61 *
62 * Its semantics depend on the producer (may contain JSON, plain text,
63 * etc.).
64 */
65 std::string message;
66
67 /**
68 * @brief Monotonic timestamp when the event was generated.
69 */
70 std::chrono::steady_clock::time_point ts;
71
72 /**
73 * @brief Optional position associated with the event in percentage
74 * coordinates.
75 *
76 * When present, (x, y) are expressed in percent of frame width/height.
77 * For example, x=50 means horizontal center.
78 */
79 std::optional<point> pos_pct;
80
81 /**
82 * @brief Name of the line / ROI / rule responsible for this event.
83 *
84 * Used primarily for tripwire / ROI events; may be empty otherwise.
85 */
86 std::string line_name;
87};
88
89} // namespace yodau::backend
90
91#endif // YODAU_BACKEND_EVENT_HPP
Simple interactive CLI (REPL) for controlling a stream_manager.
void cmd_start_stream(const std::vector< std::string > &args) const
Handler for start-stream.
void dispatch_command(const std::string &cmd, const std::vector< std::string > &args) const
Dispatch a command to its handler.
void cmd_set_line(const std::vector< std::string > &args) const
Handler for set-line.
int run() const
Run the interactive command loop.
void cmd_add_line(const std::vector< std::string > &args) const
Handler for add-line.
static cxxopts::ParseResult parse_with_cxxopts(const std::string &cmd, const std::vector< std::string > &args, cxxopts::Options &options)
Parse command arguments using cxxopts.
backend::stream_manager & stream_mgr
Stream manager controlled by this CLI.
void cmd_stop_stream(const std::vector< std::string > &args) const
Handler for stop-stream.
void cmd_list_streams(const std::vector< std::string > &args) const
Handler for list-streams.
void cmd_add_stream(const std::vector< std::string > &args) const
Handler for add-stream.
void cmd_list_lines(const std::vector< std::string > &args) const
Handler for list-lines.
cli_client(backend::stream_manager &mgr)
Construct a CLI client operating on an existing manager.
Definition cli_client.cpp:5
static std::vector< std::string > tokenize(const std::string &line)
Split a line into whitespace-separated tokens.
Central coordinator for streams, geometry, frame processing and events.
std::function< void(const std::string &stream_name, frame &&f)> manual_push_fn
Hook for manual frame pushing.
Represents a single video stream and its analytic connections.
Definition stream.hpp:64
static yodau::backend::tripwire_dir parse_tripwire_dir(const std::string &s)
std::shared_ptr< line const > line_ptr
Shared, immutable line pointer.
Definition geometry.hpp:146
event_kind
High-level classification of backend events.
Definition event.hpp:19
tripwire_dir
Allowed crossing direction for a tripwire.
Definition geometry.hpp:62
Generic event produced by the backend.
Definition event.hpp:44
std::chrono::steady_clock::time_point ts
Monotonic timestamp when the event was generated.
Definition event.hpp:70
event_kind kind
Type of the event.
Definition event.hpp:50
std::string stream_name
Name/identifier of the stream that produced the event.
Definition event.hpp:57
std::optional< point > pos_pct
Optional position associated with the event in percentage coordinates.
Definition event.hpp:79
std::string line_name
Name of the line / ROI / rule responsible for this event.
Definition event.hpp:86
std::string message
Human-readable event description or payload.
Definition event.hpp:65
Video frame container.
Definition frame.hpp:44
Point in percentage-based image coordinates.
Definition geometry.hpp:19