Instrument Neutral Distributed Interface INDI  2.0.2
indiapi.h
Go to the documentation of this file.
1 #if 0
2 INDI
3 Copyright (C) 2003 Elwood C. Downey
4 2022 Ludovic Pollet
5 
6 This library is free software;
7 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;
10 either
11 version 2.1 of the License, or (at your option) any later version.
12 
13 This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY;
15 without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library;
21 if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
23 
24 #endif
25 
26 #pragma once
27 
28 #include <stdio.h>
29 
129 /*******************************************************************************
130  * INDI wire protocol version implemented by this API.
131  * N.B. this is indepedent of the API itself.
132  */
133 
134 #define INDIV 1.7
135 
136 /* INDI Library version */
137 #define INDI_VERSION_MAJOR 2
138 #define INDI_VERSION_MINOR 0
139 #define INDI_VERSION_RELEASE 2
140 
141 /*******************************************************************************
142  * Manifest constants
143  */
144 
149 typedef enum
150 {
151 ISS_OFF = 0,
152 ISS_ON
154 
159 typedef enum
160 {
161 IPS_IDLE = 0,
164 IPS_ALERT
166 
171 typedef enum
172 {
177 
182 typedef enum
183 {
186 IP_RW
188 
189 // The XML strings for these attributes may be any length but implementations
190 // are only obligued to support these lengths for the various string attributes.
191 #define MAXINDINAME 64
192 #define MAXINDILABEL 64
193 #define MAXINDIDEVICE 64
194 #define MAXINDIGROUP 64
195 #define MAXINDIFORMAT 64
196 #define MAXINDIBLOBFMT 64
197 #define MAXINDITSTAMP 64
198 #define MAXINDIMESSAGE 255
199 
200 /*******************************************************************************
201  * Typedefs for each INDI Property type.
202  *
203  * INumber.format may be any printf-style appropriate for double
204  * or style "m" to create sexigesimal using the form "%<w>.<f>m" where
205  * <w> is the total field width.
206  * <f> is the width of the fraction. valid values are:
207  * 9 -> :mm:ss.ss
208  * 8 -> :mm:ss.s
209  * 6 -> :mm:ss
210  * 5 -> :mm.m
211  * 3 -> :mm
212  *
213  * examples:
214  *
215  * to produce use
216  *
217  * "-123:45" %7.3m
218  * " 0:01:02" %9.6m
219  */
220 
225 typedef struct _IText
226 {
232  char *text;
236  void *aux0;
238  void *aux1;
240 
245 typedef struct _ITextVectorProperty
246 {
258  double timeout;
264  int ntp;
268  void *aux;
270 
275 typedef struct _INumber
276 {
284  double min;
286  double max;
288  double step;
290  double value;
294  void *aux0;
296  void *aux1;
298 
319 {
331  double timeout;
337  int nnp;
341  void *aux;
343 
348 typedef struct _ISwitch
349 {
359  void *aux;
361 
367 {
381  double timeout;
387  int nsp;
391  void *aux;
393 
398 typedef struct _ILight
399 {
409  void *aux;
411 
416 typedef struct _ILightVectorProperty
417 {
431  int nlp;
435  void *aux;
437 
442 typedef struct _IBLOB/* one BLOB descriptor */
443 {
451  void *blob;
453  int bloblen;
455  int size;
459  void *aux0;
461  void *aux1;
463  void *aux2;
465 
470 typedef struct _IBLOBVectorProperty /* BLOB vector property descriptor */
471 {
483  double timeout;
489  int nbp;
493  void *aux;
495 
500 #define NARRAY(a) (sizeof(a) / sizeof(a[0]))
501 
505 #define assert_mem(p) if((p) == 0) { fprintf(stderr, "%s(%s): Failed to allocate memory\n", __FILE__, __func__); exit(1); }
506 
507 
508 #ifdef __cplusplus
509 extern "C" {
510 #endif
511 
512 // FIXME: duplicated from indidevapi.h. Can we share ?
513 
514 // Advertize support for shared blob on this platform
515 #define INDI_SHARED_BLOB_SUPPORT
516 #include "sharedblob.h"
517 
518 #ifdef __cplusplus
519 }
520 #endif
ISState
Switch state.
Definition: indiapi.h:150
@ ISS_OFF
Definition: indiapi.h:151
@ ISS_ON
Definition: indiapi.h:152
#define MAXINDIBLOBFMT
Definition: indiapi.h:196
#define MAXINDIDEVICE
Definition: indiapi.h:193
struct _IBLOBVectorProperty IBLOBVectorProperty
#define MAXINDIFORMAT
Definition: indiapi.h:195
#define MAXINDITSTAMP
Definition: indiapi.h:197
struct _IBLOB IBLOB
IPerm
Permission hint, with respect to client.
Definition: indiapi.h:183
@ IP_RW
Definition: indiapi.h:186
@ IP_RO
Definition: indiapi.h:184
@ IP_WO
Definition: indiapi.h:185
IPState
Property state.
Definition: indiapi.h:160
@ IPS_BUSY
Definition: indiapi.h:163
@ IPS_ALERT
Definition: indiapi.h:164
@ IPS_IDLE
Definition: indiapi.h:161
@ IPS_OK
Definition: indiapi.h:162
#define MAXINDILABEL
Definition: indiapi.h:192
struct _ISwitchVectorProperty ISwitchVectorProperty
struct _INumber INumber
ISRule
Switch vector rule hint.
Definition: indiapi.h:172
@ ISR_1OFMANY
Definition: indiapi.h:173
@ ISR_NOFMANY
Definition: indiapi.h:175
@ ISR_ATMOST1
Definition: indiapi.h:174
#define MAXINDIGROUP
Definition: indiapi.h:194
#define MAXINDINAME
Definition: indiapi.h:191
struct _ITextVectorProperty ITextVectorProperty
struct _ISwitch ISwitch
struct _ILightVectorProperty ILightVectorProperty
struct _ILight ILight
struct _INumberVectorProperty INumberVectorProperty
struct _IText IText
Namespace to encapsulate INDI client, drivers, and mediator classes.
One Blob (Binary Large Object) descriptor.
One light descriptor.
One number descriptor.
One switch descriptor.
One text descriptor.
BLOB (Binary Large Object) vector property descriptor.
Definition: indiapi.h:471
char label[MAXINDILABEL]
Definition: indiapi.h:477
char group[MAXINDIGROUP]
Definition: indiapi.h:479
char timestamp[MAXINDITSTAMP]
Definition: indiapi.h:491
char name[MAXINDINAME]
Definition: indiapi.h:475
char device[MAXINDIDEVICE]
Definition: indiapi.h:473
char label[MAXINDILABEL]
Definition: indiapi.h:447
void * aux0
Definition: indiapi.h:459
struct _IBLOBVectorProperty * bvp
Definition: indiapi.h:457
char format[MAXINDIBLOBFMT]
Definition: indiapi.h:449
void * blob
Definition: indiapi.h:451
void * aux2
Definition: indiapi.h:463
int bloblen
Definition: indiapi.h:453
char name[MAXINDINAME]
Definition: indiapi.h:445
int size
Definition: indiapi.h:455
void * aux1
Definition: indiapi.h:461
Light vector property descriptor.
Definition: indiapi.h:417
char label[MAXINDILABEL]
Definition: indiapi.h:423
char name[MAXINDINAME]
Definition: indiapi.h:421
char device[MAXINDIDEVICE]
Definition: indiapi.h:419
char group[MAXINDIGROUP]
Definition: indiapi.h:425
char timestamp[MAXINDITSTAMP]
Definition: indiapi.h:433
void * aux
Definition: indiapi.h:409
struct _ILightVectorProperty * lvp
Definition: indiapi.h:407
char name[MAXINDINAME]
Definition: indiapi.h:401
IPState s
Definition: indiapi.h:405
char label[MAXINDILABEL]
Definition: indiapi.h:403
Number vector property descriptor.
Definition: indiapi.h:319
char group[MAXINDIGROUP]
Definition: indiapi.h:327
char device[MAXINDIDEVICE]
Definition: indiapi.h:321
char name[MAXINDINAME]
Definition: indiapi.h:323
char label[MAXINDILABEL]
Definition: indiapi.h:325
char timestamp[MAXINDITSTAMP]
Definition: indiapi.h:339
char name[MAXINDINAME]
Definition: indiapi.h:278
char label[MAXINDILABEL]
Definition: indiapi.h:280
double max
Definition: indiapi.h:286
void * aux0
Definition: indiapi.h:294
double value
Definition: indiapi.h:290
double step
Definition: indiapi.h:288
double min
Definition: indiapi.h:284
char format[MAXINDIFORMAT]
Definition: indiapi.h:282
void * aux1
Definition: indiapi.h:296
struct _INumberVectorProperty * nvp
Definition: indiapi.h:292
Switch vector property descriptor.
Definition: indiapi.h:367
char device[MAXINDIDEVICE]
Definition: indiapi.h:369
char name[MAXINDINAME]
Definition: indiapi.h:371
char label[MAXINDILABEL]
Definition: indiapi.h:373
char group[MAXINDIGROUP]
Definition: indiapi.h:375
char timestamp[MAXINDITSTAMP]
Definition: indiapi.h:389
char label[MAXINDILABEL]
Definition: indiapi.h:353
struct _ISwitchVectorProperty * svp
Definition: indiapi.h:357
ISState s
Definition: indiapi.h:355
char name[MAXINDINAME]
Definition: indiapi.h:351
void * aux
Definition: indiapi.h:359
Text vector property descriptor.
Definition: indiapi.h:246
char label[MAXINDILABEL]
Definition: indiapi.h:252
char device[MAXINDIDEVICE]
Definition: indiapi.h:248
char timestamp[MAXINDITSTAMP]
Definition: indiapi.h:266
char name[MAXINDINAME]
Definition: indiapi.h:250
char group[MAXINDIGROUP]
Definition: indiapi.h:254
char name[MAXINDINAME]
Definition: indiapi.h:228
void * aux0
Definition: indiapi.h:236
struct _ITextVectorProperty * tvp
Definition: indiapi.h:234
char label[MAXINDILABEL]
Definition: indiapi.h:230
char * text
Definition: indiapi.h:232
void * aux1
Definition: indiapi.h:238