AdvancedControllerRemoteCPP/panel/deviceview.h

62 lines
1.6 KiB
C++

// deviceview.h - everything below the tabs for one controller: serial port, OPEN / CLOSE,
// the link state, IDENTIFY, HELP, the panel and the last exchange.
#ifndef DEVICEVIEW_H
#define DEVICEVIEW_H
#include "controllerlink.h"
#include <QWidget>
class QComboBox;
class QLabel;
class QPushButton;
class PanelWidget;
class DeviceView : public QWidget
{
Q_OBJECT
public:
// index: 0..2 (tab); port: serial port to preselect, "" = none
DeviceView(int index, int baudRate, const QString &port, QWidget *parent = nullptr);
PanelWidget *panel() const;
signals:
void stateChanged(int index, AdvCtrl::ControllerLink::State state);
private:
void refreshPorts();
void selectPort(const QString &device);
QString selectedPort() const;
void openPort();
void closePort();
void openHelp();
void sendKey(const QString &key);
void identify();
void setStateText(const QString &text, const QColor &colour);
void onStateChanged(AdvCtrl::ControllerLink::State state);
void onDetected(const QString &firmware, const QString &cameras, const QString &uid);
void onNotDetected();
void onLost();
void onReply(const QString &commandLine, const QString &result);
void onError(const QString &message);
void onClosed();
const int m_index;
const int m_baudRate;
AdvCtrl::ControllerLink *m_link;
QPushButton *m_open;
QPushButton *m_close;
QComboBox *m_ports;
QPushButton *m_refresh;
QLabel *m_state;
QPushButton *m_identify;
QPushButton *m_help;
PanelWidget *m_panel;
QLabel *m_last;
};
#endif // DEVICEVIEW_H