pub struct TuyaDevice { /* private fields */ }Implementations§
Source§impl TuyaDevice
impl TuyaDevice
pub fn new( ver: &str, device_id: &str, key: Option<&str>, addr: IpAddr, ) -> Result<TuyaDevice>
pub async fn connect(&mut self) -> Result<Receiver<Result<Vec<Message>>>>
pub async fn set(&mut self, tuya_payload: Payload) -> Result<()>
pub async fn set_values(&mut self, dps: Value) -> Result<()>
pub async fn get(&mut self, tuya_payload: Payload) -> Result<()>
pub async fn refresh(&mut self, tuya_payload: Payload) -> Result<()>
pub async fn send_msg(&mut self, msg: Message) -> Result<()>
Sourcepub async fn heartbeat(&mut self) -> Result<()>
pub async fn heartbeat(&mut self) -> Result<()>
Send a heartbeat to keep the connection alive. This is especially important for v3.4 devices which may close connections that appear idle.
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Gracefully disconnect from the device. This shuts down the TCP write half, signaling to the device that we’re closing the connection.
Auto Trait Implementations§
impl Freeze for TuyaDevice
impl RefUnwindSafe for TuyaDevice
impl Send for TuyaDevice
impl Sync for TuyaDevice
impl Unpin for TuyaDevice
impl UnwindSafe for TuyaDevice
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