12#define __STDC_FORMAT_MACROS
14#include <netinet/in.h>
23#define INITTIMEOUT 10000
24#define REPEATTIMEOUT 1000
66 if (Key !=
kNone || NewCode)
116 for (
int i = km->
NumKeys(); --i > 0; ) {
127 snprintf(buffer,
sizeof(buffer),
"%016" PRIX64, Code);
128 return Put(buffer, Repeat, Release);
221 {
kfF1, 0x0000001B5B31317EULL },
222 {
kfF2, 0x0000001B5B31327EULL },
223 {
kfF3, 0x0000001B5B31337EULL },
224 {
kfF4, 0x0000001B5B31347EULL },
225 {
kfF5, 0x0000001B5B31357EULL },
226 {
kfF6, 0x0000001B5B31377EULL },
227 {
kfF7, 0x0000001B5B31387EULL },
228 {
kfF8, 0x0000001B5B31397EULL },
229 {
kfF9, 0x0000001B5B32307EULL },
230 {
kfF10, 0x0000001B5B32317EULL },
231 {
kfF11, 0x0000001B5B32327EULL },
232 {
kfF12, 0x0000001B5B32337EULL },
233 {
kfUp, 0x00000000001B5B41ULL },
234 {
kfDown, 0x00000000001B5B42ULL },
235 {
kfLeft, 0x00000000001B5B44ULL },
236 {
kfRight, 0x00000000001B5B43ULL },
237 {
kfHome, 0x00000000001B5B48ULL },
238 {
kfEnd, 0x00000000001B5B46ULL },
239 {
kfPgUp, 0x000000001B5B357EULL },
240 {
kfPgDown, 0x000000001B5B367EULL },
241 {
kfIns, 0x000000001B5B327EULL },
242 {
kfDel, 0x000000001B5B337EULL },
243 {
kfNone, 0x0000000000000000ULL }
253 tcgetattr(STDIN_FILENO, &
savedTm);
255 if (tcgetattr(STDIN_FILENO, &tm) == 0) {
257 tm.c_lflag &= ~(ICANON | ECHO);
260 tcsetattr(STDIN_FILENO, TCSANOW, &tm);
271 tcsetattr(STDIN_FILENO, TCSANOW, &
savedTm);
285 return (Func <= 0xFF) ? Func : 0;
329 char bytes[4] = { 0 };
332 if ((key1 & 0xF0) == 0xF0)
334 else if ((key1 & 0xE0) == 0xE0)
336 for (
int i = 0; i < bytescount; i++) {
344 else if (key1 == 0x1B) {
368 }
while (key1 != 0x7E);
386 uint64_t FirstCommand = 0;
387 uint64_t LastCommand = 0;
388 bool Delayed =
false;
394 if (Command == LastCommand) {
407 else if (Command == FirstCommand) {
417 FirstCommand = Command;
423 PutKey(LastCommand,
false,
true);
426 else if (Delayed && FirstCommand) {
439 LastCommand = Command;
static const char * SystemCharacterTable(void)
bool TimedWait(cMutex &Mutex, int TimeoutMs)
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
uint64_t ReadKeySequence(void)
int MapCodeToFunc(uint64_t Code)
void PutKey(uint64_t Code, bool Repeat=false, bool Release=false)
static uint64_t MapFuncToCode(int Func)
static void SetRawMode(bool RawMode)
const eKeys * Macro(void) const
int NumKeys(void) const
Returns the number of keys in this macro.
const char * Plugin(void) const
const cKeyMacro * Get(eKeys Key)
void PutSetup(const char *Remote, const char *Setup)
eKeys Get(const char *Remote, const char *Code)
const char * GetSetup(const char *Remote)
void Del(cListObject *Object, bool DeleteObject=true)
void Add(cListObject *Object, cListObject *After=NULL)
bool Poll(int TimeoutMs=0)
static const char * GetPlugin(void)
Returns the name of the plugin that was set with a previous call to PutMacro() or CallPlugin().
static cRemote * learning
static const char * keyMacroPlugin
static time_t lastActivity
static eKeys Get(int WaitMs=1000, char **UnknownCode=NULL)
bool Put(uint64_t Code, bool Repeat=false, bool Release=false)
static cCondVar keyPressed
static char * unknownCode
static bool PutMacro(eKeys Key)
static cTimeMs repeatTimeout
static bool HasKeys(void)
static void TriggerLastActivity(void)
Simulates user activity, for instance to keep the current menu open even if no remote control key has...
const char * GetSetup(void)
static bool CallPlugin(const char *Plugin)
Initiates calling the given plugin's main menu function.
cRemote(const char *Name)
static const char * callPlugin
static eKeys keys[MaxKeys]
void PutSetup(const char *Setup)
virtual bool Initialize(void)
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
void Cancel(int WaitSeconds=0)
Cancels the thread by first setting 'running' to false, so that the Action() loop can finish in an or...
uint64_t Elapsed(void) const
void Set(int Ms=0)
Sets the timer.
bool TimedOut(void) const