Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PowerCapReset = &CapInstruction{ OpCode: OpReset, }
Functions ¶
This section is empty.
Types ¶
type CapInstruction ¶
type CapInstruction struct {
OpCode PowerCapOpCode
// keep string forms to facilitate wire encoding which prefers string(text) format
OpCurrentValue string
OpTargetValue string
RawTargetValue int
RawCurrentValue int
}
func GetCappingInstructions ¶
func GetCappingInstructions(response *advisorsvc.ListAndWatchResponse) ([]*CapInstruction, error)
func NewCapInstruction ¶
func NewCapInstruction(targetWatts, currWatt int) (*CapInstruction, error)
func (CapInstruction) ToCapRequest ¶
func (c CapInstruction) ToCapRequest() (opCode PowerCapOpCode, targetValue, currentValue int)
func (CapInstruction) ToListAndWatchResponse ¶
func (c CapInstruction) ToListAndWatchResponse() *advisorsvc.ListAndWatchResponse
type PowerCapOpCode ¶
type PowerCapOpCode string
const ( OpCap PowerCapOpCode = "4" OpReset PowerCapOpCode = "-1" OpUnknown PowerCapOpCode = "-2" )
type PowerCapper ¶
type PowerCapper interface {
Init() error
Start() error
Stop() error
Reset()
Cap(ctx context.Context, targetWatts, currWatt int)
}
func NewNoopCapper ¶
func NewNoopCapper() PowerCapper
Click to show internal directories.
Click to hide internal directories.