aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorOmar Tarabai <tarabai@devegypt.com>2014-07-04 15:16:00 +0000
committerOmar Tarabai <tarabai@devegypt.com>2014-07-04 15:16:00 +0000
commit85e95fea731341b5bfdbb1175520220cd1d394d5 (patch)
treeda765e955fa045c70401e16b4995b8a5b7fbd951 /src/include
parentf65ed3aab8bf35e48934cdccf4ec5b64e4b14e88 (diff)
downloadgnunet-85e95fea731341b5bfdbb1175520220cd1d394d5.tar.gz
gnunet-85e95fea731341b5bfdbb1175520220cd1d394d5.zip
completed sensordashboard + fixes
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_sensor_service.h44
-rw-r--r--src/include/gnunet_sensor_util_lib.h91
2 files changed, 91 insertions, 44 deletions
diff --git a/src/include/gnunet_sensor_service.h b/src/include/gnunet_sensor_service.h
index f81248b28..eb4fbdc67 100644
--- a/src/include/gnunet_sensor_service.h
+++ b/src/include/gnunet_sensor_service.h
@@ -71,50 +71,6 @@ struct SensorInfoShort
71 71
72}; 72};
73 73
74GNUNET_NETWORK_STRUCT_BEGIN
75
76/**
77 * Used to communicate sensor readings to
78 * collection points (SENSORDASHBAORD service)
79 */
80struct GNUNET_SENSOR_Reading
81{
82
83 /**
84 * GNUNET general message header
85 */
86 struct GNUNET_MessageHeader *header;
87
88 /**
89 * Size of the sensor name value, allocated
90 * at position 0 after this struct
91 */
92 size_t sensorname_size;
93
94 /**
95 * First part of sensor version number
96 */
97 uint16_t sensorversion_major;
98
99 /**
100 * Second part of sensor version number
101 */
102 uint16_t sensorversion_minor;
103
104 /**
105 * Timestamp of recorded reading
106 */
107 uint64_t timestamp;
108
109 /**
110 * Size of reading value, allocation
111 * at poistion 1 after this struct
112 */
113 size_t value_size;
114
115};
116GNUNET_NETWORK_STRUCT_END
117
118/** 74/**
119 * Type of an iterator over sensor definitions. 75 * Type of an iterator over sensor definitions.
120 * 76 *
diff --git a/src/include/gnunet_sensor_util_lib.h b/src/include/gnunet_sensor_util_lib.h
index 15fb61b4c..56e0bc868 100644
--- a/src/include/gnunet_sensor_util_lib.h
+++ b/src/include/gnunet_sensor_util_lib.h
@@ -188,6 +188,78 @@ struct SensorInfo
188}; 188};
189 189
190/** 190/**
191 * Carries a single reading from a sensor
192 */
193struct GNUNET_SENSOR_Reading
194{
195
196 /**
197 * Sensor this reading is related to
198 */
199 struct SensorInfo *sensor;
200
201 /**
202 * Timestamp of taking the reading
203 */
204 uint64_t timestamp;
205
206 /**
207 * Reading value
208 */
209 void *value;
210
211 /**
212 * Size of @value
213 */
214 uint16_t value_size;
215
216};
217
218GNUNET_NETWORK_STRUCT_BEGIN
219
220/**
221 * Used to communicate sensor readings to
222 * collection points (SENSORDASHBAORD service)
223 */
224struct GNUNET_SENSOR_ReadingMessage
225{
226
227 /**
228 * GNUNET general message header
229 */
230 struct GNUNET_MessageHeader header;
231
232 /**
233 * Size of the sensor name value, allocated
234 * at position 0 after this struct
235 */
236 uint16_t sensorname_size;
237
238 /**
239 * First part of sensor version number
240 */
241 uint16_t sensorversion_major;
242
243 /**
244 * Second part of sensor version number
245 */
246 uint16_t sensorversion_minor;
247
248 /**
249 * Timestamp of recorded reading
250 */
251 uint64_t timestamp;
252
253 /**
254 * Size of reading value, allocation
255 * at poistion 1 after this struct
256 */
257 uint16_t value_size;
258
259};
260GNUNET_NETWORK_STRUCT_END
261
262/**
191 * Reads sensor definitions from local data files 263 * Reads sensor definitions from local data files
192 * 264 *
193 * @return a multihashmap of loaded sensors 265 * @return a multihashmap of loaded sensors
@@ -203,6 +275,25 @@ GNUNET_SENSOR_load_all_sensors ();
203char * 275char *
204GNUNET_SENSOR_get_sensor_dir (); 276GNUNET_SENSOR_get_sensor_dir ();
205 277
278/**
279 * Parses a sensor reading message struct
280 *
281 * @param msg message header received
282 * @param sensors multihashmap of loaded sensors
283 * @return sensor reading struct or NULL if error
284 */
285struct GNUNET_SENSOR_Reading *
286GNUNET_SENSOR_parse_reading_message (const struct GNUNET_MessageHeader *msg,
287 struct GNUNET_CONTAINER_MultiHashMap *sensors);
288
289/**
290 * Destroys a group of sensors in a hashmap and the hashmap itself
291 *
292 * @param sensors hashmap containing the sensors
293 */
294void
295GNUNET_SENSOR_destroy_sensors (struct GNUNET_CONTAINER_MultiHashMap *sensors);
296
206#if 0 /* keep Emacsens' auto-indent happy */ 297#if 0 /* keep Emacsens' auto-indent happy */
207{ 298{
208#endif 299#endif