Enum input::Command

source ·
pub(crate) enum Command {
    Text {
        key_event_duration_msec: u32,
        input: String,
    },
    KeyboardEvent {
        duration_msec: u32,
        usage: u32,
    },
    Tap {
        width: u32,
        height: u32,
        tap_event_count: usize,
        duration_msec: u32,
        x: u32,
        y: u32,
    },
    Swipe {
        width: u32,
        height: u32,
        move_event_count: usize,
        duration_msec: u32,
        x0: u32,
        y0: u32,
        x1: u32,
        y1: u32,
    },
    MediaButton {
        mic_mute: bool,
        volume_up: bool,
        volume_down: bool,
        reset: bool,
        pause: bool,
        camera_disable: bool,
    },
}

Variants§

§

Text

Fields

§key_event_duration_msec: u32

Duration of the each event in milliseconds

§input: String

Input text to inject

Injects text using QWERTY keystrokes

Text is injected by translating a string into keystrokes using a QWERTY keymap. This facility is intended for end-to-end and input testing purposes only.

Only printable ASCII characters are mapped. Tab, newline, and other control characters are not supported, and keyevent should be used instead.

The events simulated consist of a series of keyboard reports, ending in a report with no keys. The number of reports is near the lower bound of reports needed to produce the requested string, minimizing pauses and shift-state transitions.

The --key_event_duration is the time between each report. Care should be taken not to provide so long a duration that key repeat kicks in.

Note: when using through fx shell with quotes, you may need to surround the invocation in strong quotes, e.g.:

fx shell ‘input text “Hello, world!”’

§

KeyboardEvent

Fields

§duration_msec: u32

Duration of the event(s) in milliseconds

§usage: u32

HID usage code

§

Tap

Fields

§width: u32

Width of the display

§height: u32

Height of the display

§tap_event_count: usize

Number of tap events to send (--duration is divided over the tap events)

§duration_msec: u32

Duration of the event(s) in milliseconds

§x: u32

X axis coordinate

§y: u32

Y axis coordinate

Injects a single tap event

This command simulates a single touch down + up sequence. By default, the x and y coordinates are in the range 0 to 1000 and will be proportionally transformed to the current display, but you can specify a virtual range for the input with the --width and --height options.

The time between the down and up report is --duration.

§

Swipe

Fields

§width: u32

Width of the display

§height: u32

Height of the display

§move_event_count: usize

Number of move events to send in between the down and up events of the swipe

§duration_msec: u32

Duration of the event(s) in milliseconds

§x0: u32

X axis start coordinate

§y0: u32

Y axis start coordinate

§x1: u32

X axis end coordinate

§y1: u32

Y axis end coordinate

Injects a swipe event

This command simulates a touch down, a series of touch move, followed up a touch up event. By default, the x and y coordinates are in the range 0 to 1000 and will be proportionally transformed to the current display, but you can specify a virtual range for the input with the --width and --height options.

The time between the down and up report is --duration.

§

MediaButton

Fields

§mic_mute: bool

0 or 1

§volume_up: bool

0 or 1

§volume_down: bool

0 or 1

§reset: bool

0 or 1

§pause: bool

0 or 1

§camera_disable: bool

0 or 1

Injects a MediaButton event

Trait Implementations§

source§

impl Debug for Command

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl StructOpt for Command

source§

fn clap<'a, 'b>() -> App<'a, 'b>

Returns the corresponding clap::App.
source§

fn from_clap(matches: &ArgMatches<'_>) -> Self

Creates the struct from clap::ArgMatches. It cannot fail with a parameter generated by clap by construction.
§

fn from_args() -> Selfwhere Self: Sized,

Gets the struct from the command line arguments. Print the error message and quit the program in case of failure.
§

fn from_iter<I>(iter: I) -> Selfwhere Self: Sized, I: IntoIterator, <I as IntoIterator>::Item: Into<OsString> + Clone,

Gets the struct from any iterator such as a Vec of your making. Print the error message and quit the program in case of failure.
§

fn from_iter_safe<I>(iter: I) -> Result<Self, Error>where Self: Sized, I: IntoIterator, <I as IntoIterator>::Item: Into<OsString> + Clone,

Gets the struct from any iterator such as a Vec of your making. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoAny for Twhere T: 'static + Send + Sync,

source§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Cast the given object into a dyn std::any::Any.
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more