author | sl |
Fri, 30 May 2014 13:45:14 +0200 | |
changeset 21 | 434d6b8a406d |
parent 16 | 35f01a0d460a |
child 23 | 1f607fa8542f |
permissions | -rw-r--r-- |
sl@2 | 1 |
#ifndef MINIDISPLAY_H |
sl@2 | 2 |
#define MINIDISPLAY_H |
sl@2 | 3 |
|
sl@2 | 4 |
#include <QQuickItem> |
sl@15 | 5 |
#include <QQuickWindow> |
sl@4 | 6 |
#include "FutabaVfd.h" |
sl@2 | 7 |
|
sl@2 | 8 |
class MiniDisplay : public QQuickItem |
sl@2 | 9 |
{ |
sl@2 | 10 |
Q_OBJECT |
sl@2 | 11 |
Q_DISABLE_COPY(MiniDisplay) |
sl@4 | 12 |
// |
sl@5 | 13 |
Q_PROPERTY(bool isOpen READ isOpen NOTIFY statusChanged) |
sl@18 | 14 |
Q_PROPERTY(bool offScreenMode READ offScreenMode WRITE setOffScreenMode NOTIFY offScreenModeChanged) |
sl@5 | 15 |
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) |
sl@8 | 16 |
Q_PROPERTY(QString vendor READ vendor) |
sl@8 | 17 |
Q_PROPERTY(QString product READ product) |
sl@8 | 18 |
Q_PROPERTY(QString serialNumber READ serialNumber) |
sl@10 | 19 |
Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) |
sl@10 | 20 |
Q_PROPERTY(int maxBrightness READ maxBrightness NOTIFY opened) |
sl@10 | 21 |
Q_PROPERTY(int minBrightness READ minBrightness NOTIFY opened) |
sl@11 | 22 |
Q_PROPERTY(QPoint framePosition READ framePosition WRITE setFramePosition NOTIFY closed) |
sl@4 | 23 |
|
sl@4 | 24 |
public: |
sl@5 | 25 |
//Methods |
sl@4 | 26 |
Q_INVOKABLE void open(); |
sl@4 | 27 |
Q_INVOKABLE void close(); |
sl@4 | 28 |
// |
sl@4 | 29 |
Q_INVOKABLE void clear(); |
sl@4 | 30 |
Q_INVOKABLE void fill(); |
sl@4 | 31 |
Q_INVOKABLE void swapBuffers(); |
sl@9 | 32 |
// |
sl@9 | 33 |
Q_INVOKABLE void requestPowerStatus(); |
sl@9 | 34 |
Q_INVOKABLE void requestDeviceId(); |
sl@9 | 35 |
Q_INVOKABLE void requestFirmwareVersion(); |
sl@4 | 36 |
|
sl@15 | 37 |
Q_INVOKABLE void renderOwnWindow(); |
sl@15 | 38 |
Q_INVOKABLE void renderWindow(QQuickWindow* aWindow); |
sl@15 | 39 |
Q_INVOKABLE void renderImage(QImage* aImage); |
sl@16 | 40 |
// |
sl@16 | 41 |
Q_INVOKABLE void setPixel(int x, int y, bool on); |
sl@16 | 42 |
|
sl@16 | 43 |
|
sl@16 | 44 |
|
sl@15 | 45 |
|
sl@5 | 46 |
public: |
sl@5 | 47 |
//Properties |
sl@5 | 48 |
bool isOpen(); |
sl@5 | 49 |
QFont font() const {return iFont;} |
sl@5 | 50 |
void setFont(const QFont& aFont); |
sl@8 | 51 |
// |
sl@18 | 52 |
bool offScreenMode(); |
sl@18 | 53 |
void setOffScreenMode(bool aOn); |
sl@18 | 54 |
// |
sl@8 | 55 |
QString vendor(); |
sl@8 | 56 |
QString product(); |
sl@8 | 57 |
QString serialNumber(); |
sl@10 | 58 |
// |
sl@10 | 59 |
int maxBrightness() const; |
sl@10 | 60 |
int minBrightness() const; |
sl@10 | 61 |
int brightness() const; |
sl@10 | 62 |
void setBrightness(int aBrightness); |
sl@11 | 63 |
// |
sl@11 | 64 |
QPoint framePosition() const; |
sl@11 | 65 |
void setFramePosition(const QPoint& aPoint); |
sl@5 | 66 |
|
sl@4 | 67 |
signals: |
sl@5 | 68 |
void opened(); |
sl@5 | 69 |
void openError(); |
sl@11 | 70 |
void closing(); |
sl@5 | 71 |
void closed(); |
sl@5 | 72 |
void statusChanged(); |
sl@5 | 73 |
void fontChanged(); |
sl@10 | 74 |
void brightnessChanged(); |
sl@18 | 75 |
void offScreenModeChanged(); |
sl@9 | 76 |
// |
sl@9 | 77 |
void powerStatus(bool powerOn); |
sl@9 | 78 |
void deviceId(QString deviceId); |
sl@9 | 79 |
void firmwareVersion(QString version); |
sl@9 | 80 |
|
sl@9 | 81 |
public slots: |
sl@9 | 82 |
void readTimer(); |
sl@9 | 83 |
|
sl@2 | 84 |
|
sl@2 | 85 |
public: |
sl@2 | 86 |
MiniDisplay(QQuickItem *parent = 0); |
sl@2 | 87 |
~MiniDisplay(); |
sl@4 | 88 |
|
sl@4 | 89 |
private: |
sl@4 | 90 |
GP1212A01A iDisplay; |
sl@5 | 91 |
QFont iFont; |
sl@9 | 92 |
int iReadAttempt; |
sl@10 | 93 |
int iBrightness; |
sl@11 | 94 |
QPoint iFramePosition; |
sl@2 | 95 |
}; |
sl@2 | 96 |
|
sl@2 | 97 |
#endif // MINIDISPLAY_H |
sl@2 | 98 |