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>
impl<T: Transport> Iqos<T>
Sourcepub const fn new(transport: T) -> Self
pub const fn new(transport: T) -> Self
Create a new IQOS library facade around a transport implementation.
Sourcepub fn transport_mut(&mut self) -> &mut T
pub fn transport_mut(&mut self) -> &mut T
Mutably borrow the underlying transport.
Sourcepub async fn read_brightness(&self) -> Result<BrightnessLevel>
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.
Sourcepub async fn set_brightness(&self, level: BrightnessLevel) -> Result<()>
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.
Sourcepub async fn read_flexpuff(&self, model: DeviceModel) -> Result<FlexPuffSetting>
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.
Sourcepub async fn set_flexpuff(
&self,
model: DeviceModel,
setting: FlexPuffSetting,
) -> Result<()>
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.
Sourcepub async fn set_smartgesture(
&self,
model: DeviceModel,
enabled: bool,
) -> Result<()>
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.
Sourcepub async fn lock(&self, model: DeviceModel) -> Result<()>
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.
Sourcepub async fn unlock(&self, model: DeviceModel) -> Result<()>
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.
Sourcepub async fn set_autostart(
&self,
model: DeviceModel,
enabled: bool,
) -> Result<()>
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.
Sourcepub async fn read_autostart(&self, model: DeviceModel) -> Result<bool>
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.
Sourcepub async fn read_flexbattery(
&self,
model: DeviceModel,
) -> Result<FlexBatterySettings>
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.
Sourcepub async fn set_flexbattery(
&self,
model: DeviceModel,
settings: FlexBatterySettings,
) -> Result<()>
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.
Sourcepub async fn read_diagnosis(&self) -> Result<DiagnosticData>
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.
Sourcepub async fn read_firmware_version(
&self,
kind: FirmwareKind,
) -> Result<FirmwareVersion>
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.
Sourcepub async fn read_product_number(
&self,
kind: ProductNumberKind,
) -> Result<String>
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.
Sourcepub async fn read_vibration_settings(
&self,
model: DeviceModel,
) -> Result<VibrationSettings>
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.
Sourcepub async fn update_vibration_settings(
&self,
model: DeviceModel,
settings: VibrationSettings,
) -> Result<()>
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.
Sourcepub async fn read_battery_voltage(&self) -> Result<f32>
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.
Sourcepub async fn read_device_status(
&self,
model: DeviceModel,
device_info: DeviceInfo,
) -> Result<DeviceStatus>
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.
Sourcepub async fn vibrate_start(&self) -> Result<()>
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.
Sourcepub async fn vibrate_stop(&self) -> Result<()>
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.
Sourcepub async fn find_my_iqos_start(&self) -> Result<()>
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.
Sourcepub async fn find_my_iqos_stop(&self) -> Result<()>
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.