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
|
/***************************************************************************
lircsupport.h - description
-------------------
begin : Mon Feb 4 2002
copyright : (C) 2002 by Martin Witte / Frank Schwanz
email : emw-kradio@nocabal.de / schwanz@fh-brandenburg.de
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef LIRCSUPPORT_H
#define LIRCSUPPORT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <QtCore/QObject>
#include "timecontrol_interfaces.h"
#include "radio_interfaces.h"
#include "radiodevicepool_interfaces.h"
#include "soundstreamclient_interfaces.h"
#include "pluginbase.h"
enum LIRC_Actions {
LIRC_DIGIT_0,
LIRC_DIGIT_1,
LIRC_DIGIT_2,
LIRC_DIGIT_3,
LIRC_DIGIT_4,
LIRC_DIGIT_5,
LIRC_DIGIT_6,
LIRC_DIGIT_7,
LIRC_DIGIT_8,
LIRC_DIGIT_9,
LIRC_POWER_ON,
LIRC_POWER_OFF,
LIRC_PAUSE,
LIRC_RECORD_START,
LIRC_RECORD_STOP,
LIRC_VOLUME_INC,
LIRC_VOLUME_DEC,
LIRC_CHANNEL_NEXT,
LIRC_CHANNEL_PREV,
LIRC_SEARCH_NEXT,
LIRC_SEARCH_PREV,
LIRC_SLEEP,
LIRC_APPLICATION_QUIT
};
struct lirc_config;
class QSocketNotifier;
class QTimer;
class LircSupport : public QObject,
public PluginBase,
public IRadioClient,
public ITimeControlClient,
public ISoundStreamClient,
public IRadioDevicePoolClient
{
Q_OBJECT
public:
LircSupport(const QString &instanceID, const QString &name);
~LircSupport();
virtual bool connectI (Interface *);
virtual bool disconnectI (Interface *);
virtual void startPlugin();
virtual QString pluginClassName() const { return "LircSupport"; }
// virtual const QString &name() const { return PluginBase::name(); }
// virtual QString &name() { return PluginBase::name(); }
virtual void setActions(const QMap<LIRC_Actions, QString> &actions, const QMap<LIRC_Actions, QString> &alt_actions);
virtual const QMap<LIRC_Actions, QString> &getActions() const { return m_Actions; }
virtual const QMap<LIRC_Actions, QString> &getAlternativeActions() const { return m_AlternativeActions; }
const QString &getLIRCConfigurationFile() const { return m_lirc_config_file; }
void setLIRCConfigurationFile(const QString &f);
int getLIRC_fd() const { return m_fd_lirc; }
const QString &getPowerOnMode () const { return m_LIRCPowerOnMode; }
const QString &getPowerOffMode() const { return m_LIRCPowerOffMode; }
void getLIRCModeSync(bool &at_startup, bool &at_runtime) { at_startup = m_LIRCModeSyncAtStartup; at_runtime = m_LIRCModeSyncAtRuntime; }
void setPowerOnMode (const QString &m);
void setPowerOffMode(const QString &m);
void setLIRCModeSync(bool at_startup, bool at_runtime);
// PluginBase
public:
virtual void saveState ( KConfigGroup &) const;
virtual void restoreState (const KConfigGroup &);
virtual ConfigPageInfo createConfigurationPage();
// virtual AboutPageInfo createAboutPage();
// IRadioClient methods
RECEIVERS:
bool noticePowerChanged(bool on);
bool noticeStationChanged (const RadioStation &, int /*idx*/) { return false; }
bool noticeStationsChanged(const StationList &/*sl*/) { return false; }
bool noticePresetFileChanged(const QString &/*f*/) { return false; }
bool noticeRDSStateChanged (bool /*enabled*/) { return false; }
bool noticeRDSRadioTextChanged (const QString &/*s*/) { return false; }
bool noticeRDSStationNameChanged(const QString &/*s*/) { return false; }
bool noticeCurrentSoundStreamSourceIDChanged(SoundStreamID /*id*/) { return false; }
bool noticeCurrentSoundStreamSinkIDChanged (SoundStreamID /*id*/) { return false; }
// ITimeControlClient
RECEIVERS:
bool noticeAlarmsChanged(const AlarmVector &) { return false; }
bool noticeAlarm(const Alarm &) { return false; }
bool noticeNextAlarmChanged(const Alarm *) { return false; }
bool noticeCountdownStarted(const QDateTime &/*end*/) { return false; }
bool noticeCountdownStopped() { return false; }
bool noticeCountdownZero() { return false; }
bool noticeCountdownSecondsChanged(int /*n*/) { return false; }
// IRadioDevicePoolClient
RECEIVERS:
bool noticeActiveDeviceChanged(IRadioDevice *) { return false; }
bool noticeDevicesChanged(const QList<IRadioDevice*> &) { return false; }
bool noticeDeviceDescriptionChanged(const QString &) { return false; }
protected:
void activateStation(int i);
bool checkActions(const QString &string, int repeat_counter, const QMap<LIRC_Actions, QString> &map);
void processLIRCCode(const QString &c, bool event_map, bool is_raw);
void setLIRCMode(const QString &m);
bool doLIRCModeSync() const;
void checkLIRCConfigurationFile(const QString &fname);
void LIRC_init_fd();
void LIRC_init_config();
void LIRC_close_fd();
void LIRC_close_config();
protected slots:
void slotLIRC(int socket);
void slotKbdTimedOut();
signals:
void sigUpdateConfig();
void sigRawLIRCSignal(const QString &what, int repeat_counter, bool &consumed);
protected:
QString m_lirc_config_file;
QSocketNotifier *m_lirc_notify;
int m_fd_lirc;
struct lirc_config *m_lircConfig;
QString m_LIRCPowerOnMode;
QString m_LIRCPowerOffMode;
bool m_LIRCModeSyncAtStartup;
bool m_LIRCModeSyncAtRuntime;
QString m_lircrc_startup_mode;
QTimer *m_kbdTimer;
int m_addIndex;
// bool m_TakeRawLIRC;
QMap<LIRC_Actions, QString> m_Actions;
QMap<LIRC_Actions, QString> m_AlternativeActions;
bool m_inStartupPhase;
bool m_ignorePowerOnOff;
};
#endif
|