#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "qtcpserver.h"
#include <QList>
#include <QNetworkInterface>
#include <anchor.h>
#include <QPlainTextEdit>
#include <qcustomplot.h>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    QTcpServer server;
    QList<QHostAddress> adresy;
    Anchor tag0[6], tag1[6], tag2[6];
    int tag0Trilateration[3]={0,1,2}, tag1Trilateration[3]={0,1,2}, tag2Trilateration[3]={0,1,2};

private slots:
    void new_connection();
    void new_data();
    void on_SetAPossitionClicked();
    void on_ShowAPossitionClicked();
    void on_rButtonT0Clicked();
    void on_rButtonT1Clicked();
    void on_rButtonT2Clicked();
    void setData(QByteArray recieved);
    void getData(QByteArray recieved, QTcpSocket* client);
    void showChangedData(Anchor &rtag, QByteArray recieved);
    void showRecievedInConsole(QByteArray recieved, QDateTime currentTime);
    void pteClearSet(QPlainTextEdit* pteDate, QPlainTextEdit* pteRssi, QString sDate, QString sRssi);
    void pteGetDouble(QPlainTextEdit* pteXP, QPlainTextEdit* pteYP, int AnchorNumber);
    void pteSetString(QPlainTextEdit* pteXP, QPlainTextEdit* pteYP, int AnchorNumber);
    void plotInit();
    void drawLine(double x0, double y0, double x1, double y1, int graphNumber);
    void showCircle(Anchor &rtag, QCPCurve* Circle);
    void showCircle(Anchor &rtag, QCPCurve* Circle, int sequence);
    void showCircle(QVector3D &rPoint, QCPCurve* Circle);
    void trilaterate(int tagNumber, int* ptagTrilateration);

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
