control

package
v0.0.0-...-3ccddf6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package control is a generated protocol buffer package.

It is generated from these files:

control.proto
service.proto

It has these top-level messages:

Radiator
Zone
GetZonesRequest
GetZonesReply
GetZoneStatusRequest
GetZoneStatusReply
SetZoneScheduleRequest
SetZoneScheduleReply
Config

Package control is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Day     = 0x05
	Night   = 0x03
	Defrost = 0x09
	Off     = 0x60
	Auto    = 0x11
)

Variables

View Source
var HeatingState_name = map[int32]string{
	0: "UNKNOWN",
	1: "ON",
	2: "OFF",
}
View Source
var HeatingState_value = map[string]int32{
	"UNKNOWN": 0,
	"ON":      1,
	"OFF":     2,
}

Functions

func RegisterHeatingControlServiceHandler

func RegisterHeatingControlServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterHeatingControlServiceHandler registers the http handlers for service HeatingControlService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterHeatingControlServiceHandlerClient

func RegisterHeatingControlServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HeatingControlServiceClient) error

RegisterHeatingControlServiceHandler registers the http handlers for service HeatingControlService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HeatingControlServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HeatingControlServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HeatingControlServiceClient" to call the correct interceptors.

func RegisterHeatingControlServiceHandlerFromEndpoint

func RegisterHeatingControlServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterHeatingControlServiceHandlerFromEndpoint is same as RegisterHeatingControlServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterHeatingControlServiceServer

func RegisterHeatingControlServiceServer(s *grpc.Server, srv HeatingControlServiceServer)

Types

type ByName

type ByName []*Zone

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type Config

type Config struct {
	Zone []*Zone `protobuf:"bytes,1,rep,name=zone" json:"zone,omitempty"`
}

func (*Config) Descriptor

func (*Config) Descriptor() ([]byte, []int)

func (*Config) GetZone

func (m *Config) GetZone() []*Zone

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) String

func (m *Config) String() string

type Controller

type Controller struct {
	Config map[string]*Room
	// contains filtered or unexported fields
}

func NewController

func NewController(
	path string,
	controller RadiatorController,
	calendarService *calendar.CalendarScheduleService,
	logger *zap.SugaredLogger,
) (*Controller, error)

func (*Controller) ControlRadiators

func (c *Controller) ControlRadiators(ctx context.Context)

func (*Controller) GetNextState

func (c *Controller) GetNextState(room *Room) HeatingState

func (*Controller) GetZoneStatus

func (s *Controller) GetZoneStatus(ctx context.Context, req *GetZoneStatusRequest) (*GetZoneStatusReply, error)

func (*Controller) GetZones

func (s *Controller) GetZones(ctx context.Context, req *GetZonesRequest) (*GetZonesReply, error)

func (*Controller) SetZoneSchedule

func (s *Controller) SetZoneSchedule(ctx context.Context, req *SetZoneScheduleRequest) (*SetZoneScheduleReply, error)

type GetZoneStatusReply

type GetZoneStatusReply struct {
	Name               string       `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	TargetTemperature  float32      `protobuf:"fixed32,2,opt,name=target_temperature,json=targetTemperature" json:"target_temperature,omitempty"`
	CurrentTemperature float32      `protobuf:"fixed32,3,opt,name=current_temperature,json=currentTemperature" json:"current_temperature,omitempty"`
	State              HeatingState `protobuf:"varint,4,opt,name=state,enum=control.HeatingState" json:"state,omitempty"`
}

func (*GetZoneStatusReply) Descriptor

func (*GetZoneStatusReply) Descriptor() ([]byte, []int)

func (*GetZoneStatusReply) GetCurrentTemperature

func (m *GetZoneStatusReply) GetCurrentTemperature() float32

func (*GetZoneStatusReply) GetName

func (m *GetZoneStatusReply) GetName() string

func (*GetZoneStatusReply) GetState

func (m *GetZoneStatusReply) GetState() HeatingState

func (*GetZoneStatusReply) GetTargetTemperature

func (m *GetZoneStatusReply) GetTargetTemperature() float32

func (*GetZoneStatusReply) ProtoMessage

func (*GetZoneStatusReply) ProtoMessage()

func (*GetZoneStatusReply) Reset

func (m *GetZoneStatusReply) Reset()

func (*GetZoneStatusReply) String

func (m *GetZoneStatusReply) String() string

type GetZoneStatusRequest

type GetZoneStatusRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}

func (*GetZoneStatusRequest) Descriptor

func (*GetZoneStatusRequest) Descriptor() ([]byte, []int)

func (*GetZoneStatusRequest) GetName

func (m *GetZoneStatusRequest) GetName() string

func (*GetZoneStatusRequest) ProtoMessage

func (*GetZoneStatusRequest) ProtoMessage()

func (*GetZoneStatusRequest) Reset

func (m *GetZoneStatusRequest) Reset()

func (*GetZoneStatusRequest) String

func (m *GetZoneStatusRequest) String() string

type GetZonesReply

type GetZonesReply struct {
	Zone []*Zone `protobuf:"bytes,1,rep,name=zone" json:"zone,omitempty"`
}

func (*GetZonesReply) Descriptor

func (*GetZonesReply) Descriptor() ([]byte, []int)

func (*GetZonesReply) GetZone

func (m *GetZonesReply) GetZone() []*Zone

func (*GetZonesReply) ProtoMessage

func (*GetZonesReply) ProtoMessage()

func (*GetZonesReply) Reset

func (m *GetZonesReply) Reset()

func (*GetZonesReply) String

func (m *GetZonesReply) String() string

type GetZonesRequest

type GetZonesRequest struct {
}

func (*GetZonesRequest) Descriptor

func (*GetZonesRequest) Descriptor() ([]byte, []int)

func (*GetZonesRequest) ProtoMessage

func (*GetZonesRequest) ProtoMessage()

func (*GetZonesRequest) Reset

func (m *GetZonesRequest) Reset()

func (*GetZonesRequest) String

func (m *GetZonesRequest) String() string

type HeatingControlServiceClient

type HeatingControlServiceClient interface {
	GetZones(ctx context.Context, in *GetZonesRequest, opts ...grpc.CallOption) (*GetZonesReply, error)
	GetZoneStatus(ctx context.Context, in *GetZoneStatusRequest, opts ...grpc.CallOption) (*GetZoneStatusReply, error)
	SetZoneSchedule(ctx context.Context, in *SetZoneScheduleRequest, opts ...grpc.CallOption) (*SetZoneScheduleReply, error)
}

func NewHeatingControlServiceClient

func NewHeatingControlServiceClient(cc *grpc.ClientConn) HeatingControlServiceClient

type HeatingControlServiceServer

type HeatingControlServiceServer interface {
	GetZones(context.Context, *GetZonesRequest) (*GetZonesReply, error)
	GetZoneStatus(context.Context, *GetZoneStatusRequest) (*GetZoneStatusReply, error)
	SetZoneSchedule(context.Context, *SetZoneScheduleRequest) (*SetZoneScheduleReply, error)
}

type HeatingState

type HeatingState int32
const (
	HeatingState_UNKNOWN HeatingState = 0
	HeatingState_ON      HeatingState = 1
	HeatingState_OFF     HeatingState = 2
)

func (HeatingState) EnumDescriptor

func (HeatingState) EnumDescriptor() ([]byte, []int)

func (HeatingState) String

func (x HeatingState) String() string

type Radiator

type Radiator struct {
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}

func (*Radiator) Descriptor

func (*Radiator) Descriptor() ([]byte, []int)

func (*Radiator) GetAddress

func (m *Radiator) GetAddress() []byte

func (*Radiator) ProtoMessage

func (*Radiator) ProtoMessage()

func (*Radiator) Reset

func (m *Radiator) Reset()

func (*Radiator) String

func (m *Radiator) String() string

type RadiatorController

type RadiatorController interface {
	TurnOn([]byte)
	TurnOff([]byte)
}

type RadioController

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

func NewRadioController

func NewRadioController() *RadioController

func (*RadioController) TurnOff

func (c *RadioController) TurnOff(addr []byte)

func (*RadioController) TurnOn

func (c *RadioController) TurnOn(addr []byte)

type Room

type Room struct {
	Pid *pidctrl.PIDController

	LastTemp float64
	// contains filtered or unexported fields
}

type SetZoneScheduleReply

type SetZoneScheduleReply struct {
}

func (*SetZoneScheduleReply) Descriptor

func (*SetZoneScheduleReply) Descriptor() ([]byte, []int)

func (*SetZoneScheduleReply) ProtoMessage

func (*SetZoneScheduleReply) ProtoMessage()

func (*SetZoneScheduleReply) Reset

func (m *SetZoneScheduleReply) Reset()

func (*SetZoneScheduleReply) String

func (m *SetZoneScheduleReply) String() string

type SetZoneScheduleRequest

type SetZoneScheduleRequest struct {
}

func (*SetZoneScheduleRequest) Descriptor

func (*SetZoneScheduleRequest) Descriptor() ([]byte, []int)

func (*SetZoneScheduleRequest) ProtoMessage

func (*SetZoneScheduleRequest) ProtoMessage()

func (*SetZoneScheduleRequest) Reset

func (m *SetZoneScheduleRequest) Reset()

func (*SetZoneScheduleRequest) String

func (m *SetZoneScheduleRequest) String() string

type Zone

type Zone struct {
	Name              string      `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Radiator          []*Radiator `protobuf:"bytes,2,rep,name=radiator" json:"radiator,omitempty"`
	CalendarId        string      `protobuf:"bytes,4,opt,name=calendar_id,json=calendarId" json:"calendar_id,omitempty"`
	TargetTemperature int32       `protobuf:"varint,5,opt,name=target_temperature,json=targetTemperature" json:"target_temperature,omitempty"`
}

func (*Zone) Descriptor

func (*Zone) Descriptor() ([]byte, []int)

func (*Zone) GetCalendarId

func (m *Zone) GetCalendarId() string

func (*Zone) GetName

func (m *Zone) GetName() string

func (*Zone) GetRadiator

func (m *Zone) GetRadiator() []*Radiator

func (*Zone) GetTargetTemperature

func (m *Zone) GetTargetTemperature() int32

func (*Zone) ProtoMessage

func (*Zone) ProtoMessage()

func (*Zone) Reset

func (m *Zone) Reset()

func (*Zone) String

func (m *Zone) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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