aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--advertisement.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/advertisement.go b/advertisement.go
index 7bf2e1c..363b28f 100644
--- a/advertisement.go
+++ b/advertisement.go
@@ -1,9 +1,9 @@
package anki
const (
- VehicleStateFullBattery = 1 << 4
- VehicleStateLowBattery = 1 << 5
- VehicleStateOnCharger = 1 << 6
+ stateFullBattery = 1 << 4
+ stateLowBattery = 1 << 5
+ stateOnCharger = 1 << 6
)
type VehicleAdvInfo struct {
@@ -13,6 +13,18 @@ type VehicleAdvInfo struct {
Name [13]byte // UTF8: 12 bytes + NULL
}
+func (v VehicleAdvInfo) FullBattery() bool {
+ return v.VehicleAdvState&stateFullBattery != 0
+}
+
+func (v VehicleAdvInfo) LowBattery() bool {
+ return v.VehicleAdvState&stateLowBattery != 0
+}
+
+func (v VehicleAdvInfo) OnCharger() bool {
+ return v.VehicleAdvState&stateOnCharger != 0
+}
+
type VehicleAdvMfg struct {
Identifier uint32
ModelID uint8