pub struct Gen2Device { /* private fields */ }Implementations§
Source§impl Gen2Device
impl Gen2Device
pub fn new(info: DeviceInfo, client: Client, password: Option<String>) -> Self
Sourcepub fn new_with_host(
info: DeviceInfo,
base_host: String,
client: Client,
password: Option<String>,
) -> Self
pub fn new_with_host( info: DeviceInfo, base_host: String, client: Client, password: Option<String>, ) -> Self
Build a Gen2Device addressed by an explicit host[:port] string
rather than info.ip, so a device that isn’t reachable on the
default port (or that must be reached by a test harness on an
ephemeral loopback port) can still be targeted.
pub fn info(&self) -> &DeviceInfo
Sourcepub async fn rpc_raw(
&self,
method: &str,
params: Option<Value>,
) -> Result<Value>
pub async fn rpc_raw( &self, method: &str, params: Option<Value>, ) -> Result<Value>
Raw JSON-RPC passthrough: call method with params verbatim and
return the device’s raw JSON response. Used by the console command
path, where the caller (not this crate) has already classified the
method’s hazard; a device-side error object still becomes
Error::Rejected via rpc_call.
pub async fn status(&self) -> Result<DeviceStatus>
pub async fn switch_status(&self, id: u8) -> Result<SwitchStatus>
pub async fn switch_set(&self, id: u8, on: bool) -> Result<SwitchResult>
pub async fn switch_toggle(&self, id: u8) -> Result<SwitchResult>
pub async fn light_components(&self) -> Result<Vec<LightComponent>>
pub async fn light_set( &self, kind: LightKind, id: u8, params: &LightParams, ) -> Result<SwitchResult>
pub async fn light_toggle( &self, kind: LightKind, id: u8, ) -> Result<SwitchResult>
pub async fn light_status(&self, kind: LightKind, id: u8) -> Result<LightStatus>
pub async fn power(&self, id: u8) -> Result<PowerReading>
pub async fn firmware_check(&self) -> Result<FirmwareInfo>
pub async fn config_get(&self) -> Result<Value>
pub async fn reboot(&self) -> Result<()>
pub async fn firmware_update(&self) -> Result<()>
pub async fn config_set(&self, key: &str, value: &str) -> Result<Value>
pub async fn schedule_list(&self) -> Result<Value>
pub async fn webhook_list(&self) -> Result<Value>
pub async fn config_restore(&self, config: &Value) -> Result<()>
pub async fn set_name(&self, name: &str) -> Result<()>
Auto Trait Implementations§
impl !RefUnwindSafe for Gen2Device
impl !UnwindSafe for Gen2Device
impl Freeze for Gen2Device
impl Send for Gen2Device
impl Sync for Gen2Device
impl Unpin for Gen2Device
impl UnsafeUnpin for Gen2Device
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more