Documentation
¶
Index ¶
- func MakeNetwork() (Network, ReadFunc, WriteFunc)
- func ReadFromFile() (model.Store, error)
- func SaveStore(store *model.Store)
- func SaveToFile(store model.Store) error
- type Network
- func (n *Network) AddAccessKey() ([]byte, error)
- func (n *Network) AddDevice(name string, uuid []byte, groupAddr uint16) (uint16, error)
- func (n *Network) AddGroup(name string) (uint16, error)
- func (n *Network) CheckAccessKey(webKey []byte) bool
- func (n *Network) CheckIfConfigured() bool
- func (n *Network) Close()
- func (n *Network) ConfigHub() ([]byte, error)
- func (n *Network) EventBind(groupAddr, devAddr, elemAddr, sceneNumber uint16) error
- func (n *Network) GetGroup(groupAddr uint16) (*model.Group, error)
- func (n *Network) GetGroups() map[uint16]*model.Group
- func (n *Network) GetUnprovisionedNodes() [][]byte
- func (n *Network) ReadState(groupAddr, devAddr, elemAddr uint16) ([]byte, error)
- func (n *Network) RemoveDevice(groupAddr, devAddr uint16) error
- func (n *Network) RemoveGroup(groupAddr uint16) error
- func (n *Network) ResetHub()
- func (n *Network) SceneDelete(groupAddr, sceneNumber uint16) error
- func (n *Network) SceneRecall(groupAddr, sceneNumber uint16) error
- func (n *Network) SceneStore(groupAddr uint16, name string) (uint16, error)
- func (n *Network) SetState(state []byte, groupAddr, elemAddr uint16) error
- func (n *Network) UpdateState(elemAddr uint16, state byte) error
- type ReadFunc
- type WriteFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeNetwork ¶
MakeNetwork opens all resources needed to run the network and returns read and write functions that need to be run on their own goroutines
func ReadFromFile ¶
ReadFromFile reads data from the home.data file
func SaveToFile ¶
SaveToFile writes data to the home.data file
Types ¶
type Network ¶
type Network struct { Store *model.Store Controller mesh.Controller UnprovisionedNodes *[][]byte NodeAdded chan uint16 }
Network holds all needed data for the operation of the mesh network
func (*Network) AddAccessKey ¶
AddAccessKey generates and saves a Web Key
func (*Network) CheckAccessKey ¶
CheckAccessKey checks the access key using know access keys
func (*Network) CheckIfConfigured ¶
CheckIfConfigured checks if the network is configured
func (*Network) Close ¶
func (n *Network) Close()
Close closes all of the resources that the network depends on
func (*Network) EventBind ¶
EventBind sends a event bind msg to the element and sets the elements state to the scene number
func (*Network) GetGroups ¶
GetGroups returns a map of references to all of the groups in the network
func (*Network) GetUnprovisionedNodes ¶
GetUnprovisionedNodes returns a list of detected unprovisioned nodes
func (*Network) RemoveDevice ¶
RemoveDevice sends are reset message and removes the device from the group
func (*Network) RemoveGroup ¶
RemoveGroup deletes the group from the store and sends reset messages to all the devices in the group
func (*Network) ResetHub ¶
func (n *Network) ResetHub()
ResetHub Initializes the hub for the first time
func (*Network) SceneDelete ¶
SceneDelete sends a delete message to devices in the group and removes the scene from the group
func (*Network) SceneRecall ¶
SceneRecall sends a recall message to devices in the group
func (*Network) SceneStore ¶
SceneStore adds a scene to a group and sends a SceneStore message