Documentation ¶
Index ¶
- Constants
- type Connection
- func (c *Connection) CheckMagSafeExistence() bool
- func (c *Connection) Close() error
- func (c *Connection) DisableAdapter() error
- func (c *Connection) DisableCharging() error
- func (c *Connection) EnableAdapter() error
- func (c *Connection) EnableCharging() error
- func (c *Connection) GetBatteryCharge() (int, error)
- func (c *Connection) GetMagSafeLedState() (MagSafeLedState, error)
- func (c *Connection) IsAdapterEnabled() (bool, error)
- func (c *Connection) IsChargingEnabled() (bool, error)
- func (c *Connection) IsMagSafeCharging() (bool, error)
- func (c *Connection) IsPluggedIn() (bool, error)
- func (c *Connection) Open() error
- func (c *Connection) Read(key string) (gosmc.SMCVal, error)
- func (c *Connection) SetMagSafeCharging(charging bool) error
- func (c *Connection) SetMagSafeLedState(state MagSafeLedState) error
- func (c *Connection) Write(key string, value []byte) error
- type MagSafeLedState
Constants ¶
const ( MagSafeLedKey = "ACLC" // Not verified yet. ACPowerKey = "AC-W" // Not verified yet. ChargingKey1 = "CH0B" // Not verified yet. ChargingKey2 = "CH0C" // Not verified yet. AdapterKey = "CH0K" BatteryChargeKey = "BBIF" )
Various SMC keys for amd64 (Intel 64). This file is not used currently because we have no plan to support Classic Intel MacBooks. However, if we want to, we have something to work on.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
*gosmc.Connection
}
Connection is a wrapper of gosmc.Connection.
func (*Connection) CheckMagSafeExistence ¶ added in v0.2.0
func (c *Connection) CheckMagSafeExistence() bool
CheckMagSafeExistence .
func (*Connection) DisableAdapter ¶
func (c *Connection) DisableAdapter() error
DisableAdapter disables the adapter.
func (*Connection) DisableCharging ¶
func (c *Connection) DisableCharging() error
DisableCharging disables charging.
func (*Connection) EnableAdapter ¶
func (c *Connection) EnableAdapter() error
EnableAdapter enables the adapter.
func (*Connection) EnableCharging ¶
func (c *Connection) EnableCharging() error
EnableCharging enables charging.
func (*Connection) GetBatteryCharge ¶
func (c *Connection) GetBatteryCharge() (int, error)
GetBatteryCharge returns the battery charge.
func (*Connection) GetMagSafeLedState ¶ added in v0.2.0
func (c *Connection) GetMagSafeLedState() (MagSafeLedState, error)
GetMagSafeLedState .
func (*Connection) IsAdapterEnabled ¶
func (c *Connection) IsAdapterEnabled() (bool, error)
IsAdapterEnabled returns whether the adapter is enabled.
func (*Connection) IsChargingEnabled ¶
func (c *Connection) IsChargingEnabled() (bool, error)
IsChargingEnabled returns whether charging is enabled.
func (*Connection) IsMagSafeCharging ¶ added in v0.2.0
func (c *Connection) IsMagSafeCharging() (bool, error)
IsMagSafeCharging .
func (*Connection) IsPluggedIn ¶
func (c *Connection) IsPluggedIn() (bool, error)
IsPluggedIn returns whether the device is plugged in.
func (*Connection) Read ¶
func (c *Connection) Read(key string) (gosmc.SMCVal, error)
Read reads a value from SMC.
func (*Connection) SetMagSafeCharging ¶ added in v0.2.0
func (c *Connection) SetMagSafeCharging(charging bool) error
SetMagSafeCharging .
func (*Connection) SetMagSafeLedState ¶ added in v0.2.0
func (c *Connection) SetMagSafeLedState(state MagSafeLedState) error
SetMagSafeLedState .
type MagSafeLedState ¶ added in v0.2.0
type MagSafeLedState uint8
MagSafeLedState is the state of the MagSafe LED.
const ( LEDSystem MagSafeLedState = 0x00 LEDOff MagSafeLedState = 0x01 LEDGreen MagSafeLedState = 0x03 LEDOrange MagSafeLedState = 0x04 LEDErrorOnce MagSafeLedState = 0x05 LEDErrorPermSlow MagSafeLedState = 0x06 LEDErrorPermFast MagSafeLedState = 0x07 LEDErrorPermOff MagSafeLedState = 0x19 )
Representation of MagSafeLedState.