#ifndef SERIALGPS_H
#define SERIALGPS_H
#include <QObject>
#include <QSerialPort>
#include <QPushButton>
#include <QLineEdit>
#include <QTextEdit>
#include <QByteArray>
#include "../paregnrmc.h"

class SerialGPS: public QObject
{
    Q_OBJECT
public:
    SerialGPS(QObject *parent = nullptr);
    RMCData getStoredGNRMCData() const;
    void openSerialPort();
    void closeSerialPort();

signals:
    void openCloseButtonTextChanged(const QString& text);
    void openError();
    void dataReceived(const QByteArray& data);
    void gnrmcDataReceived(const RMCData storedGNRMCData);
    void storedGNRMCDataUpdated(const RMCData &data); // 新增信号

private slots:
    void sendData();
    void readData();


private:
    void setupSerialPort();

    QSerialPort serialPort;
    RMCData storedGNRMCData;
};

#endif // SERIALGPS_H
