~ubuntu-branches/ubuntu/quantal/libindi/quantal

« back to all changes in this revision

Viewing changes to .svn/tmp/indidevapi.h.2.tmp

  • Committer: Bazaar Package Importer
  • Author(s): Rohan Garg, Rohan Garg, Jonathan Riddell, Jonathan Thomas
  • Date: 2011-07-14 18:18:04 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110714181804-3fybxiy3tpjnk9kq
Tags: 0.8-0ubuntu1
[ Rohan Garg ]
* New upstream release
  - Add boost to build deps
  - Bump soversion to 0.8

[ Jonathan Riddell ]
* Use source format 3.0
* Add kubuntu_01_link_pthreads.diff to fix linking with pthreads

[ Jonathan Thomas ]
* Change Maintainer from MOTU to Ubuntu Developers

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if 0
2
 
    INDI
3
 
    Copyright (C) 2003-2006 Elwood C. Downey
4
 
 
5
 
                        Modified by Jasem Mutlaq (2003-2006)
6
 
 
7
 
    This library is free software; you can redistribute it and/or
8
 
    modify it under the terms of the GNU Lesser General Public
9
 
    License as published by the Free Software Foundation; either
10
 
    version 2.1 of the License, or (at your option) any later version.
11
 
 
12
 
    This library is distributed in the hope that it will be useful,
13
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
    Lesser General Public License for more details.
16
 
 
17
 
    You should have received a copy of the GNU Lesser General Public
18
 
    License along with this library; if not, write to the Free Software
19
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 
21
 
#endif
22
 
 
23
 
#ifndef INDI_DEVAPI_H
24
 
#define INDI_DEVAPI_H
25
 
 
26
 
/** \file indidevapi.h
27
 
    \brief Interface to the reference INDI C API device implementation on the Device Driver side.
28
 
    \author Elwood C. Downey
29
 
    \author Jasem Mutlaq
30
 
     
31
 
     This file is divided into two main sections:\n
32
 
     <ol><li> Functions the INDI device driver framework defines which the Driver may
33
 
     call:</li>
34
 
 
35
 
      <ul><li>IDxxx functions to send messages to an INDI client.</li>
36
 
      <li>IExxx functions to implement the event driven model.</li>
37
 
      <li>IUxxx functions to perform handy utility functions.</li></ul>
38
 
 
39
 
     <li>Functions the INDI device driver framework calls which the Driver must
40
 
    define:</li>
41
 
 
42
 
     <ul><li>ISxxx to respond to messages from a Client.</li></ul></ol>
43
 
 
44
 
<p>These functions are the interface to the INDI C-language Device Driver
45
 
reference implementation library. Any driver that uses this interface is
46
 
expected to #include "indidevapi.h" and to link with indidrivermain.o and
47
 
eventloop.o. Indidevapi.h further includes indiapi.h. The former contains
48
 
the prototypes for the functions documented here, although many functions
49
 
take arguments defined in the latter.</p>
50
 
 
51
 
<p>These functions make it much easier to write a compliant INDI driver than
52
 
starting from scratch, and also serve as a concrete
53
 
example of the interactions an INDI driver, in any language, is expected to
54
 
accommodate.</p>
55
 
 
56
 
<p>The reference driver framework and the optimizations made within the reference
57
 
indiserver both assume and require that one driver program implements exactly
58
 
one logical INDI device.</p>
59
 
 
60
 
<p>The functions in this framework fall into two broad categories. Some are
61
 
functions that a driver must define because they are called by the reference
62
 
framework; these functions begin with IS. The remaining functions are library
63
 
utilities a driver may use to do important operations.</p>
64
 
 
65
 
<p>A major point to realize is that an INDI driver built with this framework
66
 
does not contain the C main() function. As soon as a driver begins executing,
67
 
it listens on stdin for INDI messages. Only when a valid and appropriate
68
 
message is received will it then call the driver via one of the IS functions.
69
 
The driver is then expected to respond promptly by calling one of the ID
70
 
library functions. It may also use any of the IU utility functions as desired
71
 
to make processing a message easier.</p>
72
 
 
73
 
<p>Rather separate from these IS, ID and IU functions are a collection of
74
 
functions that utilize the notion of a callback. In a callback design,
75
 
the driver registers a function with the framework to be called under
76
 
certain circumstances. When said circumstances occur, the framework will
77
 
call the callback function. The driver never calls these callbacks directly.
78
 
These callback functions begin with IE. They can arrange for a callback
79
 
function to be called under three kinds of circumstances: when a given file
80
 
descriptor may be read without blocking (because either data is available
81
 
or EOF has been encountered), when a given time interval has elapsed, or
82
 
when the framework has nothing urgent to do. The callback functions for each
83
 
circumstance must be written according to a well defined prototype since,
84
 
after all, the framework must know how to call the callback correctlty.</p>
85
 
 
86
 
*/
87
 
 
88
 
 
89
 
/*******************************************************************************
90
 
 * get the data structures
91
 
 */
92
 
 
93
 
#include "indiapi.h"
94
 
#include "lilxml.h"
95
 
 
96
 
/*******************************************************************************
97
 
 *******************************************************************************
98
 
 *
99
 
 *  Functions the INDI device driver framework defines which the Driver may call
100
 
 *
101
 
 *******************************************************************************
102
 
 *******************************************************************************
103
 
 */
104
 
 
105
 
#ifdef __cplusplus
106
 
extern "C" {
107
 
#endif
108
 
 
109
 
/**
110
 
 * \defgroup d2cFunctions IDDef Functions: Functions drivers call to define their properties to clients.
111
 
 
112
 
<p>Each of the following functions creates the appropriate XML formatted
113
 
INDI message from its arguments and writes it to stdout. From there, is it
114
 
typically read by indiserver which then sends it to the clients that have
115
 
expressed interest in messages from the Device indicated in the message.</p>
116
 
 
117
 
<p>In addition to type-specific arguments, all end with a printf-style format
118
 
string, and appropriate subsequent arguments, that form the \param msg
119
 
attribute within the INDI message. If the format argument is NULL, no message
120
 
attribute is included with the message. Note that a \e timestamp 
121
 
attribute is also always added automatically based on the clock on the 
122
 
computer on which this driver is running.</p>
123
 
 
124
 
*/
125
 
 
126
 
 
127
 
/*@{*/
128
 
 
129
 
/** \brief Tell client to create a text vector property.
130
 
    \param t pointer to the vector text property to be defined.
131
 
    \param msg message in printf style to send to the client. May be NULL.
132
 
*/
133
 
extern void IDDefText (const ITextVectorProperty *t, const char *msg, ...)
134
 
#ifdef __GNUC__
135
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
136
 
#endif
137
 
;
138
 
 
139
 
/** \brief Tell client to create a number number property.
140
 
    \param n pointer to the vector number property to be defined.
141
 
    \param msg message in printf style to send to the client. May be NULL.
142
 
*/
143
 
extern void IDDefNumber (const INumberVectorProperty *n, const char *msg, ...)
144
 
#ifdef __GNUC__
145
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
146
 
#endif
147
 
;
148
 
 
149
 
/** \brief Tell client to create a switch vector property.
150
 
    \param s pointer to the vector switch property to be defined.
151
 
    \param msg message in printf style to send to the client. May be NULL.
152
 
*/
153
 
extern void IDDefSwitch (const ISwitchVectorProperty *s, const char *msg, ...)
154
 
#ifdef __GNUC__
155
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
156
 
#endif
157
 
;
158
 
 
159
 
/** \brief Tell client to create a light vector property.
160
 
    \param l pointer to the vector light property to be defined.
161
 
    \param msg message in printf style to send to the client. May be NULL.
162
 
*/
163
 
extern void IDDefLight (const ILightVectorProperty *l, const char *msg, ...)
164
 
#ifdef __GNUC__
165
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
166
 
#endif
167
 
;
168
 
 
169
 
/** \brief Tell client to create a BLOB vector property.
170
 
    \param b pointer to the vector BLOB property to be defined.
171
 
    \param msg message in printf style to send to the client. May be NULL.
172
 
 */
173
 
extern void IDDefBLOB (const IBLOBVectorProperty *b, const char *msg, ...)
174
 
#ifdef __GNUC__
175
 
    __attribute__ ( ( format( printf, 2, 3 ) ) )
176
 
#endif
177
 
;
178
 
 
179
 
 
180
 
/*@}*/
181
 
 
182
 
/**
183
 
 * \defgroup d2cuFunctions IDSet Functions: Functions drivers call to tell clients of new values for existing properties.
184
 
 */
185
 
/*@{*/
186
 
 
187
 
/** \brief Tell client to update an existing text vector property.
188
 
    \param t pointer to the vector text property.
189
 
    \param msg message in printf style to send to the client. May be NULL.
190
 
*/
191
 
extern void IDSetText (const ITextVectorProperty *t, const char *msg, ...)
192
 
#ifdef __GNUC__
193
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
194
 
#endif
195
 
;
196
 
 
197
 
/** \brief Tell client to update an existing number vector property.
198
 
    \param n pointer to the vector number property.
199
 
    \param msg message in printf style to send to the client. May be NULL.
200
 
*/
201
 
extern void IDSetNumber (const INumberVectorProperty *n, const char *msg, ...)
202
 
#ifdef __GNUC__
203
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
204
 
#endif
205
 
;
206
 
 
207
 
/** \brief Tell client to update an existing switch vector property.
208
 
    \param s pointer to the vector switch property.
209
 
    \param msg message in printf style to send to the client. May be NULL.
210
 
*/
211
 
extern void IDSetSwitch (const ISwitchVectorProperty *s, const char *msg, ...)
212
 
#ifdef __GNUC__
213
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
214
 
#endif
215
 
;
216
 
 
217
 
/** \brief Tell client to update an existing light vector property.
218
 
    \param l pointer to the vector light property.
219
 
    \param msg message in printf style to send to the client. May be NULL.
220
 
*/
221
 
extern void IDSetLight (const ILightVectorProperty *l, const char *msg, ...)
222
 
#ifdef __GNUC__
223
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
224
 
#endif
225
 
;
226
 
 
227
 
/** \brief Tell client to update an existing BLOB vector property.
228
 
    \param b pointer to the vector BLOB property.
229
 
    \param msg message in printf style to send to the client. May be NULL.
230
 
 */
231
 
extern void IDSetBLOB (const IBLOBVectorProperty *b, const char *msg, ...)
232
 
#ifdef __GNUC__
233
 
    __attribute__ ( ( format( printf, 2, 3 ) ) )
234
 
#endif
235
 
;
236
 
 
237
 
/*@}*/
238
 
 
239
 
/**
240
 
 * \defgroup d2duFunctions ID Functions: Functions to delete properties, and log messages locally or remotely.
241
 
 */
242
 
/*@{*/
243
 
 
244
 
 
245
 
/** \brief Function Drivers call to send log messages to Clients.
246
 
 
247
 
    If dev is specified the Client shall associate the message with that device; if dev is NULL the Client shall treat the message as generic from no specific Device.
248
 
    
249
 
    \param dev device name
250
 
    \param msg message in printf style to send to the client.
251
 
*/
252
 
extern void IDMessage (const char *dev, const char *msg, ...)
253
 
#ifdef __GNUC__
254
 
        __attribute__ ( ( format( printf, 2, 3 ) ) )
255
 
#endif
256
 
;
257
 
 
258
 
/** \brief Function Drivers call to inform Clients a Property is no longer available, or the entire device is gone if name is NULL.
259
 
 
260
 
    \param dev device name. If device name is NULL, the entire device will be deleted.
261
 
    \param name property name to be deleted.
262
 
    \param msg message in printf style to send to the client.
263
 
*/
264
 
extern void IDDelete (const char *dev, const char *name, const char *msg, ...)
265
 
#ifdef __GNUC__
266
 
        __attribute__ ( ( format( printf, 3, 4 ) ) )
267
 
#endif
268
 
;
269
 
 
270
 
/** \brief Function Drivers call to log a message locally.
271
 
 
272
 
    The message is not sent to any Clients.
273
 
    
274
 
    \param msg message in printf style to send to the client.
275
 
*/
276
 
extern void IDLog (const char *msg, ...)
277
 
#ifdef __GNUC__
278
 
        __attribute__ ( ( format( printf, 1, 2 ) ) )
279
 
#endif
280
 
;
281
 
 
282
 
/*@}*/
283
 
 
284
 
/**
285
 
 * \defgroup snoopFunctions ISnoop Functions: Functions drivers call to snoop on other drivers.
286
 
 
287
 
 */
288
 
/*@{*/
289
 
 
290
 
 
291
 
/** \typedef BLOBHandling
292
 
    \brief How drivers handle BLOBs incoming from snooping drivers */
293
 
typedef enum 
294
 
{
295
 
  B_NEVER=0,    /*!< Never receive BLOBs */
296
 
  B_ALSO,       /*!< Receive BLOBs along with normal messages */
297
 
  B_ONLY        /*!< ONLY receive BLOBs from drivers, ignore all other traffic */
298
 
} BLOBHandling;
299
 
 
300
 
/** \brief Function a Driver calls to snoop on another Device. Snooped messages will then arrive via ISSnoopDevice.
301
 
    \param snooped_device name of the device to snoop.
302
 
    \param snooped_property name of the snooped property in the device.
303
 
*/
304
 
extern void IDSnoopDevice (const char *snooped_device, char *snooped_property);
305
 
 
306
 
/** \brief Function a Driver calls to control whether they will receive BLOBs from snooped devices.
307
 
    \param snooped_device_name name of the device to snoop.
308
 
    \param bh How drivers handle BLOBs incoming from snooping drivers.
309
 
*/
310
 
extern void IDSnoopBLOBs (const char *snooped_device, BLOBHandling bh);
311
 
 
312
 
/*@}*/
313
 
 
314
 
/**
315
 
 * \defgroup deventFunctions IE Functions: Functions drivers call to register with the INDI event utilities.
316
 
 
317
 
     Callbacks are called when a read on a file descriptor will not block. Timers are called once after a specified interval. Workprocs are called when there is nothing else to do. The "Add" functions return a unique id for use with their corresponding "Rm" removal function. An arbitrary pointer may be specified when a function is registered which will be stored and forwarded unchanged when the function is later invoked.
318
 
 */
319
 
/*@{*/
320
 
     
321
 
 /* signature of a callback, timout caller and work procedure function */
322
 
 
323
 
/** \typedef IE_CBF
324
 
    \brief Signature of a callback. */
325
 
typedef void (IE_CBF) (int readfiledes, void *userpointer);
326
 
 
327
 
/** \typedef IE_TCF
328
 
    \brief Signature of a timeout caller. */
329
 
typedef void (IE_TCF) (void *userpointer);
330
 
 
331
 
/** \typedef IE_WPF
332
 
    \brief Signature of a work procedure function. */
333
 
typedef void (IE_WPF) (void *userpointer);
334
 
 
335
 
/* functions to add and remove callbacks, timers and work procedures */
336
 
 
337
 
/** \brief Register a new callback, \e fp, to be called with \e userpointer as argument when \e readfiledes is ready.
338
 
*
339
 
* \param readfiledes file descriptor.
340
 
* \param fp a pointer to the callback function.
341
 
* \param userpointer a pointer to be passed to the callback function when called.
342
 
* \return a unique callback id for use with IERmCallback().
343
 
*/
344
 
extern int  IEAddCallback (int readfiledes, IE_CBF *fp, void *userpointer);
345
 
 
346
 
/** \brief Remove a callback function.
347
 
*
348
 
* \param callbackid the callback ID returned from IEAddCallback()
349
 
*/
350
 
extern void IERmCallback (int callbackid);
351
 
 
352
 
/** \brief Register a new timer function, \e fp, to be called with \e ud as argument after \e ms.
353
 
 
354
 
 Add to list in order of decreasing time from epoch, ie, last entry runs soonest. The timer will only invoke the callback function \b once. You need to call addTimer again if you want to repeat the process.
355
 
*
356
 
* \param millisecs timer period in milliseconds.
357
 
* \param fp a pointer to the callback function.
358
 
* \param userpointer a pointer to be passed to the callback function when called.
359
 
* \return a unique id for use with IERmTimer().
360
 
*/
361
 
extern int  IEAddTimer (int millisecs, IE_TCF *fp, void *userpointer);
362
 
 
363
 
/** \brief Remove the timer with the given \e timerid, as returned from IEAddTimer.
364
 
*
365
 
* \param timerid the timer callback ID returned from IEAddTimer().
366
 
*/
367
 
extern void IERmTimer (int timerid);
368
 
 
369
 
/** \brief Add a new work procedure, fp, to be called with ud when nothing else to do.
370
 
*
371
 
* \param fp a pointer to the work procedure callback function.
372
 
* \param userpointer a pointer to be passed to the callback function when called.
373
 
* \return a unique id for use with IERmWorkProc().
374
 
*/
375
 
extern int  IEAddWorkProc (IE_WPF *fp, void *userpointer);
376
 
 
377
 
/** \brief Remove a work procedure.
378
 
*
379
 
* \param workprocid The unique ID for the work procedure to be removed.
380
 
*/
381
 
extern void IERmWorkProc (int workprocid);
382
 
 
383
 
/* wait in-line for a flag to set, presumably by another event function */
384
 
 
385
 
extern int IEDeferLoop (int maxms, int *flagp);
386
 
extern int IEDeferLoop0 (int maxms, int *flagp);
387
 
 
388
 
/*@}*/
389
 
 
390
 
/**
391
 
 * \defgroup dutilFunctions IU Functions: Functions drivers call to perform handy utility routines.
392
 
 
393
 
<p>This section describes handy utility functions that are provided by the
394
 
framework for tasks commonly required in the processing of client
395
 
messages. It is not strictly necessary to use these functions, but it
396
 
both prudent and efficient to do so.</P>
397
 
 
398
 
<p>These do not communicate with the Client in any way.</p>
399
 
 */
400
 
/*@{*/
401
 
 
402
 
 
403
 
/** \brief Find an IText member in a vector text property.
404
 
*
405
 
* \param tp a pointer to a text vector property.
406
 
* \param name the name of the member to search for.
407
 
* \return a pointer to an IText member on match, or NULL if nothing is found.
408
 
*/
409
 
extern IText   *IUFindText  (const ITextVectorProperty *tp, const char *name);
410
 
 
411
 
/** \brief Find an INumber member in a number text property.
412
 
*
413
 
* \param tp a pointer to a number vector property.
414
 
* \param name the name of the member to search for.
415
 
* \return a pointer to an INumber member on match, or NULL if nothing is found.
416
 
*/
417
 
extern INumber *IUFindNumber(const INumberVectorProperty *tp, const char *name);
418
 
 
419
 
/** \brief Find an ISwitch member in a vector switch property.
420
 
*
421
 
* \param tp a pointer to a switch vector property.
422
 
* \param name the name of the member to search for.
423
 
* \return a pointer to an ISwitch member on match, or NULL if nothing is found.
424
 
*/
425
 
extern ISwitch *IUFindSwitch(const ISwitchVectorProperty *tp, const char *name);
426
 
 
427
 
/** \brief Returns the first ON switch it finds in the vector switch property.
428
 
 
429
 
*   \note This is only valid for ISR_1OFMANY mode. That is, when only one switch out of many is allowed to be ON. Do not use this function if you can have multiple ON switches in the same vector property.
430
 
*        
431
 
* \param tp a pointer to a switch vector property.
432
 
* \return a pointer to the \e first ON ISwitch member if found. If all switches are off, NULL is returned. 
433
 
*/
434
 
extern ISwitch *IUFindOnSwitch (const ISwitchVectorProperty *tp);
435
 
 
436
 
/** \brief Reset all switches in a switch vector property to OFF.
437
 
*
438
 
* \param svp a pointer to a switch vector property.
439
 
*/
440
 
extern void IUResetSwitch(ISwitchVectorProperty *svp);
441
 
 
442
 
/** \brief Update all switches in a switch vector property.
443
 
*
444
 
* \param svp a pointer to a switch vector property.
445
 
* \param states the states of the new ISwitch members.
446
 
* \param names the names of the ISwtich members to update.
447
 
* \param n the number of ISwitch members to update.
448
 
* \return 0 if update successful, -1 otherwise.
449
 
*/
450
 
extern int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n);
451
 
 
452
 
/** \brief Update all numbers in a number vector property.
453
 
*
454
 
* \param nvp a pointer to a number vector property.
455
 
* \param values the states of the new INumber members.
456
 
* \param names the names of the INumber members to update.
457
 
* \param n the number of INumber members to update.
458
 
* \return 0 if update successful, -1 otherwise. Update will fail if values are out of scope, or in case of property name mismatch.
459
 
*/
460
 
extern int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n);
461
 
 
462
 
/** \brief Update all text members in a text vector property.
463
 
*
464
 
* \param tvp a pointer to a text vector property.
465
 
* \param texts a pointer to the text members
466
 
* \param names the names of the IText members to update.
467
 
* \param n the number of IText members to update.
468
 
* \return 0 if update successful, -1 otherwise. Update will fail in case of property name mismatch.
469
 
*/
470
 
extern int IUUpdateText(ITextVectorProperty *tvp, char * texts[], char *names[], int n);
471
 
 
472
 
/** \brief Function to update the min and max elements of a number in the client
473
 
    \param nvp pointer to an INumberVectorProperty.
474
 
 */
475
 
extern void IUUpdateMinMax(const INumberVectorProperty *nvp);
476
 
 
477
 
/** \brief Function to reliably save new text in a IText.
478
 
    \param tp pointer to an IText member.
479
 
    \param newtext the new text to be saved     
480
 
*/
481
 
extern void IUSaveText (IText *tp, const char *newtext);
482
 
 
483
 
/** \brief Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
484
 
    \param sp pointer a switch property to fill
485
 
    \param name the switch name
486
 
    \param label the switch label
487
 
    \param s the switch state (ISS_ON or ISS_OFF)
488
 
*/
489
 
extern void IUFillSwitch(ISwitch *sp, const char *name, const char * label, ISState s);
490
 
 
491
 
/** \brief Assign attributes for a light property. The light's auxiliary elements will be set to NULL.
492
 
    \param lp pointer a light property to fill
493
 
    \param name the light name
494
 
    \param label the light label
495
 
    \param s the light state (IDLE, WARNING, OK, ALERT)
496
 
*/
497
 
extern void IUFillLight(ILight *lp, const char *name, const char * label, IPState s);
498
 
 
499
 
/** \brief Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
500
 
    \param np pointer a number property to fill
501
 
    \param name the number name
502
 
    \param label the number label
503
 
    \param format the number format in printf style (e.g. "%02d")
504
 
    \param min  the minimum possible value
505
 
    \param max the maximum possible value
506
 
    \param step the step used to climb from minimum value to maximum value
507
 
    \param value the number's current value
508
 
*/
509
 
extern void IUFillNumber(INumber *np, const char *name, const char * label, const char *format, double min, double max, double step, double value);
510
 
 
511
 
/** \brief Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
512
 
    \param tp pointer a text property to fill
513
 
    \param name the text name
514
 
    \param label the text label
515
 
    \param initialText the initial text
516
 
*/
517
 
extern void IUFillText(IText *tp, const char *name, const char * label, const char *initialText);
518
 
 
519
 
 
520
 
/** \brief Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
521
 
    \param svp pointer a switch vector property to fill
522
 
    \param sp pointer to an array of switches
523
 
    \param nsp the dimension of sp
524
 
    \param dev the device name this vector property belongs to
525
 
    \param name the vector property name
526
 
    \param label the vector property label
527
 
    \param group the vector property group
528
 
    \param p the vector property permission
529
 
    \param r the switches behavior
530
 
    \param timeout vector property timeout in seconds 
531
 
    \param s the vector property initial state.
532
 
*/
533
 
extern void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char * dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s);
534
 
 
535
 
/** \brief Assign attributes for a light vector property. The vector's auxiliary elements will be set to NULL.
536
 
    \param lvp pointer a light vector property to fill
537
 
    \param lp pointer to an array of lights
538
 
    \param nlp the dimension of lp
539
 
    \param dev the device name this vector property belongs to
540
 
    \param name the vector property name
541
 
    \param label the vector property label
542
 
    \param group the vector property group
543
 
    \param s the vector property initial state.
544
 
*/
545
 
extern void IUFillLightVector(ILightVectorProperty *lvp, ILight *lp, int nlp, const char * dev, const char *name, const char *label, const char *group, IPState s);
546
 
 
547
 
/** \brief Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
548
 
    \param nvp pointer a number vector property to fill
549
 
    \param np pointer to an array of numbers
550
 
    \param nnp the dimension of np
551
 
    \param dev the device name this vector property belongs to
552
 
    \param name the vector property name
553
 
    \param label the vector property label
554
 
    \param group the vector property group
555
 
    \param p the vector property permission
556
 
    \param timeout vector property timeout in seconds 
557
 
    \param s the vector property initial state.
558
 
*/
559
 
extern void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char * dev, const char *name, const char *label, const char* group, IPerm p, double timeout, IPState s);
560
 
 
561
 
/** \brief Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
562
 
    \param tvp pointer a text vector property to fill
563
 
    \param tp pointer to an array of texts
564
 
    \param ntp the dimension of tp
565
 
    \param dev the device name this vector property belongs to
566
 
    \param name the vector property name
567
 
    \param label the vector property label
568
 
    \param group the vector property group
569
 
    \param p the vector property permission
570
 
    \param timeout vector property timeout in seconds 
571
 
    \param s the vector property initial state.
572
 
*/
573
 
extern void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char * dev, const char *name, const char *label, const char* group, IPerm p, double timeout, IPState s);
574
 
 
575
 
/** \brief Update a snooped number vector property from the given XML root element.
576
 
    \param root XML root elememnt containing the snopped property content
577
 
    \param nvp a pointer to the number vector property to be updated.
578
 
    \return 0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.
579
 
*/
580
 
extern int IUSnoopNumber (XMLEle *root, INumberVectorProperty *nvp);
581
 
 
582
 
/** \brief Update a snooped text vector property from the given XML root element.
583
 
    \param root XML root elememnt containing the snopped property content
584
 
    \param tvp a pointer to the text vector property to be updated.
585
 
    \return 0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.
586
 
*/
587
 
extern int IUSnoopText (XMLEle *root, ITextVectorProperty *tvp);
588
 
 
589
 
/** \brief Update a snooped light vector property from the given XML root element.
590
 
    \param root XML root elememnt containing the snopped property content
591
 
    \param lvp a pointer to the light vector property to be updated.
592
 
    \return 0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.
593
 
*/
594
 
extern int IUSnoopLight (XMLEle *root, ILightVectorProperty *lvp);
595
 
 
596
 
/** \brief Update a snooped switch vector property from the given XML root element.
597
 
    \param root XML root elememnt containing the snopped property content
598
 
    \param svp a pointer to the switch vector property to be updated.
599
 
    \return 0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.
600
 
*/
601
 
extern int IUSnoopSwitch (XMLEle *root, ISwitchVectorProperty *svp);
602
 
 
603
 
/** \brief Update a snooped BLOB vector property from the given XML root element.
604
 
    \param root XML root elememnt containing the snopped property content
605
 
    \param bvp a pointer to the BLOB vector property to be updated.
606
 
    \return 0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.
607
 
*/
608
 
extern int IUSnoopBLOB (XMLEle *root, IBLOBVectorProperty *bvp);
609
 
 
610
 
/*@}*/
611
 
 
612
 
/*******************************************************************************
613
 
 *******************************************************************************
614
 
 *
615
 
 *   Functions the INDI Device Driver framework calls which the Driver must
616
 
 *   define.
617
 
 *
618
 
 *******************************************************************************
619
 
 *******************************************************************************
620
 
 */
621
 
 
622
 
 
623
 
 
624
 
/**
625
 
 * \defgroup dcuFunctions IS Functions: Functions all drivers must define.
626
 
 
627
 
This section defines functions that must be defined in each driver. These
628
 
functions are never called by the driver, but are called by the driver
629
 
framework. These must always be defined even if they do nothing.
630
 
*/
631
 
/*@{*/
632
 
 
633
 
/** \brief Get Device Properties
634
 
    \param dev the name of the device.
635
 
 
636
 
This function is called by the framework whenever the driver has received a
637
 
getProperties message from an INDI client. The argument \param dev is either a
638
 
string containing the name of the device specified within the message, or NULL
639
 
if no device was specified. If the driver does not recognize the device, it
640
 
should ignore the message and do nothing. If dev matches the device the driver
641
 
is implementing, or dev is NULL, the driver must respond by sending one defXXX
642
 
message to describe each property defined by this device, including its
643
 
current (or initial) value. The recommended way to send these messages is to
644
 
call the appropriate IDDef functions.
645
 
*/  
646
 
extern void ISGetProperties (const char *dev);
647
 
 
648
 
 
649
 
/** \brief Update the value of an existing text vector property.
650
 
    \param dev the name of the device.
651
 
    \param name the name of the text vector property to update.
652
 
    \param texts an array of text values.
653
 
    \param names parallel names to the array of text values.
654
 
    \param n the dimension of texts[].
655
 
    \note You do not need to call this function, it is called by INDI when new text values arrive from the client.
656
 
*/
657
 
extern void ISNewText (const char *dev, const char *name, char *texts[],
658
 
    char *names[], int n); 
659
 
 
660
 
/** \brief Update the value of an existing number vector property.
661
 
    \param dev the name of the device.
662
 
    \param name the name of the number vector property to update.
663
 
    \param doubles an array of number values.
664
 
    \param names parallel names to the array of number values.
665
 
    \param n the dimension of doubles[].
666
 
    \note You do not need to call this function, it is called by INDI when new number values arrive from the client.
667
 
*/
668
 
extern void ISNewNumber (const char *dev, const char *name, double *doubles,
669
 
    char *names[], int n); 
670
 
 
671
 
/** \brief Update the value of an existing switch vector property.
672
 
    \param dev the name of the device.
673
 
    \param name the name of the switch vector property to update.
674
 
    \param states an array of switch states.
675
 
    \param names parallel names to the array of switch states.
676
 
    \param n the dimension of states[].
677
 
    \note You do not need to call this function, it is called by INDI when new switch values arrive from the client.
678
 
*/
679
 
extern void ISNewSwitch (const char *dev, const char *name, ISState *states,
680
 
    char *names[], int n); 
681
 
 
682
 
/** \brief Update data of an existing blob vector property.
683
 
    \param dev the name of the device.
684
 
    \param name the name of the blob vector property to update.
685
 
    \param sizes an array of base64 blob sizes in bytes \e before decoding.
686
 
    \param blobsizes an array of the sizes of blobs \e after decoding from base64.
687
 
    \param blobs an array of decoded data. Each blob size is found in \e blobsizes array.
688
 
    \param formats Blob data format (e.g. fits.z).
689
 
    \param names names of blob members to update. 
690
 
    \param n the number of blobs to update.
691
 
    \note You do not need to call this function, it is called by INDI when new blob values arrive from the client.
692
 
          e.g. BLOB element with name names[0] has data located in blobs[0] with size sizes[0] and format formats[0].
693
 
*/
694
 
 
695
 
extern void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n); 
696
 
 
697
 
/** \brief Function defined by Drivers that is called when another Driver it is snooping (by having previously called IDSnoopDevice()) sent any INDI message.
698
 
    \param root The argument contains the full message exactly as it was sent by the driver.
699
 
    \e Hint: use the IUSnoopXXX utility functions to help crack the message if it was one of setXXX or defXXX.
700
 
*/
701
 
extern void ISSnoopDevice (XMLEle *root);
702
 
 
703
 
/*@}*/
704
 
 
705
 
/* Handy readability macro to avoid unused variables warnings */
706
 
#define INDI_UNUSED(x) (void) x
707
 
 
708
 
#ifdef __cplusplus
709
 
}
710
 
#endif
711
 
 
712
 
#endif