diff options
Diffstat (limited to 'svdrp.h')
-rw-r--r-- | svdrp.h | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: svdrp.h 4.2 2015/05/22 13:44:43 kls Exp $ + * $Id: svdrp.h 4.3 2015/09/01 10:34:09 kls Exp $ */ #ifndef __SVDRP_H @@ -40,20 +40,35 @@ public: ///< 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; } + 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, + }; + +const char *SVDRPHostName(void); void SetSVDRPGrabImageDir(const char *GrabImageDir); void StartSVDRPHandler(int TcpPort, int UdpPort); void StopSVDRPHandler(void); void SendSVDRPDiscover(const char *Address = NULL); -bool GetSVDRPServerNames(cStringList *ServerNames); +bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag = sffNone); ///< Gets a list of all available VDRs this VDR is connected to via SVDRP, ///< and stores it in the given ServerNames list. The list is cleared ///< before getting the server names. + ///< If FetchFlag is given, only the server names for which the local + ///< 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. #endif //__SVDRP_H |