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
impl AsyncDevice
Sourcepub fn into_inner(self) -> Device
pub fn into_inner(self) -> Device
Back to the sync Device.
Sourcepub fn move_rel(&self, dx: i16, dy: i16) -> Result<()>
pub fn move_rel(&self, dx: i16, dy: i16) -> Result<()>
MOVE: relative cursor movement; see Device::move_rel.
Sourcepub fn move_rel_now(&self, dx: i16, dy: i16) -> Result<()>
pub fn move_rel_now(&self, dx: i16, dy: i16) -> Result<()>
MOVE (cursor) bypassing movement riding; see Device::move_rel_now.
Sourcepub fn wheel_now(&self, delta: i16) -> Result<()>
pub fn wheel_now(&self, delta: i16) -> Result<()>
MOVE (wheel) bypassing movement riding; see Device::wheel_now.
Sourcepub fn pan_now(&self, delta: i16) -> Result<()>
pub fn pan_now(&self, delta: i16) -> Result<()>
MOVE (AC Pan) bypassing movement riding; see Device::pan_now.
Sourcepub fn flush_motion(&self) -> Result<()>
pub fn flush_motion(&self) -> Result<()>
Emit motion held for a ride now; see Device::flush_motion.
Sourcepub fn discard_motion(&self) -> Result<()>
pub fn discard_motion(&self) -> Result<()>
Drop motion held for a ride; see Device::discard_motion.
Sourcepub fn move_axis(
&self,
motion: Motion,
timing: MoveTiming,
pending: PendingMotion,
) -> Result<()>
pub fn move_axis( &self, motion: Motion, timing: MoveTiming, pending: PendingMotion, ) -> Result<()>
MOVE: any relative axis (cursor, wheel, AC Pan); see Device::move_axis.
Sourcepub fn inject(&self, usage: impl Into<Usage>, action: Action) -> Result<()>
pub fn inject(&self, usage: impl Into<Usage>, action: Action) -> Result<()>
INJECT: override a button, key or media usage; see Device::inject.
Sourcepub fn press(&self, usage: impl Into<Usage>) -> Result<()>
pub fn press(&self, usage: impl Into<Usage>) -> Result<()>
Press (force down) a usage; see Device::press.
Sourcepub fn release(&self, usage: impl Into<Usage>) -> Result<()>
pub fn release(&self, usage: impl Into<Usage>) -> Result<()>
Soft-release a usage; see Device::release.
Sourcepub fn force_release(&self, usage: impl Into<Usage>) -> Result<()>
pub fn force_release(&self, usage: impl Into<Usage>) -> Result<()>
Force-release a usage; see Device::force_release.
Sourcepub fn reset(&self) -> Result<()>
pub fn reset(&self) -> Result<()>
RESET: return to passthrough; see Device::reset.
Sourcepub fn factory_reset(&self) -> Result<()>
pub fn factory_reset(&self) -> Result<()>
RESET, erase the store and reboot; see Device::factory_reset.
Sourcepub fn reboot(&self, target: RebootTarget) -> Result<()>
pub fn reboot(&self, target: RebootTarget) -> Result<()>
Reboot a chip (run or ROM download per the target); see Device::reboot.
Sourcepub fn reapply(&self) -> Result<()>
pub fn reapply(&self) -> Result<()>
Re-send every held override; see Device::reapply.
Sourcepub fn reconnect(&self) -> Result<()>
pub fn reconnect(&self) -> Result<()>
Best-effort reconnect over the shared core; blocks the calling thread. See
Device::reconnect.
Sourcepub fn counters(&self) -> CountersSnapshot
pub fn counters(&self) -> CountersSnapshot
Snapshot of the always-on counters; see Device::counters.
Sourcepub fn logs(&self) -> LogStream
pub fn logs(&self) -> LogStream
LogStream over the device LOG stream, with recv_async; see Device::logs.
Sourcepub fn led(&self, target: LedTarget, mode: LedMode, level: u8) -> Result<()>
pub fn led(&self, target: LedTarget, mode: LedMode, level: u8) -> Result<()>
LED: override a status LED; see Device::led.
Sourcepub fn scale(
&self,
target: impl Into<LockTarget>,
direction: Direction,
scale: i16,
) -> Result<()>
pub fn scale( &self, target: impl Into<LockTarget>, direction: Direction, scale: i16, ) -> Result<()>
LOCK: weigh physical input on a target; see Device::scale.
Sourcepub fn scale_axis(
&self,
axis: Axis,
direction: Direction,
scale: i16,
) -> Result<()>
pub fn scale_axis( &self, axis: Axis, direction: Direction, scale: i16, ) -> Result<()>
LOCK: weigh a relative axis by sign; see Device::scale_axis.
Sourcepub fn scale_all(
&self,
what: Blanket,
direction: Direction,
scale: i16,
) -> Result<()>
pub fn scale_all( &self, what: Blanket, direction: Direction, scale: i16, ) -> Result<()>
LOCK: weigh a Blanket group; see Device::scale_all.
Sourcepub fn lock(
&self,
target: impl Into<LockTarget>,
direction: Direction,
) -> Result<()>
pub fn lock( &self, target: impl Into<LockTarget>, direction: Direction, ) -> Result<()>
LOCK: block a usage (button/key/media) or axis; see Device::lock.
Sourcepub fn unlock(
&self,
target: impl Into<LockTarget>,
direction: Direction,
) -> Result<()>
pub fn unlock( &self, target: impl Into<LockTarget>, direction: Direction, ) -> Result<()>
LOCK: release a locked usage or axis; see Device::unlock.
Sourcepub fn lock_axis(&self, axis: Axis, direction: Direction) -> Result<()>
pub fn lock_axis(&self, axis: Axis, direction: Direction) -> Result<()>
LOCK: block a relative axis by sign; see Device::lock_axis.
Sourcepub fn unlock_axis(&self, axis: Axis, direction: Direction) -> Result<()>
pub fn unlock_axis(&self, axis: Axis, direction: Direction) -> Result<()>
LOCK: release an axis lock; see Device::unlock_axis.
Sourcepub fn lock_all(&self, what: Blanket, direction: Direction) -> Result<()>
pub fn lock_all(&self, what: Blanket, direction: Direction) -> Result<()>
LOCK: block a whole group; see Device::lock_all.
Sourcepub fn unlock_all(&self, what: Blanket, direction: Direction) -> Result<()>
pub fn unlock_all(&self, what: Blanket, direction: Direction) -> Result<()>
LOCK: release a blanket lock; see Device::unlock_all.
Sourcepub fn catch_events(
&self,
filters: impl IntoIterator<Item = CatchFilter>,
) -> Result<EventStream>
pub fn catch_events( &self, filters: impl IntoIterator<Item = CatchFilter>, ) -> Result<EventStream>
Subscribe to the catch stream; see Device::catch_events.
Sourcepub fn input_events(
&self,
filters: impl IntoIterator<Item = CatchFilter>,
) -> Result<InputStream>
pub fn input_events( &self, filters: impl IntoIterator<Item = CatchFilter>, ) -> Result<InputStream>
Subscribe to decoded input edges; see Device::input_events.
Sourcepub fn allow_imperfect_clones(&self, allow: bool) -> Result<()>
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.
Sourcepub fn set_movement_riding(&self, window: Option<Duration>) -> Result<()>
pub fn set_movement_riding(&self, window: Option<Duration>) -> Result<()>
OPTION(MOVE_RIDE): movement riding; see Device::set_movement_riding.
Sourcepub fn set_emit_pace(&self, pace: EmitPace, force_hz: Option<u16>) -> Result<()>
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.
Sourcepub fn clear_name(&self) -> Result<()>
pub fn clear_name(&self) -> Result<()>
OPTION(NAME) clear: revert to the derived default; see Device::clear_name.
Sourcepub fn set_bearing(
&self,
window: Option<Duration>,
mode: BearingMode,
) -> Result<()>
pub fn set_bearing( &self, window: Option<Duration>, mode: BearingMode, ) -> Result<()>
OPTION(BEARING): what With/Against are measured against; see Device::set_bearing.
Sourcepub fn set_render(&self, mode: RenderMode, full: bool) -> Result<()>
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.
Sourcepub fn set_spread(&self, percent: u16) -> Result<()>
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.
Sourcepub async fn query_version(&self) -> Result<Version>
pub async fn query_version(&self) -> Result<Version>
Box version.
Sourcepub async fn firmware_info(&self) -> Result<FirmwareInfo>
pub async fn firmware_info(&self) -> Result<FirmwareInfo>
Both chips’ firmware versions and slot state (§4.16).
Sourcepub async fn stage_firmware(
&self,
target: UpdateTarget,
image: Vec<u8>,
progress: impl FnMut(UpdateProgress) + Send + 'static,
) -> Result<u32>
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.
Sourcepub async fn abort_update(&self, target: UpdateTarget) -> Result<()>
pub async fn abort_update(&self, target: UpdateTarget) -> Result<()>
Drop whatever is staged or in flight for one target.
Sourcepub async fn activate_firmware(&self) -> Result<()>
pub async fn activate_firmware(&self) -> Result<()>
Commit every staged image and reboot into it.
Sourcepub async fn update_firmware(
&self,
target: UpdateTarget,
image: Vec<u8>,
progress: impl FnMut(UpdateProgress) + Send + 'static,
) -> Result<()>
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.
Sourcepub async fn wait_firmware_confirmed(&self) -> Result<FirmwareInfo>
pub async fn wait_firmware_confirmed(&self) -> Result<FirmwareInfo>
Wait until neither chip is on probation.
Sourcepub async fn query_health(&self) -> Result<Health>
pub async fn query_health(&self) -> Result<Health>
Box health flags.
Sourcepub async fn device_info(&self) -> Result<DeviceInfo>
pub async fn device_info(&self) -> Result<DeviceInfo>
Cloned device’s USB identity, kind and product (§4.3).
Sourcepub async fn query_rate(&self) -> Result<Rate>
pub async fn query_rate(&self) -> Result<Rate>
Live native report rate (§4.5).
Sourcepub async fn query_stats(&self) -> Result<Stats>
pub async fn query_stats(&self) -> Result<Stats>
Delivery and telemetry counters (§4.6).
Sourcepub async fn query_locks(&self) -> Result<Locks>
pub async fn query_locks(&self) -> Result<Locks>
Active locks (§4.8).
Sourcepub async fn query_catch(&self) -> Result<CatchState>
pub async fn query_catch(&self) -> Result<CatchState>
Live catch table, box-side drop counts and inter-chip clock (§4.9).
Sourcepub async fn query_imperfect(&self) -> Result<ImperfectStatus>
pub async fn query_imperfect(&self) -> Result<ImperfectStatus>
Imperfect-clone status (§4.14).
Sourcepub async fn query_movement_riding(&self) -> Result<Option<Duration>>
pub async fn query_movement_riding(&self) -> Result<Option<Duration>>
Movement-riding window (§4.14); None = off.
Sourcepub async fn query_emit_pace(&self) -> Result<EmitPaceStatus>
pub async fn query_emit_pace(&self) -> Result<EmitPaceStatus>
Emit pacing mode and the rate in effect (§4.14).
Sourcepub async fn query_bearing(&self) -> Result<Bearing>
pub async fn query_bearing(&self) -> Result<Bearing>
Bearing (§4.14).
Sourcepub async fn query_render(&self) -> Result<RenderStatus>
pub async fn query_render(&self) -> Result<RenderStatus>
Render texture and whether a profile has armed (§4.14).
Sourcepub async fn query_spread(&self) -> Result<SpreadStatus>
pub async fn query_spread(&self) -> Result<SpreadStatus>
Spread percent and the interval in effect (§4.14).
Sourcepub async fn raw(
&self,
ep: u8,
direction: Direction,
bytes: &[u8],
) -> Result<()>
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.
Sourcepub async fn transfer(
&self,
ep: u8,
setup: Setup,
out: &[u8],
) -> Result<TransferOutcome>
pub async fn transfer( &self, ep: u8, setup: Setup, out: &[u8], ) -> Result<TransferOutcome>
TRANSFER: one control transfer against the device; see Device::transfer.
Sourcepub async fn transfer_timeout(
&self,
ep: u8,
setup: Setup,
out: &[u8],
timeout: Duration,
) -> Result<TransferOutcome>
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.
Sourcepub async fn set_rewrite(&self, rule: &RewriteRule) -> Result<()>
pub async fn set_rewrite(&self, rule: &RewriteRule) -> Result<()>
REWRITE: add one rewrite rule; see Device::set_rewrite.
Sourcepub fn remove_rewrite(&self, rule: &RewriteRule) -> Result<()>
pub fn remove_rewrite(&self, rule: &RewriteRule) -> Result<()>
REWRITE remove: drop one rule by key; see Device::remove_rewrite.
Sourcepub fn clear_rewrite(&self) -> Result<()>
pub fn clear_rewrite(&self) -> Result<()>
REWRITE clear: drop the whole table; see Device::clear_rewrite.
Sourcepub async fn query_rewrite(&self) -> Result<RewriteTable>
pub async fn query_rewrite(&self) -> Result<RewriteTable>
QUERY(REWRITE): rewrite-table summary; see Device::query_rewrite.
Sourcepub async fn query_rewrite_entry(&self, index: u8) -> Result<RewriteRule>
pub async fn query_rewrite_entry(&self, index: u8) -> Result<RewriteRule>
QUERY(REWRITE_ENTRY): one rule in full; see Device::query_rewrite_entry.
Sourcepub fn set_patch(&self, patch: &Patch) -> Result<()>
pub fn set_patch(&self, patch: &Patch) -> Result<()>
PATCH: store one descriptor patch; see Device::set_patch.
Sourcepub async fn apply_patch(&self) -> Result<()>
pub async fn apply_patch(&self) -> Result<()>
PATCH APPLY: re-present the clone with the stored set; see Device::apply_patch.
Sourcepub fn clear_patch(&self) -> Result<()>
pub fn clear_patch(&self) -> Result<()>
PATCH CLEAR: erase this device’s stored set; see Device::clear_patch.
Sourcepub async fn query_patches(&self) -> Result<PatchSet>
pub async fn query_patches(&self) -> Result<PatchSet>
QUERY(PATCHES): patch set summary; see Device::query_patches.
Sourcepub async fn query_patch_entry(&self, index: u8) -> Result<Patch>
pub async fn query_patch_entry(&self, index: u8) -> Result<Patch>
QUERY(PATCH_ENTRY): one patch in full; see Device::query_patch_entry.
Sourcepub fn transform(&self, t: &Transform) -> Result<()>
pub fn transform(&self, t: &Transform) -> Result<()>
TRANSFORM: add one field transform (ungated); see Device::transform.
Sourcepub fn untransform(&self, t: &Transform) -> Result<()>
pub fn untransform(&self, t: &Transform) -> Result<()>
TRANSFORM remove: drop one transform by key; see Device::untransform.
Sourcepub fn clear_transforms(&self) -> Result<()>
pub fn clear_transforms(&self) -> Result<()>
TRANSFORM clear: drop the whole table; see Device::clear_transforms.
Sourcepub fn transform_swap(&self, a: Axis, b: Axis) -> Result<()>
pub fn transform_swap(&self, a: Axis, b: Axis) -> Result<()>
TRANSFORM: exchange two axes; see Device::transform_swap.
Sourcepub fn transform_remap(
&self,
source: impl Into<LockTarget>,
dest: impl Into<LockTarget>,
) -> Result<()>
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.
Sourcepub async fn query_transforms(&self) -> Result<Transforms>
pub async fn query_transforms(&self) -> Result<Transforms>
QUERY(TRANSFORMS): transform table; see Device::query_transforms.
Sourcepub fn clip(&self) -> AsyncClipHandle
pub fn clip(&self) -> AsyncClipHandle
Buffered-clip playback (§3.11); see Device::clip.
Sourcepub fn open(path: impl AsRef<Path>) -> Result<AsyncDevice>
pub fn open(path: impl AsRef<Path>) -> Result<AsyncDevice>
Open the box at path as an AsyncDevice.
Sourcepub fn find() -> Result<AsyncDevice>
pub fn find() -> Result<AsyncDevice>
Open the first box found as an AsyncDevice; blocks. See Device::find.
Sourcepub fn list() -> Vec<BoxInfo>
pub fn list() -> Vec<BoxInfo>
Every connected box; blocks (a scan and a version read per box). See Device::list.
Sourcepub fn open_by_id(id: &str) -> Result<AsyncDevice>
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.
Sourcepub fn find_mouse_box() -> Result<AsyncDevice>
pub fn find_mouse_box() -> Result<AsyncDevice>
Open the first box cloning a mouse; see Device::find_mouse_box.
Sourcepub fn find_keyboard_box() -> Result<AsyncDevice>
pub fn find_keyboard_box() -> Result<AsyncDevice>
Open the first box cloning a keyboard; see Device::find_keyboard_box.