pub struct LightingWrite {
pub method: LightingMethod,
pub color: Rgb,
}Expand description
One complete solid-colour transaction, including RGB ownership rollback.
Fields§
§method: LightingMethodPreferred protocol path.
color: RgbThe colour after applying the configured brightness.
Implementations§
Source§impl LightingWrite
impl LightingWrite
Sourcepub async fn apply(
self,
backend: &dyn HidBackend,
route: &DeviceRoute,
cancelled: impl Fn() -> bool,
available: impl Fn() -> bool,
) -> Result<Option<RgbControlLease>, WriteError>
pub async fn apply( self, backend: &dyn HidBackend, route: &DeviceRoute, cancelled: impl Fn() -> bool, available: impl Fn() -> bool, ) -> Result<Option<RgbControlLease>, WriteError>
Open a standalone route and apply with the same ownership contract as
Self::apply_on. The native worker owns this channel through cleanup.
Sourcepub async fn apply_on(
self,
shared: &SharedChannel,
cancelled: impl Fn() -> bool,
available: impl Fn() -> bool,
) -> Result<Option<RgbControlLease>, WriteError>
pub async fn apply_on( self, shared: &SharedChannel, cancelled: impl Fn() -> bool, available: impl Fn() -> bool, ) -> Result<Option<RgbControlLease>, WriteError>
Apply on the supplied channel, observing caller cancellation and channel
availability between requests. available must reject retired agent
publications and suspended host I/O, including during compensation.
The owner MUST poll to completion and serialize lighting transactions on
this route. Do not wrap this future in timeout or abort its task. Reads
have a five-second overall deadline; a started RGB native write drains
before cancellation/deadline errors trigger rollback. Its response and
the rollback response each have the channel’s own bounded wait. A native
write that never completes cannot safely release ownership on a timer.
Returns the 0x8071 software control the write left held, if any. A
long-lived host keeps the first lease per device and hands it back with
release_rgb_control when it leaves; a standalone command leaves the
colour in place.