#ifndef GRIFOTIMERDOCKWIDGET_H
#define GRIFOTIMERDOCKWIDGET_H

#include <QFrame>
#include "qgscopedevice.h"

class GrifoTimerDevice: public QgScopeDevice
{
    Q_OBJECT

    Q_PROPERTY(bool connected MEMBER m_connected)
    Q_PROPERTY(BatchMode batchMode READ batchMode WRITE setBatchMode)
    Q_PROPERTY(unsigned int batchCounter READ batchCounter WRITE setBatchCounter)
    Q_PROPERTY(unsigned int batchLen MEMBER m_batchLen)

    Q_PROPERTY(unsigned int batchbreak MEMBER m_batchBreak)

    Q_PROPERTY(int fragsPerBatch READ fragsPerBatch WRITE setFragsPerBatch)
    Q_PROPERTY(int sendFastMode READ sendFastMode WRITE setSendFastMode)

public:
   enum BatchMode { BatchSlave, BatchMaster, BatchAuto};
   Q_ENUM(BatchMode)

   GrifoTimerDevice();

   BatchMode batchMode() const;
   void setBatchMode(BatchMode m);

   void setFragsPerBatch(int n);
   int fragsPerBatch() const;

   void setSendFastMode(int n);
   int sendFastMode() const;


   unsigned int batchCounter() const;
   void setBatchCounter(unsigned int);

public slots:
    void simulationReset();
    void scSetTestImageCenter(int x, int y);

Q_SIGNALS:
    void batchGenerated(int n);

private:
   bool m_connected;
   //unsigned int m_batchCounter;
   unsigned int m_batchLen;
   unsigned int m_batchBreak;

   class Implementation;
   Implementation& p_;

   friend class GrifoTimerDockWidget;
};

namespace Ui {
class GrifoTimerDockWidget;
}

class GrifoTimerDockWidget : public QFrame
{
    Q_OBJECT

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

    QgScopeDevice* scopeDevice() const;
private slots:
    void on_tbStep_clicked();

private:
    Ui::GrifoTimerDockWidget *ui;

    class GrifoTimerDevice& p_;
};

#endif // GRIFOTIMERDOCKWIDGET_H
