Exemplo n.º 1
0
 private async void Battery_ValueChanged(BatteryValue value)
 {
     _logger.LogInformation($"Battery level:{value.Level}");
     if (value.Level < MINIMUM_BATTERY_LEVEL)
     {
         _logger.LogWarning("Fatal battery level aborting the program");
         await Stop();
     }
 }
Exemplo n.º 2
0
        internal static BatteryValue BatteryValue(byte[] data, int index)
        {
            BatteryValue battery = new BatteryValue(BatteryMode.All);

            battery.Voltage     = BitConverter.ToSingle(data, index);
            index              += DataType.DATAF.ByteLength();
            battery.Ampere      = BitConverter.ToSingle(data, index);
            index              += DataType.DATAF.ByteLength();
            battery.Temperature = BitConverter.ToSingle(data, index);
            index              += DataType.DATAF.ByteLength();
            battery.Level       = data[index];
            return(battery);
        }