diff options
| author | Klaus Schmidinger <vdr@tvdr.de> | 2011-08-27 10:43:18 +0200 | 
|---|---|---|
| committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-08-27 10:43:18 +0200 | 
| commit | ac5f296f20d2d573e4b800c26c8ec4fff8e9f838 (patch) | |
| tree | 04a2e883e0476e0a7c2ee4d3c1db8d166a97b162 | |
| parent | 048d0df54a0fa8b81c4a63bb3b20bd7eac8addd1 (diff) | |
| download | vdr-ac5f296f20d2d573e4b800c26c8ec4fff8e9f838.tar.gz vdr-ac5f296f20d2d573e4b800c26c8ec4fff8e9f838.tar.bz2 | |
The SVDRP command HITK now accepts multiple keys
| -rw-r--r-- | HISTORY | 3 | ||||
| -rw-r--r-- | svdrp.c | 37 | 
2 files changed, 29 insertions, 11 deletions
| @@ -6699,7 +6699,7 @@ Video Disk Recorder Revision History    constructor is negative (avoids the "cTimeMs: using monotonic clock..." log message    before VDR's starting log message). -2011-08-21: Version 1.7.21 +2011-08-27: Version 1.7.21  - Fixed detecting frames for channels that split frames into several payloads    (reported by Derek Kelly). @@ -6728,3 +6728,4 @@ Video Disk Recorder Revision History  - The Audio and Subtitles options are now available through the Green and Yellow    keys in the Setup/DVB menu (thanks to Rolf Ahrenberg). This is mainly for remote    controls that don't have dedicated keys for these functions. +- The SVDRP command HITK now accepts multiple keys (up to 31). @@ -10,7 +10,7 @@   * and interact with the Video Disk Recorder - or write a full featured   * graphical interface that sits on top of an SVDRP connection.   * - * $Id: svdrp.c 2.9 2011/02/25 14:38:45 kls Exp $ + * $Id: svdrp.c 2.10 2011/08/27 10:43:18 kls Exp $   */  #include "svdrp.h" @@ -219,9 +219,11 @@ const char *HelpPages[] = {    "    image format defaults to JPEG.",    "HELP [ <topic> ]\n"    "    The HELP command gives help info.", -  "HITK [ <key> ]\n" +  "HITK [ <key> ... ]\n"    "    Hit the given remote control key. Without option a list of all\n" -  "    valid key names is given.", +  "    valid key names is given. If more than one key is given, they are\n" +  "    entered into the remote control queue in the given sequence. There\n" +  "    can be up to 31 keys.",    "LSTC [ :groups | <number> | <name> ]\n"    "    List channels. Without option, all channels are listed. Otherwise\n"    "    only the given channel is listed. If a name is given, all channels\n" @@ -902,13 +904,28 @@ void cSVDRP::CmdHELP(const char *Option)  void cSVDRP::CmdHITK(const char *Option)  {    if (*Option) { -     eKeys k = cKey::FromString(Option); -     if (k != kNone) { -        cRemote::Put(k); -        Reply(250, "Key \"%s\" accepted", Option); -        } -     else -        Reply(504, "Unknown key: \"%s\"", Option); +     char buf[strlen(Option) + 1]; +     strcpy(buf, Option); +     const char *delim = " \t"; +     char *strtok_next; +     char *p = strtok_r(buf, delim, &strtok_next); +     int NumKeys = 0; +     while (p) { +           eKeys k = cKey::FromString(p); +           if (k != kNone) { +              if (!cRemote::Put(k)) { +                 Reply(451, "Too many keys in \"%s\" (only %d accepted)", Option, NumKeys); +                 return; +                 } +              } +           else { +              Reply(504, "Unknown key: \"%s\"", p); +              return; +              } +           NumKeys++; +           p = strtok_r(NULL, delim, &strtok_next); +           } +     Reply(250, "Key%s \"%s\" accepted", NumKeys > 1 ? "s" : "", Option);       }    else {       Reply(-214, "Valid <key> names for the HITK command:"); | 
