pub struct InboundEvent {
pub timestamp_ns: u64,
pub source_id: String,
pub kind: EventKind,
pub payload: EventPayload,
pub capability_lease: Option<u64>,
pub span: Span,
}Expand description
An inbound event record — the structured ABI for HID/sensor data.
Every inbound event has:
- A timestamp (nanoseconds, monotonic or Unix).
- A source ID (which device/sensor produced this event).
- An event kind (pointer, keyboard, touch, etc.).
- A payload (inline data or fat buffer reference).
- An optional capability lease ID (for biosignals and other capability-leased sources).
Fields§
§timestamp_ns: u64Timestamp in nanoseconds (monotonic or Unix, depending on source).
source_id: StringSource device/sensor ID (e.g. “mouse:0”, “keyboard:0”, “eeg:0”).
kind: EventKindThe kind of event.
payload: EventPayloadThe event payload (inline or fat buffer).
capability_lease: Option<u64>Optional capability lease ID (for biosignals and other leased sources).
span: SpanThe span where this event was triggered (if from VibeScript).
Implementations§
Source§impl InboundEvent
impl InboundEvent
Sourcepub fn new(
timestamp_ns: u64,
source_id: &str,
kind: EventKind,
payload: EventPayload,
) -> Self
pub fn new( timestamp_ns: u64, source_id: &str, kind: EventKind, payload: EventPayload, ) -> Self
Create a new inbound event.
Sourcepub fn with_lease(self, lease_id: u64) -> Self
pub fn with_lease(self, lease_id: u64) -> Self
Set the capability lease ID.
Sourcepub fn pointer_move(timestamp_ns: u64, source_id: &str, x: f64, y: f64) -> Self
pub fn pointer_move(timestamp_ns: u64, source_id: &str, x: f64, y: f64) -> Self
Create a pointer move event.
Create a pointer button event.
Sourcepub fn keyboard(
timestamp_ns: u64,
source_id: &str,
key_code: i64,
pressed: bool,
) -> Self
pub fn keyboard( timestamp_ns: u64, source_id: &str, key_code: i64, pressed: bool, ) -> Self
Create a keyboard event.
Sourcepub fn touch(
timestamp_ns: u64,
source_id: &str,
touch_id: i64,
x: f64,
y: f64,
phase: &str,
) -> Self
pub fn touch( timestamp_ns: u64, source_id: &str, touch_id: i64, x: f64, y: f64, phase: &str, ) -> Self
Create a touch event.
Sourcepub fn biosignal(
timestamp_ns: u64,
source_id: &str,
iri: &str,
hash: u64,
lease_id: u64,
) -> Self
pub fn biosignal( timestamp_ns: u64, source_id: &str, iri: &str, hash: u64, lease_id: u64, ) -> Self
Create a biosignal event (with capability lease).
Sourcepub fn depth(timestamp_ns: u64, source_id: &str, iri: &str, hash: u64) -> Self
pub fn depth(timestamp_ns: u64, source_id: &str, iri: &str, hash: u64) -> Self
Create a depth map event (fat buffer).
Sourcepub fn sip_and_puff(
timestamp_ns: u64,
source_id: &str,
strength: f64,
duration_ms: u64,
) -> Self
pub fn sip_and_puff( timestamp_ns: u64, source_id: &str, strength: f64, duration_ms: u64, ) -> Self
Create a sip-and-puff event (assistive input).
strength is 0.0–1.0 (no puff → hard puff).
duration_ms is the duration of the sip/puff in milliseconds.
Sourcepub fn switch_event(
timestamp_ns: u64,
source_id: &str,
switch_id: i64,
pressed: bool,
) -> Self
pub fn switch_event( timestamp_ns: u64, source_id: &str, switch_id: i64, pressed: bool, ) -> Self
Create a switch event (assistive input — single switch, binary).
Sourcepub fn braille_chord(timestamp_ns: u64, source_id: &str, dots: u8) -> Self
pub fn braille_chord(timestamp_ns: u64, source_id: &str, dots: u8) -> Self
Create a Braille chord event (assistive input).
dots is a bitmask of the 8 Braille dots (bits 0–7).
Sourcepub fn eye_gaze(
timestamp_ns: u64,
source_id: &str,
x: f64,
y: f64,
fixation_ms: u64,
) -> Self
pub fn eye_gaze( timestamp_ns: u64, source_id: &str, x: f64, y: f64, fixation_ms: u64, ) -> Self
Create an eye-gaze event (assistive input — eye tracking).
Sourcepub fn gamepad(
timestamp_ns: u64,
source_id: &str,
buttons: u32,
axes: &[f64],
) -> Self
pub fn gamepad( timestamp_ns: u64, source_id: &str, buttons: u32, axes: &[f64], ) -> Self
Create a Gamepad event (buttons + axes).
Sourcepub fn spatial_head(
timestamp_ns: u64,
source_id: &str,
pos: [f64; 3],
ori: [f64; 4],
) -> Self
pub fn spatial_head( timestamp_ns: u64, source_id: &str, pos: [f64; 3], ori: [f64; 4], ) -> Self
Create a 6-DoF Spatial Head pose event.
Sourcepub fn spatial_hand(
timestamp_ns: u64,
source_id: &str,
is_left: bool,
joint_asset_iri: &str,
joint_asset_hash: u64,
pinch_confidence: f64,
) -> Self
pub fn spatial_hand( timestamp_ns: u64, source_id: &str, is_left: bool, joint_asset_iri: &str, joint_asset_hash: u64, pinch_confidence: f64, ) -> Self
Create a 26-joint Spatial Hand skeleton tracking event.
Sourcepub fn spatial_gaze(
timestamp_ns: u64,
source_id: &str,
origin: [f64; 3],
direction: [f64; 3],
pupil_dia_mm: f64,
) -> Self
pub fn spatial_gaze( timestamp_ns: u64, source_id: &str, origin: [f64; 3], direction: [f64; 3], pupil_dia_mm: f64, ) -> Self
Create a Spatial Gaze tracking ray event.