QAlphaCloud  0.0.1
Qt bindings for Alpha Cloud
Public Types | Public Slots | Signals | Public Member Functions | Properties | List of all members
QAlphaCloud::StorageSystemsModel Class Reference

Storage Systems Model. More...

#include <storagesystemsmodel.h>

Inherits QAbstractListModel.

Public Types

enum class  Roles {
  SerialNumber = Qt::UserRole , Status , InverterModel , InverterPower ,
  BatteryModel , BatteryGrossCapacity , BatteryRemainingCapacity , BatteryUsableCapacity ,
  PhotovoltaicPower , RawJson
}
 The model roles. More...
 

Public Slots

bool reload ()
 (Re)load data More...
 

Signals

void countChanged ()
 

Public Member Functions

 StorageSystemsModel (QObject *parent=nullptr)
 Creates a StorageSystemsModel instance. More...
 
 StorageSystemsModel (QAlphaCloud::Connector *connector, QObject *parent=nullptr)
 Creates a StorageSystemsModel intsance. More...
 
Q_REQUIRED_RESULT QAlphaCloud::Connectorconnector () const
 
void setConnector (QAlphaCloud::Connector *connector)
 
Q_SIGNAL void connectorChanged (QAlphaCloud::Connector *connector)
 
Q_REQUIRED_RESULT bool cached () const
 
void setCached (bool cached)
 
Q_SIGNAL void cachedChanged (bool cached)
 
QAlphaCloud::RequestStatus status () const
 
Q_SIGNAL void statusChanged (QAlphaCloud::RequestStatus status)
 
QString primarySerialNumber () const
 
Q_SIGNAL void primarySerialNumberChanged (const QString &primarySerialNumber)
 
QAlphaCloud::ErrorCode error () const
 
Q_SIGNAL void errorChanged (QAlphaCloud::ErrorCode error)
 
QString errorString () const
 
Q_SIGNAL void errorStringChanged (const QString &errorString)
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QHash< int, QByteArray > roleNames () const override
 

Properties

QAlphaCloud::Connectorconnector
 The connector to use.
 
bool cached
 Cache the data on disk. More...
 
int count
 The number of items in the model.
 
QString primarySerialNumber
 The first serial number in the model. More...
 
QAlphaCloud::RequestStatus status
 The current request status. More...
 
QAlphaCloud::ErrorCode error
 The error, if any. More...
 
QString errorString
 The error string, if any. More...
 

Detailed Description

Storage Systems Model.

List all storage systems associated with the user.

Wraps the /getEssList API endpoint.

Member Enumeration Documentation

◆ Roles

The model roles.

Enumerator
SerialNumber 

System serial number (QString).

Status 

Status of the energy management system (QAlphaCloud::SystemStatus).

InverterModel 

Interver model (QString).

InverterPower 

Gross power of the inverter system in W (int).

BatteryModel 

Battery model (QString).

BatteryGrossCapacity 

Gross battery capacity in Wh. Typically there's a capacity buffer that cannot be used (int).

BatteryRemainingCapacity 

Remaining battery capacity in Wh (int).

BatteryUsableCapacity 

Usable battery capacity in per-cent % (qreal).

PhotovoltaicPower 

Gross power provided by the photovoltaic system in W (int).

RawJson 

Returns the raw JSON data for this system. Useful for extracting properties that aren't provided through the model (QJsonObject).

Constructor & Destructor Documentation

◆ StorageSystemsModel() [1/2]

QAlphaCloud::StorageSystemsModel::StorageSystemsModel ( QObject *  parent = nullptr)
explicit

Creates a StorageSystemsModel instance.

Parameters
parentThe owner
Note
A connector must be set before requests can be made.

◆ StorageSystemsModel() [2/2]

QAlphaCloud::StorageSystemsModel::StorageSystemsModel ( QAlphaCloud::Connector connector,
QObject *  parent = nullptr 
)
explicit

Creates a StorageSystemsModel intsance.

Parameters
connectorThe connector
parentThe owner

Member Function Documentation

◆ reload

bool QAlphaCloud::StorageSystemsModel::reload ( )
slot

(Re)load data

Note
Contrary to the other objects, this is not done automatically in QML.
You must set a connector before requests can be sent.
When the request fails, the current data is not cleared.

Property Documentation

◆ cached

bool QAlphaCloud::StorageSystemsModel::cached
readwrite

Cache the data on disk.

Whether to cache the storage systems data on disk since it is unlikely to change often. Default is true.

◆ error

QAlphaCloud::ErrorCode QAlphaCloud::StorageSystemsModel::error
read

The error, if any.

There can still be valid data in the model from a previous successful request.

◆ errorString

QString QAlphaCloud::StorageSystemsModel::errorString
read

The error string, if any.

Note
Not every error code has an errorString associated with it.

◆ primarySerialNumber

QString QAlphaCloud::StorageSystemsModel::primarySerialNumber
read

The first serial number in the model.

This is provided for convenience, so one does not need to deal with QAbstractListModel API for serving the common case of having a single storage system.

◆ status

QAlphaCloud::RequestStatus QAlphaCloud::StorageSystemsModel::status
read

The current request status.

The model may contain cached data before a request is sent and even if status is NoRequest.


The documentation for this class was generated from the following files: