gobat

package module
v0.0.0-...-d0b9be2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MPL-2.0 Imports: 6 Imported by: 0

README

gobat

Go library for pwoer-supply uevent files

Documentation

GoDoc

Reference

gobat-cli

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AC

type AC struct {
	Path   string
	Name   string
	Online bool
}

AC is the struct for the power source

func (*AC) Populate

func (ac *AC) Populate() error

Populate updates information regarding pointer PowerSupply

type Battery

type Battery struct {
	Path       string
	Name       string   `json:"name"`
	Status     string   `json:"status"`
	Present    bool     `json:"present"`
	Technology string   `json:"technology"`
	Model      Model    `json:"model"`
	CycleCount int64    `json:"cycle_count"`
	Voltage    Voltage  `json:"voltage"`
	CurrentNow int64    `json:"current_now"`
	Charge     Charge   `json:"charge"`
	Capacity   Capacity `json:"capacity"`
}

Battery is the struct for a battery

func (*Battery) IsCharging

func (b *Battery) IsCharging() bool

IsCharging is a pretty redundant function, but I'll be using it

func (*Battery) PercentCharge

func (b *Battery) PercentCharge() float64

PercentCharge calculates the remaining power

func (*Battery) Populate

func (b *Battery) Populate() error

Populate updates information regarding pointer PowerSupply

func (*Battery) TimeLeftUntilFull

func (b *Battery) TimeLeftUntilFull() (*time.Duration, error)

TimeLeftUntilFull calculates the time left until full charge

func (*Battery) TimeRemaining

func (b *Battery) TimeRemaining() (*time.Duration, error)

TimeRemaining calculates the time remaining

type Capacity

type Capacity struct {
	Capacity int    `json:"capacity"`
	Level    string `json:"level"`
}

Capacity is the battery capacity

type Charge

type Charge struct {
	FullDesign int64 `json:"full_design"`
	Full       int64 `json:"full"`
	Now        int64 `json:"now"`
}

Charge is the battery charge

type Model

type Model struct {
	Name         string `json:"name"`
	Manufacturer string `json:"manufacturer"`
	Serial       int64  `json:"serial"`
}

Model is the battery model

type PowerSupplies

type PowerSupplies struct {
	AC      AC
	Battery []Battery
}

PowerSupplies is the struct for batteries and AC

func GetDevices

func GetDevices() (*PowerSupplies, error)

GetDevices returns an array of backlight devices (intel_backlight, acpi_backlight, etc)

func (*PowerSupplies) PopulateAll

func (devices *PowerSupplies) PopulateAll() error

PopulateAll updates everything in PowerSupplies

type Voltage

type Voltage struct {
	MinDesign int64 `json:"min_design"`
	Now       int64 `json:"now"`
}

Voltage is the battery voltage

Jump to

Keyboard shortcuts

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