All Projects → distatus → Battery

distatus / Battery

Licence: other
cross-platform, normalized battery information library

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Battery

Xrepo
🗂️ A cross-platform C/C++ package manager based on Xmake
Stars: ✭ 162 (-4.71%)
Mutual labels:  cross-platform
Muon
GPU based Electron on a diet
Stars: ✭ 2,068 (+1116.47%)
Mutual labels:  cross-platform
Persistentbottomnavbar
A highly customizable persistent bottom navigation bar for Flutter
Stars: ✭ 165 (-2.94%)
Mutual labels:  cross-platform
Klooni1010
libGDX game based on the original 1010!
Stars: ✭ 163 (-4.12%)
Mutual labels:  cross-platform
Netcorecms
NetCoreCMS is a modular theme supported Content Management System developed using ASP.Net Core 2.0 MVC. Which is also usable as web application framework. This project is still under development. Please do not use before it's first release.
Stars: ✭ 165 (-2.94%)
Mutual labels:  cross-platform
Protogame
This project has been sunset as of 1st Jan 2018 and is no longer supported or maintained
Stars: ✭ 166 (-2.35%)
Mutual labels:  cross-platform
Xresloader
跨平台Excel导表工具(Excel=>protobuf/msgpack/lua/javascript/json/xml)
Stars: ✭ 161 (-5.29%)
Mutual labels:  cross-platform
Timelapse
🎬 Native macOS app for recording timelapse videos of your desktop.
Stars: ✭ 169 (-0.59%)
Mutual labels:  cross-platform
Helio Workstation
One music sequencer for all major platforms, desktop and mobile
Stars: ✭ 2,257 (+1227.65%)
Mutual labels:  cross-platform
Div Games Studio
Complete cross platform games development package, originally for DOS but now available on modern platforms.
Stars: ✭ 168 (-1.18%)
Mutual labels:  cross-platform
Lc Finder
An image annotation and object detection tool written in C
Stars: ✭ 163 (-4.12%)
Mutual labels:  cross-platform
Airpodsbattery Monitor For Mac
Simple Widget to display your AirPods battery levels from the Mac Status bar
Stars: ✭ 165 (-2.94%)
Mutual labels:  battery
Ddoor
DDoor - cross platform backdoor using dns txt records
Stars: ✭ 168 (-1.18%)
Mutual labels:  cross-platform
React Native Timeline Flatlist
FlatList based timeline component for React Native for iOS and Android
Stars: ✭ 163 (-4.12%)
Mutual labels:  cross-platform
Expo Voxel
🎮🌳 Voxel Terrain made in React Native. ∛
Stars: ✭ 169 (-0.59%)
Mutual labels:  cross-platform
Litenetlib
Lite reliable UDP library for Mono and .NET
Stars: ✭ 2,179 (+1181.76%)
Mutual labels:  cross-platform
Msquic
Cross-platform, C implementation of the IETF QUIC protocol.
Stars: ✭ 2,501 (+1371.18%)
Mutual labels:  cross-platform
Covscript
Covariant Script Interpreter
Stars: ✭ 169 (-0.59%)
Mutual labels:  cross-platform
Robot Js
Native system automation for node.js
Stars: ✭ 169 (-0.59%)
Mutual labels:  cross-platform
Autopilot Rs
A simple, cross-platform GUI automation module for Rust.
Stars: ✭ 168 (-1.18%)
Mutual labels:  cross-platform

battery Build Status Go Report Card GoDoc

Cross-platform, normalized battery information library.

Gives access to a system independent, typed battery state, capacity, charge and voltage values recalculated as necessary to be returned in mW, mWh or V units.

Currently supported systems:

  • Linux 2.6.39+
  • OS X 10.10+
  • Windows XP+
  • FreeBSD
  • DragonFlyBSD
  • NetBSD
  • OpenBSD
  • Solaris

Installation

$ go get -u github.com/distatus/battery

Code Example

import (
	"fmt"

	"github.com/distatus/battery"
)

func main() {
	batteries, err := battery.GetAll()
	if err != nil {
		fmt.Println("Could not get battery info!")
		return
	}
	for i, battery := range batteries {
		fmt.Printf("Bat%d: ", i)
		fmt.Printf("state: %s, ", battery.State.String())
		fmt.Printf("current capacity: %f mWh, ", battery.Current)
		fmt.Printf("last full capacity: %f mWh, ", battery.Full)
		fmt.Printf("design capacity: %f mWh, ", battery.Design)
		fmt.Printf("charge rate: %f mW, ", battery.ChargeRate)
		fmt.Printf("voltage: %f V, ", battery.Voltage)
		fmt.Printf("design voltage: %f V\n", battery.DesignVoltage)
	}
}

CLI

There is also a little utility which - more or less - mimicks the GNU/Linux acpi -b command.

Installation

$ go get -u github.com/distatus/battery/cmd/battery

Usage

$ battery
BAT0: Full, 95.61% [Voltage: 12.15V (design: 12.15V)]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].