summaryrefslogtreecommitdiff
path: root/svdrp.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-09-10 10:39:45 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2015-09-10 10:39:45 +0200
commitbc0de5dbc56d5b4f373f09e92cf07ec773ccab4e (patch)
treef457a0f3a37f9f009ac5f242745b26d48c4a0935 /svdrp.h
parent4e3325b7f7e30d1013798d74b8e7e0b8471813b1 (diff)
downloadvdr-bc0de5dbc56d5b4f373f09e92cf07ec773ccab4e.tar.gz
vdr-bc0de5dbc56d5b4f373f09e92cf07ec773ccab4e.tar.bz2
Implemented full handling of remote timers
Diffstat (limited to 'svdrp.h')
-rw-r--r--svdrp.h58
1 files changed, 17 insertions, 41 deletions
diff --git a/svdrp.h b/svdrp.h
index 10c0c053..ba33fc27 100644
--- a/svdrp.h
+++ b/svdrp.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: svdrp.h 4.4 2015/09/06 12:39:24 kls Exp $
+ * $Id: svdrp.h 4.5 2015/09/09 09:44:12 kls Exp $
*/
#ifndef __SVDRP_H
@@ -12,46 +12,6 @@
#include "tools.h"
-class cSVDRPCommand {
-protected:
- cString serverName;
- cString command;
- cStringList response;
-public:
- cSVDRPCommand(const char *ServerName, const char *Command);
- ///< Sets up an SVDRP Command to be executed on the VDR with the given
- ///< ServerName. A list of all available servers can be retrieved by
- ///< calling GetSVDRPServerNames().
- ///< Command is one SVDRP command, followed by optional parameters,
- ///< just as it can be given in a normal SVDRP connection. It doesn't
- ///< need to be terminated with a newline.
- virtual ~cSVDRPCommand();
- bool Execute(void);
- ///< Sends the Command given in the constructor to the remote VDR
- ///< and collects all of the response strings.
- ///< Returns true if the data exchange was successful. Whether or
- ///< not the actual SVDRP command was successful depends on the
- ///< resulting strings from the remote VDR, which can be accessed
- ///< by calling Response(). Execute() can be called any number of
- ///< times. The list of response strings will be cleared before
- ///< the command is actually executed.
- const cStringList *Response(void) const { return &response; }
- ///< Returns the list of strings the remote VDR has sent in response
- ///< to the command. The response strings are exactly as received,
- ///< with the leading three digit reply code and possible continuation
- ///< line indicator ('-') in place.
- const char *Response(int Index) { return (Index >= 0 && Index < response.Size()) ? response[Index] : NULL; }
- ///< This is a convenience function for accessing the response strings.
- ///< Returns the string at the given Index, or NULL if Index is out
- ///< of range.
- int Code(const char *s) { return s ? atoi(s) : 0; }
- ///< Returns the value of the three digit reply code of the given
- ///< response string.
- const char *Value(const char *s) { return s && s[0] && s[1] && s[2] && s[3] ? s + 4 : NULL; }
- ///< Returns the actual value of the given response string, skipping
- ///< the three digit reply code and possible continuation line indicator.
- };
-
enum eSvdrpFetchFlags {
sffNone = 0b0000,
sffTimers = 0b0001,
@@ -72,5 +32,21 @@ bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag =
///< client has this flag set will be returned, and the client's flag
///< will be cleared.
///< Returns true if the resulting list is not empty.
+bool ExecSVDRPCommand(const char *ServerName, const char *Command, cStringList *Response = NULL);
+ ///< Sends the given SVDRP Command string to the remote VDR identified
+ ///< by ServerName and collects all of the response strings in Response.
+ ///< If no Response parameter is given, the response from command execution
+ ///< is ignored.
+ ///< Returns true if the data exchange was successful. Whether or
+ ///< not the actual SVDRP command was successful depends on the
+ ///< resulting strings from the remote VDR, which can be accessed
+ ///< through Response. If Response is given, it will be cleared before
+ ///< the command is actually executed.
+inline int SVDRPCode(const char *s) { return s ? atoi(s) : 0; }
+ ///< Returns the value of the three digit reply code of the given
+ ///< SVDRP response string.
+inline const char *SVDRPValue(const char *s) { return s && s[0] && s[1] && s[2] && s[3] ? s + 4 : NULL; }
+ ///< Returns the actual value of the given SVDRP response string, skipping
+ ///< the three digit reply code and possible continuation line indicator.
#endif //__SVDRP_H