forked from yavdr/vdr-plugin-restfulapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.h
44 lines (37 loc) · 982 Bytes
/
remote.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cxxtools/http/request.h>
#include <cxxtools/http/reply.h>
#include <cxxtools/http/responder.h>
#include "tools.h"
#include <vector>
#include <vdr/channels.h>
#include <vdr/keys.h>
#include <vdr/remote.h>
struct eKeyPair
{
const char* str;
eKeys key;
};
class KeyPairList
{
private:
std::vector< struct eKeyPair > keys;
void append(const char* str, eKeys key);
public:
KeyPairList();
~KeyPairList();
bool hitKey(std::string key);
};
class RemoteResponder : public cxxtools::http::Responder
{
private:
KeyPairList* keyPairList;
public:
explicit RemoteResponder(cxxtools::http::Service& service)
: cxxtools::http::Responder(service)
{
keyPairList = new KeyPairList();
}
~RemoteResponder() { delete keyPairList; }
virtual void reply(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
};
typedef cxxtools::http::CachedService<RemoteResponder> RemoteService;