pub struct ProtocolV32;Trait Implementations§
Source§impl TuyaProtocol for ProtocolV32
impl TuyaProtocol for ProtocolV32
fn version(&self) -> Version
fn get_effective_command(&self, command: CommandType) -> u32
fn generate_payload( &self, device_id: &str, command: CommandType, data: Option<Value>, cid: Option<&str>, t: u64, ) -> Result<(u32, Value)>
fn pack_payload( &self, payload: &[u8], cmd: u32, cipher: &TuyaCipher, ) -> Result<Vec<u8>>
fn decrypt_payload( &self, payload: Vec<u8>, cipher: &TuyaCipher, ) -> Result<Vec<u8>>
fn has_version_header(&self, payload: &[u8]) -> bool
Source§fn requires_session_key(&self) -> bool
fn requires_session_key(&self) -> bool
Returns whether this protocol version requires session key negotiation.
Source§fn encrypt_session_key(
&self,
session_key: &[u8],
cipher: &TuyaCipher,
_nonce: &[u8],
) -> Result<Vec<u8>>
fn encrypt_session_key( &self, session_key: &[u8], cipher: &TuyaCipher, _nonce: &[u8], ) -> Result<Vec<u8>>
Encrypts the session key according to protocol version requirements.
Source§fn get_prefix(&self) -> u32
fn get_prefix(&self) -> u32
Returns the message prefix (e.g., 0x55AA or 0x6699) for this protocol version.
Source§fn get_hmac_key<'a>(&self, _cipher_key: &'a [u8]) -> Option<&'a [u8]>
fn get_hmac_key<'a>(&self, _cipher_key: &'a [u8]) -> Option<&'a [u8]>
Returns the HMAC key to use for message packing/unpacking, if applicable.
Source§fn is_empty_payload_allowed(&self, _cmd: u32) -> bool
fn is_empty_payload_allowed(&self, _cmd: u32) -> bool
Returns whether an empty payload is allowed for the given command.
Source§fn should_check_dev22_fallback(&self) -> bool
fn should_check_dev22_fallback(&self) -> bool
Returns whether the protocol should attempt dev22 fallback on error.
Source§fn prepare_session_key_negotiation(&self) -> Vec<u8> ⓘ
fn prepare_session_key_negotiation(&self) -> Vec<u8> ⓘ
Step 1: Prepare local nonce for session key negotiation.
Auto Trait Implementations§
impl Freeze for ProtocolV32
impl RefUnwindSafe for ProtocolV32
impl Send for ProtocolV32
impl Sync for ProtocolV32
impl Unpin for ProtocolV32
impl UnwindSafe for ProtocolV32
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