-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcsdkWrapper.h
More file actions
44 lines (36 loc) · 982 Bytes
/
csdkWrapper.h
File metadata and controls
44 lines (36 loc) · 982 Bytes
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
44
#include <string>
class CsdkWrapper
{
public:
enum EntityHandlerResult
{
EH_RESULT_ERROR = 0,
EH_RESULT_OK,
EH_RESULT_SLOW
};
typedef void *RequestHandle;
typedef void *ResourceHandle;
static const size_t NUM_PARAMS = 4;
struct EntityHandlerInfo
{
// Resource name that callback is invoked for
std::string resource;
// Resource handle
ResourceHandle resourceHandle;
// Handle of request
RequestHandle requestHandle;
// REST method from received request
std::string method;
// Resource parameters
std::string params[NUM_PARAMS];
std::string json();
};
typedef EntityHandlerResult (*EntityHandler)(EntityHandlerInfo *request);
CsdkWrapper();
bool start(EntityHandler handler, std::string uri);
bool stop();
bool respond(EntityHandlerInfo *response);
bool process();
private:
bool createResource();
};