Documentation ¶
Overview ¶
To be updated if new logical devices are created
Index ¶
- Constants
- type Appliance
- func (d *Appliance) GetDevice() Device
- func (d *Appliance) MakeBaseMsg() map[string]interface{}
- func (d *Appliance) ProcessResponse(code int, b []byte)
- func (d *Appliance) SendCommand(cmd int, jdata interface{}) error
- func (d *Appliance) SendEncryptedCommand(cmd int, jdata interface{}) error
- func (d *Appliance) StatusMsg() []byte
- func (d *Appliance) String() string
- type BaseDevice
- type ConfigurationData
- type Device
- type DeviceManager
- func (dm *DeviceManager) ApplianceCount() int
- func (dm *DeviceManager) ApplianceKeys() []string
- func (dm *DeviceManager) DefineDevice(Name, GwId, Key, Ip, Version string, device Device)
- func (dm *DeviceManager) DeviceKeys() []string
- func (dm *DeviceManager) DisableLogging()
- func (dm *DeviceManager) GetAppliance(key string) (*Appliance, bool)
- func (dm *DeviceManager) GetDevice(key string) (Device, bool)
- type SyncChannel
- type SyncMsg
Constants ¶
View Source
const ( CodeMsgSet = 7 CodeMsgStatus = 10 CodeMsgPing = 9 CodeMsgAutoStatus = 8 )
Code for tuya messages
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Appliance ¶
type Appliance struct { Version string // contains filtered or unexported fields }
the appliance proxies the hardware device
func (*Appliance) MakeBaseMsg ¶
create base messages
func (*Appliance) ProcessResponse ¶
func (*Appliance) SendCommand ¶
Send message unencrypted
func (*Appliance) SendEncryptedCommand ¶
-------------------------------
type BaseDevice ¶
to be embedded in Device
func (*BaseDevice) Init ¶
func (b *BaseDevice) Init(typ string, a *Appliance, c *ConfigurationData)
BaseDevice initialization to be invoked during configation
func (*BaseDevice) Name ¶
func (b *BaseDevice) Name() string
func (*BaseDevice) Notify ¶
func (b *BaseDevice) Notify(code int, d Device)
func (*BaseDevice) Subscribe ¶
func (b *BaseDevice) Subscribe(c SyncChannel) int64
func (*BaseDevice) Type ¶
func (b *BaseDevice) Type() string
Implementation of Device interface provided by BaseDevice
func (*BaseDevice) Unsubscribe ¶
func (b *BaseDevice) Unsubscribe(key int64)
type ConfigurationData ¶
type ConfigurationData struct { Name string GwId string Type string Key string Ip string //optional Version string //optional, default to 3.1, may be updated by UDP listener }
configuration data
type Device ¶
type Device interface { Type() string Name() string Subscribe(SyncChannel) int64 Unsubscribe(int64) Configure(*Appliance, *ConfigurationData) ProcessResponse(int, []byte) Init(string, *Appliance, *ConfigurationData) }
type DeviceManager ¶
func NewDeviceManager ¶
func NewDeviceManager(jdata string) *DeviceManager
func NewDeviceManagerRaw ¶
func NewDeviceManagerRaw() *DeviceManager
func (*DeviceManager) ApplianceCount ¶
func (dm *DeviceManager) ApplianceCount() int
-------------------------------------------
func (*DeviceManager) ApplianceKeys ¶
func (dm *DeviceManager) ApplianceKeys() []string
-------------------------------------------
func (*DeviceManager) DefineDevice ¶
func (dm *DeviceManager) DefineDevice(Name, GwId, Key, Ip, Version string, device Device)
-------------------------------------------
func (*DeviceManager) DeviceKeys ¶
func (dm *DeviceManager) DeviceKeys() []string
-------------------------------------------
func (*DeviceManager) DisableLogging ¶
func (dm *DeviceManager) DisableLogging()
func (*DeviceManager) GetAppliance ¶
func (dm *DeviceManager) GetAppliance(key string) (*Appliance, bool)
-------------------------------------------
type SyncChannel ¶
type SyncChannel chan SyncMsg
func MakeSyncChannel ¶
func MakeSyncChannel() SyncChannel
Click to show internal directories.
Click to hide internal directories.