2 This file is part of GNUnet
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/gnunet_sensor_service.h
23 * @brief API to the sensor service
24 * @author Omar Tarabai
26 #ifndef GNUNET_SENSOR_SERVICE_H
27 #define GNUNET_SENSOR_SERVICE_H
30 #include "gnunet_util_lib.h"
35 #if 0 /* keep Emacsens' auto-indent happy */
42 * Handle to the sensor service.
44 struct GNUNET_SENSOR_Handle;
47 * Structure containing brief info about sensor
49 struct SensorInfoShort
58 * First part of version number
60 uint16_t version_major;
63 * Second part of version number
65 uint16_t version_minor;
74 GNUNET_NETWORK_STRUCT_BEGIN
77 * Used to communicate sensor readings to
78 * collection points (SENSORDASHBAORD service)
80 struct GNUNET_SENSOR_Reading
84 * GNUNET general message header
86 struct GNUNET_MessageHeader *header;
89 * Size of the sensor name value, allocated
90 * at position 0 after this struct
92 size_t sensorname_size;
95 * First part of sensor version number
97 uint16_t sensorversion_major;
100 * Second part of sensor version number
102 uint16_t sensorversion_minor;
105 * Timestamp of recorded reading
110 * Size of reading value, allocation
111 * at poistion 1 after this struct
116 GNUNET_NETWORK_STRUCT_END
119 * Type of an iterator over sensor definitions.
122 * @param hello hello message for the peer (can be NULL)
123 * @param error message
125 typedef void (*GNUNET_SENSOR_SensorIteratorCB) (void *cls,
126 const struct SensorInfoShort *sensor,
127 const char *err_msg);
130 * Continuation called with a status result.
133 * @param emsg error message, NULL on success
135 typedef void (*GNUNET_SENSOR_Continuation)(void *cls,
139 * Connect to the sensor service.
141 * @return NULL on error
143 struct GNUNET_SENSOR_Handle *
144 GNUNET_SENSOR_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
147 * Disconnect from the sensor service
149 * @param h handle to disconnect
152 GNUNET_SENSOR_disconnect(struct GNUNET_SENSOR_Handle *h);
155 * Client asking to iterate all available sensors
157 * @param h Handle to SENSOR service
158 * @param timeout how long to wait until timing out
159 * @param sensorname information on one sensor only, can be NULL to get all
160 * @param sensorname_len length of the sensorname parameter
161 * @param callback the method to call for each sensor
162 * @param callback_cls closure for callback
163 * @return iterator context
165 struct GNUNET_SENSOR_SensorIteratorContext *
166 GNUNET_SENSOR_iterate_sensors (struct GNUNET_SENSOR_Handle *h,
167 struct GNUNET_TIME_Relative timeout,
168 const char* sensorname, size_t sensorname_len,
169 GNUNET_SENSOR_SensorIteratorCB callback, void *callback_cls);
171 #if 0 /* keep Emacsens' auto-indent happy */