Jamoma API  0.6.0.a19
WebSocketAnswerManager.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularWebSocket
4  *
5  * @brief A Protocol interface
6  *
7  * @details
8  *
9  * @authors Laurent Garnier, Théo de la Hogue
10  *
11  * @copyright © 2011, Laurent Garnier, Théo de la Hogue @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
17 #ifndef WEBSOCKET_ANSWER_MANAGER
18 #define WEBSOCKET_ANSWER_MANAGER
19 
20 #include "WebSocket.h"
21 #include "WebSocketInclude.h"
22 #include "WebSocketAnswer.h"
23 
24 #include <string>
25 #include <vector>
26 
27 class WebSocket;
28 typedef WebSocket* WebSocketPtr;
29 
30 class WebSocketAnswerManager {
31 
32 private:
33 
34  WebSocketPtr mProtocol;
35 
36  TTHashPtr mDiscoverAnswers;
37  TTHashPtr mDiscoverAllAnswers;
38  TTHashPtr mGetAnswers;
39 
40 public:
41 
42  WebSocketAnswerManager(WebSocketPtr aMinuitProtocol);
43  virtual ~WebSocketAnswerManager();
44 
45  void AddDiscoverAnswer(TTSymbol from, TTAddress address, int timeOutInMs = DEFAULT_TIMEOUT);
46  TTErr ReceiveDiscoverAnswer(TTSymbol from, TTAddress address, const TTValue& value, TTErr error = kTTErrNone);
47  int CheckDiscoverAnswer(TTSymbol from, TTAddress address, TTValue& value);
48  TTErr ParseDiscoverAnswer(const TTValue& answer, TTSymbol& returnedType, TTValue& returnedChildren, TTValue& returnedAttributes);
49 
50  void AddDiscoverAllAnswer(TTSymbol from, TTAddress address, int timeOutInMs = DEFAULT_TIMEOUT);
51  TTErr ReceiveDiscoverAllAnswer(TTSymbol from, TTAddress address, const TTValue& value, TTErr error = kTTErrNone);
52  int CheckDiscoverAllAnswer(TTSymbol from, TTAddress address, TTValue& value);
53  TTErr ParseDiscoverAllAnswer(const TTValue& answer, TTNodePtr node);
54 
55  void AddGetAnswer(TTSymbol from, TTAddress address, int timeOutInMs = DEFAULT_TIMEOUT);
56  TTErr ReceiveGetAnswer(TTSymbol from, TTAddress address, const TTValue& value, TTErr error = kTTErrNone);
57  int CheckGetAnswer(TTSymbol from, TTAddress address, TTValue& value);
58 };
59 typedef WebSocketAnswerManager* WebSocketAnswerManagerPtr;
60 
61 #endif // WEBSOCKET_ANSWER_MANAGER
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to ...
Definition: TTNode.h:59
It's the WebSocket protocol.
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Definition: TTAddress.h:29
WebSocket Answer.
Maintain a collection of TTValue objects indexed by TTSymbol pointers.
Definition: TTHash.h:36
Create a web socket plugin.
Definition: WebSocket.h:33
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
It's the WebSocket protocol.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
No Error.
Definition: TTBase.h:343
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34