Skip to main content

AsyncDevice

Struct AsyncDevice 

Source
pub struct AsyncDevice { /* private fields */ }
Expand description

Async view over a Device: the same Link core. Queries are async and await the correlated RESP with the default timeout; commands send at once.

Implementations§

Source§

impl AsyncDevice

Source

pub fn into_inner(self) -> Device

Back to the sync Device.

Source

pub fn move_rel(&self, dx: i16, dy: i16) -> Result<()>

MOVE: relative cursor movement; see Device::move_rel.

Source

pub fn wheel(&self, delta: i16) -> Result<()>

WHEEL: vertical scroll; see Device::wheel.

Source

pub fn move_rel_now(&self, dx: i16, dy: i16) -> Result<()>

MOVE (cursor) bypassing movement riding; see Device::move_rel_now.

Source

pub fn wheel_now(&self, delta: i16) -> Result<()>

MOVE (wheel) bypassing movement riding; see Device::wheel_now.

Source

pub fn pan(&self, delta: i16) -> Result<()>

MOVE (AC Pan): horizontal scroll; see Device::pan.

Source

pub fn pan_now(&self, delta: i16) -> Result<()>

MOVE (AC Pan) bypassing movement riding; see Device::pan_now.

Source

pub fn flush_motion(&self) -> Result<()>

Emit motion held for a ride now; see Device::flush_motion.

Source

pub fn discard_motion(&self) -> Result<()>

Drop motion held for a ride; see Device::discard_motion.

Source

pub fn move_axis( &self, motion: Motion, timing: MoveTiming, pending: PendingMotion, ) -> Result<()>

MOVE: any relative axis (cursor, wheel, AC Pan); see Device::move_axis.

Source

pub fn inject(&self, usage: impl Into<Usage>, action: Action) -> Result<()>

INJECT: override a button, key or media usage; see Device::inject.

Source

pub fn press(&self, usage: impl Into<Usage>) -> Result<()>

Press (force down) a usage; see Device::press.

Source

pub fn release(&self, usage: impl Into<Usage>) -> Result<()>

Soft-release a usage; see Device::release.

Source

pub fn force_release(&self, usage: impl Into<Usage>) -> Result<()>

Force-release a usage; see Device::force_release.

Source

pub fn reset(&self) -> Result<()>

RESET: return to passthrough; see Device::reset.

Source

pub fn factory_reset(&self) -> Result<()>

RESET, erase the store and reboot; see Device::factory_reset.

Source

pub fn reboot(&self, target: RebootTarget) -> Result<()>

Reboot a chip (run or ROM download per the target); see Device::reboot.

Source

pub fn reapply(&self) -> Result<()>

Re-send every held override; see Device::reapply.

Source

pub fn reconnect(&self) -> Result<()>

Best-effort reconnect over the shared core; blocks the calling thread. See Device::reconnect.

Source

pub fn counters(&self) -> CountersSnapshot

Snapshot of the always-on counters; see Device::counters.

Source

pub fn logs(&self) -> LogStream

LogStream over the device LOG stream, with recv_async; see Device::logs.

Source

pub fn led(&self, target: LedTarget, mode: LedMode, level: u8) -> Result<()>

LED: override a status LED; see Device::led.

Source

pub fn scale( &self, target: impl Into<LockTarget>, direction: Direction, scale: i16, ) -> Result<()>

LOCK: weigh physical input on a target; see Device::scale.

Source

pub fn scale_axis( &self, axis: Axis, direction: Direction, scale: i16, ) -> Result<()>

LOCK: weigh a relative axis by sign; see Device::scale_axis.

Source

pub fn scale_all( &self, what: Blanket, direction: Direction, scale: i16, ) -> Result<()>

LOCK: weigh a Blanket group; see Device::scale_all.

Source

pub fn lock( &self, target: impl Into<LockTarget>, direction: Direction, ) -> Result<()>

LOCK: block a usage (button/key/media) or axis; see Device::lock.

Source

pub fn unlock( &self, target: impl Into<LockTarget>, direction: Direction, ) -> Result<()>

LOCK: release a locked usage or axis; see Device::unlock.

Source

pub fn lock_axis(&self, axis: Axis, direction: Direction) -> Result<()>

LOCK: block a relative axis by sign; see Device::lock_axis.

Source

pub fn unlock_axis(&self, axis: Axis, direction: Direction) -> Result<()>

LOCK: release an axis lock; see Device::unlock_axis.

Source

pub fn lock_all(&self, what: Blanket, direction: Direction) -> Result<()>

LOCK: block a whole group; see Device::lock_all.

Source

pub fn unlock_all(&self, what: Blanket, direction: Direction) -> Result<()>

LOCK: release a blanket lock; see Device::unlock_all.

Source

pub fn catch_events( &self, filters: impl IntoIterator<Item = CatchFilter>, ) -> Result<EventStream>

Subscribe to the catch stream; see Device::catch_events.

Source

pub fn input_events( &self, filters: impl IntoIterator<Item = CatchFilter>, ) -> Result<InputStream>

Subscribe to decoded input edges; see Device::input_events.

Source

pub fn allow_imperfect_clones(&self, allow: bool) -> Result<()>

OPTION(IMPERFECT): allow cloning a device the box cannot clone exactly; see Device::allow_imperfect_clones.

Source

pub fn set_movement_riding(&self, window: Option<Duration>) -> Result<()>

OPTION(MOVE_RIDE): movement riding; see Device::set_movement_riding.

Source

pub fn set_emit_pace(&self, pace: EmitPace, force_hz: Option<u16>) -> Result<()>

OPTION(EMIT): emit pacing and forced wire rate; see Device::set_emit_pace.

Source

pub fn set_name(&self, name: &str) -> Result<()>

OPTION(NAME): box name; see Device::set_name.

Source

pub fn clear_name(&self) -> Result<()>

OPTION(NAME) clear: revert to the derived default; see Device::clear_name.

Source

pub fn set_bearing( &self, window: Option<Duration>, mode: BearingMode, ) -> Result<()>

OPTION(BEARING): what With/Against are measured against; see Device::set_bearing.

Source

pub fn set_render(&self, mode: RenderMode, full: bool) -> Result<()>

OPTION(RENDER): render texture, and whether native motion goes through it; see Device::set_render.

Source

pub fn set_spread(&self, percent: u16) -> Result<()>

OPTION(SPREAD): percent of the host’s command interval an injected delta is released across; see Device::set_spread.

Source

pub async fn query_version(&self) -> Result<Version>

Box version.

Source

pub async fn firmware_info(&self) -> Result<FirmwareInfo>

Both chips’ firmware versions and slot state (§4.16).

Source

pub async fn stage_firmware( &self, target: UpdateTarget, image: Vec<u8>, progress: impl FnMut(UpdateProgress) + Send + 'static, ) -> Result<u32>

Write one image into the target chip’s spare slot, inert until activate_firmware.

Source

pub async fn abort_update(&self, target: UpdateTarget) -> Result<()>

Drop whatever is staged or in flight for one target.

Source

pub async fn activate_firmware(&self) -> Result<()>

Commit every staged image and reboot into it.

Source

pub async fn update_firmware( &self, target: UpdateTarget, image: Vec<u8>, progress: impl FnMut(UpdateProgress) + Send + 'static, ) -> Result<()>

Stage one image and activate it.

Not cancellable: dropping the future stops the wait, not the transfer, which runs to completion on its own thread, and the box still reboots into the new image.

Source

pub async fn wait_firmware_confirmed(&self) -> Result<FirmwareInfo>

Wait until neither chip is on probation.

Source

pub async fn query_health(&self) -> Result<Health>

Box health flags.

Source

pub async fn device_info(&self) -> Result<DeviceInfo>

Cloned device’s USB identity, kind and product (§4.3).

Source

pub async fn caps(&self) -> Result<Caps>

Cloned device’s capabilities (§4.4).

Source

pub async fn query_rate(&self) -> Result<Rate>

Live native report rate (§4.5).

Source

pub async fn query_stats(&self) -> Result<Stats>

Delivery and telemetry counters (§4.6).

Source

pub async fn query_locks(&self) -> Result<Locks>

Active locks (§4.8).

Source

pub async fn query_catch(&self) -> Result<CatchState>

Live catch table, box-side drop counts and inter-chip clock (§4.9).

Source

pub async fn query_imperfect(&self) -> Result<ImperfectStatus>

Imperfect-clone status (§4.14).

Source

pub async fn query_movement_riding(&self) -> Result<Option<Duration>>

Movement-riding window (§4.14); None = off.

Source

pub async fn query_emit_pace(&self) -> Result<EmitPaceStatus>

Emit pacing mode and the rate in effect (§4.14).

Source

pub async fn query_bearing(&self) -> Result<Bearing>

Bearing (§4.14).

Source

pub async fn query_render(&self) -> Result<RenderStatus>

Render texture and whether a profile has armed (§4.14).

Source

pub async fn query_spread(&self) -> Result<SpreadStatus>

Spread percent and the interval in effect (§4.14).

Source

pub async fn raw( &self, ep: u8, direction: Direction, bytes: &[u8], ) -> Result<()>

RAW: put raw bytes on a cloned endpoint in a direction; see Device::raw.

Source

pub async fn transfer( &self, ep: u8, setup: Setup, out: &[u8], ) -> Result<TransferOutcome>

TRANSFER: one control transfer against the device; see Device::transfer.

Source

pub async fn transfer_timeout( &self, ep: u8, setup: Setup, out: &[u8], timeout: Duration, ) -> Result<TransferOutcome>

transfer with an explicit reply timeout; see Device::transfer_timeout.

Source

pub async fn set_rewrite(&self, rule: &RewriteRule) -> Result<()>

REWRITE: add one rewrite rule; see Device::set_rewrite.

Source

pub fn remove_rewrite(&self, rule: &RewriteRule) -> Result<()>

REWRITE remove: drop one rule by key; see Device::remove_rewrite.

Source

pub fn clear_rewrite(&self) -> Result<()>

REWRITE clear: drop the whole table; see Device::clear_rewrite.

Source

pub async fn query_rewrite(&self) -> Result<RewriteTable>

QUERY(REWRITE): rewrite-table summary; see Device::query_rewrite.

Source

pub async fn query_rewrite_entry(&self, index: u8) -> Result<RewriteRule>

QUERY(REWRITE_ENTRY): one rule in full; see Device::query_rewrite_entry.

Source

pub fn set_patch(&self, patch: &Patch) -> Result<()>

PATCH: store one descriptor patch; see Device::set_patch.

Source

pub async fn apply_patch(&self) -> Result<()>

PATCH APPLY: re-present the clone with the stored set; see Device::apply_patch.

Source

pub fn clear_patch(&self) -> Result<()>

PATCH CLEAR: erase this device’s stored set; see Device::clear_patch.

Source

pub async fn query_patches(&self) -> Result<PatchSet>

QUERY(PATCHES): patch set summary; see Device::query_patches.

Source

pub async fn query_patch_entry(&self, index: u8) -> Result<Patch>

QUERY(PATCH_ENTRY): one patch in full; see Device::query_patch_entry.

Source

pub fn transform(&self, t: &Transform) -> Result<()>

TRANSFORM: add one field transform (ungated); see Device::transform.

Source

pub fn untransform(&self, t: &Transform) -> Result<()>

TRANSFORM remove: drop one transform by key; see Device::untransform.

Source

pub fn clear_transforms(&self) -> Result<()>

TRANSFORM clear: drop the whole table; see Device::clear_transforms.

Source

pub fn transform_swap(&self, a: Axis, b: Axis) -> Result<()>

TRANSFORM: exchange two axes; see Device::transform_swap.

Source

pub fn transform_remap( &self, source: impl Into<LockTarget>, dest: impl Into<LockTarget>, ) -> Result<()>

TRANSFORM: remap a source field into a destination; see Device::transform_remap.

Source

pub async fn query_transforms(&self) -> Result<Transforms>

QUERY(TRANSFORMS): transform table; see Device::query_transforms.

Source

pub fn clip(&self) -> AsyncClipHandle

Buffered-clip playback (§3.11); see Device::clip.

Source

pub fn open(path: impl AsRef<Path>) -> Result<AsyncDevice>

Open the box at path as an AsyncDevice.

Source

pub fn find() -> Result<AsyncDevice>

Open the first box found as an AsyncDevice; blocks. See Device::find.

Source

pub fn list() -> Vec<BoxInfo>

Every connected box; blocks (a scan and a version read per box). See Device::list.

Source

pub fn open_by_id(id: &str) -> Result<AsyncDevice>

Open the box whose device MAC or CH343 serial matches id; see Device::open_by_id.

Source

pub fn find_mouse_box() -> Result<AsyncDevice>

Open the first box cloning a mouse; see Device::find_mouse_box.

Source

pub fn find_keyboard_box() -> Result<AsyncDevice>

Open the first box cloning a keyboard; see Device::find_keyboard_box.

Trait Implementations§

Source§

impl Clone for AsyncDevice

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AsyncDevice

Source§

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

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

impl From<Device> for AsyncDevice

Source§

fn from(device: Device) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

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 T
where U: From<T>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
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