smartbus

package
v0.0.0-...-bc7ced1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2017 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DRIVER_SUBNET      = 0x01
	DRIVER_DEVICE_ID   = 0x99
	DRIVER_DEVICE_TYPE = 0x1234
	DRIVER_CLIENT_ID   = "smartbus"
)

FIXME

View Source
const (
	BROADCAST_SUBNET = 0xff
	BROADCAST_DEVICE = 0xff
)
View Source
const (
	LIGHT_LEVEL_OFF    = 0
	LIGHT_LEVEL_ON     = 100
	PANEL_BUTTON_COUNT = 16
)
View Source
const (
	QUERY_MODULES_DEV_DIMMER  = 0x01
	QUERY_MODULES_DEV_RELAY   = 0x02
	QUERY_MODULES_DEV_HVAC    = 0x03
	QUERY_MODULES_DEV_SENSORS = 0x04
	QUERY_MODULES_DEV_Z_AUDIO = 0x05

	BUTTON_COMMAND_INVALID                         = 0x00
	BUTTON_COMMAND_SINGLE_CHANNEL_LIGHTING_CONTROL = 0x59

	PANEL_CONTROL_TYPE_INVALID           = 0x00
	PANEL_CONTROL_TYPE_IR_RECEIVER       = 0x01
	PANEL_CONTROL_TYPE_BUTTON_LOCK       = 0x02
	PANEL_CONTROL_TYPE_AC_ON_OFF         = 0x03
	PANEL_CONTROL_TYPE_COOLING_SET_POINT = 0x04
	PANEL_CONTROL_TYPE_FAN_SPEED         = 0x05
	PANEL_CONTROL_TYPE_AC_MODE           = 0x06
	PANEL_CONTROL_TYPE_HEAT_SET_POINT    = 0x07
	PANEL_CONTROL_TYPE_AUTO_SET_POINT    = 0x08
	PANEL_CONTROL_TYPE_GO_TO_PAGE        = 0x16
)
View Source
const (
	// FIXME: make these configurable?
	NUM_VIRTUAL_RELAYS  = 15
	REQUEST_QUEUE_SIZE  = 16
	REQUEST_NUM_RETRIES = 20
	REQUEST_TIMEOUT     = 500 * time.Millisecond
)
View Source
const (
	MESSAGE_QUEUE_INBOUND_QUEUE_SIZE = 10
)
View Source
const (
	MIN_FRAME_SIZE = 11 // excluding sync
)
View Source
const (
	SmartbusPort = 6000
)

Variables

This section is empty.

Functions

func NewSmartbusTCPDriver

func NewSmartbusTCPDriver(serialAddress, brokerAddress string, provideUdpGateway bool) (*wbgo.Driver, error)

func ParseMessage

func ParseMessage(reader io.Reader, message interface{}) (err error)

func ReadChannelStatusField

func ReadChannelStatusField(reader io.Reader, value reflect.Value) error

func ReadRemarkField

func ReadRemarkField(reader io.Reader, value reflect.Value) error

func ReadSmartbus

func ReadSmartbus(reader io.Reader, mutex MutexLike, ch chan *SmartbusMessage, rawReadCh chan []byte)

func ReadSmartbusFrame

func ReadSmartbusFrame(reader io.Reader) ([]byte, bool)

func ReadSmartbusRaw

func ReadSmartbusRaw(reader io.Reader, mutex MutexLike, frameHandler func(frame []byte))

func ReadStatusBytesField

func ReadStatusBytesField(reader io.Reader, value reflect.Value) error

func ReadSync

func ReadSync(reader io.Reader, mutex MutexLike) error

func ReadTaggedField

func ReadTaggedField(reader io.Reader, value reflect.Value, tag string) error

func ReadTemperatureListField

func ReadTemperatureListField(reader io.Reader, value reflect.Value) error

func RegisterDeviceModelType

func RegisterDeviceModelType(construct DeviceConstructor)

func RegisterMessage

func RegisterMessage(messagePtr interface{})

func WriteChannelStatusField

func WriteChannelStatusField(writer io.Writer, value reflect.Value) error

func WriteFrame

func WriteFrame(writer io.Writer, fullMsg SmartbusMessage)

func WriteFrameRaw

func WriteFrameRaw(writer io.Writer, header MessageHeader, writeMsg func(writer io.Writer))

func WriteMessage

func WriteMessage(writer io.Writer, message interface{}) (err error)

func WritePreBuiltFrame

func WritePreBuiltFrame(writer io.Writer, frame []byte)

func WriteRemarkField

func WriteRemarkField(writer io.Writer, value reflect.Value) error

func WriteSmartbus

func WriteSmartbus(writer io.Writer, mutex MutexLike, ch chan interface{})

func WriteStatusBytesField

func WriteStatusBytesField(writer io.Writer, value reflect.Value) error

func WriteTaggedField

func WriteTaggedField(writer io.Writer, value reflect.Value, tag string) error

func WriteTemperatureListField

func WriteTemperatureListField(writer io.Writer, value reflect.Value) error

Types

type AssignPanelButton

type AssignPanelButton struct {
	ButtonNo        uint8
	FunctionNo      uint8
	Command         uint8
	CommandSubnetID uint8
	CommandDeviceID uint8
	ChannelNo       uint8
	Level           uint8
	Duration        uint16
	Unknown         uint8
}

func (*AssignPanelButton) Opcode

func (*AssignPanelButton) Opcode() uint16

type AssignPanelButtonResponse

type AssignPanelButtonResponse struct {
	ButtonNo   uint8
	FunctionNo uint8
}

func (*AssignPanelButtonResponse) Opcode

type Connector

type Connector func() (SmartbusIO, error)

type DDPDeviceModel

type DDPDeviceModel struct {
	DeviceModelBase
	// contains filtered or unexported fields
}

func (*DDPDeviceModel) AcceptOnValue

func (dm *DDPDeviceModel) AcceptOnValue(name, value string) bool

func (*DDPDeviceModel) OnAssignPanelButtonResponse

func (dm *DDPDeviceModel) OnAssignPanelButtonResponse(msg *AssignPanelButtonResponse)

func (*DDPDeviceModel) OnQueryModules

func (dm *DDPDeviceModel) OnQueryModules(msg *QueryModules)

func (*DDPDeviceModel) OnQueryPanelButtonAssignmentResponse

func (dm *DDPDeviceModel) OnQueryPanelButtonAssignmentResponse(msg *QueryPanelButtonAssignmentResponse)

func (*DDPDeviceModel) OnReadMACAddressResponse

func (dm *DDPDeviceModel) OnReadMACAddressResponse(msg *ReadMACAddressResponse)

func (*DDPDeviceModel) OnSetPanelButtonModesResponse

func (dm *DDPDeviceModel) OnSetPanelButtonModesResponse(msg *SetPanelButtonModesResponse)

func (*DDPDeviceModel) OnSingleChannelControlCommand

func (dm *DDPDeviceModel) OnSingleChannelControlCommand(msg *SingleChannelControlCommand)

func (*DDPDeviceModel) Poll

func (dm *DDPDeviceModel) Poll()

func (*DDPDeviceModel) Type

func (dm *DDPDeviceModel) Type() uint16

type DatagramIO

type DatagramIO struct {
	// contains filtered or unexported fields
}

func NewDatagramIO

func NewDatagramIO(rawReadCh chan []byte) (*DatagramIO, error)

func (*DatagramIO) Send

func (dgramIO *DatagramIO) Send(msg SmartbusMessage)

func (*DatagramIO) SendRaw

func (dgramIO *DatagramIO) SendRaw(msg []byte)

func (*DatagramIO) Start

func (dgramIO *DatagramIO) Start() chan *SmartbusMessage

func (*DatagramIO) Stop

func (dgramIO *DatagramIO) Stop()

type DeviceConstructor

type DeviceConstructor func(model *SmartbusModel, smartDev *SmartbusDevice) RealDeviceModel

type DeviceModelBase

type DeviceModelBase struct {
	Observer wbgo.DeviceObserver
	// contains filtered or unexported fields
}

func (*DeviceModelBase) AcceptValue

func (dev *DeviceModelBase) AcceptValue(name, value string)

func (*DeviceModelBase) IsVirtual

func (dev *DeviceModelBase) IsVirtual() bool

func (*DeviceModelBase) Name

func (dm *DeviceModelBase) Name() string

func (*DeviceModelBase) Observe

func (dev *DeviceModelBase) Observe(observer wbgo.DeviceObserver)

func (*DeviceModelBase) OnReadMACAddressResponse

func (dev *DeviceModelBase) OnReadMACAddressResponse(msg *ReadMACAddressResponse)

func (*DeviceModelBase) Title

func (dm *DeviceModelBase) Title() string

type FieldReadFunc

type FieldReadFunc func(reader io.Reader, value reflect.Value) error

type FieldWriteFunc

type FieldWriteFunc func(writer io.Writer, value reflect.Value) error

type Hmix12DeviceModel

type Hmix12DeviceModel struct {
	*ZoneBeastDeviceModel
}

TBD: test

func (*Hmix12DeviceModel) OnQueryChannelStatusesResponse

func (hm *Hmix12DeviceModel) OnQueryChannelStatusesResponse(msg *QueryChannelStatusesResponse)

func (*Hmix12DeviceModel) Poll

func (hm *Hmix12DeviceModel) Poll()

func (*Hmix12DeviceModel) Type

func (hm *Hmix12DeviceModel) Type() uint16

type Message

type Message interface {
	Opcode() uint16
}

type MessageDumper

type MessageDumper struct {
	MessageFormatter
}

func NewMessageDumper

func NewMessageDumper(prefix string) *MessageDumper

type MessageFormatter

type MessageFormatter struct {
	AddMessage func(format string, args ...interface{})
}

func (*MessageFormatter) OnAssignPanelButton

func (f *MessageFormatter) OnAssignPanelButton(msg *AssignPanelButton, hdr *MessageHeader)

func (*MessageFormatter) OnAssignPanelButtonResponse

func (f *MessageFormatter) OnAssignPanelButtonResponse(msg *AssignPanelButtonResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnPanelControlResponse

func (f *MessageFormatter) OnPanelControlResponse(msg *PanelControlResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnQueryChannelStatuses

func (f *MessageFormatter) OnQueryChannelStatuses(msg *QueryChannelStatuses,
	hdr *MessageHeader)

func (*MessageFormatter) OnQueryChannelStatusesResponse

func (f *MessageFormatter) OnQueryChannelStatusesResponse(msg *QueryChannelStatusesResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnQueryModules

func (f *MessageFormatter) OnQueryModules(msg *QueryModules, hdr *MessageHeader)

func (*MessageFormatter) OnQueryModulesResponse

func (f *MessageFormatter) OnQueryModulesResponse(msg *QueryModulesResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnQueryPanelButtonAssignment

func (f *MessageFormatter) OnQueryPanelButtonAssignment(msg *QueryPanelButtonAssignment,
	hdr *MessageHeader)

func (*MessageFormatter) OnQueryPanelButtonAssignmentResponse

func (f *MessageFormatter) OnQueryPanelButtonAssignmentResponse(msg *QueryPanelButtonAssignmentResponse, hdr *MessageHeader)

func (*MessageFormatter) OnReadMACAddress

func (f *MessageFormatter) OnReadMACAddress(msg *ReadMACAddress,
	hdr *MessageHeader)

func (*MessageFormatter) OnReadMACAddressResponse

func (f *MessageFormatter) OnReadMACAddressResponse(msg *ReadMACAddressResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnReadSensorStatus

func (f *MessageFormatter) OnReadSensorStatus(msg *ReadSensorStatus, hdr *MessageHeader)

func (*MessageFormatter) OnReadSensorStatusResponse

func (f *MessageFormatter) OnReadSensorStatusResponse(msg *ReadSensorStatusResponse, hdr *MessageHeader)

func (*MessageFormatter) OnReadTemperatureValues

func (f *MessageFormatter) OnReadTemperatureValues(msg *ReadTemperatureValues, hdr *MessageHeader)

func (*MessageFormatter) OnReadTemperatureValuesResponse

func (f *MessageFormatter) OnReadTemperatureValuesResponse(msg *ReadTemperatureValuesResponse, hdr *MessageHeader)

func (*MessageFormatter) OnSceneControl

func (f *MessageFormatter) OnSceneControl(msg *SceneControl, hdr *MessageHeader)

func (*MessageFormatter) OnSceneControlResponse

func (f *MessageFormatter) OnSceneControlResponse(msg *SceneControlResponse, hdr *MessageHeader)

func (*MessageFormatter) OnSensorStatusBroadcast

func (f *MessageFormatter) OnSensorStatusBroadcast(msg *SensorStatusBroadcast, hdr *MessageHeader)

func (*MessageFormatter) OnSetPanelButtonModes

func (f *MessageFormatter) OnSetPanelButtonModes(msg *SetPanelButtonModes, hdr *MessageHeader)

func (*MessageFormatter) OnSetPanelButtonModesResponse

func (f *MessageFormatter) OnSetPanelButtonModesResponse(msg *SetPanelButtonModesResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnSingleChannelControlCommand

func (f *MessageFormatter) OnSingleChannelControlCommand(msg *SingleChannelControlCommand, hdr *MessageHeader)

func (*MessageFormatter) OnSingleChannelControlResponse

func (f *MessageFormatter) OnSingleChannelControlResponse(msg *SingleChannelControlResponse,
	hdr *MessageHeader)

func (*MessageFormatter) OnZoneBeastBroadcast

func (f *MessageFormatter) OnZoneBeastBroadcast(msg *ZoneBeastBroadcast,
	hdr *MessageHeader)

type MessageHeader

type MessageHeader struct {
	OrigSubnetID   uint8
	OrigDeviceID   uint8
	OrigDeviceType uint16
	Opcode         uint16
	TargetSubnetID uint8
	TargetDeviceID uint8
}

type MessageQueue

type MessageQueue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMessageQueue

func NewMessageQueue(timerFunc TimerFunc, timeout time.Duration, numRetries int, queueSize int) *MessageQueue

func (*MessageQueue) Enqueue

func (queue *MessageQueue) Enqueue(item QueueItem) error

Enqueue puts item into the queue. If the queue is full, an error is returned. This function is threadsafe.

func (*MessageQueue) HandleReceivedMessage

func (queue *MessageQueue) HandleReceivedMessage(msg Message)

HandleReceivedMessage notifies the queue about the incoming message. This function is threadsafe.

func (*MessageQueue) Start

func (queue *MessageQueue) Start()

func (*MessageQueue) Stop

func (queue *MessageQueue) Stop()

type MutexLike

type MutexLike interface {
	Lock()
	Unlock()
}

type PacketParser

type PacketParser func(io.Reader) (interface{}, error)

func MakePreprocessedPacketParser

func MakePreprocessedPacketParser(construct func() Message) PacketParser

func MakeSimplePacketParser

func MakeSimplePacketParser(construct func() Message) PacketParser

type PanelControlResponse

type PanelControlResponse struct {
	Type  uint8
	Value uint8
}

PanelControlResponse is sent by the panel (should be sent as a response to similiarly structured 0xe3d8, but seems to be sent on its own, too)

func (*PanelControlResponse) Opcode

func (*PanelControlResponse) Opcode() uint16

type PreprocessedMessage

type PreprocessedMessage interface {
	FromRaw(func(interface{}) error) error
	ToRaw() (interface{}, error)
}

type QueryChannelStatuses

type QueryChannelStatuses struct {
	Index uint8 // spec says there's no such field, but it's present

}

QueryChannelStatuses is sent by the panel to fan controller devices

func (*QueryChannelStatuses) Opcode

func (*QueryChannelStatuses) Opcode() uint16

type QueryChannelStatusesResponse

type QueryChannelStatusesResponse struct {
	ChannelStatus []uint8 `sbus:"statusBytes"`
}

QueryChannelStatuses is sent by the panel to fan controller devices

func (*QueryChannelStatusesResponse) Opcode

type QueryModules

type QueryModules struct{}

QueryModules is sent by DDP upon a button press

func (*QueryModules) Opcode

func (*QueryModules) Opcode() uint16

type QueryModulesResponse

type QueryModulesResponse struct {
	ControlledDeviceSubnetID uint8
	ControlledDeviceID       uint8
	DeviceCategory           uint8
	ChannelNo                uint8
	HVACSubnetID             uint8
	HVACDeviceID             uint8
}

QueryModulesResponse is sent as a response to QueryModules

func (*QueryModulesResponse) FromRaw

func (msg *QueryModulesResponse) FromRaw(parseRaw func(interface{}) error) (err error)

func (*QueryModulesResponse) Opcode

func (*QueryModulesResponse) Opcode() uint16

func (*QueryModulesResponse) ToRaw

func (msg *QueryModulesResponse) ToRaw() (interface{}, error)

type QueryModulesResponseRaw

type QueryModulesResponseRaw struct {
	ControlledDeviceSubnetID uint8
	ControlledDeviceID       uint8
	DeviceCategory           uint8
	Param1                   uint8
	Param2                   uint8
	Param3                   uint8
	Param4                   uint8
}

type QueryPanelButtonAssignment

type QueryPanelButtonAssignment struct {
	ButtonNo   uint8
	FunctionNo uint8
}

func (*QueryPanelButtonAssignment) Opcode

type QueryPanelButtonAssignmentResponse

type QueryPanelButtonAssignmentResponse struct {
	ButtonNo        uint8
	FunctionNo      uint8
	Command         uint8
	CommandSubnetID uint8
	CommandDeviceID uint8
	ChannelNo       uint8
	Level           uint8
	Duration        uint16
}

func (*QueryPanelButtonAssignmentResponse) Opcode

type QueueItem

type QueueItem interface {
	Run()
	IsResponse(msg Message) bool
	Name() string
}

type QueuePred

type QueuePred func(msg Message) bool

type ReadMACAddress

type ReadMACAddress struct{}

func (*ReadMACAddress) Opcode

func (*ReadMACAddress) Opcode() uint16

type ReadMACAddressResponse

type ReadMACAddressResponse struct {
	MAC    [8]uint8
	Remark []uint8 `sbus:"remark"`
}

func (*ReadMACAddressResponse) Opcode

func (*ReadMACAddressResponse) Opcode() uint16

type ReadSensorStatus

type ReadSensorStatus struct{}

func (*ReadSensorStatus) Opcode

func (*ReadSensorStatus) Opcode() uint16

type ReadSensorStatusResponse

type ReadSensorStatusResponse struct {
	Success     bool `sbus:"success"`
	Temperature int  `sbus:"sensorTemp"`
	Illuminance uint16
	Movement    bool `sbus:"flag"`
	DryContact1 bool `sbus:"flag"`
	DryContact2 bool `sbus:"flag"`
	Reserved1   uint8
	Reserved2   uint8
}

func (*ReadSensorStatusResponse) Opcode

func (*ReadSensorStatusResponse) Opcode() uint16

type ReadTemperatureValues

type ReadTemperatureValues struct {
	UseCelsius bool `sbus:"flag"`
}

func (*ReadTemperatureValues) Opcode

func (*ReadTemperatureValues) Opcode() uint16

type ReadTemperatureValuesResponse

type ReadTemperatureValuesResponse struct {
	UseCelsius bool   `sbus:"flag"`
	Values     []int8 `sbus:"templist"`
}

func (*ReadTemperatureValuesResponse) Opcode

type RealDeviceModel

type RealDeviceModel interface {
	wbgo.LocalDeviceModel
	Type() uint16
	Poll()
}

func NewDDPDeviceModel

func NewDDPDeviceModel(model *SmartbusModel, smartDev *SmartbusDevice) RealDeviceModel

func NewHmix12DeviceModel

func NewHmix12DeviceModel(model *SmartbusModel, smartDev *SmartbusDevice) RealDeviceModel

func NewSensor8in1

func NewSensor8in1(model *SmartbusModel, smartDev *SmartbusDevice) RealDeviceModel

func NewSensorSB_CMS_8in1

func NewSensorSB_CMS_8in1(model *SmartbusModel, smartDev *SmartbusDevice) RealDeviceModel

func NewZoneBeastDeviceModel

func NewZoneBeastDeviceModel(model *SmartbusModel, smartDev *SmartbusDevice) RealDeviceModel

type Request

type Request struct {
	// contains filtered or unexported fields
}

func (*Request) IsResponse

func (request *Request) IsResponse(msg Message) bool

func (*Request) Name

func (request *Request) Name() string

func (*Request) Run

func (request *Request) Run()

type SceneControl

type SceneControl struct {
	ZoneNo  uint8
	SceneNo uint8
}

SceneControl queries device status

func (*SceneControl) Opcode

func (*SceneControl) Opcode() uint16

type SceneControlResponse

type SceneControlResponse struct {
	ZoneNo        uint8
	SceneNo       uint8
	ChannelStatus []bool `sbus:"channelStatus"`
}

SceneControlResponse is a response for SceneControl packet

func (*SceneControlResponse) Opcode

func (*SceneControlResponse) Opcode() uint16

type Sensor8in1

type Sensor8in1 struct {
	DeviceModelBase
	// contains filtered or unexported fields
}

func (*Sensor8in1) AcceptOnValue

func (sens *Sensor8in1) AcceptOnValue(name, value string) bool

func (*Sensor8in1) OnReadSensorStatusResponse

func (sens *Sensor8in1) OnReadSensorStatusResponse(msg *ReadSensorStatusResponse)

func (*Sensor8in1) Poll

func (sens *Sensor8in1) Poll()

func (*Sensor8in1) Type

func (sens *Sensor8in1) Type() uint16

type SensorSB_CMS_8in1

type SensorSB_CMS_8in1 struct {
	Sensor8in1
	// contains filtered or unexported fields
}

func (*SensorSB_CMS_8in1) Type

func (sens *SensorSB_CMS_8in1) Type() uint16

type SensorStatusBroadcast

type SensorStatusBroadcast struct {
	Temperature int `sbus:"sensorTemp"`
	Illuminance uint16
	Movement    bool `sbus:"flag"`
	DryContact1 bool `sbus:"flag"`
	DryContact2 bool `sbus:"flag"`
	Reserved1   uint8
	Reserved2   uint8
}

func (*SensorStatusBroadcast) Opcode

func (*SensorStatusBroadcast) Opcode() uint16

type SetPanelButtonModes

type SetPanelButtonModes struct {
	Modes [16]string `sbus:"panelButtonModes"`
}

func (*SetPanelButtonModes) Opcode

func (*SetPanelButtonModes) Opcode() uint16

type SetPanelButtonModesResponse

type SetPanelButtonModesResponse struct {
	Success bool `sbus:"success"`
}

func (*SetPanelButtonModesResponse) Opcode

type SingleChannelControlCommand

type SingleChannelControlCommand struct {
	ChannelNo uint8
	Level     uint8
	Duration  uint16 // FIXME: is it really duration? ("running time")
}

SingleChannelControlCommand toggles single relay output

func (*SingleChannelControlCommand) Opcode

type SingleChannelControlResponse

type SingleChannelControlResponse struct {
	ChannelNo     uint8
	Success       bool `sbus:"success"`
	Level         uint8
	ChannelStatus []bool `sbus:"channelStatus"`
}

SingleChannelControlResponse is sent as a response to SingleChannelControlCommand

func (*SingleChannelControlResponse) Opcode

type SmartbusConnection

type SmartbusConnection struct {
	// contains filtered or unexported fields
}

SmartbusConnection provides higher-level interface for a SmartbusIO that uses endpoints to filter incoming messages by their destination and assign source addresses to outgoind messages.

func NewSmartbusConnection

func NewSmartbusConnection(smartbusIO SmartbusIO) *SmartbusConnection

func (*SmartbusConnection) Close

func (conn *SmartbusConnection) Close()

func (*SmartbusConnection) MakeSmartbusEndpoint

func (conn *SmartbusConnection) MakeSmartbusEndpoint(subnetID uint8,
	deviceID uint8, deviceType uint16) *SmartbusEndpoint

func (*SmartbusConnection) Send

func (conn *SmartbusConnection) Send(msg SmartbusMessage)

type SmartbusDevice

type SmartbusDevice struct {
	Endpoint   *SmartbusEndpoint
	SubnetID   uint8
	DeviceID   uint8
	DeviceType uint16 // filled in when a packet is received from the device
}

func (*SmartbusDevice) AssignPanelButton

func (dev *SmartbusDevice) AssignPanelButton(
	buttonNo uint8, functionNo uint8, command uint8,
	commandSubnetID uint8, commandDeviceID uint8,
	channelNo uint8, level uint8, duration uint16)

func (*SmartbusDevice) AssignPanelButtonResponse

func (dev *SmartbusDevice) AssignPanelButtonResponse(buttonNo uint8, functionNo uint8)

func (*SmartbusDevice) PanelControlResponse

func (dev *SmartbusDevice) PanelControlResponse(Type uint8, Value uint8)

func (*SmartbusDevice) QueryChannelStatuses

func (dev *SmartbusDevice) QueryChannelStatuses(index uint8)

func (*SmartbusDevice) QueryChannelStatusesResponse

func (dev *SmartbusDevice) QueryChannelStatusesResponse(channelStatus []uint8)

func (*SmartbusDevice) QueryModules

func (dev *SmartbusDevice) QueryModules()

func (*SmartbusDevice) QueryModulesResponse

func (dev *SmartbusDevice) QueryModulesResponse(deviceCategory uint8, channelNo uint8)

func (*SmartbusDevice) QueryPanelButtonAssignment

func (dev *SmartbusDevice) QueryPanelButtonAssignment(buttonNo uint8, functionNo uint8)

func (*SmartbusDevice) QueryPanelButtonAssignmentResponse

func (dev *SmartbusDevice) QueryPanelButtonAssignmentResponse(
	buttonNo uint8, functionNo uint8, command uint8,
	commandSubnetID uint8, commandDeviceID uint8,
	channelNo uint8, level uint8, duration uint16)

func (*SmartbusDevice) ReadMACAddress

func (dev *SmartbusDevice) ReadMACAddress()

func (*SmartbusDevice) ReadMACAddressResponse

func (dev *SmartbusDevice) ReadMACAddressResponse(macAddress [8]uint8, remark []uint8)

func (*SmartbusDevice) ReadSensorStatus

func (dev *SmartbusDevice) ReadSensorStatus()

func (*SmartbusDevice) ReadSensorStatusResponse

func (dev *SmartbusDevice) ReadSensorStatusResponse(success bool, temperature int, illumination uint16,
	movement, dryContact1, dryContact2 bool)

func (*SmartbusDevice) ReadTemperatureValues

func (dev *SmartbusDevice) ReadTemperatureValues(useCelsius bool)

func (*SmartbusDevice) ReadTemperatureValuesResponse

func (dev *SmartbusDevice) ReadTemperatureValuesResponse(useCelsius bool, values []int8)

func (*SmartbusDevice) SceneControl

func (dev *SmartbusDevice) SceneControl(zoneNo, sceneNo uint8)

func (*SmartbusDevice) SceneControlResponse

func (dev *SmartbusDevice) SceneControlResponse(zoneNo, sceneNo uint8, channelStatus []bool)

func (*SmartbusDevice) Send

func (dev *SmartbusDevice) Send(msg Message)

func (*SmartbusDevice) SensorStatusBroadcast

func (dev *SmartbusDevice) SensorStatusBroadcast(temperature int, illumination uint16,
	movement, dryContact1, dryContact2 bool)

func (*SmartbusDevice) SetPanelButtonModes

func (dev *SmartbusDevice) SetPanelButtonModes(modes [PANEL_BUTTON_COUNT]string)

func (*SmartbusDevice) SetPanelButtonModesResponse

func (dev *SmartbusDevice) SetPanelButtonModesResponse(success bool)

func (*SmartbusDevice) SingleChannelControl

func (dev *SmartbusDevice) SingleChannelControl(channelNo uint8, level uint8, duration uint16)

func (*SmartbusDevice) SingleChannelControlResponse

func (dev *SmartbusDevice) SingleChannelControlResponse(channelNo uint8,
	success bool, level uint8, status []bool)

func (*SmartbusDevice) ZoneBeastBroadcast

func (dev *SmartbusDevice) ZoneBeastBroadcast(zoneStatus []uint8, channelStatus []bool)

type SmartbusEndpoint

type SmartbusEndpoint struct {
	Connection *SmartbusConnection
	SubnetID   uint8
	DeviceID   uint8
	DeviceType uint16
	// contains filtered or unexported fields
}

func (*SmartbusEndpoint) AddInputSniffer

func (ep *SmartbusEndpoint) AddInputSniffer(observer interface{})

func (*SmartbusEndpoint) AddOutputSniffer

func (ep *SmartbusEndpoint) AddOutputSniffer(observer interface{})

func (*SmartbusEndpoint) GetBroadcastDevice

func (ep *SmartbusEndpoint) GetBroadcastDevice() *SmartbusDevice

func (*SmartbusEndpoint) GetSmartbusDevice

func (ep *SmartbusEndpoint) GetSmartbusDevice(subnetID uint8, deviceID uint8) *SmartbusDevice

func (*SmartbusEndpoint) Observe

func (ep *SmartbusEndpoint) Observe(observer interface{})

func (*SmartbusEndpoint) Send

func (ep *SmartbusEndpoint) Send(msg SmartbusMessage)

type SmartbusIO

type SmartbusIO interface {
	Start() chan *SmartbusMessage
	Send(msg SmartbusMessage)
	Stop()
}

type SmartbusMessage

type SmartbusMessage struct {
	Header  MessageHeader
	Message interface{}
}

func ParseFrame

func ParseFrame(frame []byte) (*SmartbusMessage, error)

type SmartbusModel

type SmartbusModel struct {
	wbgo.ModelBase
	// contains filtered or unexported fields
}

func NewSmartbusModel

func NewSmartbusModel(connector Connector, subnetID uint8,
	deviceID uint8, deviceType uint16, timerFunc TimerFunc) (model *SmartbusModel)

func (*SmartbusModel) OnAnything

func (model *SmartbusModel) OnAnything(msg Message, header *MessageHeader)

func (*SmartbusModel) Poll

func (model *SmartbusModel) Poll()

func (*SmartbusModel) SetTimerFunc

func (model *SmartbusModel) SetTimerFunc(timerFunc TimerFunc)

func (*SmartbusModel) SetVirtualRelayOn

func (model *SmartbusModel) SetVirtualRelayOn(channelNo int, on bool)

func (*SmartbusModel) Start

func (model *SmartbusModel) Start() error

func (*SmartbusModel) Stop

func (model *SmartbusModel) Stop()

func (*SmartbusModel) VirtualRelayStatus

func (model *SmartbusModel) VirtualRelayStatus() []bool

type SmartbusStreamIO

type SmartbusStreamIO struct {
	// contains filtered or unexported fields
}

func NewStreamIO

func NewStreamIO(stream io.ReadWriteCloser, rawReadCh chan []byte) *SmartbusStreamIO

func (*SmartbusStreamIO) Send

func (streamIO *SmartbusStreamIO) Send(msg SmartbusMessage)

func (*SmartbusStreamIO) SendRaw

func (streamIO *SmartbusStreamIO) SendRaw(msg []byte)

func (*SmartbusStreamIO) Start

func (streamIO *SmartbusStreamIO) Start() chan *SmartbusMessage

func (*SmartbusStreamIO) Stop

func (streamIO *SmartbusStreamIO) Stop()

type TimeoutChecker

type TimeoutChecker interface {
	IsTimeout(error) bool
}

type TimerFunc

type TimerFunc func(d time.Duration) wbgo.Timer

type VirtualRelayDevice

type VirtualRelayDevice struct {
	wbgo.DeviceBase
	// contains filtered or unexported fields
}

func NewVirtualRelayDevice

func NewVirtualRelayDevice() *VirtualRelayDevice

func (*VirtualRelayDevice) AcceptOnValue

func (dm *VirtualRelayDevice) AcceptOnValue(name, value string) bool

func (*VirtualRelayDevice) AcceptValue

func (dm *VirtualRelayDevice) AcceptValue(name, value string)

func (*VirtualRelayDevice) IsVirtual

func (dm *VirtualRelayDevice) IsVirtual() bool

func (*VirtualRelayDevice) Publish

func (dm *VirtualRelayDevice) Publish()

func (*VirtualRelayDevice) RelayStatus

func (dm *VirtualRelayDevice) RelayStatus() []bool

func (*VirtualRelayDevice) SetRelayOn

func (dm *VirtualRelayDevice) SetRelayOn(channelNo int, on bool)

type ZoneBeastBroadcast

type ZoneBeastBroadcast struct {
	ZoneStatus    []uint8 `sbus:"statusBytes"`
	ChannelStatus []bool  `sbus:"channelStatus"`
}

ZoneBeastBroadcast packets are sent by ZoneBeast at regular intervals

func (*ZoneBeastBroadcast) Opcode

func (*ZoneBeastBroadcast) Opcode() uint16

type ZoneBeastDeviceModel

type ZoneBeastDeviceModel struct {
	DeviceModelBase
	// contains filtered or unexported fields
}

func (*ZoneBeastDeviceModel) AcceptOnValue

func (dm *ZoneBeastDeviceModel) AcceptOnValue(name, value string) bool

func (*ZoneBeastDeviceModel) OnReadTemperatureValuesResponse

func (dm *ZoneBeastDeviceModel) OnReadTemperatureValuesResponse(msg *ReadTemperatureValuesResponse)

func (*ZoneBeastDeviceModel) OnSingleChannelControlResponse

func (dm *ZoneBeastDeviceModel) OnSingleChannelControlResponse(msg *SingleChannelControlResponse)

func (*ZoneBeastDeviceModel) OnZoneBeastBroadcast

func (dm *ZoneBeastDeviceModel) OnZoneBeastBroadcast(msg *ZoneBeastBroadcast)

func (*ZoneBeastDeviceModel) Poll

func (dm *ZoneBeastDeviceModel) Poll()

func (*ZoneBeastDeviceModel) Type

func (dm *ZoneBeastDeviceModel) Type() uint16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL