#pragma once
#include "pch.h"
class GY39Controller :public QObject
{
	Q_OBJECT
public:
	GY39Controller(QObject* parent = nullptr);
	~GY39Controller();
private:
	int SendCommand(QByteArray qbCommand);
	int RecvHumitureData(QByteArray &qbData);
	int ParseHumitureData(QByteArray &qbData);
public:
	int Initialize(std::string ucPortName,bool bAuto15 = false,bool bAuto45 = false);
	int GetHumiture(float &fTemp, float &fHum);
	int GetHumiture_retry(float &fTemp, float &fHum);
public slots:
signals:

private:
	int m_iBaudRate;
	QSerialPort *m_pSerialPort;
	float m_fTemperature, m_fHumidity;
};