Jamoma API  0.6.0.a19
WebSocketInclude.h
Go to the documentation of this file.
1 /**
2  * @file WebSocketInclude.h
3  * @ingroup modularWebSocket
4  * @brief It's the WebSocket protocol
5  * @authors Laurent Garnier
6  *
7  * @copyright © 2013, Laurent Garnier @n
8  * This code is licensed under the terms of the "New BSD License" @n
9  * http://creativecommons.org/licenses/BSD/
10  *
11  * @details Use cross platform libjson library from http://libjson.sourceforge.net/
12  */
13 
14 #ifndef MINUITINCLUDE_H_
15 #define MINUITINCLUDE_H_
16 
17 #ifdef TT_PLATFORM_WIN
18  #include <time.h>
19  #include <windows.h>
20 #else
21  #include <sys/time.h>
22 #endif
23 
24 #include "TTFoundationAPI.h"
25 #include "libjson.h"
26 
27 #include <sstream>
28 #include <iostream>
29 #include <string>
30 #include <map>
31 #include <vector>
32 
33 using namespace std;
34 
35 static const unsigned int WEBSOCKET_RECEPTION_PORT = 9001;
36 
37 #define WEBSOCKET_DEFAULT_REMOTE_APPNAME "telecommande"
38 #define WEBSOCKET_DEFAULT_HTML_PATH "html"
39 
40 #define WEBSOCKET_REQUEST_SET "set"
41 
42 #define WEBSOCKET_REQUEST_DISCOVER "?namespace"
43 #define WEBSOCKET_REQUEST_DISCOVER_ALL "?namespace_all"
44 #define WEBSOCKET_REQUEST_GET "?get"
45 #define WEBSOCKET_REQUEST_LISTEN "?listen"
46 
47 #define WEBSOCKET_ANSWER_DISCOVER ":namespace"
48 #define WEBSOCKET_ANSWER_DISCOVER_ALL ":namespace_all"
49 #define WEBSOCKET_ANSWER_GET ":get"
50 #define WEBSOCKET_ANSWER_LISTEN ":listen"
51 
52 #define WEBSOCKET_ERROR_DISCOVER "!namespace"
53 #define WEBSOCKET_ERROR_DISCOVER_ALL "!namespace_all"
54 #define WEBSOCKET_ERROR_GET "!get"
55 #define WEBSOCKET_ERROR_LISTEN "!listen"
56 
57 #define WEBSOCKET_REQUEST_LISTEN_ENABLE "enable"
58 #define WEBSOCKET_REQUEST_LISTEN_DISABLE "disable"
59 
60 #define WEBSOCKET_JSON_SENDER "sender"
61 #define WEBSOCKET_JSON_OPERATION "operation"
62 #define WEBSOCKET_JSON_ADDRESS "address"
63 #define WEBSOCKET_JSON_VALUE "value"
64 #define WEBSOCKET_JSON_ERROR "error"
65 
66 #define WEBSOCKET_JSON_CHILDREN "children"
67 #define WEBSOCKET_JSON_ATTRIBUTES "attributes"
68 #define WEBSOCKET_JSON_TYPE "type"
69 
70 
71 #define WEBSOCKET_START_NODES "nodes={"
72 #define WEBSOCKET_END_NODES "}"
73 #define WEBSOCKET_START_ATTRIBUTES "attributes={"
74 #define WEBSOCKET_END_ATTRIBUTES "}"
75 
76 #define ACCESS_GETTER "getter"
77 #define ACCESS_SETTER "setter"
78 #define ACCESS_GETSETTER "getsetter"
79 
80 #define DEFAULT_TIMEOUT 50
81 #define MAX_TRY 2
82 #define NO_TIMEOUT -1
83 
84 #define REQUEST_NOT_SENT -2
85 #define TIMEOUT_EXCEEDED -1
86 #define NO_ANSWER 0
87 #define ANSWER_RECEIVED 1
88 #define ANSWER_ERROR 2
89 
90 #endif /*MINUITINCLUDE_H_*/
STL namespace.