devices

package
v0.0.0-...-bff5ac0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TypeString  = "string"
	TypeBoolean = "boolean"
	TypeInteger = "integer"
	TypeNumber  = "number"

	UnitHectopascal = "hectopascal"
	UnitKelvin      = "kelvin"
	UnitPercentage  = "percentage"
	UnitArcDegrees  = "arcdegrees"
	UnitCelsius     = "celsius"
	UnitLux         = "lux"
	UnitSeconds     = "seconds"
	UnitPPM         = "ppm"

	AlarmProperty                    = "AlarmProperty"
	BarometricPressureProperty       = "BarometricPressureProperty"
	ColorProperty                    = "ColorProperty"
	ColorTemperatureProperty         = "ColorTemperatureProperty"
	ConcentrationProperty            = "ConcentrationProperty"
	CurrentProperty                  = "CurrentProperty"
	DensityProperty                  = "DensityProperty"
	FrequencyProperty                = "FrequencyProperty"
	HeatingCoolingProperty           = "HeatingCoolingProperty"
	HumidityProperty                 = "HumidityProperty"
	ImageProperty                    = "ImageProperty"
	InstantaneousPowerFactorProperty = "InstantaneousPowerFactorProperty"
	InstantaneousPowerProperty       = "InstantaneousPowerProperty"
	LeakProperty                     = "LeakProperty"
	LevelProperty                    = "LevelProperty"
	LockedProperty                   = "LockedProperty"
	MotionProperty                   = "MotionProperty"

	OpenProperty              = "OpenProperty"
	PushedProperty            = "PushedProperty"
	SmokeProperty             = "SmokeProperty"
	TargetTemperatureProperty = "TargetTemperatureProperty"
	TemperatureProperty       = "TemperatureProperty"
	ThermostatModeProperty    = "ThermostatModeProperty"
	VideoProperty             = "VideoProperty"
	VoltageProperty           = "VoltageProperty"
)

Variables

This section is empty.

Functions

func Color16ToRGB

func Color16ToRGB(colorStr string) (red, green, blue int, err error)

Types

type Device

type Device struct {
	ID          string `json:"id"`
	AtContext   string `json:"@context"`
	AtType      string `json:"@type"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`

	Links               []*Link                         `json:"links,omitempty"`
	PinRequired         bool                            `json:"pinRequired"`
	CredentialsRequired bool                            `json:"credentialsRequired"`
	BaseHref            string                          `json:"baseHref"`
	Pin                 *Pin                            `json:"pin,omitempty"`
	Properties          map[string]*properties.Property `json:"properties,omitempty"`
	Actions             map[string]*actions.Action      `json:"action,omitempty"`
	Events              map[string]*events.Event        `json:"events,omitempty"`
}

func NewDeviceFormMessage

func NewDeviceFormMessage(dev *rpc.Device) *Device

func NewDeviceFormString

func NewDeviceFormString(des string) *Device

func (*Device) AddAction

func (device *Device) AddAction(action *actions.Action)

func (*Device) AddEvent

func (device *Device) AddEvent(event *events.Event)

func (*Device) AddProperty

func (device *Device) AddProperty(property *properties.Property)

func (*Device) GetAtContext

func (device *Device) GetAtContext() string

func (*Device) GetAtType

func (device *Device) GetAtType() string

func (*Device) GetDescription

func (device *Device) GetDescription() string

func (*Device) GetID

func (device *Device) GetID() string

func (*Device) GetTitle

func (device *Device) GetTitle() string

type LightBulb

type LightBulb struct {
	*Device
}

func (*LightBulb) SetBrightness

func (light *LightBulb) SetBrightness(brightness int)

func (*LightBulb) Toggle

func (light *LightBulb) Toggle()

func (*LightBulb) TurnOff

func (light *LightBulb) TurnOff()

func (*LightBulb) TurnOn

func (light *LightBulb) TurnOn()

type LightHandler

type LightHandler interface {
	TurnOn()
	TurnOff()
	SetBrightness(brightness int)
}
type Link struct {
	Href      string `protobuf:"bytes,1,opt,name=href,proto3" json:"href,omitempty"`
	Rel       string `protobuf:"bytes,2,opt,name=rel,proto3" json:"rel,omitempty"`
	MediaType string `protobuf:"bytes,3,opt,name=mediaType,proto3" json:"mediaType,omitempty"`
}

type Pin

type Pin struct {
	Required bool   `json:"required"`
	Pattern  string `json:"pattern,omitempty"`
}

Jump to

Keyboard shortcuts

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