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
impl CueSdkClient
Sourcepub fn get_protocol_details(&self) -> &ProtocolDetails
pub fn get_protocol_details(&self) -> &ProtocolDetails
Get an immutable reference to the protocol details for the current iCUE SDK handshake.
Sourcepub fn get_layer_priority(&self) -> LayerPriority
pub fn get_layer_priority(&self) -> LayerPriority
Get the current layer priority.
Sourcepub fn get_device_count(&self) -> Result<DeviceCount, Option<CueSdkError>>
pub fn get_device_count(&self) -> Result<DeviceCount, Option<CueSdkError>>
Get the current number of connected “iCue” devices.
Sourcepub fn get_device_at(
&self,
index: u32,
) -> Result<CueDevice, GetDeviceAtIndexError>
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
.
Sourcepub fn get_all_devices(&self) -> Result<Vec<CueDevice>, GetAllDevicesError>
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 .
Sourcepub fn request_exclusive_access_control(
&self,
) -> Result<(), RequestExclusiveAccessError>
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.
Sourcepub fn release_exclusive_access_control(
&self,
) -> Result<(), ReleaseExclusiveAccessError>
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.
Sourcepub fn set_layer_priority(&self, priority: LayerPriority) -> CueSdkErrorResult
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”.
Sourcepub fn update_leds_color_buffer(
&self,
leds: &mut [(&LedColor, &mut CueLed)],
) -> Result<(), UpdateLedsColorBufferError>
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.
Sourcepub fn flush_led_colors_update_buffer<F>(&self, closure: F) -> CueSdkErrorResultwhere
F: FnMut(CueSdkErrorResult),
pub fn flush_led_colors_update_buffer<F>(&self, closure: F) -> CueSdkErrorResultwhere
F: FnMut(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
CueLed
s.
This can take “some” time, and so there is a synchronous and asynchronous option.
Sourcepub fn flush_led_colors_update_buffer_sync(&self) -> CueSdkErrorResult
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
CueLed
s.
This can take “some” time, and so there is a synchronous and asynchronous option.
Sourcepub fn subscribe_for_events<F>(
&self,
closure: F,
) -> Result<(), SubscribeForEventsError>
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.
Sourcepub fn unsubscribe_from_events(&self) -> Result<(), UnsubscribeFromEventsError>
pub fn unsubscribe_from_events(&self) -> Result<(), UnsubscribeFromEventsError>
Unsubscribe from all events.
Sourcepub fn get_led_for_key_name(
key_name: c_char,
) -> Result<LedId, Option<CueSdkError>>
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
.