Skip to main content

WearablePlatform

Struct WearablePlatform 

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

Unified smartwatch host backend smoothing Wear OS, watchOS, HarmonyOS Watch, HyperOS/Vela, OPPO, vivo, Garmin, and ZeppOS.

Implementations§

Source§

impl WearablePlatform

Vendor constructors, rotary crown translation, AOD lifecycle, and wrist/palm gesture handling for WearablePlatform.

Source

pub fn for_vendor(vendor: WearableVendor) -> Self

Creates a WearablePlatform using the canonical display and hardware profile for vendor.

§Arguments
  • WearableVendor - Target smartwatch vendor ecosystem.
§Returns
  • Self - Configured wearable platform backend.
Source

pub fn vivo_blueos() -> Self

Creates a WearablePlatform preconfigured for vivo BlueOS Watch (466x466 round dial).

§Returns
  • Self - Configured vivo BlueOS Watch platform backend.
Source

pub fn from_profile(profile: WearableProfile) -> Self

Creates a WearablePlatform from a custom WearableProfile.

§Arguments
  • WearableProfile - Custom smartwatch display and input profile.
§Returns
  • Self - Configured wearable platform backend.
Source

pub fn with_capture_last_frame(self, enabled: bool) -> Self

Enables or disables retaining a cloned snapshot of the last presented framebuffer.

§Arguments
  • bool - true to capture snapshots on each present; false for zero-clone production mode.
§Returns
  • Self - Updated wearable platform backend.
Source

pub fn last_framebuffer(&self, id: WindowId) -> Option<&Framebuffer>

Returns the last presented framebuffer snapshot for id when capture_last_frame is enabled.

§Arguments
  • WindowId - Watch window identifier.
§Returns
  • Option<&Framebuffer> - Cloned framebuffer reference when capture is enabled and id exists.
Source

pub fn primary_window_id(&self) -> Option<WindowId>

Returns the primary watch window identifier, if created.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • Option<WindowId> - Primary watch window handle.
Source

pub fn handle_crown_input( &mut self, input: WearableCrownInput, ) -> Vec<WindowEvent>

Translates a rotary crown or rotating bezel rotation event into standard EUV scroll or focus WindowEvents.

§Arguments
  • &Self - Mutable wearable platform.
  • WearableCrownInput - Raw vendor crown/bezel detent delta and mode.
§Returns
  • Vec<WindowEvent> - Normalized standard EUV events also enqueued for poll_events().
Source

pub fn enter_ambient(&mut self) -> Vec<WindowEvent>

Transitions the watch into low-power Always-On Display (AOD) ambient mode, freezing interactive pumping.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Normalized ambient transition events.
Source

pub fn pulse_ambient_tick(&mut self) -> Option<WindowEvent>

Delivers a single low-power 1Hz AOD ambient redraw pulse while remaining in AlwaysOnAmbient mode.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Option<WindowEvent> - RedrawRequested event when currently in AlwaysOnAmbient mode.
Source

pub fn enter_screen_off(&mut self) -> Vec<WindowEvent>

Transitions the watch into full ScreenOff background freeze (0% CPU/GPU).

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Normalized background freeze events.
Source

pub fn exit_ambient(&mut self) -> Vec<WindowEvent>

Wakes the watch from AlwaysOnAmbient or ScreenOff back into full interactive mode.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Normalized interactive resume events.
Source

pub fn handle_hardware_gesture( &mut self, gesture: WearableHardwareGesture, ) -> Vec<WindowEvent>

Translates physical wrist, palm-cover, double-pinch, and side-button hardware gestures into standard EUV events.

§Arguments
  • &Self - Mutable wearable platform.
  • WearableHardwareGesture - Hardware gesture detected by the watch OS.
§Returns
  • Vec<WindowEvent> - Normalized standard EUV window/system events.
Source§

impl WearablePlatform

Source

pub fn get_profile(&self) -> WearableProfile

Source

pub fn get_mut_profile(&mut self) -> &mut WearableProfile

Source

pub fn set_profile(&mut self, val: WearableProfile) -> &mut Self

Source

pub fn get_ambient_mode(&self) -> WearableAmbientMode

Source

pub fn get_mut_ambient_mode(&mut self) -> &mut WearableAmbientMode

Source

pub fn set_ambient_mode(&mut self, val: WearableAmbientMode) -> &mut Self

Source

pub fn get_compact_scale(&self) -> f32

Source

pub fn get_mut_compact_scale(&mut self) -> &mut f32

Source

pub fn set_compact_scale(&mut self, val: f32) -> &mut Self

Source

pub fn get_safe_area(&self) -> SafeAreaInsets

Source

pub fn get_mut_safe_area(&mut self) -> &mut SafeAreaInsets

Source

pub fn set_safe_area(&mut self, val: SafeAreaInsets) -> &mut Self

Source

pub fn get_crown_accumulator(&self) -> f32

Source

pub fn get_mut_crown_accumulator(&mut self) -> &mut f32

Source

pub fn set_crown_accumulator(&mut self, val: f32) -> &mut Self

Source

pub fn get_crown_scroll_step(&self) -> f32

Source

pub fn get_mut_crown_scroll_step(&mut self) -> &mut f32

Source

pub fn set_crown_scroll_step(&mut self, val: f32) -> &mut Self

Source

pub fn get_mut_primary_window(&mut self) -> &mut Option<WindowId>

Source

pub fn set_primary_window(&mut self, val: Option<WindowId>) -> &mut Self

Source

pub fn get_windows(&self) -> &HashMap<WindowId, WearableWindowRecord>

Source

pub fn get_mut_windows( &mut self, ) -> &mut HashMap<WindowId, WearableWindowRecord>

Source

pub fn set_windows( &mut self, val: HashMap<WindowId, WearableWindowRecord>, ) -> &mut Self

Source

pub fn get_touch_tracker(&self) -> &TouchPointerTracker

Source

pub fn get_mut_touch_tracker(&mut self) -> &mut TouchPointerTracker

Source

pub fn set_touch_tracker(&mut self, val: TouchPointerTracker) -> &mut Self

Source

pub fn get_pending_events(&self) -> &Vec<WindowEvent>

Source

pub fn get_mut_pending_events(&mut self) -> &mut Vec<WindowEvent>

Source

pub fn set_pending_events(&mut self, val: Vec<WindowEvent>) -> &mut Self

Source

pub fn get_storage(&self) -> &HashMap<String, String>

Source

pub fn get_mut_storage(&mut self) -> &mut HashMap<String, String>

Source

pub fn set_storage(&mut self, val: HashMap<String, String>) -> &mut Self

Source

pub fn get_route_stack(&self) -> &Vec<String>

Source

pub fn get_mut_route_stack(&mut self) -> &mut Vec<String>

Source

pub fn set_route_stack(&mut self, val: Vec<String>) -> &mut Self

Source

pub fn get_theme(&self) -> ThemeMode

Source

pub fn get_mut_theme(&mut self) -> &mut ThemeMode

Source

pub fn set_theme(&mut self, val: ThemeMode) -> &mut Self

Source

pub fn get_pump_paused(&self) -> bool

Source

pub fn get_mut_pump_paused(&mut self) -> &mut bool

Source

pub fn set_pump_paused(&mut self, val: bool) -> &mut Self

Source

pub fn get_haptic_detent_count(&self) -> u64

Source

pub fn get_mut_haptic_detent_count(&mut self) -> &mut u64

Source

pub fn set_haptic_detent_count(&mut self, val: u64) -> &mut Self

Source

pub fn get_capture_last_frame(&self) -> bool

Source

pub fn get_mut_capture_last_frame(&mut self) -> &mut bool

Source

pub fn set_capture_last_frame(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Clone for WearablePlatform

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 WearablePlatform

Source§

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

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

impl Default for WearablePlatform

Default WearablePlatform configured for WearableVendor::WearOs.

Source§

fn default() -> Self

Creates a default Wear OS circular smartwatch platform backend.

§Returns
  • Self - Default wearable platform backend.
Source§

impl PlatformBackend for WearablePlatform

PlatformBackend implementation for WearablePlatform.

Source§

fn kind(&self) -> PlatformKind

Returns PlatformKind::Wearable.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • PlatformKind - PlatformKind::Wearable.
Source§

fn capabilities(&self) -> PlatformCapabilities

Returns smartwatch capabilities refined by the active hardware profile.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • PlatformCapabilities - Wearable capability flags.
Source§

fn create_window( &mut self, config: &WindowConfig, ) -> Result<WindowState, PlatformError>

Creates a watch surface window with automatic round/squircle inscribed safe-area insets.

§Arguments
  • &Self - Mutable wearable platform.
  • &WindowConfig - Declarative window configuration.
§Returns
  • Result<WindowState, PlatformError> - Initialized watch window state.
Source§

fn window_state(&self, id: WindowId) -> Option<WindowState>

Queries live WindowState for id.

§Arguments
  • &Self - Wearable platform reference.
  • WindowId - Window identifier.
§Returns
  • Option<WindowState> - Window state if alive.
Source§

fn raw_window_handle(&self, id: WindowId) -> RawWindowHandle

Returns RawWindowHandle::WearableSurface tagged with the active WearableVendor.

§Arguments
  • &Self - Wearable platform reference.
  • WindowId - Window identifier.
§Returns
  • RawWindowHandle - Wearable surface handle.
Source§

fn poll_events(&mut self) -> Vec<WindowEvent>

Drains queued wearable input, rotary crown, gesture, and AOD lifecycle events.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Pending events.
Source§

fn set_frame_pump_paused(&mut self, paused: bool)

Updates frame pump pause state for AOD / screen-off freeze.

§Arguments
  • &Self - Mutable wearable platform.
  • bool - true to pause frame pumping.
Source§

fn is_frame_pump_paused(&self) -> bool

Returns whether the watch frame pump is paused.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • bool - Pause state.
Source§

fn present_framebuffer( &mut self, id: WindowId, framebuffer: &Framebuffer, ) -> Result<(), PlatformError>

Presents framebuffer to the active watch window record.

§Arguments
  • &Self - Mutable wearable platform.
  • WindowId - Target window handle.
  • &Framebuffer - Rendered RGBA8 framebuffer.
§Returns
  • Result<(), PlatformError> - Presentation status.
Source§

fn read_clipboard(&self) -> Option<String>

Returns None because smartwatches do not expose a system clipboard.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • Option<String> - Always None.
Source§

fn write_clipboard(&mut self, _text: &str) -> Result<(), PlatformError>

Rejects clipboard writes cleanly as Unsupported on smartwatches.

§Arguments
  • &Self - Mutable wearable platform.
  • &str - Ignored clipboard text.
§Returns
  • Result<(), PlatformError> - Err(PlatformError::Unsupported(_)).
Source§

fn system_theme(&self) -> ThemeMode

Returns the active wearable OLED theme mode.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • ThemeMode - Active watch theme mode.
Source§

fn display_refresh_rate_hz(&self) -> f32

Returns 1.0 Hz during AOD ambient mode or the watch profile’s interactive refresh rate otherwise.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • f32 - Active watch refresh rate in Hertz.
Source§

fn wait_for_events(&mut self) -> Vec<WindowEvent>

Blocks with zero CPU usage until at least one OS or lifecycle event arrives, then drains all pending events. Read more
Source§

fn present_framebuffer_region( &mut self, id: WindowId, framebuffer: &Framebuffer, _damage: DamageRegion, ) -> Result<(), PlatformError>

Presents a damaged sub-region of a CPU-rendered RGBA8 Framebuffer when supported by the backend. Read more
Source§

impl PlatformHostAdapter for WearablePlatform

PlatformHostAdapter implementation for WearablePlatform.

Source§

fn device_form_factor(&self) -> DeviceFormFactor

Returns DeviceFormFactor::Watch.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • DeviceFormFactor - DeviceFormFactor::Watch.
Source§

fn host_vendor_name(&self) -> &'static str

Returns the canonical vendor identifier string (e.g. "wearos", "watchos", "harmony-watch", "hyperos-vela").

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • &'static str - Vendor string identifier.
Source§

impl PlatformLifecycleBridge for WearablePlatform

PlatformLifecycleBridge implementation for WearablePlatform.

Source§

fn freeze_surface(&mut self) -> Vec<WindowEvent>

Freezes the watch surface into ScreenOff or AlwaysOnAmbient freeze state.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Normalized freeze events.
Source§

fn resume_surface(&mut self) -> Vec<WindowEvent>

Wakes and resumes the watch surface into full interactive mode.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Normalized resume events.
Source§

fn destroy_surface(&mut self) -> Vec<WindowEvent>

Cancels touches, pauses frame pumping, and emits Terminate.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Vec<WindowEvent> - Normalized destroy events.
Source§

impl PlatformNavigation for WearablePlatform

PlatformNavigation implementation for WearablePlatform.

Source§

fn navigate_to(&mut self, route: &str) -> Result<(), PlatformError>

Navigates to route on the wearable page stack.

§Arguments
  • &Self - Mutable wearable platform.
  • &str - Target route path.
§Returns
  • Result<(), PlatformError> - Navigation status.
Source§

fn navigate_back(&mut self, delta: u32) -> Result<(), PlatformError>

Pops delta entries from the wearable navigation stack, keeping the root watch screen.

§Arguments
  • &Self - Mutable wearable platform.
  • u32 - Pages to pop.
§Returns
  • Result<(), PlatformError> - Navigation status.
Source§

fn current_route(&self) -> &str

Returns the active wearable logical route path.

§Arguments
  • &Self - Wearable platform reference.
§Returns
  • &str - Active route string.
Source§

impl PlatformStorage for WearablePlatform

PlatformStorage implementation for WearablePlatform.

Source§

fn storage_get(&self, key: &str) -> Option<String>

Reads a key from wearable local sandbox storage.

§Arguments
  • &Self - Wearable platform reference.
  • &str - Storage key.
§Returns
  • Option<String> - Stored value, if present.
Source§

fn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>

Stores a key-value pair in wearable sandbox storage.

§Arguments
  • &Self - Mutable wearable platform.
  • &str - Storage key.
  • &str - UTF-8 value.
§Returns
  • Result<(), PlatformError> - Persistence status.
Source§

fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>

Removes key from wearable sandbox storage.

§Arguments
  • &Self - Mutable wearable platform.
  • &str - Storage key.
§Returns
  • Result<(), PlatformError> - Removal status.
Source§

fn storage_clear(&mut self) -> Result<(), PlatformError>

Clears all keys from wearable sandbox storage.

§Arguments
  • &Self - Mutable wearable platform.
§Returns
  • Result<(), PlatformError> - Clear status.
Source§

impl WindowController for WearablePlatform

WindowController implementation for WearablePlatform.

Source§

fn apply_command(&mut self, command: WindowCommand) -> Result<(), PlatformError>

Applies a WindowCommand against the smartwatch window record.

§Arguments
  • &Self - Mutable wearable platform.
  • WindowCommand - Command to execute.
§Returns
  • Result<(), PlatformError> - Execution status.

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, 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> 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.