Changeset 290a80
- Timestamp:
- 10/28/11 15:41:28 (19 months ago)
- Branches:
- ('master', '033cf796174446f5fff5bbfad1cbf1e4af35c0d8')('controller-upgrade', '72b31cc86eeeef18f1371a3067b6e8a5ca21abfc')('windows_service_fixes', 'df6bd2788365991d36d5af2a75833b8de2a5860f')
- Children:
- 4b37109f279b3517d8d152423aa0b8d6245954b7
- Parents:
- f207af7462b3b50299c33c8d76d6045061bd4455
- git-author:
- Micke Prag <micke.prag@telldus.se>2011-10-27 11:12:51+02:00
- git-committer:
- Micke Prag <micke.prag@telldus.se>2011-10-28 15:41:28+02:00
- File:
-
- 1 edited
-
docs/telldus-core.dox (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
docs/telldus-core.dox
rf285c9 r290a80 188 188 * \endcode 189 189 * 190 * \subsection sec_bu_sensors Sensors 191 * 192 * Retrieving sensor values can be done in two ways. Either by a polling 193 * interface or by callbacks. The client application can implement one or both 194 * of these interfaces. For callbacks, read more under \ref sec_events. 195 * 196 * Each of the sensors can have one or several value types. Currently only 197 * temperature and humidity are implemented. 198 * 199 * There is no API to add, remove or edit sensors. Each sensor that 200 * TellStick Duo has got any data from is added to an internal list. It is up to 201 * the client application to filter and only show the sensors your are 202 * interested in. 203 * 204 * To iterate over the list of sensors, call tdSensor() repeatedly as long as it 205 * returns \c TELLSTICK_SUCCESS. The parameters \c protocol, \c model, 206 * \c sensorId, and \c dataTypes are sent by reference and will be filled with 207 * the values. 208 * 209 * Example: 210 * \code 211 * char protocol[DATA_LENGTH], model[DATA_LENGTH]; 212 * int sensorId = 0, dataTypes = 0; 213 * while(tdSensor(protocol, DATA_LENGTH, model, DATA_LENGTH, &sensorId, &dataTypes) == TELLSTICK_SUCCESS) { 214 * //Print the sensor 215 * printf("%s,\t%s,\t%i\n", protocol, model, sensorId); 216 * } 217 * \endcode 218 * 219 * The type of sensor values the sensor supports are stored as flags in the 220 * parameter \c sensorId. Call tdSensorValue() for each type. 221 * 222 * Example: 223 * \code 224 * char value[DATA_LENGTH]; 225 * char timeBuf[80]; 226 * time_t timestamp = 0; 227 * if (dataTypes & TELLSTICK_TEMPERATURE) { 228 * tdSensorValue(protocol, model, sensorId, TELLSTICK_TEMPERATURE, value, DATA_LENGTH, (int *)×tamp); 229 * strftime(timeBuf, sizeof(timeBuf), "%Y-%m-%d %H:%M:%S", localtime(×tamp)); 230 * printf("Temperature:\t%sº\t(%s)\n", value, timeBuf); 231 * } 232 * \endcode 233 * 190 234 * \section sec_events Events 191 235 * 192 * To get events from either a TellStick Duo or ifanother software changes the193 * status of a device you have to register for a callback.236 * To get events from either a TellStick Duo, another software changes the 237 * status of a device, or new sensors values you have to register for a callback. 194 238 * 195 239 * \subsection sec_events_registering Registering for callbacks … … 199 243 * \li tdRegisterDeviceChangeEvent() 200 244 * \li tdRegisterRawDeviceEvent() 245 * \li tdRegisterSensorEvent() 201 246 * 202 247 * These all work in the same way. The first parameter is a function-pointer to … … 220 265 * \subsection sec_events_callbacks Callbacks 221 266 * 222 * telldus-core currently implements threedifferent callback function for267 * telldus-core currently implements four different callback function for 223 268 * different purposes. 224 269 * … … 273 318 * - void *context - see \ref sec_events_registering for description 274 319 * 320 * \subsubsection sec_events_callbacks_sensorevent SensorEvent 321 * 322 * This event is fired when a new sensor value is retrieved. 323 * 324 * Parameters: 325 * - const char *protocol - The sensors protocol 326 * - const char *model - The model of the sensor 327 * - int id - The unique id for the sensor. 328 * - int dataType - Flags for which types of data the sensor supports 329 * - const char *value - A human readable string of the data 330 * - int timestamp - The timestamp when the latest value was received 331 * - int callbackId - id of callback 332 * - void *context - See \ref sec_events_registering for description 333 * 275 334 * \subsection sec_events_example Example 276 335 *
Note: See TracChangeset
for help on using the changeset viewer.
