#ifndef LATTICE_COM_REIGN_H
#define LATTICE_COM_REIGN_H

#include <QMainWindow>

#include <QtSerialPort/qserialport.h>
#include <QtSerialPort/qserialportinfo.h>

#include <qtimer.h>

#define __u8    unsigned char

namespace Ui {
class lattice_com_reign;
}

class lattice_com_reign : public QMainWindow
{
    Q_OBJECT

public:
    explicit lattice_com_reign(QWidget *parent = 0);
    ~lattice_com_reign();

private slots:
    void toLog (QString str);

    void on_com_reflesh_clicked();

    void on_com_list_currentIndexChanged(int index);

    void on_connect_clicked();

    void on_com_tx_clicked();

    void on_clear_log_clicked();

    //int hid_scan_report(__u8* stt, __u8* stp);//struct hid_device *hid);

protected slots:
    void com_data_received();

private:
    Ui::lattice_com_reign *ui;    
    QList<QSerialPortInfo> com_list;
    QSerialPort com;

    QString log;
    QString com_outs;

    QTimer tmr;

    QVector <char> i2c_data;
};

#endif // LATTICE_COM_REIGN_H
