summaryrefslogtreecommitdiff
path: root/watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-01-04 04:04:03 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-01-04 04:04:03 +0300
commitbb32e56ca28bb43d5d5afef737f25e4725887725 (patch)
tree519388eb284adeb47744a9ebc334bdf9ff5444a6 /watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift
parentd549f428cbbd54c49a90f92928e670d373c4a0d9 (diff)
move watchos app sources here (which should be rewritten anyway, and usable only in very specific conditions)
Diffstat (limited to 'watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift')
-rw-r--r--watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift29
1 files changed, 29 insertions, 0 deletions
diff --git a/watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift b/watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift
new file mode 100644
index 0000000..cd31eea
--- /dev/null
+++ b/watchos/InfiniSolar/InfiniSolar WatchKit Extension/InverterStatus.swift
@@ -0,0 +1,29 @@
+//
+// InverterStatus.swift
+// InfiniSolar WatchKit Extension
+//
+// Created by Evgeny Zinoviev on 03.08.2021.
+//
+
+import Foundation
+
+struct InverterStatus: Hashable {
+ public var batteryVoltage: Float
+ public var batteryCapacity: Int
+ public var activePower: Int
+ public var pvInputPower: Int
+
+ init(batteryVoltage: Float, batteryCapacity: Int, activePower: Int, pvInputPower: Int) {
+ self.batteryVoltage = batteryVoltage
+ self.batteryCapacity = batteryCapacity
+ self.activePower = activePower
+ self.pvInputPower = pvInputPower
+ }
+
+ func hasData() -> Bool {
+ return self.batteryVoltage != 0
+ || self.batteryCapacity != 0
+ || self.activePower != 0
+ || self.pvInputPower != 0
+ }
+}