ßþ→ªn €® €n ßþœ®, ßþœ® ßœππ
This commit is contained in:
+5
-4
@@ -1,10 +1,11 @@
|
||||
package models
|
||||
|
||||
type Bridge struct {
|
||||
ID int
|
||||
Name string
|
||||
Driver DriverType
|
||||
ConnectionString string
|
||||
ID int
|
||||
Name string
|
||||
Driver DriverType
|
||||
Address string
|
||||
Token string
|
||||
}
|
||||
|
||||
type DriverType string
|
||||
|
||||
+18
-25
@@ -6,14 +6,17 @@ import (
|
||||
)
|
||||
|
||||
type Device struct {
|
||||
ID int `json:"id"`
|
||||
BridgeID int `json:"bridgeID"`
|
||||
Icon string `json:"icon"`
|
||||
Name string `json:"name"`
|
||||
Capabilities []DeviceCapability `json:"capabilities"`
|
||||
Properties map[string]string `json:"properties"`
|
||||
State DeviceState `json:"state"`
|
||||
Tags []string `json:"tags"`
|
||||
ID int `json:"id"`
|
||||
BridgeID int `json:"bridgeID"`
|
||||
InternalID string `json:"internalId"`
|
||||
Icon string `json:"icon"`
|
||||
Name string `json:"name"`
|
||||
Capabilities []DeviceCapability `json:"capabilities"`
|
||||
ButtonNames []string `json:"buttonNames"`
|
||||
DriverProperties map[string]string `json:"driverProperties"`
|
||||
UserProperties map[string]string `json:"userProperties"`
|
||||
State DeviceState `json:"state"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
// DeviceState contains optional state values that
|
||||
@@ -45,29 +48,19 @@ type DeviceRepository interface {
|
||||
}
|
||||
|
||||
var (
|
||||
DCPower DeviceCapability = "Power"
|
||||
DCColorHS DeviceCapability = "ColorHS"
|
||||
DCColorKelvin DeviceCapability = "ColorKelvin"
|
||||
DCButtonDefault DeviceCapability = "ButtonDefault"
|
||||
DCButtonOn DeviceCapability = "ButtonOn"
|
||||
DCButtonOff DeviceCapability = "ButtonOff"
|
||||
DCButtonPlus DeviceCapability = "ButtonPlus"
|
||||
DCButtonMinus DeviceCapability = "ButtonMinus"
|
||||
DCButtonToggle DeviceCapability = "ButtonToggle"
|
||||
DCIntensity DeviceCapability = "Intensity"
|
||||
DCTemperature DeviceCapability = "Temperature"
|
||||
DCPower DeviceCapability = "Power"
|
||||
DCColorHS DeviceCapability = "ColorHS"
|
||||
DCColorKelvin DeviceCapability = "ColorKelvin"
|
||||
DCButtons DeviceCapability = "Buttons"
|
||||
DCIntensity DeviceCapability = "Intensity"
|
||||
DCTemperature DeviceCapability = "Temperature"
|
||||
)
|
||||
|
||||
var Capabilities = []DeviceCapability{
|
||||
DCPower,
|
||||
DCColorHS,
|
||||
DCColorKelvin,
|
||||
DCButtonDefault,
|
||||
DCButtonOn,
|
||||
DCButtonOff,
|
||||
DCButtonPlus,
|
||||
DCButtonMinus,
|
||||
DCButtonToggle,
|
||||
DCButtons,
|
||||
DCIntensity,
|
||||
DCTemperature,
|
||||
}
|
||||
|
||||
+8
-5
@@ -1,14 +1,17 @@
|
||||
package models
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DriverResolver interface {
|
||||
ResolveFor(bridge Bridge) (Driver, error)
|
||||
}
|
||||
|
||||
type Driver interface {
|
||||
SearchBridge(ctx context.Context, address string) (Bridge, error)
|
||||
SearchDevices(ctx context.Context, bridge Bridge) ([]Device, error)
|
||||
Consume(ctx context.Context, bridge Bridge, devices []Device, ch chan Event) (chan <-struct{}, error)
|
||||
Publish(ctx context.Context, bridge Bridge, device Device) error
|
||||
SearchBridge(ctx context.Context, address string, dryRun bool) ([]Bridge, error)
|
||||
SearchDevices(ctx context.Context, bridge Bridge, timeout time.Duration) ([]Device, error)
|
||||
Consume(ctx context.Context, bridge Bridge, devices []Device, ch chan Event) (chan<- struct{}, error)
|
||||
Publish(ctx context.Context, bridge Bridge, devices []Device) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user