macOS

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Rendered for darwin/amd64

Index

Constants

This section is empty.

Variables

View Source
var (
	// Power source is off-line or no longer connected.
	IOPSOffLineValue = "Off Line"
	// Power source is connected to external or AC power, and is not draining the internal battery.
	IOPSACPowerValue = "AC Power"
	// Power source is currently using the internal battery.
	IOPSBatteryPowerValue = "Battery Power"
)

Values for key IOPSPowerSourceStateKey.

View Source
var IOPSCurrentCapacityKey = StringToCFString("Current Capacity")
View Source
var IOPSPowerSourceStateKey = StringToCFString("Power Source State")
View Source
var IOPSTimeToEmptyKey = StringToCFString("Time to Empty")

Functions

func CFArrayGetCount

func CFArrayGetCount(array CFRef) int

func CFDataGetBytePtr

func CFDataGetBytePtr(data CFRef) uintptr

func CFDataGetLength

func CFDataGetLength(data CFRef) int

func CFDataToSlice

func CFDataToSlice(data CFRef) []byte

func CFNumberGetValue

func CFNumberGetValue(num CFRef) (int32, error)

func CFRelease

func CFRelease(ref CFRef)

func CFStringToString

func CFStringToString(ref CFRef) string

CFStringToString returns a Go string representation of the passed in CFString, or an empty string if it's invalid.

func FuncPC

func FuncPC(f func()) uintptr

FuncPC returns the entry point for f. See comments in runtime/proc.go for the function of the same name.

func ReleaseCFArray

func ReleaseCFArray(array CFRef)

ReleaseCFArray iterates through an array, releasing its contents, and then releases the array itself. This is necessary because we cannot, easily, set the CFArrayCallBacks argument when creating CFArrays.

Types

type CFRef

type CFRef uintptr

CFRef is an opaque reference to a Core Foundation object. It is a pointer, but to memory not owned by Go, so not an unsafe.Pointer.

func CFArrayGetValueAtIndex

func CFArrayGetValueAtIndex(array CFRef, index int) CFRef

func CFDictionaryGetValueIfPresent

func CFDictionaryGetValueIfPresent(dict CFRef, key CFString) (value CFRef, ok bool)

func CFStringCreateExternalRepresentation

func CFStringCreateExternalRepresentation(strRef CFRef) (CFRef, error)

func IOPSCopyPowerSourcesInfo

func IOPSCopyPowerSourcesInfo() (CFRef, error)

func IOPSCopyPowerSourcesList

func IOPSCopyPowerSourcesList(blob CFRef) (CFRef, error)

func IOPSGetPowerSourceDescription

func IOPSGetPowerSourceDescription(blob CFRef, ps CFRef) (CFRef, error)

type CFString

type CFString CFRef

func StringToCFString

func StringToCFString(s string) CFString

StringToCFString returns a copy of the UTF-8 contents of s as a new CFString.

type Status

type Status struct {
	Percentage int
	Elapsed    int
	State      string
}

func Battery

func Battery() (*Status, error)

Jump to

Keyboard shortcuts

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