6#include "roo_logging.h"
10#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
30 float inVolts()
const {
return voltage_; }
39 bool isUnknown()
const {
return std::isnan(voltage_); }
42 return voltage_ < other.voltage_;
46 return voltage_ == other.voltage_;
50 return other.voltage_ < voltage_;
54 return !(other.voltage_ < voltage_);
58 return !(voltage_ < other.voltage_);
62 return !(voltage_ == other.voltage_);
85#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
87 std::string asString()
const;
91 String asArduinoString()
const;
99 explicit Voltage(
float voltage) : voltage_(voltage) {}
194roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Voltage& val);
Representation of charge, internally stored as floating-point Coulombs.
float inCoulombs() const
Returns the charge in Coulombs.
Representation of current, internally stored as floating-point Amperes.
float inAmperes() const
Returns the current in Amperes.
Representation of power, internally stored as floating-point Watts.
float inWatts() const
Returns the power in Watts.
Representation of voltage, internally stored as floating-point Volts.
bool operator<(const Voltage &other) const
friend Voltage UnknownVoltage()
Returns a voltage object representing an unknown voltage.
float inMilliVolts() const
Returns the voltage in milliVolts.
bool operator>(const Voltage &other) const
float inMicroVolts() const
Returns the voltage in microVolts.
Voltage & operator*=(float multi)
float inVolts() const
Returns the voltage in Volts.
friend Voltage VoltageInVolts(float)
Returns a voltage object equivalent to the specified voltage expressed in Volts.
Voltage & operator+=(const Voltage &other)
float inKiloVolts() const
Returns the voltage in kiloVolts.
bool operator<=(const Voltage &other) const
Voltage & operator-=(const Voltage &other)
Voltage & operator/=(float div)
Voltage()
Creates a voltage object representing an 'unknown' voltage.
bool operator!=(const Voltage &other) const
bool operator>=(const Voltage &other) const
bool isUnknown() const
Returns whether the object represents an unknown voltage.
bool operator==(const Voltage &other) const
Representation of work, internally stored as floating-point Joules.
float inJoules() const
Returns the work in joules.
For convenience conversion from roo_time::Duration.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Current CurrentInAmperes(float current)
Returns a current object equivalent to the specified current expressed in Amperes.
Voltage VoltageInVolts(float voltage)
Returns a voltage object equivalent to the specified voltage expressed in Volts.
Area operator+(Area a, Area b)
Voltage VoltageInMicroVolts(float voltage)
Returns a voltage object equivalent to the specified voltage expressed in microVolts.
Power PowerInWatts(float power)
Returns a power object equivalent to the specified power expressed in Watts.
Area operator-(Area a, Area b)
Work WorkInJoules(float work)
Returns a work object equivalent to the specified work expressed in Joules.
Voltage VoltageInMilliVolts(float voltage)
Returns a voltage object equivalent to the specified voltage expressed in milliVolts.
Voltage UnknownVoltage()
Returns a voltage object representing an unknown voltage.
Area operator/(Area a, float b)
Area operator*(Area a, float b)
Voltage VoltageInKiloVolts(float voltage)
Returns a voltage object equivalent to the specified voltage expressed in kiloVolts.
Charge ChargeInCoulombs(float charge)
Returns a charge object equivalent to the specified charge expressed in Coulombs.