#pragma once

#include <QObject>
#include "QtEndian"
#include "QTimer"
#include "QTcpSocket"
class OptoSkyManager : public QObject
{
	Q_OBJECT

public:
	OptoSkyManager(QObject *parent);
	~OptoSkyManager();
	void optall();
	void getdata();
	void readconnect();
	QString actionmod;
	QTimer *timer;
	int waittime;
	int temp1, temp2;
	void loadtcp();
	bool isreadtogotdata;
	bool readbutdonothing(int size);
	bool reloadtcp();
	float darkarry[2151];
	int flatwite;
	int flatdark;
	QString processstr;
	QString IP_Address;
	int SampleAverage;
	int WhiteReferenceAverage;
	int DarkCurrentAverage;

private:
	void ChangeArrEnding(float *data, int lenth);
public slots:
	void conecet();
	void sendMessage();
	void onReciveData();
	void sendgotdata();
	void ComFromUI(QString commom);
	/*	void gotdata();*/
	void ondisconnect();
	void ReadError(QAbstractSocket::SocketError);


signals:
	void Senddatatoui(QString datatype, QByteArray data);
	void UpdataProcessBar(QString str, int val);
};
