Torc
0.1
|
#include <torccontrol.h>
Public Types | |
enum | Type { Logic, Timer, Transition } |
Public Slots | |
void | SubscriberDeleted (QObject *Subscriber) |
void | InputValueChanged (double Value) |
void | InputValidChanged (bool Valid) |
Public Slots inherited from TorcDevice | |
bool | GetValid (void) |
double | GetValue (void) |
double | GetDefaultValue (void) |
QString | GetModelId (void) |
QString | GetUniqueId (void) |
QString | GetUserName (void) |
QString | GetUserDescription (void) |
Public Member Functions | |
virtual bool | Validate (void) |
virtual TorcControl::Type | GetType (void) const =0 |
virtual bool | IsPassthrough (void) |
Only certain logic controls can be passthrough. More... | |
virtual bool | AllowInputs (void) const |
Most controls have an input side. More... | |
bool | IsKnownInput (const QString &Input) const |
bool | IsKnownOutput (const QString &Output) const |
QString | GetUIName (void) override |
Public Member Functions inherited from TorcReferenceCounter | |
TorcReferenceCounter (void) | |
virtual | ~TorcReferenceCounter (void)=default |
void | UpRef (void) |
virtual bool | DownRef (void) |
bool | IsShared (void) |
Public Member Functions inherited from TorcHTTPService | |
TorcHTTPService (QObject *Parent, const QString &Signature, const QString &Name, const QMetaObject &MetaObject, const QString &Blacklist=QStringLiteral("")) | |
virtual | ~TorcHTTPService () |
void | ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override |
QVariantMap | ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override |
QString | GetMethod (int Index) |
QVariant | GetProperty (int Index) |
Get the value of a given property. More... | |
QVariantMap | GetServiceDetails (void) |
Return a QVariantMap describing the services methods and properties. More... | |
virtual QString | GetPresentationURL (void) |
Public Member Functions inherited from TorcHTTPHandler | |
TorcHTTPHandler (const QString &Signature, const QString &Name) | |
virtual | ~TorcHTTPHandler () |
QString | Signature (void) const |
bool | GetRecursive (void) const |
QString | Name (void) const |
Static Public Member Functions | |
static bool | ParseTimeString (const QString &Time, int &Days, int &Hours, int &Minutes, int &Seconds, quint64 &DurationInSeconds) |
Parse a Torc time string into days, hours, minutes and, if present, seconds. More... | |
static QString | DurationToString (int Days, quint64 Duration) |
Static Public Member Functions inherited from TorcReferenceCounter | |
static void | EventLoopEnding (bool Ending) |
Protected Member Functions | |
TorcControl (TorcControl::Type Type, const QVariantMap &Details) | |
virtual | ~TorcControl ()=default |
void | Graph (QByteArray *Data) |
Add this control to the state graph. More... | |
bool | Finish (void) |
Finish setup of the control. More... | |
void | InputValidChangedPriv (QObject *Input, bool Valid) |
void | CheckInputValues (void) |
void | SetValue (double Value) override |
void | SetValid (bool Valid) override |
virtual void | CalculateOutput (void)=0 |
bool | CheckForCircularReferences (const QString &UniqueId, const QString &Path) const |
Protected Member Functions inherited from TorcDevice | |
virtual | ~TorcDevice () |
Protected Member Functions inherited from TorcHTTPService | |
void | HandleSubscriberDeleted (QObject *Subscriber) |
Protected Attributes | |
bool | m_parsed |
bool | m_validated |
QStringList | m_inputList |
QStringList | m_outputList |
QMap< QObject *, QString > | m_inputs |
QMap< QObject *, QString > | m_outputs |
QMap< QObject *, double > | m_inputValues |
QMap< QObject *, double > | m_lastInputValues |
QMap< QObject *, bool > | m_inputValids |
bool | m_allInputsValid |
Protected Attributes inherited from TorcDevice | |
double | value |
double | defaultValue |
QString | modelId |
QString | uniqueId |
QString | userName |
QString | userDescription |
QMutex | lock |
bool | wasInvalid |
Protected Attributes inherited from TorcReferenceCounter | |
QAtomicInt | m_refCount |
Protected Attributes inherited from TorcHTTPService | |
QReadWriteLock | m_httpServiceLock |
Protected Attributes inherited from TorcHTTPHandler | |
QString | m_signature |
bool | m_recursive |
QString | m_name |
Friends | |
class | TorcControls |
Additional Inherited Members | |
Signals inherited from TorcDevice | |
void | ValidChanged (bool Valid) |
void | ValueChanged (double Value) |
Static Protected Member Functions inherited from TorcHTTPHandler | |
static bool | MethodIsAuthorised (TorcHTTPRequest &Request, int Allowed) |
Check the current request is authorised and set the authentication header if not. More... | |
static void | HandleOptions (TorcHTTPRequest &Request, int Allowed) |
static void | HandleFile (TorcHTTPRequest &Request, const QString &Filename, int Cache) |
Static Protected Attributes inherited from TorcDevice | |
static QHash< QString, TorcDevice * > * | gDeviceList = new QHash<QString,TorcDevice*>() |
static QMutex * | gDeviceListLock = new QMutex(QMutex::Recursive) |
Static Protected Attributes inherited from TorcReferenceCounter | |
static bool | m_eventLoopEnding = false |
Properties inherited from TorcDevice | |
bool | valid |
The control is 'valid' if all of its inputs are present, valid and have a known value. It can then determine an output value. If 'invalid' the output will be set to the default.
Definition at line 15 of file torccontrol.h.
enum TorcControl::Type |
Enumerator | |
---|---|
Logic | |
Timer | |
Transition |
Definition at line 23 of file torccontrol.h.
|
protected |
Definition at line 170 of file torccontrol.cpp.
|
protectedvirtualdefault |
|
virtual |
Most controls have an input side.
Reimplemented in TorcTimerControl.
Definition at line 290 of file torccontrol.cpp.
|
protectedpure virtual |
|
protected |
Definition at line 630 of file torccontrol.cpp.
|
protected |
Definition at line 543 of file torccontrol.cpp.
|
static |
Definition at line 156 of file torccontrol.cpp.
|
protected |
Finish setup of the control.
Finish is only called once all other parsing and validation is complete. The control is connected to its input(s) and output(s) and the device marked as validated. Qt::UniqueConnection prevents multiple slot triggering if 'paired' devices identify the same connection.
Definition at line 406 of file torccontrol.cpp.
|
pure virtual |
Implemented in TorcLogicControl, and TorcTimerControl.
|
overridevirtual |
Reimplemented from TorcHTTPService.
Definition at line 295 of file torccontrol.cpp.
|
protected |
Add this control to the state graph.
Definition at line 326 of file torccontrol.cpp.
|
slot |
Definition at line 560 of file torccontrol.cpp.
|
protected |
Definition at line 575 of file torccontrol.cpp.
|
slot |
Definition at line 508 of file torccontrol.cpp.
bool TorcControl::IsKnownInput | ( | const QString & | Input | ) | const |
Definition at line 303 of file torccontrol.cpp.
bool TorcControl::IsKnownOutput | ( | const QString & | Output | ) | const |
Definition at line 311 of file torccontrol.cpp.
|
virtual |
Only certain logic controls can be passthrough.
Reimplemented in TorcLogicControl.
Definition at line 284 of file torccontrol.cpp.
|
static |
Parse a Torc time string into days, hours, minutes and, if present, seconds.
Valid times are of the format MM, HH:MM, DD:HH:MM with an optional trailing .SS for seconds.
Definition at line 36 of file torccontrol.cpp.
|
overrideprotectedvirtual |
Reimplemented from TorcDevice.
Definition at line 615 of file torccontrol.cpp.
|
overrideprotectedvirtual |
Reimplemented from TorcDevice.
Definition at line 607 of file torccontrol.cpp.
|
slot |
Definition at line 503 of file torccontrol.cpp.
|
virtual |
Reimplemented in TorcLogicControl, and TorcTimerControl.
Definition at line 202 of file torccontrol.cpp.
|
friend |
Definition at line 17 of file torccontrol.h.
|
protected |
Definition at line 76 of file torccontrol.h.
|
protected |
Definition at line 69 of file torccontrol.h.
|
protected |
Definition at line 71 of file torccontrol.h.
|
protected |
Definition at line 75 of file torccontrol.h.
|
protected |
Definition at line 73 of file torccontrol.h.
|
protected |
Definition at line 74 of file torccontrol.h.
|
protected |
Definition at line 70 of file torccontrol.h.
|
protected |
Definition at line 72 of file torccontrol.h.
|
protected |
Definition at line 67 of file torccontrol.h.
|
protected |
Definition at line 68 of file torccontrol.h.