X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdriver%2Frc.h;h=9708ea7b73d81907c37a98a2f1faca139f4d5679;hp=557be5ea845a4df32b7ceca1baae8b7e4ddbc7fd;hb=10e7e45ae92d4fe06f70126ed256b87896dbc432;hpb=d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5 diff --git a/lib/driver/rc.h b/lib/driver/rc.h index 557be5e..9708ea7 100644 --- a/lib/driver/rc.h +++ b/lib/driver/rc.h @@ -6,12 +6,14 @@ #include #include -#include +#include class eRCInput; class eRCDriver; class eRCKey; +#ifndef SWIG + /** * \brief A remote control. * @@ -22,7 +24,7 @@ class eRCDevice: public Object protected: eRCInput *input; eRCDriver *driver; - eString id; + std::string id; public: /** * \brief Constructs a new remote control. @@ -30,7 +32,7 @@ public: * \param id The identifier of the RC, for use in settings. * \param input The \ref eRCDriver where this remote gets its codes from. */ - eRCDevice(eString id, eRCDriver *input); + eRCDevice(std::string id, eRCDriver *input); ~eRCDevice(); /** * \brief Handles a device specific code. @@ -39,27 +41,18 @@ public: * For Example, it might be 16bit codes with one bit make/break or special codes * for repeat. */ - virtual void handleCode(int code)=0; + virtual void handleCode(long code)=0; /** * \brief Get user readable description. * \result The description. */ virtual const char *getDescription() const=0; - const eString getIdentifier() const { return id; } + const std::string getIdentifier() const { return id; } /** * \brief Get a description for a specific key. * \param key The key to get the description for. * \result User readable description of given key. */ - virtual const char *getKeyDescription(const eRCKey &key) const=0; - /** - * \brief Get a dbox2-compatible keycode. - * - * THIS IS DEPRECATED! DON'T USE IT UNLESS YOU NEED IT! - * \param key The key to get the compatible code for. - * \result The dbox2-compatible code. (new RC as defined in enum). - */ - virtual int getKeyCompatibleCode(const eRCKey &key) const; }; /** @@ -102,7 +95,7 @@ class eRCShortDriver: public eRCDriver { protected: int handle; - eSocketNotifier *sn; + ePtr sn; void keyPressed(int); public: eRCShortDriver(const char *filename); @@ -113,10 +106,10 @@ class eRCInputEventDriver: public eRCDriver { protected: int handle; - eSocketNotifier *sn; + ePtr sn; void keyPressed(int); public: - eString getDeviceName(); + std::string getDeviceName(); eRCInputEventDriver(const char *filename); ~eRCInputEventDriver(); }; @@ -133,10 +126,15 @@ public: } enum { + /* there are not really flags.. */ + flagMake=0, flagBreak=1, - flagRepeat=2 + flagRepeat=2, + flagLong=3, + /* but this is. */ + flagAscii=4, }; - + bool operator<(const eRCKey &r) const { if (r.producer == producer) @@ -170,57 +168,78 @@ public: rrate; // repeat rate (in ms) }; +#endif + class eRCInput: public Object { int locked; int handle; static eRCInput *instance; - + int keyboardMode; +#ifdef SWIG + eRCInput(); + ~eRCInput(); +public: +#else public: struct lstr { - bool operator()(const eString &a, const eString &b) const + bool operator()(const std::string &a, const std::string &b) const { return a devices; + std::map devices; public: Signal1 keyEvent; - enum - { - RC_0=0, RC_1=0x1, RC_2=0x2, RC_3=0x3, RC_4=0x4, RC_5=0x5, RC_6=0x6, RC_7=0x7, - RC_8=0x8, RC_9=0x9, - RC_RIGHT=10, RC_LEFT=11, RC_UP=12, RC_DOWN=13, RC_OK=14, RC_MUTE=15, - RC_STANDBY=16, RC_GREEN=17, RC_YELLOW=18, RC_RED=19, RC_BLUE=20, RC_PLUS=21, RC_MINUS=22, - RC_HELP=23, RC_DBOX=24, - RC_UP_LEFT=27, RC_UP_RIGHT=28, RC_DOWN_LEFT=29, RC_DOWN_RIGHT=30, RC_HOME=31 - }; eRCInput(); ~eRCInput(); - - int lock(); - void unlock(); - int islocked() { return locked; } + void close(); bool open(); void setFile(int handle); + /* This is only relevant for "keyboard"-styled input devices, + i.e. not plain remote controls. It's up to the input device + driver to decide wheter an input device is a keyboard or + not. + + kmNone will ignore all Ascii Characters sent from the + keyboard/console driver, only give normal keycodes to the + application. + + kmAscii will filter out all keys which produce ascii characters, + and send them instead. Note that Modifiers like shift will still + be send. Control keys which produce escape codes are send using + normal keycodes. + + kmAll will ignore all keycodes, and send everything as ascii, + including escape codes. Pretty much useless, since you should + lock the console and pass this as the console fd for making the + tc* stuff working. + */ + void keyPressed(const eRCKey &key) { /*emit*/ keyEvent(key); } - void addDevice(const eString &id, eRCDevice *dev); - void removeDevice(const eString &id); - eRCDevice *getDevice(const eString &id); - std::map &getDevices(); - - static eRCInput *getInstance() { return instance; } - + void addDevice(const std::string &id, eRCDevice *dev); + void removeDevice(const std::string &id); + eRCDevice *getDevice(const std::string &id); + std::map &getDevices(); + eRCConfig config; +#endif + enum { kmNone, kmAscii, kmAll }; + void setKeyboardMode(int mode) { keyboardMode = mode; } + int getKeyboardMode() { return keyboardMode; } + static eRCInput *getInstance() { return instance; } + int lock(); + void unlock(); + int islocked() { return locked; } }; #endif