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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
diff -NaurwB streamdev-unpatched/server/connectionVTP.c streamdev/server/connectionVTP.c
--- streamdev-unpatched/server/connectionVTP.c 2009-10-13 08:38:47.000000000 +0200
+++ streamdev/server/connectionVTP.c 2009-11-22 20:04:07.000000000 +0100
@@ -7,6 +7,8 @@
#include "server/suspend.h"
#include "setup.h"
+#include "../services/femonservice.h"
+
#include <vdr/tools.h>
#include <vdr/videodir.h>
#include <vdr/menu.h>
@@ -710,6 +712,102 @@
return false;
}
+
+// --- cLSTQHandler -----------------------------------------------------------
+
+class cLSTQHandler
+{
+private:
+ enum eStates { Device, Status, Signal, SNR, BER, UNC, Video,
+ Audio, Dolby, EndQuality };
+ cConnectionVTP *m_Client;
+ FemonService_v1_0 m_femon;
+ int m_Errno;
+ int m_Channel;
+ cString m_Error;
+ eStates m_State;
+public:
+ cLSTQHandler(cConnectionVTP *Client, const char *Option);
+ ~cLSTQHandler();
+ bool Next(bool &Last);
+};
+
+cLSTQHandler::cLSTQHandler(cConnectionVTP *Client, const char *Option):
+ m_Client(Client),
+ m_Errno(0),
+ m_State(Device),
+ m_Channel(-1)
+{
+// if (*Option) {
+// if (isnumber(Option)) {
+// m_Channel = atoi(Option);
+// }
+// }
+
+ cPlugin *p;
+ p = cPluginManager::CallFirstService("FemonService-v1.0", &m_femon);
+ if (!p) {
+ m_Errno = 550;
+ m_Error = cString::sprintf("No support for Signal Quality found");
+ }
+}
+
+cLSTQHandler::~cLSTQHandler()
+{
+}
+
+bool cLSTQHandler::Next(bool &Last)
+{
+ if (*m_Error != NULL) {
+ Last = true;
+ cString str(m_Error);
+ m_Error = NULL;
+ return m_Client->Respond(m_Errno, "%s", *str);
+ }
+
+ Last = false;
+ switch (m_State) {
+ case Device:
+ m_State = Status;
+ if (*m_femon.fe_name != NULL)
+ return m_Client->Respond(-215, "Device : %s", *m_femon.fe_name);
+ else
+ return m_Client->Respond(-215, "Device : ");
+ case Status:
+ m_State = Signal;
+ if (*m_femon.fe_status != NULL)
+ return m_Client->Respond(-215, "Status : %s", *m_femon.fe_status);
+ else
+ return m_Client->Respond(-215, "Status : ");
+ case Signal:
+ m_State = SNR;
+ return m_Client->Respond(-215, "Signal : %04X (%2d%%)", m_femon.fe_signal, m_femon.fe_signal / 655);
+ case SNR:
+ m_State = BER;
+ return m_Client->Respond(-215, "SNR : %04X (%2d%%)", m_femon.fe_snr, m_femon.fe_snr / 655);
+ case BER:
+ m_State = UNC;
+ return m_Client->Respond(-215, "BER : %08X", m_femon.fe_ber);
+ case UNC:
+ m_State = Video;
+ return m_Client->Respond(-215, "UNC : %08X", m_femon.fe_unc);
+ case Video:
+ m_State = Audio;
+ return m_Client->Respond(-215, "Video : %.2f Mbit/s", m_femon.video_bitrate);
+ case Audio:
+ m_State = Dolby;
+ return m_Client->Respond(-215, "Audio : %.0f kbit/s", m_femon.audio_bitrate);
+ case Dolby:
+ m_State = EndQuality;
+ return m_Client->Respond(-215, "Dolby : %.0f kbit/s", m_femon.dolby_bitrate);
+ case EndQuality:
+ Last = true;
+ return m_Client->Respond(215, "End of quality information");
+ }
+ return false;
+}
+
+
// --- cConnectionVTP ---------------------------------------------------------
cConnectionVTP::cConnectionVTP(void):
@@ -727,7 +825,8 @@
m_LSTEHandler(NULL),
m_LSTCHandler(NULL),
m_LSTTHandler(NULL),
- m_LSTRHandler(NULL)
+ m_LSTRHandler(NULL),
+ m_LSTQHandler(NULL)
{
}
@@ -745,6 +844,7 @@
delete m_LSTCHandler;
delete m_LSTEHandler;
delete m_LSTRHandler;
+ delete m_LSTQHandler;
delete m_RecPlayer;
}
@@ -801,6 +901,7 @@
else if (strcasecmp(Cmd, "LSTR") == 0) return CmdLSTR(param);
else if (strcasecmp(Cmd, "LSTT") == 0) return CmdLSTT(param);
else if (strcasecmp(Cmd, "LSTC") == 0) return CmdLSTC(param);
+ else if (strcasecmp(Cmd, "LSTQ") == 0) return CmdLSTQ(param);
if (param == NULL) {
esyslog("ERROR: streamdev: this seriously shouldn't happen at %s:%d",
@@ -1268,6 +1369,11 @@
return CmdLSTX(m_LSTRHandler, Option);
}
+bool cConnectionVTP::CmdLSTQ(char *Option)
+{
+ return CmdLSTX(m_LSTQHandler, Option);
+}
+
// Functions adopted from SVDRP
#define INIT_WRAPPER() bool _res
#define Reply(c,m...) _res = Respond(c,m)
diff -NaurwB streamdev-unpatched/server/connectionVTP.h streamdev/server/connectionVTP.h
--- streamdev-unpatched/server/connectionVTP.h 2009-07-01 12:46:16.000000000 +0200
+++ streamdev/server/connectionVTP.h 2009-11-22 16:08:51.000000000 +0100
@@ -11,6 +11,7 @@
class cLSTCHandler;
class cLSTTHandler;
class cLSTRHandler;
+class cLSTQHandler;
class cConnectionVTP: public cServerConnection {
friend class cLSTEHandler;
@@ -36,6 +37,7 @@
cLSTCHandler *m_LSTCHandler;
cLSTTHandler *m_LSTTHandler;
cLSTRHandler *m_LSTRHandler;
+ cLSTQHandler *m_LSTQHandler;
protected:
template<class cHandler>
@@ -72,6 +74,7 @@
bool CmdLSTC(char *Opts);
bool CmdLSTT(char *Opts);
bool CmdLSTR(char *Opts);
+ bool CmdLSTQ(char *Opts);
// Commands adopted from SVDRP
bool CmdSTAT(const char *Option);
diff -NaurwB streamdev-unpatched/services/femonservice.h streamdev/services/femonservice.h
--- streamdev-unpatched/services/femonservice.h 1970-01-01 01:00:00.000000000 +0100
+++ streamdev/services/femonservice.h 2009-10-01 03:20:00.000000000 +0200
@@ -0,0 +1,26 @@
+/*
+ * Frontend Status Monitor plugin for the Video Disk Recorder
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ */
+
+#ifndef __FEMONSERVICE_H
+#define __FEMONSERVICE_H
+
+#include <linux/dvb/frontend.h>
+
+struct FemonService_v1_0 {
+ cString fe_name;
+ cString fe_status;
+ uint16_t fe_snr;
+ uint16_t fe_signal;
+ uint32_t fe_ber;
+ uint32_t fe_unc;
+ double video_bitrate;
+ double audio_bitrate;
+ double dolby_bitrate;
+ };
+
+#endif //__FEMONSERVICE_H
+
|