summaryrefslogtreecommitdiffstats
path: root/src/detection/battery/battery.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/detection/battery/battery.h')
-rw-r--r--src/detection/battery/battery.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/detection/battery/battery.h b/src/detection/battery/battery.h
new file mode 100644
index 0000000..1a3b4e9
--- /dev/null
+++ b/src/detection/battery/battery.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include "fastfetch.h"
+#include "modules/battery/option.h"
+
+#define FF_BATTERY_TEMP_UNSET (-DBL_MAX)
+
+typedef enum FFBatteryStatus {
+ FF_BATTERY_STATUS_NONE = 0,
+ FF_BATTERY_STATUS_UNKNOWN = 1 << 0,
+ FF_BATTERY_STATUS_AC_CONNECTED = 1 << 1,
+ FF_BATTERY_STATUS_USB_CONNECTED = 1 << 2,
+ FF_BATTERY_STATUS_WIRELESS_CONNECTED = 1 << 3,
+ FF_BATTERY_STATUS_CHARGING = 1 << 4,
+ FF_BATTERY_STATUS_DISCHARGING = 1 << 5,
+ FF_BATTERY_STATUS_CRITICAL = 1 << 6,
+} FFBatteryStatus;
+
+typedef struct FFBatteryResult {
+ FFstrbuf manufacturer;
+ FFstrbuf manufactureDate;
+ FFstrbuf modelName;
+ FFstrbuf technology;
+ FFstrbuf serial;
+ FFBatteryStatus status;
+ double capacity;
+ double temperature;
+ uint32_t cycleCount;
+ int32_t timeRemaining; // in seconds, -1 if unknown
+} FFBatteryResult;
+
+const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results);