Skip to main content

Module cast

Module cast 

Source
Expand description

omni cast mode — stream stdin to the omni wire command stream (bd-5cd61e).

omni cast reads stdin and forwards it, in real time, as a stream of crate::wire::InjectionCommands to the selected sink (the NDJSON wire on stdout by default, or the Android transport with --adb). It is the streaming sibling of one-shot omni send.

§Framing (Frame)

  • line (default): each input line becomes a text command (empty lines are skipped). Good for producer | omni cast.
  • char: each input character is forwarded as it arrives — \n/\r -> key enter, \t -> key tab, everything else -> a one-character text command. Good for real-time keystroke forwarding.
  • ndjson: each input line is parsed as a canonical NDJSON InjectionCommand and forwarded verbatim (a pump/forward mode), e.g. omni send text hi | omni cast --ndjson --adb. Blank lines are skipped; a malformed line is an error.

The actual delivery (stdout NDJSON vs. Android am-broadcast) is the caller’s sink; this module owns only stdin -> command translation, so it is unit testable without a real terminal or device. The caller flushes the sink per command for real-time behaviour.

Enums§

Frame
How omni cast frames stdin into commands.

Functions§

char_to_command
Map a single character to a command for Frame::Char streaming.
run_cast
Drive a cast: read from input, translate per frame, and hand each InjectionCommand to sink (which delivers + flushes it). Returns the number of commands emitted.
run_cast_reader
Convenience wrapper that reads from any Read (wrapping it in a std::io::BufReader).