Skip to main content

Iqos

Struct Iqos 

Source
pub struct Iqos<T: Transport> { /* private fields */ }
Expand description

Library facade placeholder for future extracted IQOS session/device API.

The concrete device/session shape will be introduced incrementally as logic is extracted from iqos_cli into transport-agnostic and backend-specific layers.

Implementations§

Source§

impl<T: Transport> Iqos<T>

Source

pub const fn new(transport: T) -> Self

Create a new IQOS library facade around a transport implementation.

Source

pub const fn transport(&self) -> &T

Borrow the underlying transport.

Source

pub fn transport_mut(&mut self) -> &mut T

Mutably borrow the underlying transport.

Source

pub async fn read_brightness(&self) -> Result<BrightnessLevel>

Read the current device brightness setting.

§Errors

Returns an error if the transport request fails or the response frame cannot be decoded as a brightness response.

Source

pub async fn set_brightness(&self, level: BrightnessLevel) -> Result<()>

Update the device brightness setting.

Sends the three-command write sequence for the requested level.

§Errors

Returns an error if any transport send fails.

Source

pub async fn read_flexpuff(&self, model: DeviceModel) -> Result<FlexPuffSetting>

Read the current FlexPuff setting.

FlexPuff is supported on ILUMA i and ILUMA i PRIME.

§Errors

Returns an error if the model does not support FlexPuff, the transport request fails, or the response frame cannot be decoded as a FlexPuff response.

Source

pub async fn set_flexpuff( &self, model: DeviceModel, setting: FlexPuffSetting, ) -> Result<()>

Update the FlexPuff setting.

§Errors

Returns an error if the model does not support FlexPuff, or if the transport send fails.

Source

pub async fn set_smartgesture( &self, model: DeviceModel, enabled: bool, ) -> Result<()>

Enable or disable Smart Gesture for the provided model.

Smart Gesture is supported on original ILUMA holder models and the ILUMA i series.

§Errors

Returns an error if the model does not support Smart Gesture, or if the transport send fails.

Source

pub async fn lock(&self, model: DeviceModel) -> Result<()>

Lock the device.

Sends the two-command lock sequence followed by a confirmation.

§Errors

Returns an error if the model does not support device lock, or if any transport send fails.

Source

pub async fn unlock(&self, model: DeviceModel) -> Result<()>

Unlock the device.

Sends the two-command unlock sequence followed by a confirmation.

§Errors

Returns an error if the model does not support device lock, or if any transport send fails.

Source

pub async fn set_autostart( &self, model: DeviceModel, enabled: bool, ) -> Result<()>

Enable or disable Auto Start for the provided model.

Auto Start is only supported on the ILUMA i series.

§Errors

Returns an error if the model does not support Auto Start, or if the transport send fails.

Source

pub async fn read_autostart(&self, model: DeviceModel) -> Result<bool>

Read the current Auto Start setting for the provided model.

Auto Start is only supported on the ILUMA i series.

§Errors

Returns an error if the model does not support Auto Start, a transport request fails, or the response frame cannot be decoded.

Source

pub async fn read_flexbattery( &self, model: DeviceModel, ) -> Result<FlexBatterySettings>

Read the current FlexBattery settings including mode and Pause Mode state.

FlexBattery is supported on IQOS ILUMA i holder-based models.

§Errors

Returns an error if the model does not support FlexBattery, a transport request fails, or a response frame cannot be decoded.

Source

pub async fn set_flexbattery( &self, model: DeviceModel, settings: FlexBatterySettings, ) -> Result<()>

Update the FlexBattery settings.

Always sends the mode write sequence. When settings.pause_mode() is Some, also sends the Pause Mode write sequence.

§Errors

Returns an error if the model does not support FlexBattery, or if any transport send fails.

Source

pub async fn read_diagnosis(&self) -> Result<DiagnosticData>

Read diagnostic telemetry from the device.

Sends all diagnosis commands in sequence and accumulates the parsed responses into a DiagnosticData value.

§Errors

Returns an error if any transport request fails, or if a response frame that matches a known header cannot be decoded.

Source

pub async fn read_firmware_version( &self, kind: FirmwareKind, ) -> Result<FirmwareVersion>

Read the firmware version for the selected IQOS component.

§Errors

Returns an error if the transport request fails or the response frame cannot be decoded as a firmware response for the requested kind.

Source

pub async fn read_product_number( &self, kind: ProductNumberKind, ) -> Result<String>

Read the product number for the selected IQOS component.

§Errors

Returns an error if the transport request fails or the response frame cannot be decoded as a product-number response for the requested kind.

Source

pub async fn read_vibration_settings( &self, model: DeviceModel, ) -> Result<VibrationSettings>

Read the current vibration settings for the provided model.

Holder-based models require an additional request to retrieve the charge-start vibration flag. One-piece models only use the main vibration settings frame.

§Errors

Returns an error if vibration is unsupported for the model, a transport operation fails, or a response frame cannot be decoded.

Source

pub async fn update_vibration_settings( &self, model: DeviceModel, settings: VibrationSettings, ) -> Result<()>

Update vibration settings for the provided model.

§Errors

Returns an error if the model does not support the requested vibration fields or a transport write fails.

Source

pub async fn read_battery_voltage(&self) -> Result<f32>

Read the current battery voltage via the SCP diagnostic command.

Returns the raw cell voltage in volts (e.g. 4.2). This uses the request/response path and is suitable for on-demand refreshes after the BLE session is established.

For the initial connection snapshot (battery percentage via GATT direct read), use IqosBle::read_battery_level.

§Errors

Returns an error if the transport request fails, the response cannot be decoded, or the battery voltage field is absent from the frame.

Source

pub async fn read_device_status( &self, model: DeviceModel, device_info: DeviceInfo, ) -> Result<DeviceStatus>

Read a device status snapshot combining GATT metadata and SCP firmware reads.

The caller supplies model and device_info — both already available on the BLE session after connect_and_discover. This method then performs the SCP reads (stick firmware, holder firmware for holder-capable models, battery voltage).

Firmware reads are fatal — they propagate errors. Battery voltage transport failures yield None; protocol decode errors still propagate.

§Errors

Returns an error if either firmware request fails or the response cannot be decoded.

Source

pub async fn vibrate_start(&self) -> Result<()>

Trigger an immediate vibration burst on the device.

Used by find_my_iqos_start. Can also be called directly when raw vibration control is needed. Stop the burst with vibrate_stop.

§Errors

Returns an error if the transport send fails.

Source

pub async fn vibrate_stop(&self) -> Result<()>

Stop an ongoing vibration burst on the device.

Counterpart to vibrate_start and find_my_iqos_start.

§Errors

Returns an error if the transport send fails.

Source

pub async fn find_my_iqos_start(&self) -> Result<()>

Start a Find My IQOS session — begin vibrating the device so it can be physically located.

The device continues to vibrate until find_my_iqos_stop is called. Delegates to vibrate_start.

§Errors

Returns an error if the transport send fails.

Source

pub async fn find_my_iqos_stop(&self) -> Result<()>

Stop a Find My IQOS session — halt the vibration burst.

Call after find_my_iqos_start once the device has been located. Delegates to vibrate_stop.

§Errors

Returns an error if the transport send fails.

Trait Implementations§

Source§

impl<T: Debug + Transport> Debug for Iqos<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Iqos<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Iqos<T>
where T: RefUnwindSafe,

§

impl<T> Send for Iqos<T>

§

impl<T> Sync for Iqos<T>

§

impl<T> Unpin for Iqos<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Iqos<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Iqos<T>
where T: UnwindSafe,

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.