1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
* targavfd plugin for VDR (C++)
*
* (C) 2010 Andreas Brachold <vdr07 AT deltab de>
*
* This targavfd plugin is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, version 3 of the License.
*
* See the files README and COPYING for details.
*
*/
#ifndef __VFD_H_
#define __VFD_H_
#include <queue>
#include <hid.h>
#include "bitmap.h"
enum eIcons {
eIconOff = 0,
eIconPLAY = 1 << 0x00, // Play
eIconPAUSE = 1 << 0x01, // Pause
eIconRECORD = 1 << 0x02, // Record
eIconMESSAGE = 1 << 0x03, // Message symbol (without the inner @)
eIconMSGAT = 1 << 0x04, // Message @
eIconMUTE = 1 << 0x05, // Mute
eIconWLAN1 = 1 << 0x06, // WLAN (tower base)
eIconWLAN2 = 1 << 0x07, // WLAN strength (1 of 3)
eIconWLAN3 = 1 << 0x08, // WLAN strength (2 of 3)
eIconWLAN4 = 1 << 0x09, // WLAN strength (3 of 3)
eIconVOLUME = 1 << 0x0A, // Volume (the word)
eIconVOL1 = 1 << 0x0B, // Volume level 1 of 14
eIconVOL2 = 1 << 0x0C, // Volume level 2 of 14
eIconVOL3 = 1 << 0x0D, // Volume level 3 of 14
eIconVOL4 = 1 << 0x0E, // Volume level 4 of 14
eIconVOL5 = 1 << 0x0F, // Volume level 5 of 14
eIconVOL6 = 1 << 0x10, // Volume level 6 of 14
eIconVOL7 = 1 << 0x11, // Volume level 7 of 14
eIconVOL8 = 1 << 0x12, // Volume level 8 of 14
eIconVOL9 = 1 << 0x13, // Volume level 9 of 14
eIconVOL10 = 1 << 0x14, // Volume level 10 of 14
eIconVOL11 = 1 << 0x15, // Volume level 11 of 14
eIconVOL12 = 1 << 0x16, // Volume level 12 of 14
eIconVOL13 = 1 << 0x17, // Volume level 13 of 14
eIconVOL14 = 1 << 0x18 // Volume level 14 of 14
};
class cVFDFont;
class cVFDQueue : public std::queue<byte> {
HIDInterface* hid;
bool bInit;
public:
cVFDQueue();
virtual ~cVFDQueue();
virtual bool open();
virtual void close();
virtual bool isopen() const { return hid != 0; }
void QueueCmd(const byte & cmd);
void QueueData(const byte & data);
bool QueueFlush();
private:
const char *hiderror(hid_return ret) const;
};
class cVFD : public cVFDQueue {
/* framebuffer and backingstore for current contents */
cVFDBitmap* framebuf;
unsigned char * backingstore;
unsigned int lastIconState;
unsigned int m_iSizeYb;
protected:
cVFDFont* pFont;
bool SendCmdClock();
bool SendCmdShutdown();
void Brightness(int nBrightness);
public:
cVFD();
virtual ~cVFD();
virtual bool open();
virtual void close ();
void clear ();
int DrawText(int x, int y, const char* string);
bool flush (bool refreshAll = true);
void icons(unsigned int state);
virtual bool SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight);
};
#endif
|