The main server, and probably only repository in this org.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
967 B

package light
import (
"context"
"git.aiterp.net/lucifer/lucifer/models"
)
var drivers = make(map[string]Driver)
// A Driver that communicates with an underlying lighting system.
type Driver interface {
// Apply applies all changed lights, which are lights that differ from what DiscoverLights returned.
Apply(ctx context.Context, bridge models.Bridge, lights ...models.Light) error
// DiscoverLights lists all available lights. The `ID` field will the -1.
DiscoverLights(ctx context.Context, bridge models.Bridge) ([]models.Light, error)
// DiscoverBridges lists all available bridges.
DiscoverBridges(ctx context.Context) ([]models.Bridge, error)
// Connect connects to a bridge, returning the bridge with the API Key.
Connect(ctx context.Context, bridge models.Bridge) (models.Bridge, error)
}
// RegisterDriver registers a driver. This must happen in init() functions.
func RegisterDriver(name string, driver Driver) {
drivers[name] = driver
}