API Documentation
Loading...
Searching...
No Matches
Battery.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Hardware
28File: Battery
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Device.h>
34#include <QObject>
35namespace NDEVR
36{
37 class Log;
38 class JSONNode;
39 /**--------------------------------------------------------------------------------------------------
40 \brief An indication of what state a Battery object is in.
41 *-----------------------------------------------------------------------------------------------**/
51 /**--------------------------------------------------------------------------------------------------
52 \brief The various types of capacity information a Battery may have.
53 *-----------------------------------------------------------------------------------------------**/
55 {
58 , e_voltage
59 };
60 /**--------------------------------------------------------------------------------------------------
61 \brief For a given BatteryCapacityType, the limits that define the state of the battery.
62 *-----------------------------------------------------------------------------------------------**/
78 /**--------------------------------------------------------------------------------------------------
79 \brief A device which has an accociated voltage or percent that changes. Can have set upper and lower
80 limits.
81 *-----------------------------------------------------------------------------------------------**/
83 {
84 Q_OBJECT
85 public:
86 Battery(const Model& name, ProgressInfo* log, QObject* parent = nullptr);
87 [[nodiscard]] fltp04 percent() const;
91 virtual void setBatteryLevel(BatteryCapacityType type, fltp04 value);
93 void showWarning(const TranslatedString& warning) const override;
94 bool isCharging() const;
95 void setIsCharging(bool is_charging);
97 virtual void forceBatteryState(const BatteryState& state);
98 [[nodiscard]] virtual BatteryState batteryState() const;
99 [[nodiscard]] virtual BatteryState batteryGroupState() const;
100 signals:
102 void batteryGroupStateChangedSignal(bool originator);
103 protected:
111 };
112}
#define HARDWARE_API
Definition DLLInfo.h:74
A device which has an accociated voltage or percent that changes. Can have set upper and lower.
Definition Battery.h:83
virtual BatteryState batteryState() const
void addBatteryGroupMember(Battery *battery)
void setIsCharging(bool is_charging)
virtual fltp04 batteryLevel(BatteryCapacityType type) const
bool m_is_charging
Definition Battery.h:110
Battery(const Model &name, ProgressInfo *log, QObject *parent=nullptr)
Time m_last_state_stable_time
Definition Battery.h:106
void setCapacityInfo(BatteryCapacityType type, const BatteryCapacityInfo &info)
bool isCharging() const
virtual BatteryState batteryGroupState() const
Buffer< Battery * > m_battery_group_members
Definition Battery.h:104
void batteryStateChangedSignal()
void batteryGroupStateChangedSignal(bool originator)
BatteryState m_bat_state
Definition Battery.h:107
fltp04 percent() const
BatteryState m_bat_group_state
Definition Battery.h:108
void showWarning(const TranslatedString &warning) const override
virtual void setBatteryLevel(BatteryCapacityType type, fltp04 value)
BatteryCapacityInfo capacityInfo(BatteryCapacityType type) const
Vector< 3, BatteryCapacityInfo > m_capacity_info
Definition Battery.h:105
BatteryState m_forced_bat_state
Definition Battery.h:109
virtual void autoUpdateBatteryState(BatteryCapacityType mode)
virtual void forceBatteryState(const BatteryState &state)
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
Definition Device.h:48
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Definition JSONParser.h:60
A core class that represents a node on model heirarchy. This node may contain a Geometry or.
Definition Model.h:58
A light-weight base class for Log that allows processes to update, without the need for.
Definition ProgressInfo.hpp:48
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
BatteryCapacityType
The various types of capacity information a Battery may have.
Definition Battery.h:55
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:125
BatteryState
An indication of what state a Battery object is in.
Definition Battery.h:43
For a given BatteryCapacityType, the limits that define the state of the battery.
Definition Battery.h:64
void toJSONNode(JSONNode &node) const
void fromJSONNode(const JSONNode &node)
bool canChangeBatteryState() const
bool operator!=(const BatteryCapacityInfo &info) const
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved.
Definition BaseValues.hpp:230