synheart-sensor-agent 0.2.2

Privacy-first PC background sensor for behavioral research
Documentation
//! Event collection module for the Synheart Sensor Agent.
//!
//! Provides platform-specific implementations for capturing keyboard and mouse
//! events in a privacy-preserving manner. Events are emitted as [`SensorEvent`]
//! values and fed into the [`WindowManager`](crate::core::WindowManager) for
//! time-based windowing.
//!
//! Use [`Collector`] as the platform-agnostic entry point and
//! [`CollectorConfig`] to configure capture behaviour.

/// Privacy-preserving event types ([`SensorEvent`](types::SensorEvent),
/// [`KeyboardEvent`](types::KeyboardEvent), [`MouseEvent`](types::MouseEvent), etc.).
pub mod types;

#[cfg(target_os = "macos")]
pub mod macos;

#[cfg(target_os = "windows")]
pub mod windows;

#[cfg(not(any(target_os = "macos", target_os = "windows")))]
pub mod noop;

// Re-export commonly used types
pub use types::{
    KeyboardEvent, KeyboardEventType, MouseEvent, MouseEventType, ScrollDirection, ScrollMagnitude,
    SensorEvent, ShortcutEvent, ShortcutType,
};

// macOS exports
#[cfg(target_os = "macos")]
pub use macos::{
    check_permission, get_frontmost_app_id, CollectorConfig, CollectorError, MacOSCollector,
};

/// Platform-agnostic collector type alias
#[cfg(target_os = "macos")]
pub type Collector = MacOSCollector;

// Windows exports
#[cfg(target_os = "windows")]
pub use windows::{
    check_permission, get_frontmost_app_id, CollectorConfig, CollectorError, WindowsCollector,
};

/// Platform-agnostic collector type alias
#[cfg(target_os = "windows")]
pub type Collector = WindowsCollector;

// Fallback for other platforms
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
pub use noop::{
    check_permission, get_frontmost_app_id, CollectorConfig, CollectorError, NoopCollector,
};

/// Platform-agnostic collector type alias
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
pub type Collector = NoopCollector;