Documentation
¶
Index ¶
- Constants
- type Command
- type ConfigMap
- type DeviceConfig
- type DeviceConfigMap
- type DeviceConfigSet
- type Element
- type Identifiable
- type Node
- func (n *Node) AddElement(el *Element)
- func (n *Node) Config() *ConfigMap
- func (n *Node) Devices() *devices.Map
- func (n *Node) Elements() []*Element
- func (n *Node) MarshalJSON() ([]byte, error)
- func (n *Node) Name() string
- func (n *Node) Node() *Node
- func (n *Node) SetConfig(c *ConfigMap)
- func (n *Node) SetDevices(devices *devices.Map)
- func (n *Node) SetElements(elements []*Element)
- func (n *Node) SetName(name string)
- func (n *Node) SetState(state interface{})
- func (n *Node) SetUuid(uuid string)
- func (n *Node) State() interface{}
- func (n *Node) Uuid() string
- type Type
- type Update
Constants ¶
View Source
const ( ElementTypeText = 0 ElementTypeButton = 1 ElementTypeToggle = 2 ElementTypeSlider = 3 ElementTypeColorPicker = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigMap ¶
type ConfigMap struct { //node Identifiable Config map[string]*DeviceConfigMap `json:"config"` }
func NewConfigMap ¶
func NewConfigMap(n Identifiable) *ConfigMap
func (*ConfigMap) Add ¶
func (cm *ConfigMap) Add(devid string) *DeviceConfigMap
func (*ConfigMap) ListenForConfigChanges ¶
func (cm *ConfigMap) ListenForConfigChanges(c chan DeviceConfigSet)
type DeviceConfig ¶
type DeviceConfigMap ¶
type DeviceConfigMap struct { Layout_ map[string]*DeviceConfig `json:"layout"` // contains filtered or unexported fields }
func (*DeviceConfigMap) Handler ¶
func (cm *DeviceConfigMap) Handler(f func(string, *DeviceConfig)) *DeviceConfigMap
func (*DeviceConfigMap) Layout ¶
func (cm *DeviceConfigMap) Layout(layout ...*DeviceConfig) *DeviceConfigMap
type DeviceConfigSet ¶
type Identifiable ¶
type Identifiable interface {
Uuid() string
}
type Node ¶
type Node struct { Name_ string `json:"Name"` Uuid_ string `json:"Uuid"` Host string Version string BuildDate string Elements_ []*Element `json:"Elements"` State_ interface{} `json:"State"` Devices_ *devices.Map `json:"Devices"` Config_ *ConfigMap `json:"config"` sync.RWMutex }
func (*Node) AddElement ¶
func (*Node) MarshalJSON ¶ added in v0.0.6
func (*Node) SetDevices ¶
func (*Node) SetElements ¶
type Type ¶
type Type byte
Type describes what type of Update package it is
const ( // TypeUpdateNode is a package from the node to the server with node specific information TypeUpdateNode Type = iota // TypeUpdateState is sent from node to server when the state changes TypeUpdateState // TypeUpdateDevices is sent from node to server with a new list of available devices TypeUpdateDevices // TypeNotification is a message to the user from a node TypeNotification // TypePing is a keep alive message TypePing // TypePong is the answer to the keep alive message TypePong // TypeCommand is sent from the server to the node with a task for the node do. For example turn on a light. TypeCommand // TypeDeviceConfigSet is sent from server to the node when a user changes a parameter in a device TypeDeviceConfigSet )
type Update ¶
type Update struct { Type Type Data *json.RawMessage }
Update is the outer most layer in the communication between node and server. The purpose is to encapsulate the data to transfer with a type.
func NewUpdateWithData ¶
NewUpdateWithData encodes data in to a new Update struct that can be used to communicate between node and server
Click to show internal directories.
Click to hide internal directories.