![]() |
Fotobot
Get data from your photovoltaic plant
|
Communicates with invertors using serial port. More...
#include <modbustcp.h>
Public Slots | |
void | open () |
Opens serial port. More... | |
![]() | |
void | quit () |
Quits the running thread. More... | |
Public Member Functions | |
MODBUSTCP () | |
Constructor. The very basic initializations. More... | |
![]() | |
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... | |
Private Slots | |
void | slotInit () |
Function called within running thread to initialize all needed child objects. More... | |
void | slotQuit () |
void | loop () |
Loops the invertors's list. More... | |
Private Member Functions | |
void | readInvertor () |
void | readInvertorInfo (const DBT_INVERTORS &invertor) |
QByteArray | readModbus (const DBT_INVERTORS &invertor, quint16 regaddress, quint16 regcnt, quint16 expectedLength) |
void | incrementFrameId () |
float | float32 (const QByteArray &data, int offset) const |
qint16 | integer16 (const QByteArray &data, int offset) const |
qint32 | integer32 (const QByteArray &data, int offset) const |
QString | stateToString (int) |
QString | exceptionCodeToString (int) |
Private Attributes | |
QTimer * | m_timer |
quint16 | m_frameid |
int | m_current_invertor_index |
Current index in INVERTOR::m_invertors list. | |
int | m_number_of_ok |
int | m_number_of_err |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
static INVERTOR * | create (DBT_LINES::Type) |
Factory makes instances depending on type. | |
![]() | |
virtual void | slotInit ()=0 |
Initializes ancestors. More... | |
virtual void | slotQuit ()=0 |
Quits ancestors. More... | |
![]() | |
void | setStatus (int address, int retries, const QString &command, const QString &status) |
Set status of line. | |
![]() | |
DBT_LINES | m_line |
Stores information about line. | |
QList< DBT_INVERTORS > | m_invertors |
Stores information about all invertors connected to the line. | |
Communicates with invertors using serial port.
The class opens one serial port. If you have more ports, you have to have more instances of the MODBUSTCP class;
Definition at line 26 of file modbustcp.h.
MODBUSTCP::MODBUSTCP | ( | ) |
Constructor. The very basic initializations.
Only basic initializations can be made here. All needed objects must be created in slotInit() function. Constructor runs in different thread than the rest of the class!
Definition at line 35 of file modbustcp.cpp.
|
privateslot |
Loops the invertors's list.
Slot is called from timer's signal. Loops throw the invertors's list and call readInvertor() function for every invertor in the list, one invertor per call.
Current invertor index in m_invertors list is stored in m_current_invertor_index member variable.
At the end starts timer again so the event loop calls this function again when the inverval passes.
Definition at line 96 of file modbustcp.cpp.
|
slot |
Opens serial port.
Opens serial port and set all communication parameters. Starts timer for main loop when successfull.
Sends the data signal with error message set when an error occured.
Definition at line 79 of file modbustcp.cpp.
|
privateslot |
Function called within running thread to initialize all needed child objects.
This is the first function called when the object is created and new thread event loop is started. All needed objects must be created in this function.
Definition at line 51 of file modbustcp.cpp.