#ifndef SERVER_H
#define SERVER_H

#include <QObject>
#include <QTcpServer>
#include <QNetworkInterface>
#include <QStringList>
#include "connection.h"


class Server : public QObject
{
    Q_OBJECT
public:
    explicit Server(QObject *parent = 0);
    QStringList getIpList();
    void startServer(QHostAddress);
    void stopServer();
    QString getStatus();
    void send(const QByteArray &ba);
    
private:
    QTcpServer * m_server;
    QList <Connection*> clients;
    int next_conn_id;

private slots:
    void newConnection();
    void connectionClosed();
    void received(QByteArray ba);

signals:
    void receiveData(QByteArray ba);

};

#endif // SERVER_H
