Program Listing for File battery.hpp

Return to documentation for file (/tmp/ws/src/kobuki_core/include/kobuki_core/modules/battery.hpp)

/*****************************************************************************
** Ifdefs
*****************************************************************************/

#ifndef KOBUKI_CORE_BATTERY_HPP_
#define KOBUKI_CORE_BATTERY_HPP_

/*****************************************************************************
** Includes
*****************************************************************************/

#include <stdint.h>
#include "../packets/core_sensors.hpp"
#include "../macros.hpp"

/*****************************************************************************
** Namespaces
*****************************************************************************/

namespace kobuki {

/*****************************************************************************
** Interfaces
*****************************************************************************/

class kobuki_PUBLIC Battery {
public:
  enum Source {
    None,
    Adapter,
    Dock
  };
  enum Level {
    Dangerous,
    Low,
    Healthy,
    Maximum
  };
  enum State {
    Discharging,
    Charged,
    Charging
  };

  Battery() {}
  Battery (const uint8_t &new_voltage, const uint8_t &charger_flag);
  Level level() const;
  float percent() const;

  static double capacity;
  static double low;
  static double dangerous;
  double voltage;
  State charging_state;
  Source charging_source;
};

} // namespace kobuki

#endif /* KOBUKI_CORE_BATTERY_HPP_ */