[O] Make measurement for battery
This commit is contained in:
@@ -1,15 +1,16 @@
|
|||||||
package org.hydev.wearsync.bles.decoders
|
package org.hydev.wearsync.bles.decoders
|
||||||
|
|
||||||
|
import com.influxdb.annotations.Measurement
|
||||||
import com.welie.blessed.asUInt8
|
import com.welie.blessed.asUInt8
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class BatteryDecoder : IDecoder<UInt>
|
@Measurement(name = "wear-battery")
|
||||||
|
data class BatteryMeasurement(val percent: UInt)
|
||||||
|
|
||||||
|
class BatteryDecoder : IDecoder<BatteryMeasurement>
|
||||||
{
|
{
|
||||||
override val sid = UUID.fromString("0000180F-0000-1000-8000-00805f9b34fb")
|
override val sid = UUID.fromString("0000180F-0000-1000-8000-00805f9b34fb")
|
||||||
override val cid = UUID.fromString("00002A19-0000-1000-8000-00805f9b34fb")
|
override val cid = UUID.fromString("00002A19-0000-1000-8000-00805f9b34fb")
|
||||||
|
|
||||||
override fun decode(value: ByteArray): UInt
|
override fun decode(value: ByteArray) = BatteryMeasurement(value.asUInt8()!!)
|
||||||
{
|
|
||||||
return value.asUInt8()!!
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -8,8 +8,5 @@ class ModelDecoder : IDecoder<String>
|
|||||||
override val sid = UUID.fromString("0000180A-0000-1000-8000-00805f9b34fb")
|
override val sid = UUID.fromString("0000180A-0000-1000-8000-00805f9b34fb")
|
||||||
override val cid = UUID.fromString("00002A24-0000-1000-8000-00805f9b34fb")
|
override val cid = UUID.fromString("00002A24-0000-1000-8000-00805f9b34fb")
|
||||||
|
|
||||||
override fun decode(value: ByteArray): String
|
override fun decode(value: ByteArray) = value.asString()
|
||||||
{
|
|
||||||
return value.asString()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user