Skip to content

Commit 9d0ef23

Browse files
committed
feature: add BatteryStatus() function to display values
Signed-off-by: deadprogram <[email protected]>
1 parent be94c7d commit 9d0ef23

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/findmy/data.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,19 @@ func NewData(keyData []byte) bluetooth.ManufacturerDataElement {
8888
Data: data,
8989
}
9090
}
91+
92+
// BatteryStatus returns a string representation of the battery status.
93+
func BatteryStatus(status byte) string {
94+
switch status {
95+
case StatusBatteryFull:
96+
return "full"
97+
case StatusBatteryMedium:
98+
return "medium"
99+
case StatusBatteryLow:
100+
return "low"
101+
case StatusBatteryCritical:
102+
return "critical"
103+
default:
104+
return "unknown"
105+
}
106+
}

0 commit comments

Comments
 (0)