CueSdkClient

Struct CueSdkClient 

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

The primary struct for interacting with top level iCUE SDK functionality.

The struct has some internal book-keeping around exclusive access, and event subscriptions, and will clean those up when it is dropped.

It also houses the ProtocolDetails for the current session, and the current LayerPriority.

Implementations§

Source§

impl CueSdkClient

Source

pub fn get_protocol_details(&self) -> &ProtocolDetails

Get an immutable reference to the protocol details for the current iCUE SDK handshake.

Source

pub fn get_layer_priority(&self) -> LayerPriority

Get the current layer priority.

Source

pub fn get_device_count(&self) -> Result<DeviceCount, Option<CueSdkError>>

Get the current number of connected “iCue” devices.

Source

pub fn get_device_at( &self, index: u32, ) -> Result<CueDevice, GetDeviceAtIndexError>

Get the device located at the specified index.

The index should be at max, one less than the number of devices (devices are zero indexed matching the index you get back from getAllDevices.

Source

pub fn get_all_devices(&self) -> Result<Vec<CueDevice>, GetAllDevicesError>

Get all devices currently connected, with their full details including leds.

If some device pointers come back invalid, this method will fail entirely, returning errors for each device pointer that didn’t match some expected invariant .

Source

pub fn request_exclusive_access_control( &self, ) -> Result<(), RequestExclusiveAccessError>

Request exclusive access control of the SDK.

This means other clients can’t “do” anything, but can read data.

If you do have exclusive access, it can be released manually with the release_exclusive_access_control method or it will happen automatically when the CueSdkClient is dropped.

The “default” mode is non-exclusive.

Source

pub fn release_exclusive_access_control( &self, ) -> Result<(), ReleaseExclusiveAccessError>

Release exclusive access control to the SDK.

This means other clients can conflict with the messages you are sending to the connected devices.

Non-exclusive access is the “default” mode.

Source

pub fn set_layer_priority(&self, priority: LayerPriority) -> CueSdkErrorResult

Set the layer priority for the client, (higher value is a higher priority).

By default, all clients start with 128.

The “priority” mechanism here is not about speed or queuing, but is about when two commands “conflict” which one “wins”.

Source

pub fn update_leds_color_buffer( &self, leds: &mut [(&LedColor, &mut CueLed)], ) -> Result<(), UpdateLedsColorBufferError>

Update the native iCUE SDK color buffer, to then eventually write to the connected devices.

The iCUE SDK has it’s own internal data structures for updating LED colors. Instead of writing directly to devices, it batches calls, and does other internal items.

For this reason, you always need to write to a buffer (here, or on a CueLed struct itself) and then flush the buffer when you want those commands to take effect.

Source

pub fn flush_led_colors_update_buffer<F>(&self, closure: F) -> CueSdkErrorResult

Queues a flush of the iCUE SDK buffer, calling the passed in closure when the flush completes (successfully or not).

After updating the color buffer, flushing it will send the led update commands to the specified CueLeds.

This can take “some” time, and so there is a synchronous and asynchronous option.

Source

pub fn flush_led_colors_update_buffer_sync(&self) -> CueSdkErrorResult

Flushes the iCUE SDK buffer synchronously, blocking the current thread, and then returning the flush result.

After updating the color buffer, flushing it will send the led update commands to the specified CueLeds.

This can take “some” time, and so there is a synchronous and asynchronous option.

Source

pub fn subscribe_for_events<F>( &self, closure: F, ) -> Result<(), SubscribeForEventsError>

Subscribe for various events emitted from the iCUE SDK, with the passed in closure.

You can unsubscribe manually by calling unsubscribe_from_events or the CueSdkClient will unsubscribe automatically if it is subscribed at the time it is dropped.

Source

pub fn unsubscribe_from_events(&self) -> Result<(), UnsubscribeFromEventsError>

Unsubscribe from all events.

Source

pub fn get_led_for_key_name( key_name: c_char, ) -> Result<LedId, Option<CueSdkError>>

Returns the LedID for the provided key name, as a c_char.

Trait Implementations§

Source§

impl Debug for CueSdkClient

Source§

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

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

impl Drop for CueSdkClient

When the CueSdkClient is dropped, we check for existing event subscriptions, or exclusive access rights and release/unsubscribe if needed.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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