Fotobot
Get data from your photovoltaic plant
socketlist.h
Go to the documentation of this file.
1 
6 #ifndef _SocketList_H_
7 #define _SocketList_H_
8 
9 #include <QObject>
10 #include <QTcpSocket>
11 #include <QHash>
12 #include <QThread>
13 
14 #define SOCKETLIST SocketList::socketList()
15 
19 class SocketList : public QObject {
20  Q_OBJECT
21  public:
22  static SocketList *socketList(QObject *parent = NULL);
23 
29  QTcpSocket *socket(int line);
30 
36  void addLine(int line, const QString& hostname, int port);
37 
45  void open(int line);
46 
47  private:
48  SocketList(QObject *parent);
49  static SocketList *m_socketList;
50 
51  QHash<int, QTcpSocket *> m_line_socket;
52  QHash<int, QString> m_line_hostname;
53  QHash<int, int> m_line_port;
54 
55  QThread *m_parentThread;
56 };
57 
58 #endif
59 
void addLine(int line, const QString &hostname, int port)
Adds new line to list.
Definition: socketlist.cpp:25
QTcpSocket * socket(int line)
Returns socket associated with line.
Definition: socketlist.cpp:67
void open(int line)
Opens socket for line.
Definition: socketlist.cpp:37