Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assembler ¶
type Assembler struct {
// contains filtered or unexported fields
}
func NewAssemmbler ¶
type CommandType ¶
type CommandType uint16
CommandType represents a command in the Tuya BLE protocol
const ( FUN_SENDER_DEVICE_INFO CommandType = 0x0000 FUN_SENDER_PAIR CommandType = 0x0001 FUN_SENDER_DPS CommandType = 0x0002 FUN_SENDER_DEVICE_STATUS CommandType = 0x0003 FUN_RECEIVE_DP CommandType = 0x8001 FUN_RECEIVE_TIME1_REQ CommandType = 0x8011 FUN_RECEIVE_TIME2_REQ CommandType = 0x8012 )
type Packet ¶
type Packet struct { SeqNum uint32 ResponseTo uint32 CommandType CommandType Payload []byte SecurityFlag SecurityFlag IV []byte Data []byte // Encrypted data }
Packet represents a Tuya BLE packet
func DecryptAndParsePacket ¶
DecryptAndParsePacket decrypts and parses a packet from the given data
func NewPacket ¶
func NewPacket(seqNum, responseTo uint32, commandType CommandType, payload []byte, securityFlag SecurityFlag) *Packet
NewPacket creates a new Packet instance
type SecurityFlag ¶
type SecurityFlag byte
SecurityFlag represents a security flag in the Tuya BLE protocol
const ( SecurityFlagAuth SecurityFlag = 0x01 SecurityFlagLogin SecurityFlag = 0x04 SecurityFlagSession SecurityFlag = 0x05 )
Click to show internal directories.
Click to hide internal directories.