![]() |
Fotobot
Get data from your photovoltaic plant
|
Virtual class for invertor communication. More...
#include <invertor.h>
Public Slots | |
void | quit () |
Quits the running thread. More... | |
Signals | |
void | data (DBT_DATA) |
Signal to send retrieved data to other objects. More... | |
void | loopFinished (int number_of_ok, int number_of_err) |
Signal is sent when reading cycle was finished and all invertors were read. More... | |
Public Member Functions | |
INVERTOR_status | status () |
Returns current status of the line. | |
virtual void | setLine (const DBT_LINES &) |
Sets the parameters for the line. More... | |
virtual void | setInvertors (const QList< DBT_INVERTORS > &) |
Sets the list of invertors connected to the line. More... | |
void | start (Priority priority=InheritPriority) |
Starts the thread. More... | |
Static Public Member Functions | |
static INVERTOR * | create (DBT_LINES::Type) |
Factory makes instances depending on type. | |
Protected Slots | |
virtual void | slotInit ()=0 |
Initializes ancestors. More... | |
virtual void | slotQuit ()=0 |
Quits ancestors. More... | |
Protected Member Functions | |
void | setStatus (int address, int retries, const QString &command, const QString &status) |
Set status of line. | |
Protected Attributes | |
DBT_LINES | m_line |
Stores information about line. | |
QList< DBT_INVERTORS > | m_invertors |
Stores information about all invertors connected to the line. | |
Private Attributes | |
INVERTOR_status | m_status |
Line status. | |
QMutex | m_status_mutex |
Virtual class for invertor communication.
Every derived class must implement slotInit() nd slotQuit() methods.
As parameters the object gets the line specification in DBT_LINES object and list of invertors connected to this line in DBT_INVERTORS's list. One independent thread is started for every line.
When all needed parameters are set the start() function must be called.
Data are sent to other object using signal data(DBT_DATA);
Definition at line 28 of file invertor.h.
|
signal |
Signal to send retrieved data to other objects.
In main thread this signal is connected to DATABASE object and saves the stored data to database file.
All retrieved data should be stored in the DBT_DATA class. When an error occured, the error member variable must be set. Then the other values stored in class are ignored.
|
signal |
Signal is sent when reading cycle was finished and all invertors were read.
As a response to this signal the database commit should be requested.
|
slot |
Quits the running thread.
From this slot the virtual method slotQuit() is called so the child class can stop its work and close all opened file descriptors.
Definition at line 69 of file invertor.cpp.
|
virtual |
Sets the list of invertors connected to the line.
The DBT_INVERTORS corresonds to database table INVERTORS.
Definition at line 49 of file invertor.cpp.
|
virtual |
Sets the parameters for the line.
The DBT_LINES corresponds to database table LINES - all needed parameters should be set in the database using webserver part.
Definition at line 42 of file invertor.cpp.
|
protectedpure virtualslot |
Initializes ancestors.
This function is called as a first event from event loop when new thread is started.
Important: Do not create any Qt object in derived class's constructor. Make new objects (timers, serial lines and so on) in the slotInit() implementation. Constructor and slotInit() function are called within different threads so all objects created in constructor makes problem later.
|
protectedpure virtualslot |
Quits ancestors.
This function is called when the quit signal was received. You should close your serial lines and make other necessary jobs to end the invertor. Do not call QThread::quit() from this function since it is called after your action automatically in INVERTOR::quit() method.
void INVERTOR::start | ( | Priority | priority = InheritPriority | ) |
Starts the thread.
Starts the thread's event loop, moves the object to that thread and calls from the event loop ancestor's slotInit() function.
Definition at line 36 of file invertor.cpp.