XbeeConfigurationWindow.h 1.42 KB
Newer Older
Franz's avatar
Franz committed
1 2 3 4 5 6 7 8 9
#ifndef _XBEECONFIGURATIONWINDOW_H_
#define _XBEECONFIGURATIONWINDOW_H_

#include <QObject>
#include <QWidget>
#include <QAction>
#include <QTimer>
#include <QShowEvent>
#include <QHideEvent>
10 11 12
#include <QComboBox>
#include <QLabel>
#include <QLayout>
Franz's avatar
Franz committed
13 14
#include <LinkInterface.h>
#include"XbeeLinkInterface.h"
oberion's avatar
oberion committed
15
#include "../comm/HexSpinBox.h"
Franz's avatar
Franz committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33


class XbeeConfigurationWindow : public QWidget
{
	Q_OBJECT

public:
	XbeeConfigurationWindow(LinkInterface* link, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Sheet);
	~XbeeConfigurationWindow();

	QAction* getAction();

public slots:
	void configureCommunication();
	void setPortName(QString port);
	void setBaudRateString(QString baud);
	void setupPortList();

oberion's avatar
oberion committed
34 35 36 37
private slots:
	void addrChangedHigh(int addr);
	void addrChangedLow(int addr);

Franz's avatar
Franz committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
protected:
    void showEvent(QShowEvent* event);
    void hideEvent(QHideEvent* event);
    bool userConfigured; ///< Switch to detect if current values are user-selected and shouldn't be overriden

private:
	QLabel *portLabel;
	QLabel *baudLabel;
	QComboBox *portBox;
	QComboBox *baudBox;
	QGridLayout *actionLayout;
	QHBoxLayout *xbeeLayout;
	QVBoxLayout *tmpLayout;
	XbeeLinkInterface* link;
    QAction* action;
    QTimer* portCheckTimer;
oberion's avatar
oberion committed
54 55 56 57 58 59 60 61
	HexSpinBox* highAddr;
	HexSpinBox* lowAddr;
	QLabel* highAddrLabel;
	QLabel* lowAddrLabel;

signals:
	void addrHighChanged(quint32 addrHigh);
	void addrLowChanged(quint32 addrLow);
Franz's avatar
Franz committed
62 63 64
};


65
#endif //_XBEECONFIGURATIONWINDOW_H_