mesh

package module
v0.0.0-...-ca091ef Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 4 Imported by: 1

README

Archive notice

This project was created for educational purposes. And was never intended for use in any production setting. To prevent forks and attempts to contribute I have archived it.

HomeProject

For details on the project See the repository https://github.com/AJGherardi/HomeProject

Documentation

Index

Constants

View Source
const (
	OpSetup               = 0x00
	OpSetupStatus         = 0x01
	OpAddKey              = 0x02
	OpAddKeyStatus        = 0x03
	OpUnprovisionedBeacon = 0x04
	OpProvision           = 0x05
	OpNodeAdded           = 0x06
	OpConfigureNode       = 0x07
	OpConfigureNodeStatus = 0x08
	OpSendMessage         = 0x09
	OpReset               = 0x10
	OpReboot              = 0x11
	OpNodeReset           = 0x12
	OpState               = 0x13
	OpConfigureElem       = 0x14
	OpConfigureElemStatus = 0x15
	OpSendRecallMessage   = 0x16
	OpSendStoreMessage    = 0x17
	OpSendDeleteMessage   = 0x18
	OpSendBindMessage     = 0x19
	OpEvent               = 0x20
)

Op codes for the Mesh Controller

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller holds all the needed usb vars to talk to the Mesh Controller

func Open

func Open() (Controller, error)

Open gets the Mesh Controller using usb

func (*Controller) AddKey

func (controller *Controller) AddKey(appIdx uint16) error

AddKey generates an app key at the given index

func (*Controller) Close

func (controller *Controller) Close()

Close must be called when the Mesh Controller is not needed anymore

func (*Controller) ConfigureElem

func (controller *Controller) ConfigureElem(groupAddr uint16, nodeAddr uint16, elemAddr uint16, appIdx uint16) error

ConfigureElem binds an app key to the elem with the given addr

func (*Controller) ConfigureNode

func (controller *Controller) ConfigureNode(addr uint16, appIdx uint16) error

ConfigureNode binds an app key to the node with the given addr

func (*Controller) Provision

func (controller *Controller) Provision(uuid []byte) error

Provision adds a device with the given uuid to the network

func (*Controller) Read

func (controller *Controller) Read(
	onSetupStatus func(),
	onAddKeyStatus func(appIdx uint16),
	onUnprovisionedBeacon func(uuid []byte),
	onNodeAdded func(addr uint16),
	onState func(addr uint16, state byte),
	onEvent func(addr uint16),
) error

Read calls the provided funcs when a msg from the Mesh Controller is received

func (*Controller) Reboot

func (controller *Controller) Reboot() error

Reboot reboots the Mesh Controller must be called after reset

func (*Controller) Reset

func (controller *Controller) Reset() error

Reset removes all mesh related items from the Mesh Controller's flash

func (*Controller) ResetNode

func (controller *Controller) ResetNode(addr uint16) error

ResetNode Removes the node with the givin addr from the mesh network

func (*Controller) SendBindMessage

func (controller *Controller) SendBindMessage(sceneNumber uint16, addr uint16, appIdx uint16) error

SendBindMessage sends a bt mesh event bind message using the app key at the given index to the given addr

func (*Controller) SendDeleteMessage

func (controller *Controller) SendDeleteMessage(sceneNumber uint16, addr uint16, appIdx uint16) error

SendDeleteMessage sends a bt mesh scene delete message using the app key at the given index to the given addr

func (*Controller) SendMessage

func (controller *Controller) SendMessage(state byte, addr uint16, appIdx uint16) error

SendMessage sends a bt mesh message using the app key at the given index to the given addr

func (*Controller) SendRecallMessage

func (controller *Controller) SendRecallMessage(sceneNumber uint16, addr uint16, appIdx uint16) error

SendRecallMessage sends a bt mesh scene recall message using the app key at the given index to the given addr

func (*Controller) SendStoreMessage

func (controller *Controller) SendStoreMessage(sceneNumber uint16, addr uint16, appIdx uint16) error

SendStoreMessage sends a bt mesh scene store message using the app key at the given index to the given addr

func (*Controller) Setup

func (controller *Controller) Setup() error

Setup creates a new bt mesh network

func (*Controller) WriteData

func (controller *Controller) WriteData(data []byte) error

WriteData writes data to the Mesh Controller over usb

Jump to

Keyboard shortcuts

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