Struct logitech_led_sdk::Sdk

source ·
pub struct Sdk(/* private fields */);
Expand description

Entry to Api.

This serves as proof of initalization and prevents the API from being used by other threads.

Implementations§

source§

impl Sdk

source

pub fn new() -> Option<Self>

Create a new sdk instance with no name.

Returns

Returns None if the sdk could not be initialized.

source

pub fn new_with_name(name: &str) -> Option<Self>

Create a new sdk instance with a name, where the name is the name of the application using the sdk.

Panics

Panics if the name contains interior NULs.

Returns

Returns None if the sdk could not be initialized.

source

pub fn get_version(&self) -> Option<(u32, u32, u32)>

Returns the sdk version.

Returns

Returns a tuple of the major, minor and build numbers if successful. Returns None if the version could not be found.

source

pub fn set_target(&self, target_device: TargetDevice) -> bool

Selects the target devices.

Returns

Returns true if the target devices were selected.

source

pub fn set_lighting(&self, color: ColorPercent) -> bool

Sets the lighting.

Returns

Returns true if successful.

source

pub fn set_lighting_for_key_with_name( &self, key: KeyName, color: ColorPercent ) -> bool

Set the lighting for a keyboard key by key name.

Returns

Returns true if successful.

source

pub fn set_lighting_for_key_with_scan_code( &self, scan_code: u32, color: ColorPercent ) -> bool

Sets the lighting for a keyboard key by scan code.

Returns

Returns true if successful.

source

pub fn set_lighting_for_key_with_hid_code( &self, hid_code: u32, color: ColorPercent ) -> bool

Sets the lighting for a keyboard key by HID code.

Returns

Returns true if successful.

source

pub fn set_lighting_for_target_zone( &self, device: DeviceType, zone: u32, color: ColorPercent ) -> bool

Sets the lighting for a specific device’s target zone.

A zone number is generally different per device, read the offical SDK docs for more info.

Returns

Returns true if successful.

source

pub fn flash_lighting( &self, color: ColorPercent, duration: Option<Duration>, interval: Duration ) -> bool

Save the current lighting, play the effect, and restore the lighting.

duration controls how long the flashes occur overall. If omitted, it will run until manually stopped. The interval is the time between flashes.

Returns

Returns false if the call fails or any of the time values are too large.

source

pub fn flash_single_key( &self, key: KeyName, color: ColorPercent, duration: Option<Duration>, interval: Duration ) -> bool

Start a flashing effect on the given key.

duration controls how long the flashes occur overall. If omitted, it will run until manually stopped. The interval is the time between flashes.

Returns

Returns false if the call fails or any of the time values are too large.

source

pub fn stop_effects(&self) -> bool

Stops all current LED effects.

Returns

Returns false if the call fails.

source

pub fn stop_effects_on_key(&self, key: KeyName) -> bool

Stops all LED effects on one key.

Returns

Returns false if the call fails.

source

pub fn pulse_lighting( &self, color: ColorPercent, duration: Option<Duration>, interval: Duration ) -> bool

Save the current lighting, pulse the lighting, then restore the lighting.

duration controls how long the pulses occur overall. If omitted, it will run until manually stopped. The interval is the time between pulses.

Returns

Returns false if the call fails or any of the time values are too large.

source

pub fn pulse_single_key( &self, key: KeyName, start_color: ColorPercent, end_color: ColorPercent, duration: Duration, is_infinite: bool ) -> bool

Start a pulsing effect on the given key.

duration controls how long the pulses occur overall.

Returns

Returns false if the call fails or any of the time values are too large.

source

pub fn save_lighting_for_key(&self, key: KeyName) -> bool

Saves the current lighting config for the given key.

Returns

Returns false if the call fails.

source

pub fn restore_lighting_for_key(&self, key: KeyName) -> bool

Restores the current lighting config for the given key.

Returns

Returns false if the call fails.

Trait Implementations§

source§

impl Drop for Sdk

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Sdk

§

impl !Send for Sdk

§

impl Sync for Sdk

§

impl Unpin for Sdk

§

impl UnwindSafe for Sdk

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
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.
source§

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

Performs the conversion.