Documentation ¶
Index ¶
- func AssignIDs(bus evbus.Bus, number int, db dbW)
- func CloseAll(slabs []*Slab)
- func DiscardEvents() chan Event
- func ListenAll(slabs []*Slab, bus evbus.Bus, wg *sync.WaitGroup)
- func ObjectListener(s *Slab, bus evbus.Bus) error
- func SignalObject(bus evbus.Bus, c *RGB) error
- func TestLights(slabs []*Slab) error
- type CommandDTO
- type Config
- type DB
- type Event
- type RGB
- type Repo
- func (r *Repo) AssignIDs()
- func (r *Repo) Close() error
- func (r *Repo) Execute(cmdAlien *mqtt.Command)
- func (r *Repo) LoadIDs()
- func (r *Repo) LoadOrAssign()
- func (r *Repo) OffAll() error
- func (r *Repo) OpenDB(path string) error
- func (r *Repo) SignalObject(color *RGB)
- func (r *Repo) Slab(id byte) *Slab
- func (r *Repo) WaitGroup() *sync.WaitGroup
- type Slab
- func (s *Slab) Close() error
- func (s *Slab) FadeIn(delay time.Duration, upto byte, c *RGB) error
- func (s *Slab) ID() string
- func (s *Slab) Off() error
- func (s *Slab) On(c *RGB) error
- func (s *Slab) RawSensor() (byte, error)
- func (s *Slab) Sensor() (bool, error)
- func (s *Slab) SetBrightness(value byte) error
- func (s *Slab) SetThreshold(threshold byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscardEvents ¶
func DiscardEvents() chan Event
DiscardEvents returns channel that discards events sent to it.
func ListenAll ¶
ListenAll starts ObjectListener in parallel on all slabs, sending events to event bus.
func ObjectListener ¶
ObjectListener emits event when sensor status changes on a slab. It can signal detection with lighting slab.
func SignalObject ¶
SignalObject light a slab when an object appears.
func TestLights ¶
TestLights turns off each slab, then turns them back off after a while.
Types ¶
type CommandDTO ¶
type CommandDTO struct { ID byte `json:"id"` Command byte `json:"command,omitempty"` RGB *RGB `json:"rgb,omitempty"` Delay byte `json:"delay,omitempty"` }
CommandDTO describes data that has to be provided for hardware.
type Config ¶
type Config struct { Repository struct { Filter string `envconfig:"default=ACM"` Path string `envconfig:"default=./slabs.db"` } }
Config for slabs supporting envconfig for environmental variable parsing.
type DB ¶
type DB interface { Close() error // contains filtered or unexported methods }
DB is an abstract for accessing database.
type Repo ¶
Repo stores slabs' data. It allows controlling multiple slabs at once.
func NewRepo ¶
NewRepo creates Repo of all slabs, iterating through /dev files and connecting to those, containing `filter`.
func (*Repo) SignalObject ¶
SignalObject with given color represented as RGB.
type Slab ¶
type Slab struct {
// contains filtered or unexported fields
}
Slab contains single slab info.
func (*Slab) SetBrightness ¶
SetBrightness set brightness, which isn't updated until next color set.
func (*Slab) SetThreshold ¶
SetThreshold sets value below which object is detected as 'on slab'.