Skip to content

Commit

Permalink
feat(Screen/trait): Add initial Screen trait
Browse files Browse the repository at this point in the history
  • Loading branch information
shymega committed Aug 4, 2023
1 parent f860a70 commit be705e4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/platforms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "0.1.0"
edition = "2018"

[dependencies]
uuid = { version = "1.4.1", features = ["serde", "v4", "fast-rng"] }

[target.'cfg(all(target_family = "unix",not(any(target_os = "ios", target_os = "macos", target_os = "android"))))'.dependencies]
breadx = "3.1.0"
Expand Down
30 changes: 30 additions & 0 deletions src/lib/platforms/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,33 @@
// SPDX-License-Identifier: GPL-2.0-only

//! Stub module (TODO) for the `common` types.

/// `ScreenTrait` acts as a common specification of operations that can be executed on (TODO) a
/// `Screen` struct.
pub trait ScreenTrait {
/// This function connects to the `Screen`.
fn connect(&mut self) -> std::io::Result<()>;
/// This function 'disables' a `Screen`.
/// Basically, this means the screen remains connected, but can't be interacted with.
fn disable(&mut self) -> std::io::Result<()>;
/// This function disconnects from a `Screen`.
fn disconnect(&mut self) -> std::io::Result<()>;
/// This function 'enables' a `Screen`.
/// Basically, this means the screen remains connected, and can be interacted with.
fn enable(&mut self) -> std::io::Result<()>;
/// This function force-disconnects from a `Screen`.
fn force_disconnect(&mut self) -> std::io::Result<()>;
/// This function returns the `human name` assigned to the `Screen`.
fn get_human_name(&self) -> &str;
/// This function returns the `Uuid` of the `Screen`.
fn get_uuid(&self) -> &uuid::Uuid;
/// This function returns the Zeroconf name advertised of the `Screen`.
fn get_zeroconf_name(&self) -> &str;
/// This function returns a `bool` value, representing if a `Screen` is connected to the
/// `Primary`.
fn is_connected(&self) -> bool;
/// This function returns a `bool` value, representing if a `Screen` is enabled.
fn is_enabled(&self) -> bool;
/// This function returns a `bool` value, representing if a `Screen` has control of the mouse/keyboard
fn is_focused(&self) -> bool;
}

0 comments on commit be705e4

Please sign in to comment.