thermal

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ThrottlePlanPerformance uint32 = 0x00
	ThrottlePlanTurbo       uint32 = 0x01
	ThrottlePlanSilent      uint32 = 0x02
)

TODO: validate these constants are actually what they say they are

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WMI               atkacpi.WMI
	PowerCfg          *power.Cfg
	Profiles          []Profile
	AutoThermal       bool
	AutoThermalConfig struct {
		PluggedIn string
		Unplugged string
	}
}

Config defines the entry point for Windows Power Option and a list of thermal profiles

type Control

type Control struct {
	Config
	PersistConfig
	// contains filtered or unexported fields
}

Control defines contains the Windows Power Option and list of thermal profiles

func NewControl

func NewControl(conf Config) (*Control, error)

NewControl allows you to cycle to the next thermal profile

func (*Control) AddOrModifyProfile

func (c *Control) AddOrModifyProfile(modifyProfile *ModifyProfileStruct)

func (*Control) Apply

func (c *Control) Apply() error

Apply satisfies persist.Registry

func (*Control) Close

func (c *Control) Close() error

Close satisfied persist.Registry

func (*Control) CurrentProfile

func (c *Control) CurrentProfile() Profile

CurrentProfile will return the currently active Profile

func (*Control) GetTemperatures added in v1.0.6

func (c *Control) GetTemperatures() Temperatures

func (*Control) GetWSInfo

func (c *Control) GetWSInfo() gin.H

func (*Control) HandleWSMessage

func (c *Control) HandleWSMessage(ws *websocket.Conn, action int, value string)

func (*Control) Initialize

func (c *Control) Initialize() error

Initialize satisfies system/plugin.Plugin

func (*Control) Load

func (c *Control) Load(v []byte) error

Load satisfies persist.Registry TODO: check if the input is actually valid

func (*Control) MoveProfile

func (c *Control) MoveProfile(moveInput *MoveProfileStruct)

func (*Control) Name

func (c *Control) Name() string

Name satisfies persist.Registry

func (*Control) NextProfile

func (c *Control) NextProfile(howMany int) (string, error)

NextProfile will cycle to the next profile

func (*Control) Notify

func (c *Control) Notify(t plugin.Notification)

Notify satisfies system/plugin.Plugin

func (*Control) RemoveProfile

func (c *Control) RemoveProfile(profileId int)

func (*Control) ResetProfiles

func (c *Control) ResetProfiles()

func (*Control) Run

func (c *Control) Run(haltCtx context.Context, cb chan<- plugin.Callback) <-chan error

Run satisfies system/plugin.Plugin

func (*Control) SwitchToProfile

func (c *Control) SwitchToProfile(name string) (string, error)

SwitchToProfile will switch the profile with the given name

func (*Control) Value

func (c *Control) Value() []byte

Value satisfies persist.Registry

type FanTable

type FanTable struct {
	ByteTable []byte
}

func NewFanTable

func NewFanTable(curve string) (*FanTable, error)

func (*FanTable) Bytes

func (f *FanTable) Bytes() []byte

Bytes returns the binary representation of the table

func (*FanTable) MarshalJSON

func (f *FanTable) MarshalJSON() ([]byte, error)

func (*FanTable) String

func (f *FanTable) String() string

String() returns the original fan curve in string reprensentation

type ModifyProfileStruct

type ModifyProfileStruct struct {
	ProfileId        int    `json:"profileId"`
	Name             string `json:"name"`
	WindowsPowerPlan string `json:"windowsPowerPlan"`
	ThrottlePlan     uint32 `json:"throttlePlan"`
	CPUFanCurve      string `json:"cpuFanCurve"`
	GPUFanCurve      string `json:"gpuFanCurve"`
	FastSwitch       bool   `json:"fastSwitch"`
}

type MoveProfileStruct

type MoveProfileStruct struct {
	FromId   int `json:"fromId"`
	TargetId int `json:"targetId"`
}

type PersistConfig

type PersistConfig struct {
	CurrentProfile int       `json:"currentProfile"`
	SavedProfiles  []Profile `json:"profiles"`
}

type Profile

type Profile struct {
	Name             string    `json:"name"`
	WindowsPowerPlan string    `json:"windowsPowerPlan"`
	ThrottlePlan     uint32    `json:"throttlePlan"`
	CPUFanCurve      *FanTable `json:"cpuFanCurve"`
	GPUFanCurve      *FanTable `json:"gpuFanCurve"`
	FastSwitch       bool      `json:"fastSwitch"`
}

func GetDefaultThermalProfiles

func GetDefaultThermalProfiles() []Profile

GetDefaultThermalProfiles will return the default list of Profiles

type Temperatures added in v1.0.6

type Temperatures struct {
	GPU float32 `json:"gpu"`
	CPU float32 `json:"cpu"`
}

type TextMarshaler

type TextMarshaler interface {
	MarshalText() (text []byte, err error)
}

Jump to

Keyboard shortcuts

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