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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
|
/***************************************************************************
lircsupport.cpp - description
-------------------
begin : Mon Feb 4 2002
copyright : (C) 2002 by Martin Witte / Frank Schwanz
email : [email protected] / [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program 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; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "lircsupport.h"
#ifdef HAVE_LIRC
#include <lirc/lirc_client.h>
#endif
#include <tqsocketnotifier.h>
#include <tqtimer.h>
#include <tqfile.h>
#include <kapplication.h>
#include <kaboutdata.h>
#include <kstandarddirs.h>
#include "../../src/include/errorlog-interfaces.h"
#include "../../src/include/radiodevice_interfaces.h"
#include "../../src/include/stationlist.h"
#include "../../src/include/aboutwidget.h"
#include "lirc-configuration.h"
#include <cstdlib>
#define LIRCRC ".lircrc"
///////////////////////////////////////////////////////////////////////
//// plugin library functions
//#ifdef HAVE_LIRC
PLUGIN_LIBRARY_FUNCTIONS(LircSupport, "tderadio-lirc", i18n("Linux Infrared Control (LIRC) Support"));
//#endif
/////////////////////////////////////////////////////////////////////////////
LircSupport::LircSupport(const TQString &name)
: PluginBase(name, i18n("LIRC Plugin")),
m_TakeRawLIRC(false)
{
#ifdef HAVE_LIRC
logDebug(i18n("initializing tderadio lirc plugin"));
fprintf (stderr, "%s\n", (const char*)i18n("initializing tderadio lirc plugin").utf8());
char *prg = (char*)"tderadio";
TQString slircrc = getenv("HOME");
slircrc += "/" LIRCRC;
TQFile lircrc(slircrc);
if (!lircrc.exists()) {
logWarning(i18n("%1 does not exist. File was created with TDERadio's default .lircrc proposal").arg(LIRCRC));
TQFile default_lircrc(locate("data", "tderadio/default-dot-lircrc"));
lircrc.open(IO_WriteOnly);
default_lircrc.open(IO_ReadOnly);
char *buf = new char [default_lircrc.size() + 1];
default_lircrc.readBlock(buf, default_lircrc.size());
lircrc.writeBlock(buf, default_lircrc.size());
lircrc.close();
default_lircrc.close();
delete buf;
}
m_fd_lirc = lirc_init(prg, 1);
m_lirc_notify = 0;
m_lircConfig = 0;
if (m_fd_lirc != -1) {
if (lirc_readconfig (NULL, &m_lircConfig, NULL) == 0) {
m_lirc_notify = new TQSocketNotifier(m_fd_lirc, TQSocketNotifier::Read, this, "lirc_notifier");
if (m_lirc_notify)
TQObject::connect(m_lirc_notify, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotLIRC(int)));
// check config
lirc_config_entry *found = NULL;
for (lirc_config_entry *e = m_lircConfig->first; e; e = e->next) {
if (TQString(e->prog) == prg)
found = e;
}
if (!found) {
logWarning(i18n("There is no entry for tderadio in any of your .lircrc files."));
logWarning(i18n("Please setup your .lircrc files correctly."));
m_TakeRawLIRC = true;
}
} else {
lirc_deinit();
m_fd_lirc = -1;
}
}
if (m_fd_lirc == -1) {
logWarning(i18n("Initializing tderadio lirc plugin failed"));
fprintf (stderr, "%s\n", (const char*)i18n("Initializing tderadio lirc plugin failed").utf8());
} else {
logDebug(i18n("Initializing tderadio lirc plugin successful"));
fprintf (stderr, "%s\n", (const char*)i18n("Initializing tderadio lirc plugin successful").utf8());
}
#endif
m_kbdTimer = new TQTimer (this);
TQObject::connect (m_kbdTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotKbdTimedOut()));
m_addIndex = 0;
}
LircSupport::~LircSupport()
{
#ifdef HAVE_LIRC
if (m_fd_lirc != -1)
lirc_deinit();
if (m_lircConfig)
lirc_freeconfig(m_lircConfig);
m_fd_lirc = -1;
m_lircConfig = 0;
#endif
}
void LircSupport::slotLIRC(int /*socket*/ )
{
#ifdef HAVE_LIRC
if (!m_lircConfig || !m_lirc_notify || m_fd_lirc == -1)
return;
char *code = 0, *c = 0;
if (lirc_nextcode(&code) == 0) {
while(m_TakeRawLIRC || (lirc_code2char (m_lircConfig, code, &c) == 0 && c != NULL)) {
TQString x = c;
int repeat_counter = 1;
if (m_TakeRawLIRC || (TQString(c) == "eventmap")) {
TQStringList l = TQStringList::split(" ", code);
if (l.count() >=4) {
x = l[2];
repeat_counter = l[1].toInt(NULL, 16);
}
}
bool consumed = false;
logDebug(TQString("LIRC: ") + x);
emit sigRawLIRCSignal(x, repeat_counter, consumed);
if (!consumed) {
if (!checkActions(x, repeat_counter, m_Actions))
checkActions(x, repeat_counter, m_AlternativeActions);
}
}
}
else {
// some error has occurred on the socket => close lirc plugin
logWarning(i18n("Reading from LIRC socket failed. Disabling LIRC Functions till next start of tderadio"));
delete m_lirc_notify;
m_lirc_notify = NULL;
}
if (code)
free (code);
#endif
}
void LircSupport::slotKbdTimedOut()
{
activateStation (m_addIndex);
m_addIndex = 0;
}
void LircSupport::activateStation (int i)
{
if (! sendActivateStation(i - 1))
sendActivateStation( (i + 9) % 10);
}
bool LircSupport::connectI (Interface *i)
{
bool a = IRadioClient::connectI (i);
bool b = ITimeControlClient::connectI (i);
bool c = IRadioDevicePoolClient::connectI (i);
bool d = PluginBase::connectI(i);
bool e = ISoundStreamClient::connectI(i);
return a || b || c || d || e;
}
bool LircSupport::disconnectI (Interface *i)
{
bool a = IRadioClient::disconnectI (i);
bool b = ITimeControlClient::disconnectI (i);
bool c = IRadioDevicePoolClient::disconnectI (i);
bool d = PluginBase::disconnectI(i);
bool e = ISoundStreamClient::disconnectI(i);
return a || b || c || d || e;
}
void LircSupport::saveState (TDEConfig *c) const
{
c->writeEntry("LIRC_DIGIT_0", m_Actions[LIRC_DIGIT_0]);
c->writeEntry("LIRC_DIGIT_1", m_Actions[LIRC_DIGIT_1]);
c->writeEntry("LIRC_DIGIT_2", m_Actions[LIRC_DIGIT_2]);
c->writeEntry("LIRC_DIGIT_3", m_Actions[LIRC_DIGIT_3]);
c->writeEntry("LIRC_DIGIT_4", m_Actions[LIRC_DIGIT_4]);
c->writeEntry("LIRC_DIGIT_5", m_Actions[LIRC_DIGIT_5]);
c->writeEntry("LIRC_DIGIT_6", m_Actions[LIRC_DIGIT_6]);
c->writeEntry("LIRC_DIGIT_7", m_Actions[LIRC_DIGIT_7]);
c->writeEntry("LIRC_DIGIT_8", m_Actions[LIRC_DIGIT_8]);
c->writeEntry("LIRC_DIGIT_9", m_Actions[LIRC_DIGIT_9]);
c->writeEntry("LIRC_POWER_ON", m_Actions[LIRC_POWER_ON]);
c->writeEntry("LIRC_POWER_OFF", m_Actions[LIRC_POWER_OFF]);
c->writeEntry("LIRC_PAUSE", m_Actions[LIRC_PAUSE]);
c->writeEntry("LIRC_RECORD_START", m_Actions[LIRC_RECORD_START]);
c->writeEntry("LIRC_RECORD_STOP", m_Actions[LIRC_RECORD_STOP]);
c->writeEntry("LIRC_VOLUME_INC", m_Actions[LIRC_VOLUME_INC]);
c->writeEntry("LIRC_VOLUME_DEC", m_Actions[LIRC_VOLUME_DEC]);
c->writeEntry("LIRC_CHANNEL_NEXT", m_Actions[LIRC_CHANNEL_NEXT]);
c->writeEntry("LIRC_CHANNEL_PREV", m_Actions[LIRC_CHANNEL_PREV]);
c->writeEntry("LIRC_SEARCH_NEXT", m_Actions[LIRC_SEARCH_NEXT]);
c->writeEntry("LIRC_SEARCH_PREV", m_Actions[LIRC_SEARCH_PREV]);
c->writeEntry("LIRC_SLEEP", m_Actions[LIRC_SLEEP]);
c->writeEntry("LIRC_APPLICATION_QUIT", m_Actions[LIRC_APPLICATION_QUIT]);
c->writeEntry("ALT_LIRC_DIGIT_0", m_AlternativeActions[LIRC_DIGIT_0]);
c->writeEntry("ALT_LIRC_DIGIT_1", m_AlternativeActions[LIRC_DIGIT_1]);
c->writeEntry("ALT_LIRC_DIGIT_2", m_AlternativeActions[LIRC_DIGIT_2]);
c->writeEntry("ALT_LIRC_DIGIT_3", m_AlternativeActions[LIRC_DIGIT_3]);
c->writeEntry("ALT_LIRC_DIGIT_4", m_AlternativeActions[LIRC_DIGIT_4]);
c->writeEntry("ALT_LIRC_DIGIT_5", m_AlternativeActions[LIRC_DIGIT_5]);
c->writeEntry("ALT_LIRC_DIGIT_6", m_AlternativeActions[LIRC_DIGIT_6]);
c->writeEntry("ALT_LIRC_DIGIT_7", m_AlternativeActions[LIRC_DIGIT_7]);
c->writeEntry("ALT_LIRC_DIGIT_8", m_AlternativeActions[LIRC_DIGIT_8]);
c->writeEntry("ALT_LIRC_DIGIT_9", m_AlternativeActions[LIRC_DIGIT_9]);
c->writeEntry("ALT_LIRC_POWER_ON", m_AlternativeActions[LIRC_POWER_ON]);
c->writeEntry("ALT_LIRC_POWER_OFF", m_AlternativeActions[LIRC_POWER_OFF]);
c->writeEntry("ALT_LIRC_PAUSE", m_AlternativeActions[LIRC_PAUSE]);
c->writeEntry("ALT_LIRC_RECORD_START", m_AlternativeActions[LIRC_RECORD_START]);
c->writeEntry("ALT_LIRC_RECORD_STOP", m_AlternativeActions[LIRC_RECORD_STOP]);
c->writeEntry("ALT_LIRC_VOLUME_INC", m_AlternativeActions[LIRC_VOLUME_INC]);
c->writeEntry("ALT_LIRC_VOLUME_DEC", m_AlternativeActions[LIRC_VOLUME_DEC]);
c->writeEntry("ALT_LIRC_CHANNEL_NEXT", m_AlternativeActions[LIRC_CHANNEL_NEXT]);
c->writeEntry("ALT_LIRC_CHANNEL_PREV", m_AlternativeActions[LIRC_CHANNEL_PREV]);
c->writeEntry("ALT_LIRC_SEARCH_NEXT", m_AlternativeActions[LIRC_SEARCH_NEXT]);
c->writeEntry("ALT_LIRC_SEARCH_PREV", m_AlternativeActions[LIRC_SEARCH_PREV]);
c->writeEntry("ALT_LIRC_SLEEP", m_AlternativeActions[LIRC_SLEEP]);
c->writeEntry("ALT_LIRC_APPLICATION_QUIT", m_AlternativeActions[LIRC_APPLICATION_QUIT]);
}
void LircSupport::restoreState (TDEConfig *c)
{
m_Actions[LIRC_DIGIT_0] = c->readEntry("LIRC_DIGIT_0", "0");
m_Actions[LIRC_DIGIT_1] = c->readEntry("LIRC_DIGIT_1", "1");
m_Actions[LIRC_DIGIT_2] = c->readEntry("LIRC_DIGIT_2", "2");
m_Actions[LIRC_DIGIT_3] = c->readEntry("LIRC_DIGIT_3", "3");
m_Actions[LIRC_DIGIT_4] = c->readEntry("LIRC_DIGIT_4", "4");
m_Actions[LIRC_DIGIT_5] = c->readEntry("LIRC_DIGIT_5", "5");
m_Actions[LIRC_DIGIT_6] = c->readEntry("LIRC_DIGIT_6", "6");
m_Actions[LIRC_DIGIT_7] = c->readEntry("LIRC_DIGIT_7", "7");
m_Actions[LIRC_DIGIT_8] = c->readEntry("LIRC_DIGIT_8", "8");
m_Actions[LIRC_DIGIT_9] = c->readEntry("LIRC_DIGIT_9", "9");
m_Actions[LIRC_POWER_ON] = c->readEntry("LIRC_POWER_ON", "RADIO");
m_Actions[LIRC_POWER_OFF] = c->readEntry("LIRC_POWER_OFF", "RADIO");
m_Actions[LIRC_PAUSE] = c->readEntry("LIRC_PAUSE", "FULL_SCREEN");
m_Actions[LIRC_RECORD_START] = c->readEntry("LIRC_RECORD_START", "");
m_Actions[LIRC_RECORD_STOP] = c->readEntry("LIRC_RECORD_STOP", "");
m_Actions[LIRC_VOLUME_INC] = c->readEntry("LIRC_VOLUME_INC", "VOL+");
m_Actions[LIRC_VOLUME_DEC] = c->readEntry("LIRC_VOLUME_DEC", "VOL-");
m_Actions[LIRC_CHANNEL_NEXT] = c->readEntry("LIRC_CHANNEL_NEXT", "CH+");
m_Actions[LIRC_CHANNEL_PREV] = c->readEntry("LIRC_CHANNEL_PREV", "CH-");
m_Actions[LIRC_SEARCH_NEXT] = c->readEntry("LIRC_SEARCH_NEXT", "SOURCE");
m_Actions[LIRC_SEARCH_PREV] = c->readEntry("LIRC_SEARCH_PREV", "MUTE");
m_Actions[LIRC_SLEEP] = c->readEntry("LIRC_SLEEP", "MINIMIZE");
m_Actions[LIRC_APPLICATION_QUIT] = c->readEntry("LIRC_APPLICATION_QUIT", "");
m_AlternativeActions[LIRC_DIGIT_0] = c->readEntry("ALT_LIRC_DIGIT_0", "");
m_AlternativeActions[LIRC_DIGIT_1] = c->readEntry("ALT_LIRC_DIGIT_1", "");
m_AlternativeActions[LIRC_DIGIT_2] = c->readEntry("ALT_LIRC_DIGIT_2", "");
m_AlternativeActions[LIRC_DIGIT_3] = c->readEntry("ALT_LIRC_DIGIT_3", "");
m_AlternativeActions[LIRC_DIGIT_4] = c->readEntry("ALT_LIRC_DIGIT_4", "");
m_AlternativeActions[LIRC_DIGIT_5] = c->readEntry("ALT_LIRC_DIGIT_5", "");
m_AlternativeActions[LIRC_DIGIT_6] = c->readEntry("ALT_LIRC_DIGIT_6", "");
m_AlternativeActions[LIRC_DIGIT_7] = c->readEntry("ALT_LIRC_DIGIT_7", "");
m_AlternativeActions[LIRC_DIGIT_8] = c->readEntry("ALT_LIRC_DIGIT_8", "");
m_AlternativeActions[LIRC_DIGIT_9] = c->readEntry("ALT_LIRC_DIGIT_9", "");
m_AlternativeActions[LIRC_POWER_ON] = c->readEntry("ALT_LIRC_POWER_ON", "");
m_AlternativeActions[LIRC_POWER_OFF] = c->readEntry("ALT_LIRC_POWER_OFF", "TV");
m_AlternativeActions[LIRC_PAUSE] = c->readEntry("ALT_LIRC_PAUSE", "");
m_AlternativeActions[LIRC_RECORD_START] = c->readEntry("ALT_LIRC_RECORD_START", "");
m_AlternativeActions[LIRC_RECORD_STOP] = c->readEntry("ALT_LIRC_RECORD_STOP", "");
m_AlternativeActions[LIRC_VOLUME_INC] = c->readEntry("ALT_LIRC_VOLUME_INC", "");
m_AlternativeActions[LIRC_VOLUME_DEC] = c->readEntry("ALT_LIRC_VOLUME_DEC", "");
m_AlternativeActions[LIRC_CHANNEL_NEXT] = c->readEntry("ALT_LIRC_CHANNEL_NEXT", "");
m_AlternativeActions[LIRC_CHANNEL_PREV] = c->readEntry("ALT_LIRC_CHANNEL_PREV", "");
m_AlternativeActions[LIRC_SEARCH_NEXT] = c->readEntry("ALT_LIRC_SEARCH_NEXT", "");
m_AlternativeActions[LIRC_SEARCH_PREV] = c->readEntry("ALT_LIRC_SEARCH_PREV", "");
m_AlternativeActions[LIRC_SLEEP] = c->readEntry("ALT_LIRC_SLEEP", "");
m_AlternativeActions[LIRC_APPLICATION_QUIT] = c->readEntry("ALT_LIRC_APPLICATION_QUIT", "");
emit sigUpdateConfig();
}
ConfigPageInfo LircSupport::createConfigurationPage()
{
LIRCConfiguration *conf = new LIRCConfiguration(NULL, this);
TQObject::connect(this, TQT_SIGNAL(sigUpdateConfig()), conf, TQT_SLOT(slotUpdateConfig()));
TQObject::connect(this, TQT_SIGNAL(sigRawLIRCSignal(const TQString &, int, bool &)),
conf, TQT_SLOT (slotRawLIRCSignal(const TQString &, int, bool &)));
return ConfigPageInfo (conf,
i18n("LIRC Support"),
i18n("LIRC Plugin"),
"connect_creating");
}
AboutPageInfo LircSupport::createAboutPage()
{
/* TDEAboutData aboutData("tderadio",
NULL,
NULL,
I18N_NOOP("Linux Infrared Remote Control Support for TDERadio"),
TDEAboutData::License_GPL,
"(c) 2002-2005 Martin Witte",
0,
"http://sourceforge.net/projects/tderadio",
0);
aboutData.addAuthor("Martin Witte", "", "[email protected]");
return AboutPageInfo(
new TDERadioAboutWidget(aboutData, TDERadioAboutWidget::AbtTabbed),
i18n("LIRC Support"),
i18n("LIRC Plugin"),
"connect_creating"
);*/
return AboutPageInfo();
}
bool LircSupport::checkActions(const TQString &lirc_string, int repeat_counter, const TQMap<LIRC_Actions, TQString> &map)
{
SoundStreamID streamID = queryCurrentSoundStreamID();
bool retval = false;
bool q = false;
SoundFormat sf;
ISeekRadio *seeker = NULL;
TQMapConstIterator<LIRC_Actions, TQString> it = map.begin();
TQMapConstIterator<LIRC_Actions, TQString> end = map.end();
for (; !retval && it != end; ++it) {
if ((*it).length() && lirc_string == *it) {
LIRC_Actions action = it.key();
int digit = -1;
switch (action) {
case LIRC_DIGIT_0 :
if (repeat_counter == 0) {
digit = 0;
retval = true;
}
break;
case LIRC_DIGIT_1 :
if (repeat_counter == 0) {
digit = 1;
retval = true;
}
break;
case LIRC_DIGIT_2 :
if (repeat_counter == 0) {
digit = 2;
retval = true;
}
break;
case LIRC_DIGIT_3 :
if (repeat_counter == 0) {
digit = 3;
retval = true;
}
break;
case LIRC_DIGIT_4 :
if (repeat_counter == 0) {
digit = 4;
retval = true;
}
break;
case LIRC_DIGIT_5 :
if (repeat_counter == 0) {
digit = 5;
retval = true;
}
break;
case LIRC_DIGIT_6 :
if (repeat_counter == 0) {
digit = 6;
retval = true;
}
break;
case LIRC_DIGIT_7 :
if (repeat_counter == 0) {
digit = 7;
retval = true;
}
break;
case LIRC_DIGIT_8 :
if (repeat_counter == 0) {
digit = 8;
retval = true;
}
break;
case LIRC_DIGIT_9 :
if (repeat_counter == 0) {
digit = 9;
retval = true;
}
break;
case LIRC_POWER_ON :
if (repeat_counter == 0 && !queryIsPowerOn()) {
retval = true;
sendPowerOn();
}
break;
case LIRC_POWER_OFF :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
sendPowerOff();
}
break;
case LIRC_PAUSE :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
sendPausePlayback(streamID);
}
break;
case LIRC_RECORD_START :
queryIsRecordingRunning(streamID, q = false, sf);
if (repeat_counter == 0 && !q) {
retval = true;
sendStartRecording(streamID);
}
break;
case LIRC_RECORD_STOP :
queryIsRecordingRunning(streamID, q = false, sf);
if (repeat_counter == 0 && q) {
retval = true;
sendStopRecording(streamID);
}
break;
case LIRC_VOLUME_INC :
if (queryIsPowerOn()) {
retval = true;
float oldVolume = 0;
queryPlaybackVolume(streamID, oldVolume);
sendPlaybackVolume (streamID, oldVolume + 1.0/32.0);
}
break;
case LIRC_VOLUME_DEC :
if (queryIsPowerOn()) {
retval = true;
float oldVolume = 0;
queryPlaybackVolume(streamID, oldVolume);
sendPlaybackVolume (streamID, oldVolume - 1.0/32.0);
}
break;
case LIRC_CHANNEL_NEXT :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
int k = queryCurrentStationIdx() + 1;
if (k >= queryStations().count())
k = 0;
sendActivateStation(k);
}
break;
case LIRC_CHANNEL_PREV :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
int k = queryCurrentStationIdx() - 1;
if (k < 0)
k = queryStations().count() - 1;
sendActivateStation(k);
}
break;
case LIRC_SEARCH_NEXT :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
seeker = dynamic_cast<ISeekRadio*> (queryActiveDevice());
seeker->startSeekUp();
}
break;
case LIRC_SEARCH_PREV :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
seeker = dynamic_cast<ISeekRadio*> (queryActiveDevice());
seeker->startSeekDown();
}
break;
case LIRC_SLEEP :
if (repeat_counter == 0 && queryIsPowerOn()) {
retval = true;
sendStartCountdown();
}
break;
case LIRC_APPLICATION_QUIT :
retval = true;
kapp->quit();
break;
default:
break;
}
if (digit >= 0) {
if (m_addIndex || digit == 0) {
activateStation(m_addIndex * 10 + digit);
m_kbdTimer->stop();
m_addIndex = 0;
} else {
m_addIndex = digit;
m_kbdTimer->start(500, true);
}
}
}
}
return retval;
}
void LircSupport::setActions(const TQMap<LIRC_Actions, TQString> &actions, const TQMap<LIRC_Actions, TQString> &alt_actions)
{
m_Actions = actions;
m_AlternativeActions = alt_actions;
}
#include "lircsupport.moc"
|