replicode
control_messages.h
Go to the documentation of this file.
1 /*
2 * HUMANOBS - mBrane
3 *
4 * Eric Nivel
5 * Center for Analysis and Design of Intelligent Agents
6 * Reykjavik University, Menntavegur 1, 101 Reykjavik, Iceland
7 * http://cadia.ru.is
8 * Copyright(c)2012
9 *
10 * This software was developed by the above copyright holder as part of
11 * the HUMANOBS EU research project, in collaboration with the
12 * following parties:
13 *
14 * Autonomous Systems Laboratory
15 * Technical University of Madrid, Spain
16 * http://www.aslab.org/
17 *
18 * Communicative Machines
19 * Edinburgh, United Kingdom
20 * http://www.cmlabs.com/
21 *
22 * Istituto Dalle Molle di Studi sull'Intelligenza Artificiale
23 * University of Lugano and SUPSI, Switzerland
24 * http://www.idsia.ch/
25 *
26 * Institute of Cognitive Sciences and Technologies
27 * Consiglio Nazionale delle Ricerche, Italy
28 * http://www.istc.cnr.it/
29 *
30 * Dipartimento di Ingegneria Informatica
31 * University of Palermo, Italy
32 * http://roboticslab.dinfo.unipa.it/index.php/Main/HomePage
33 *
34 *
35 * --- HUMANOBS Open-Source BSD License, with CADIA Clause v 1.0 ---
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, is permitted provided that the following conditions
39 * are met:
40 *
41 * - Redistributions of source code must retain the above copyright
42 * and collaboration notice, this list of conditions and the
43 * following disclaimer.
44 *
45 * - Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following
47 * disclaimer in the documentation and/or other materials provided
48 * with the distribution.
49 *
50 * - Neither the name of its copyright holders nor the names of its
51 * contributors may be used to endorse or promote products
52 * derived from this software without specific prior written permission.
53 *
54 * - CADIA Clause: The license granted in and to the software under this
55 * agreement is a limited-use license. The software may not be used in
56 * furtherance of:
57 * (i) intentionally causing bodily injury or severe emotional distress
58 * to any person;
59 * (ii) invading the personal privacy or violating the human rights of
60 * any person; or
61 * (iii) committing or preparing for any act of war.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
64 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
65 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
66 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
67 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
68 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
69 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
70 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
71 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
72 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
73 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74 */
75 
76 #ifndef mBrane_sdk_control_messages_h
77 #define mBrane_sdk_control_messages_h
78 
79 #include "message.h"
80 
81 
82 namespace mBrane
83 {
84 namespace sdk
85 {
86 namespace payloads
87 {
88 
89 class mBrane_dll SystemReady: // sent when all the nodes specified in the node cfg file are up and running
90  public ControlMessage<SystemReady>
91 {
92 };
93 
94 class mBrane_dll SyncProbe:
95  public ControlMessage<SyncProbe>
96 {
97 public:
99 };
100 
101 class mBrane_dll SyncEcho:
102  public ControlMessage<SyncEcho>
103 {
104 public:
105  int64_t t0; // from probe node_send_ts
106  int64_t t1; // from probe node_recv_ts
107  // t2 is recorded in echo node_send_ts
108  // t3 is recorded in echo node_recv_ts
109 };
110 
111 class mBrane_dll NodeJoined:
112  public ControlMessage<NodeJoined>
113 {
114 public:
116 };
117 
118 class mBrane_dll NodeLeft:
119  public ControlMessage<NodeLeft>
120 {
121 public:
123 };
124 
125 class mBrane_dll SetThreshold:
126  public ControlMessage<SetThreshold>
127 {
128 public:
131  float threshold;
132 };
133 
134 class mBrane_dll ActivateModule:
135  public ControlMessage<ActivateModule>
136 {
137 public:
143 };
144 
145 class mBrane_dll ActivateSpace:
146  public ControlMessage<ActivateSpace>
147 {
148 public:
150  uint16_t space_id; // the space on which target space is projected onto
151  uint16_t target_sid; // the space to set the activation for
153 };
154 
155 template<class U> class Subscribe:
156  public ControlMessage<U>
157 {
158 public:
163 };
164 
165 class mBrane_dll SubscribeMessage:
166  public Subscribe<SubscribeMessage>
167 {
168 public:
170 };
171 
172 class mBrane_dll UnsubscribeMessage:
173  public Subscribe<UnsubscribeMessage>
174 {
175 public:
177 };
178 
179 class mBrane_dll SubscribeStream:
180  public Subscribe<SubscribeStream>
181 {
182 public:
184 };
185 
186 class mBrane_dll UnsubscribeStream:
187  public Subscribe<UnsubscribeStream>
188 {
189 public:
191 };
192 
193 class mBrane_dll CreateModule:
194  public ControlMessage<CreateModule>
195 {
196 public:
201 };
202 
203 class mBrane_dll DeleteModule:
204  public ControlMessage<DeleteModule>
205 {
206 public:
210 };
211 
212 class mBrane_dll CreateSpace:
213  public ControlMessage<CreateSpace>
214 {
215 public:
219 };
220 
221 class mBrane_dll DeleteSpace:
222  public ControlMessage<DeleteSpace>
223 {
224 public:
227 };
228 
229 class mBrane_dll KillModule: // internal message issued upon reception of DeleteModule
230  public ControlMessage<KillModule>
231 {
232 };
233 
234 template<class U> class _DeleteSharedObjects:
235  public ControlMessage<U>
236 {
237 public:
239 };
240 
241 class mBrane_dll DeleteSharedObjects: // issued by the garbage collector. Triggers ack from remote nodes.
242  public CStorage<_DeleteSharedObjects<DeleteSharedObjects>, uint32_t>
243 {
244 };
245 
246 class mBrane_dll AckDeleteSharedObjects:
247  public ControlMessage<AckDeleteSharedObjects>
248 {
249 public:
251 };
252 
253 #define MBRANE_MESSAGE_CLASS(C) static const uint16_t C##_CID=(uint16_t)__COUNTER__;
254 //#define MBRANE_MESSAGE_CLASS(C) static const uint16_t C##_CID=ClassRegister::Load<C>(0);
255 #include "mBrane_message_classes.h"
256 
257 void mBrane_dll LoadControlMessageMetaData(); // overwrites C::_MetaData with actual values (i.e. C_CID dependent) - where C is a Core-defined control message;
258 // Core, mBrane and the user lib have different copies of C::_MetaData (initialized to 0x00FFFFFFFFFFFFF) at Core loading time;
259 // called by mBrane in main();
260 // C::_MetaData is not used by the user lib (no instances of mBrane control messages are created: the user lib only reacts to their occurrences).
261 }
262 }
263 }
264 
265 
266 #endif
Definition: control_messages.h:234
Definition: control_messages.h:203
Definition: control_messages.h:193
uint8_t node_id
Definition: control_messages.h:122
uint16_t module_cid
Definition: control_messages.h:208
uint8_t host_id
Definition: control_messages.h:149
float activationLevel
Definition: control_messages.h:142
uint16_t space_id
Definition: control_messages.h:130
uint16_t sender_cid
Definition: control_messages.h:197
uint16_t message_cid
Definition: control_messages.h:169
uint8_t host_id
Definition: control_messages.h:138
uint8_t host_id
Definition: control_messages.h:159
uint8_t host_id
Definition: control_messages.h:199
Definition: control_messages.h:94
uint16_t space_id
Definition: control_messages.h:141
Definition: control_messages.h:118
Definition: array.h:84
uint16_t stream_id
Definition: control_messages.h:190
Definition: control_messages.h:89
Definition: control_messages.h:134
uint16_t sender_cid
Definition: control_messages.h:216
uint16_t sender_id
Definition: control_messages.h:198
uint16_t target_sid
Definition: control_messages.h:151
Definition: control_messages.h:172
uint16_t module_id
Definition: control_messages.h:161
uint8_t host_id
Definition: control_messages.h:218
uint8_t host_id
Definition: control_messages.h:129
uint8_t node_id
Definition: control_messages.h:250
uint16_t sender_id
Definition: control_messages.h:217
Definition: control_messages.h:165
float threshold
Definition: control_messages.h:131
uint16_t module_id
Definition: control_messages.h:209
uint16_t message_cid
Definition: control_messages.h:176
Definition: control_messages.h:186
Definition: control_messages.h:221
Definition: control_messages.h:241
uint16_t space_id
Definition: control_messages.h:226
int64_t t0
Definition: control_messages.h:105
Definition: message.h:185
Definition: control_messages.h:125
uint16_t module_cid
Definition: control_messages.h:200
void LoadControlMessageMetaData()
Definition: control_messages.cpp:86
uint16_t module_id
Definition: control_messages.h:140
Definition: control_messages.h:179
uint8_t node_id
Definition: control_messages.h:115
uint16_t module_cid
Definition: control_messages.h:139
uint8_t host_id
Definition: control_messages.h:225
uint16_t stream_id
Definition: control_messages.h:183
uint8_t node_id
Definition: control_messages.h:238
Definition: control_messages.h:101
uint16_t space_id
Definition: control_messages.h:150
Definition: control_messages.h:212
Definition: control_messages.h:111
uint8_t node_id
Definition: control_messages.h:98
uint16_t space_id
Definition: control_messages.h:162
float activationLevel
Definition: control_messages.h:152
Definition: control_messages.h:229
int64_t t1
Definition: control_messages.h:106
Definition: control_messages.h:145
uint8_t host_id
Definition: control_messages.h:207
Definition: control_messages.h:155
Definition: control_messages.h:246
uint16_t module_cid
Definition: control_messages.h:160