Instrument Neutral Distributed Interface INDI  1.9.2
Macros | Typedefs | Enumerations | Functions
indidevapi.h File Reference

Interface to the reference INDI C API device implementation on the Device Driver side. More...

#include "indiapi.h"
#include "lilxml.h"

Go to the source code of this file.

Macros

#define ATTRIBUTE_FORMAT_PRINTF(A, B)
 
#define INDI_UNUSED(x)   (void)x
 

Typedefs

typedef void() IE_CBF(int readfiledes, void *userpointer)
 Signature of a callback. More...
 
typedef void() IE_TCF(void *userpointer)
 Signature of a timeout caller. More...
 
typedef void() IE_WPF(void *userpointer)
 Signature of a work procedure function. More...
 

Enumerations

enum  BLOBHandling { B_NEVER = 0, B_ALSO, B_ONLY }
 How drivers handle BLOBs incoming from snooping drivers. More...
 

Functions

void IDDefText (const ITextVectorProperty *t, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to create a text vector property. More...
 
void void IDDefTextVA (const ITextVectorProperty *t, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void IDDefNumber (const INumberVectorProperty *n, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to create a number number property. More...
 
void void void void IDDefNumberVA (const INumberVectorProperty *n, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void void IDDefSwitch (const ISwitchVectorProperty *s, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to create a switch vector property. More...
 
void void void void void void IDDefSwitchVA (const ISwitchVectorProperty *s, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void void void void IDDefLight (const ILightVectorProperty *l, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to create a light vector property. More...
 
void void void void void void void void IDDefLightVA (const ILightVectorProperty *l, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void void void void void void IDDefBLOB (const IBLOBVectorProperty *b, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to create a BLOB vector property. More...
 
void void void void void void void void void void IDDefBLOBVA (const IBLOBVectorProperty *b, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void IDSetText (const ITextVectorProperty *t, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to update an existing text vector property. More...
 
void void IDSetTextVA (const ITextVectorProperty *t, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void IDSetNumber (const INumberVectorProperty *n, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to update an existing number vector property. More...
 
void void void void IDSetNumberVA (const INumberVectorProperty *n, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void void IDSetSwitch (const ISwitchVectorProperty *s, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to update an existing switch vector property. More...
 
void void void void void void IDSetSwitchVA (const ISwitchVectorProperty *s, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void void void void IDSetLight (const ILightVectorProperty *l, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to update an existing light vector property. More...
 
void void void void void void void void IDSetLightVA (const ILightVectorProperty *l, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void void void void void void IDSetBLOB (const IBLOBVectorProperty *b, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Tell client to update an existing BLOB vector property. More...
 
void void void void void void void void void void IDSetBLOBVA (const IBLOBVectorProperty *b, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void IDMessage (const char *dev, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
 Function Drivers call to send log messages to Clients. More...
 
void void IDMessageVA (const char *dev, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(2
 
void void void IDDelete (const char *dev, const char *name, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(3
 Function Drivers call to inform Clients a Property is no longer available, or the entire device is gone if name is NULL. More...
 
void void void void IDDeleteVA (const char *dev, const char *name, const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void void IDLog (const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(1
 Function Drivers call to log a message locally. More...
 
void void void void void void IDLogVA (const char *msg, va_list arg) ATTRIBUTE_FORMAT_PRINTF(1
 
void IDSnoopDevice (const char *snooped_device, const char *snooped_property)
 Function a Driver calls to snoop on another Device. Snooped messages will then arrive via ISSnoopDevice. More...
 
void IDSnoopBLOBs (const char *snooped_device, const char *snooped_property, BLOBHandling bh)
 Function a Driver calls to control whether they will receive BLOBs from snooped devices. More...
 
int IEAddCallback (int readfiledes, IE_CBF *fp, void *userpointer)
 Register a new callback, fp, to be called with userpointer as argument when readfiledes is ready. More...
 
void IERmCallback (int callbackid)
 Remove a callback function. More...
 
int IEAddTimer (int millisecs, IE_TCF *fp, void *userpointer)
 Register a new single-shot timer function, fp, to be called with ud as argument after ms. More...
 
int IEAddPeriodicTimer (int millisecs, IE_TCF *fp, void *userpointer)
 Register a new periodic timer function, fp, to be called with ud as argument after ms. More...
 
int IERemainingTimer (int timerid)
 Returns the timer's remaining value in milliseconds left until the timeout. More...
 
int IENSecRemainingTimer (int tid)
 
void IERmTimer (int timerid)
 Remove the timer with the given timerid, as returned from IEAddTimer() or IEAddPeriodicTimer(). More...
 
int IEAddWorkProc (IE_WPF *fp, void *userpointer)
 Add a new work procedure, fp, to be called with ud when nothing else to do. More...
 
void IERmWorkProc (int workprocid)
 Remove a work procedure. More...
 
int IEDeferLoop (int maxms, int *flagp)
 
int IEDeferLoop0 (int maxms, int *flagp)
 
ITextIUFindText (const ITextVectorProperty *tvp, const char *name)
 Find an IText member in a vector text property. More...
 
INumberIUFindNumber (const INumberVectorProperty *nvp, const char *name)
 Find an INumber member in a number text property. More...
 
ISwitchIUFindSwitch (const ISwitchVectorProperty *svp, const char *name)
 Find an ISwitch member in a vector switch property. More...
 
ILightIUFindLight (const ILightVectorProperty *lvp, const char *name)
 Find an ILight member in a vector Light property. More...
 
IBLOBIUFindBLOB (const IBLOBVectorProperty *bvp, const char *name)
 Find an IBLOB member in a vector BLOB property. More...
 
ISwitchIUFindOnSwitch (const ISwitchVectorProperty *sp)
 Returns the first ON switch it finds in the vector switch property. More...
 
int IUFindIndex (const char *needle, char **hay, unsigned int n)
 Returns the index of the string in a string array. More...
 
int IUFindOnSwitchIndex (const ISwitchVectorProperty *sp)
 Returns the index of first ON switch it finds in the vector switch property. More...
 
const char * IUFindOnSwitchName (ISState *states, char *names[], int n)
 Returns the name of the first ON switch it finds in the supplied arguments. More...
 
void IUResetSwitch (ISwitchVectorProperty *svp)
 Reset all switches in a switch vector property to OFF. More...
 
int IUUpdateSwitch (ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
 Update all switches in a switch vector property. More...
 
int IUUpdateNumber (INumberVectorProperty *nvp, double values[], char *names[], int n)
 Update all numbers in a number vector property. More...
 
int IUUpdateText (ITextVectorProperty *tvp, char *texts[], char *names[], int n)
 Update all text members in a text vector property. More...
 
int IUUpdateBLOB (IBLOBVectorProperty *bvp, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Update all BLOB members in a BLOB vector property. More...
 
int IUSaveBLOB (IBLOB *bp, int size, int blobsize, char *blob, char *format)
 Function to save blob metadata in the corresponding blob. More...
 
void IUUpdateMinMax (const INumberVectorProperty *nvp)
 Function to update the min and max elements of a number in the client. More...
 
void IUSaveText (IText *tp, const char *newtext)
 Function to reliably save new text in a IText. More...
 
void IUFillSwitch (ISwitch *sp, const char *name, const char *label, ISState s)
 Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL. More...
 
void IUFillLight (ILight *lp, const char *name, const char *label, IPState s)
 Assign attributes for a light property. The light's auxiliary elements will be set to NULL. More...
 
void IUFillNumber (INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
 Assign attributes for a number property. The number's auxiliary elements will be set to NULL. More...
 
void IUFillText (IText *tp, const char *name, const char *label, const char *initialText)
 Assign attributes for a text property. The text's auxiliary elements will be set to NULL. More...
 
void IUFillBLOB (IBLOB *bp, const char *name, const char *label, const char *format)
 Assign attributes for a BLOB property. The BLOB's data and auxiliary elements will be set to NULL. More...
 
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)
 Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL. More...
 
void IUFillLightVector (ILightVectorProperty *lvp, ILight *lp, int nlp, const char *dev, const char *name, const char *label, const char *group, IPState s)
 Assign attributes for a light vector property. The vector's auxiliary elements will be set to NULL. More...
 
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)
 Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL. More...
 
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)
 Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL. More...
 
void IUFillBLOBVector (IBLOBVectorProperty *bvp, IBLOB *bp, int nbp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
 Assign attributes for a BLOB vector property. The vector's auxiliary elements will be set to NULL. More...
 
int IUSnoopNumber (XMLEle *root, INumberVectorProperty *nvp)
 Update a snooped number vector property from the given XML root element. More...
 
int IUSnoopText (XMLEle *root, ITextVectorProperty *tvp)
 Update a snooped text vector property from the given XML root element. More...
 
int IUSnoopLight (XMLEle *root, ILightVectorProperty *lvp)
 Update a snooped light vector property from the given XML root element. More...
 
int IUSnoopSwitch (XMLEle *root, ISwitchVectorProperty *svp)
 Update a snooped switch vector property from the given XML root element. More...
 
int IUSnoopBLOB (XMLEle *root, IBLOBVectorProperty *bvp)
 Update a snooped BLOB vector property from the given XML root element. More...
 
void ISGetProperties (const char *dev)
 Get Device Properties. More...
 
void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 Update the value of an existing text vector property. More...
 
void ISNewNumber (const char *dev, const char *name, double *values, char *names[], int n)
 Update the value of an existing number vector property. More...
 
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Update the value of an existing switch vector property. More...
 
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Update data of an existing blob vector property. More...
 
void ISSnoopDevice (XMLEle *root)
 Function defined by Drivers that is called when another Driver it is snooping (by having previously called IDSnoopDevice()) sent any INDI message. More...
 
int crackDN (XMLEle *root, char **dev, char **name, char msg[])
 Extract dev and name attributes from an XML element. More...
 
int crackIPState (const char *str, IPState *ip)
 Extract property state (Idle, OK, Busy, Alert) from the supplied string. More...
 
int crackISState (const char *str, ISState *ip)
 Extract switch state (On or Off) from the supplied string. More...
 
int crackIPerm (const char *str, IPerm *ip)
 Extract property permission state (RW, RO, WO) from the supplied string. More...
 
int crackISRule (const char *str, ISRule *ip)
 Extract switch rule (OneOfMany, OnlyOne..etc) from the supplied string. More...
 
const char * pstateStr (IPState s)
 
const char * sstateStr (ISState s)
 
const char * ruleStr (ISRule r)
 
const char * permStr (IPerm p)
 
void xmlv1 ()
 

Detailed Description

Interface to the reference INDI C API device implementation on the Device Driver side.

Author
Elwood C. Downey
Jasem Mutlaq

This file is divided into two main sections:

  1. Functions the INDI device driver framework defines which the Driver may call:

    • IDxxx functions to send messages to an INDI client. Please note that it is recommended to use the INDI Library wrapper functions instead of calling IDxxx directly.
    • IExxx functions to implement the event driven model.
    • IUxxx functions to perform handy utility functions.

  2. Functions the INDI device driver framework calls which the Driver must define:

    • ISxxx to respond to messages from a Client.

These functions are the interface to the INDI C-language Device Driver reference implementation library. Any driver that uses this interface is expected to #include "indidevapi.h" and to link with indidrivermain.o and eventloop.o. Indidevapi.h further includes indiapi.h. The former contains the prototypes for the functions documented here, although many functions take arguments defined in the latter.

These functions make it much easier to write a compliant INDI driver than starting from scratch, and also serve as a concrete example of the interactions an INDI driver, in any language, is expected to accommodate.

The reference driver framework and the optimizations made within the reference indiserver both assume and require that one driver program implements exactly one logical INDI device.

The functions in this framework fall into two broad categories. Some are functions that a driver must define because they are called by the reference framework; these functions begin with IS. The remaining functions are library utilities a driver may use to do important operations.

A major point to realize is that an INDI driver built with this framework does not contain the C main() function. As soon as a driver begins executing, it listens on stdin for INDI messages. Only when a valid and appropriate message is received will it then call the driver via one of the IS functions. The driver is then expected to respond promptly by calling one of the ID library functions. It may also use any of the IU utility functions as desired to make processing a message easier.

Rather separate from these IS, ID and IU functions are a collection of functions that utilize the notion of a callback. In a callback design, the driver registers a function with the framework to be called under certain circumstances. When said circumstances occur, the framework will call the callback function. The driver never calls these callbacks directly. These callback functions begin with IE. They can arrange for a callback function to be called under three kinds of circumstances: when a given file descriptor may be read without blocking (because either data is available or EOF has been encountered), when a given time interval has elapsed, or when the framework has nothing urgent to do. The callback functions for each circumstance must be written according to a well defined prototype since, after all, the framework must know how to call the callback correctlty.

Definition in file indidevapi.h.

Macro Definition Documentation

◆ ATTRIBUTE_FORMAT_PRINTF

#define ATTRIBUTE_FORMAT_PRINTF (   A,
 
)

Definition at line 140 of file indidevapi.h.

◆ INDI_UNUSED

#define INDI_UNUSED (   x)    (void)x
Examples
simpleskeleton.cpp.

Definition at line 799 of file indidevapi.h.

Typedef Documentation

◆ IE_CBF

IE_CBF

Signature of a callback.

Definition at line 301 of file indidevapi.h.

◆ IE_TCF

IE_TCF

Signature of a timeout caller.

Definition at line 305 of file indidevapi.h.

◆ IE_WPF

IE_WPF

Signature of a work procedure function.

Definition at line 309 of file indidevapi.h.

Enumeration Type Documentation

◆ BLOBHandling

How drivers handle BLOBs incoming from snooping drivers.

Enumerator
B_NEVER 

Never receive BLOBs

B_ALSO 

Receive BLOBs along with normal messages

B_ONLY 

ONLY receive BLOBs from drivers, ignore all other traffic

Definition at line 268 of file indidevapi.h.

Function Documentation

◆ crackDN()

int crackDN ( XMLEle root,
char **  dev,
char **  name,
char  msg[] 
)

Extract dev and name attributes from an XML element.

Parameters
rootThe XML element to be parsed.
devpointer to an allocated buffer to save the extracted element device name attribute. The buffer size must be at least MAXINDIDEVICE bytes.
namepointer to an allocated buffer to save the extracted elemented name attribute. The buffer size must be at least MAXINDINAME bytes.
msgpointer to an allocated char buffer to store error messages. The minimum buffer size is MAXRBUF.
Returns
0 if successful, -1 if error is encountered and msg is set.

Definition at line 1317 of file indicom.c.

◆ crackIPerm()

int crackIPerm ( const char *  str,
IPerm ip 
)

Extract property permission state (RW, RO, WO) from the supplied string.

Parameters
strA string representation of the permission state.
ipPointer to IPerm structure to store the extracted permission state.
Returns
0 if successful, -1 if error is encountered.

Definition at line 1240 of file indicom.c.

◆ crackIPState()

int crackIPState ( const char *  str,
IPState ip 
)

Extract property state (Idle, OK, Busy, Alert) from the supplied string.

Parameters
strA string representation of the state.
ipPointer to IPState structure to store the extracted property state.
Returns
0 if successful, -1 if error is encountered.

Definition at line 1211 of file indicom.c.

◆ crackISRule()

int crackISRule ( const char *  str,
ISRule ip 
)

Extract switch rule (OneOfMany, OnlyOne..etc) from the supplied string.

Parameters
strA string representation of the switch rule.
ipPointer to ISRule structure to store the extracted switch rule.
Returns
0 if successful, -1 if error is encountered.

Definition at line 1253 of file indicom.c.

◆ crackISState()

int crackISState ( const char *  str,
ISState ip 
)

Extract switch state (On or Off) from the supplied string.

Parameters
strA string representation of the switch state.
ipPointer to ISState structure to store the extracted switch state.
Returns
0 if successful, -1 if error is encountered.

Definition at line 1229 of file indicom.c.

◆ IDDefBLOB()

void void void void void void void void void IDDefBLOB ( const IBLOBVectorProperty b,
const char *  msg,
  ... 
)

Tell client to create a BLOB vector property.

Parameters
bpointer to the vector BLOB property to be defined.
msgmessage in printf style to send to the client. May be NULL.

◆ IDDefBLOBVA()

void void void void void void void void void void IDDefBLOBVA ( const IBLOBVectorProperty b,
const char *  msg,
va_list  arg 
)

◆ IDDefLight()

void void void void void void void IDDefLight ( const ILightVectorProperty l,
const char *  msg,
  ... 
)

Tell client to create a light vector property.

Parameters
lpointer to the vector light property to be defined.
msgmessage in printf style to send to the client. May be NULL.

◆ IDDefLightVA()

void void void void void void void void IDDefLightVA ( const ILightVectorProperty l,
const char *  msg,
va_list  arg 
)

◆ IDDefNumber()

void void void IDDefNumber ( const INumberVectorProperty n,
const char *  msg,
  ... 
)

Tell client to create a number number property.

Parameters
npointer to the vector number property to be defined.
msgmessage in printf style to send to the client. May be NULL.

◆ IDDefNumberVA()

void void void void IDDefNumberVA ( const INumberVectorProperty n,
const char *  msg,
va_list  arg 
)

◆ IDDefSwitch()

void void void void void IDDefSwitch ( const ISwitchVectorProperty s,
const char *  msg,
  ... 
)

Tell client to create a switch vector property.

Parameters
spointer to the vector switch property to be defined.
msgmessage in printf style to send to the client. May be NULL.

◆ IDDefSwitchVA()

void void void void void void IDDefSwitchVA ( const ISwitchVectorProperty s,
const char *  msg,
va_list  arg 
)

◆ IDDefText()

void IDDefText ( const ITextVectorProperty t,
const char *  msg,
  ... 
)

Tell client to create a text vector property.

Parameters
tpointer to the vector text property to be defined.
msgmessage in printf style to send to the client. May be NULL.

◆ IDDefTextVA()

void void IDDefTextVA ( const ITextVectorProperty t,
const char *  msg,
va_list  arg 
)

◆ IDDelete()

void void void IDDelete ( const char *  dev,
const char *  name,
const char *  msg,
  ... 
)

Function Drivers call to inform Clients a Property is no longer available, or the entire device is gone if name is NULL.

Parameters
devdevice name. If device name is NULL, the entire device will be deleted.
nameproperty name to be deleted.
msgmessage in printf style to send to the client.

◆ IDDeleteVA()

void void void void IDDeleteVA ( const char *  dev,
const char *  name,
const char *  msg,
va_list  arg 
)

◆ IDLog()

void void void void void IDLog ( const char *  msg,
  ... 
)

Function Drivers call to log a message locally.

The message is not sent to any Clients.

Parameters
msgmessage in printf style to send to the client.
Examples
simpleskeleton.cpp, and tutorial_client.cpp.

◆ IDLogVA()

void void void void void void IDLogVA ( const char *  msg,
va_list  arg 
)

◆ IDMessage()

void IDMessage ( const char *  dev,
const char *  msg,
  ... 
)

Function Drivers call to send log messages to Clients.

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.

Parameters
devdevice name
msgmessage in printf style to send to the client.
Examples
dome.cpp, simpleccd.cpp, and simpledevice.cpp.

◆ IDMessageVA()

void void IDMessageVA ( const char *  dev,
const char *  msg,
va_list  arg 
)

◆ IDSetBLOB()

void void void void void void void void void IDSetBLOB ( const IBLOBVectorProperty b,
const char *  msg,
  ... 
)

Tell client to update an existing BLOB vector property.

Parameters
bpointer to the vector BLOB property.
msgmessage in printf style to send to the client. May be NULL.
Examples
simpleskeleton.cpp.

◆ IDSetBLOBVA()

void void void void void void void void void void IDSetBLOBVA ( const IBLOBVectorProperty b,
const char *  msg,
va_list  arg 
)

◆ IDSetLight()

void void void void void void void IDSetLight ( const ILightVectorProperty l,
const char *  msg,
  ... 
)

Tell client to update an existing light vector property.

Parameters
lpointer to the vector light property.
msgmessage in printf style to send to the client. May be NULL.
Examples
simpleskeleton.cpp.

◆ IDSetLightVA()

void void void void void void void void IDSetLightVA ( const ILightVectorProperty l,
const char *  msg,
va_list  arg 
)

◆ IDSetNumber()

void void void IDSetNumber ( const INumberVectorProperty n,
const char *  msg,
  ... 
)

Tell client to update an existing number vector property.

Parameters
npointer to the vector number property.
msgmessage in printf style to send to the client. May be NULL.
Examples
simpleccd.cpp, and simpleskeleton.cpp.

◆ IDSetNumberVA()

void void void void IDSetNumberVA ( const INumberVectorProperty n,
const char *  msg,
va_list  arg 
)

◆ IDSetSwitch()

void void void void void IDSetSwitch ( const ISwitchVectorProperty s,
const char *  msg,
  ... 
)

Tell client to update an existing switch vector property.

Parameters
spointer to the vector switch property.
msgmessage in printf style to send to the client. May be NULL.
Examples
dome.cpp, and simpleskeleton.cpp.

◆ IDSetSwitchVA()

void void void void void void IDSetSwitchVA ( const ISwitchVectorProperty s,
const char *  msg,
va_list  arg 
)

◆ IDSetText()

void IDSetText ( const ITextVectorProperty t,
const char *  msg,
  ... 
)

Tell client to update an existing text vector property.

Parameters
tpointer to the vector text property.
msgmessage in printf style to send to the client. May be NULL.

◆ IDSetTextVA()

void void IDSetTextVA ( const ITextVectorProperty t,
const char *  msg,
va_list  arg 
)

◆ IDSnoopBLOBs()

void IDSnoopBLOBs ( const char *  snooped_device,
const char *  snooped_property,
BLOBHandling  bh 
)

Function a Driver calls to control whether they will receive BLOBs from snooped devices.

Parameters
snooped_devicename of the device to snoop.
snooped_propertyname of property to snoop. If NULL, then all BLOBs from the given device are snooped.
bhHow drivers handle BLOBs incoming from snooping drivers.

Definition at line 157 of file indidriver.c.

◆ IDSnoopDevice()

void IDSnoopDevice ( const char *  snooped_device,
const char *  snooped_property 
)

Function a Driver calls to snoop on another Device. Snooped messages will then arrive via ISSnoopDevice.

Parameters
snooped_devicename of the device to snoop.
snooped_propertyname of the snooped property in the device.
Examples
dome.cpp.

Definition at line 137 of file indidriver.c.

◆ IEAddCallback()

int IEAddCallback ( int  readfiledes,
IE_CBF fp,
void *  userpointer 
)

Register a new callback, fp, to be called with userpointer as argument when readfiledes is ready.

Parameters
readfiledesfile descriptor.
fpa pointer to the callback function.
userpointera pointer to be passed to the callback function when called.
Returns
a unique callback id for use with IERmCallback().

Definition at line 515 of file eventloop.c.

◆ IEAddPeriodicTimer()

int IEAddPeriodicTimer ( int  millisecs,
IE_TCF fp,
void *  userpointer 
)

Register a new periodic timer function, fp, to be called with ud as argument after ms.

Parameters
millisecstimer period in milliseconds.
fpa pointer to the callback function.
userpointera pointer to be passed to the callback function when called.
Returns
a unique id for use with IERmTimer().

Definition at line 530 of file eventloop.c.

◆ IEAddTimer()

int IEAddTimer ( int  millisecs,
IE_TCF fp,
void *  userpointer 
)

Register a new single-shot timer function, fp, to be called with ud as argument after ms.

Parameters
millisecstimer period in milliseconds.
fpa pointer to the callback function.
userpointera pointer to be passed to the callback function when called.
Returns
a unique id for use with IERmTimer().

Definition at line 525 of file eventloop.c.

◆ IEAddWorkProc()

int IEAddWorkProc ( IE_WPF fp,
void *  userpointer 
)

Add a new work procedure, fp, to be called with ud when nothing else to do.

Parameters
fpa pointer to the work procedure callback function.
userpointera pointer to be passed to the callback function when called.
Returns
a unique id for use with IERmWorkProc().

Definition at line 550 of file eventloop.c.

◆ IEDeferLoop()

int IEDeferLoop ( int  maxms,
int *  flagp 
)

Definition at line 560 of file eventloop.c.

◆ IEDeferLoop0()

int IEDeferLoop0 ( int  maxms,
int *  flagp 
)

Definition at line 565 of file eventloop.c.

◆ IENSecRemainingTimer()

int IENSecRemainingTimer ( int  tid)

Returns the timer's remaining value in nanoseconds left until the timeout.

Parameters
tidthe timer callback ID returned from addTimer() or addPeriodicTimer()
Returns
If the timer not exists, the returned value will be -1.

◆ IERemainingTimer()

int IERemainingTimer ( int  timerid)

Returns the timer's remaining value in milliseconds left until the timeout.

Parameters
timeridthe timer callback ID returned from IEAddTimer() or IEAddPeriodicTimer()
Returns
If the timer not exists, the returned value will be -1.

Definition at line 535 of file eventloop.c.

◆ IERmCallback()

void IERmCallback ( int  callbackid)

Remove a callback function.

Parameters
callbackidthe callback ID returned from IEAddCallback()

Definition at line 520 of file eventloop.c.

◆ IERmTimer()

void IERmTimer ( int  timerid)

Remove the timer with the given timerid, as returned from IEAddTimer() or IEAddPeriodicTimer().

Parameters
timeridthe timer callback ID returned from IEAddTimer() or IEAddPeriodicTimer().

Definition at line 545 of file eventloop.c.

◆ IERmWorkProc()

void IERmWorkProc ( int  workprocid)

Remove a work procedure.

Parameters
workprocidThe unique ID for the work procedure to be removed.

Definition at line 555 of file eventloop.c.

◆ ISGetProperties()

void ISGetProperties ( const char *  dev)

Get Device Properties.

Parameters
devthe name of the device.

This function is called by the framework whenever the driver has received a getProperties message from an INDI client. The argument

Parameters
devis either a string containing the name of the device specified within the message, or NULL if no device was specified. If the driver does not recognize the device, it should ignore the message and do nothing. If dev matches the device the driver is implementing, or dev is NULL, the driver must respond by sending one defXXX message to describe each property defined by this device, including its current (or initial) value. The recommended way to send these messages is to call the appropriate IDDef functions.

Definition at line 53 of file defaultdevice.cpp.

◆ ISNewBLOB()

void ISNewBLOB ( const char *  dev,
const char *  name,
int  sizes[],
int  blobsizes[],
char *  blobs[],
char *  formats[],
char *  names[],
int  n 
)

Update data of an existing blob vector property.

Parameters
devthe name of the device.
namethe name of the blob vector property to update.
sizesan array of base64 blob sizes in bytes before decoding.
blobsizesan array of the sizes of blobs after decoding from base64.
blobsan array of decoded data. Each blob size is found in blobsizes array.
formatsBlob data format (e.g. fits.z).
namesnames of blob members to update.
nthe number of blobs to update.
Note
You do not need to call this function, it is called by INDI when new blob values arrive from the client. e.g. BLOB element with name names[0] has data located in blobs[0] with size sizes[0] and format formats[0].

Definition at line 84 of file defaultdevice.cpp.

◆ ISNewNumber()

void ISNewNumber ( const char *  dev,
const char *  name,
double *  values,
char *  names[],
int  n 
)

Update the value of an existing number vector property.

Parameters
devthe name of the device.
namethe name of the number vector property to update.
valuesan array of number values.
namesparallel names to the array of number values.
nthe dimension of doubles[].
Note
You do not need to call this function, it is called by INDI when new number values arrive from the client.

◆ ISNewSwitch()

void ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)

Update the value of an existing switch vector property.

Parameters
devthe name of the device.
namethe name of the switch vector property to update.
statesan array of switch states.
namesparallel names to the array of switch states.
nthe dimension of states[].
Note
You do not need to call this function, it is called by INDI when new switch values arrive from the client.

Definition at line 60 of file defaultdevice.cpp.

◆ ISNewText()

void ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)

Update the value of an existing text vector property.

Parameters
devthe name of the device.
namethe name of the text vector property to update.
textsan array of text values.
namesparallel names to the array of text values.
nthe dimension of texts[].
Note
You do not need to call this function, it is called by INDI when new text values arrive from the client.

Definition at line 76 of file defaultdevice.cpp.

◆ ISSnoopDevice()

void ISSnoopDevice ( XMLEle root)

Function defined by Drivers that is called when another Driver it is snooping (by having previously called IDSnoopDevice()) sent any INDI message.

Parameters
rootThe argument contains the full message exactly as it was sent by the driver. Hint: use the IUSnoopXXX utility functions to help crack the message if it was one of setXXX or defXXX.

Definition at line 94 of file defaultdevice.cpp.

◆ IUFillBLOB()

void IUFillBLOB ( IBLOB bp,
const char *  name,
const char *  label,
const char *  format 
)

Assign attributes for a BLOB property. The BLOB's data and auxiliary elements will be set to NULL.

Parameters
bppointer a BLOB property to fill
namethe BLOB name
labelthe BLOB label
formatthe BLOB format.

Definition at line 390 of file indidriver.c.

◆ IUFillBLOBVector()

void IUFillBLOBVector ( IBLOBVectorProperty bvp,
IBLOB bp,
int  nbp,
const char *  dev,
const char *  name,
const char *  label,
const char *  group,
IPerm  p,
double  timeout,
IPState  s 
)

Assign attributes for a BLOB vector property. The vector's auxiliary elements will be set to NULL.

Parameters
bvppointer a BLOB vector property to fill
bppointer to an array of BLOBs
nbpthe dimension of bp
devthe device name this vector property belongs to
namethe vector property name
labelthe vector property label
groupthe vector property group
pthe vector property permission
timeoutvector property timeout in seconds
sthe vector property initial state.

Definition at line 499 of file indidriver.c.

◆ IUFillLight()

void IUFillLight ( ILight lp,
const char *  name,
const char *  label,
IPState  s 
)

Assign attributes for a light property. The light's auxiliary elements will be set to NULL.

Parameters
lppointer a light property to fill
namethe light name
labelthe light label
sthe light state (IDLE, WARNING, OK, ALERT)
Examples
dome.cpp.

Definition at line 334 of file indidriver.c.

◆ IUFillLightVector()

void IUFillLightVector ( ILightVectorProperty lvp,
ILight lp,
int  nlp,
const char *  dev,
const char *  name,
const char *  label,
const char *  group,
IPState  s 
)

Assign attributes for a light vector property. The vector's auxiliary elements will be set to NULL.

Parameters
lvppointer a light vector property to fill
lppointer to an array of lights
nlpthe dimension of lp
devthe device name this vector property belongs to
namethe vector property name
labelthe vector property label
groupthe vector property group
sthe vector property initial state.
Examples
dome.cpp.

Definition at line 435 of file indidriver.c.

◆ IUFillNumber()

void IUFillNumber ( INumber np,
const char *  name,
const char *  label,
const char *  format,
double  min,
double  max,
double  step,
double  value 
)

Assign attributes for a number property. The number's auxiliary elements will be set to NULL.

Parameters
nppointer a number property to fill
namethe number name
labelthe number label
formatthe number format in printf style (e.g. "%02d")
minthe minimum possible value
maxthe maximum possible value
stepthe step used to climb from minimum value to maximum value
valuethe number's current value

Definition at line 348 of file indidriver.c.

◆ IUFillNumberVector()

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 
)

Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.

Parameters
nvppointer a number vector property to fill
nppointer to an array of numbers
nnpthe dimension of np
devthe device name this vector property belongs to
namethe vector property name
labelthe vector property label
groupthe vector property group
pthe vector property permission
timeoutvector property timeout in seconds
sthe vector property initial state.

Definition at line 455 of file indidriver.c.

◆ IUFillSwitch()

void IUFillSwitch ( ISwitch sp,
const char *  name,
const char *  label,
ISState  s 
)

Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.

Parameters
sppointer a switch property to fill
namethe switch name
labelthe switch label
sthe switch state (ISS_ON or ISS_OFF)
Examples
dome.cpp.

Definition at line 320 of file indidriver.c.

◆ IUFillSwitchVector()

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 
)

Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.

Parameters
svppointer a switch vector property to fill
sppointer to an array of switches
nspthe dimension of sp
devthe device name this vector property belongs to
namethe vector property name
labelthe vector property label
groupthe vector property group
pthe vector property permission
rthe switches behavior
timeoutvector property timeout in seconds
sthe vector property initial state.
Examples
dome.cpp.

Definition at line 412 of file indidriver.c.

◆ IUFillText()

void IUFillText ( IText tp,
const char *  name,
const char *  label,
const char *  initialText 
)

Assign attributes for a text property. The text's auxiliary elements will be set to NULL.

Parameters
tppointer a text property to fill
namethe text name
labelthe text label
initialTextthe initial text

Definition at line 369 of file indidriver.c.

◆ IUFillTextVector()

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 
)

Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.

Parameters
tvppointer a text vector property to fill
tppointer to an array of texts
ntpthe dimension of tp
devthe device name this vector property belongs to
namethe vector property name
labelthe vector property label
groupthe vector property group
pthe vector property permission
timeoutvector property timeout in seconds
sthe vector property initial state.

Definition at line 477 of file indidriver.c.

◆ IUFindBLOB()

IBLOB* IUFindBLOB ( const IBLOBVectorProperty bvp,
const char *  name 
)

Find an IBLOB member in a vector BLOB property.

Parameters
bvpa pointer to a BLOB vector property.
namethe name of the member to search for.
Returns
a pointer to an IBLOB member on match, or NULL if nothing is found.
Examples
simpleskeleton.cpp.

Definition at line 1381 of file indicom.c.

◆ IUFindIndex()

int IUFindIndex ( const char *  needle,
char **  hay,
unsigned int  n 
)

Returns the index of the string in a string array.

Parameters
needlethe string to match against each element in the hay
haya pointer to a string array to search in
nthe size of hay
Returns
index of needle if found in the hay. Otherwise -1 if not found.

Definition at line 1860 of file indidriver.c.

◆ IUFindLight()

ILight* IUFindLight ( const ILightVectorProperty lvp,
const char *  name 
)

Find an ILight member in a vector Light property.

Parameters
lvpa pointer to a Light vector property.
namethe name of the member to search for.
Returns
a pointer to an ILight member on match, or NULL if nothing is found.

Definition at line 1371 of file indicom.c.

◆ IUFindNumber()

INumber* IUFindNumber ( const INumberVectorProperty nvp,
const char *  name 
)

Find an INumber member in a number text property.

Parameters
nvpa pointer to a number vector property.
namethe name of the member to search for.
Returns
a pointer to an INumber member on match, or NULL if nothing is found.

Definition at line 1351 of file indicom.c.

◆ IUFindOnSwitch()

ISwitch* IUFindOnSwitch ( const ISwitchVectorProperty sp)

Returns the first ON switch it finds in the vector switch property.

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.
Parameters
spa pointer to a switch vector property.
Returns
a pointer to the first ON ISwitch member if found. If all switches are off, NULL is returned.
Examples
simpleskeleton.cpp.

Definition at line 1393 of file indicom.c.

◆ IUFindOnSwitchIndex()

int IUFindOnSwitchIndex ( const ISwitchVectorProperty sp)

Returns the index of first ON switch it finds in the vector switch property.

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.
Parameters
spa pointer to a switch vector property.
Returns
index to the first ON ISwitch member if found. If all switches are off, -1 is returned.
Examples
simpleskeleton.cpp.

Definition at line 1403 of file indicom.c.

◆ IUFindOnSwitchName()

const char* IUFindOnSwitchName ( ISState states,
char *  names[],
int  n 
)

Returns the name of the first ON switch it finds in the supplied arguments.

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.
This is a convience function intended to be used in ISNewSwitch(...) function to find out ON switch name without having to change actual switch state via IUUpdateSwitch(..)
Parameters
stateslist of switch states passed by ISNewSwitch()
nameslist of switch names passed by ISNewSwitch()
nnumber of switches passed by ISNewSwitch()
Returns
name of the first ON ISwitch member if found. If all switches are off, NULL is returned.

Definition at line 1412 of file indicom.c.

◆ IUFindSwitch()

ISwitch* IUFindSwitch ( const ISwitchVectorProperty svp,
const char *  name 
)

Find an ISwitch member in a vector switch property.

Parameters
svpa pointer to a switch vector property.
namethe name of the member to search for.
Returns
a pointer to an ISwitch member on match, or NULL if nothing is found.

Definition at line 1361 of file indicom.c.

◆ IUFindText()

IText* IUFindText ( const ITextVectorProperty tvp,
const char *  name 
)

Find an IText member in a vector text property.

Parameters
tvpa pointer to a text vector property.
namethe name of the member to search for.
Returns
a pointer to an IText member on match, or NULL if nothing is found.

Definition at line 1341 of file indicom.c.

◆ IUResetSwitch()

void IUResetSwitch ( ISwitchVectorProperty svp)

Reset all switches in a switch vector property to OFF.

Parameters
svpa pointer to a switch vector property.

Definition at line 1421 of file indicom.c.

◆ IUSaveBLOB()

int IUSaveBLOB ( IBLOB bp,
int  size,
int  blobsize,
char *  blob,
char *  format 
)

Function to save blob metadata in the corresponding blob.

Parameters
bppointer to an IBLOB member.
sizesize of the blob buffer encoded in base64
blobsizeactual size of the buffer after base64 decoding. This is the actual byte count used in drivers.
blobpointer to the blob buffer
formatformat of the blob buffer
Note
Do not call this function directly, it is called internally by IUUpdateBLOB.

Definition at line 311 of file indidriver.c.

◆ IUSaveText()

void IUSaveText ( IText tp,
const char *  newtext 
)

Function to reliably save new text in a IText.

Parameters
tppointer to an IText member.
newtextthe new text to be saved

Definition at line 1428 of file indicom.c.

◆ IUSnoopBLOB()

int IUSnoopBLOB ( XMLEle root,
IBLOBVectorProperty bvp 
)

Update a snooped BLOB vector property from the given XML root element.

Parameters
rootXML root elememnt containing the snopped property content
bvpa pointer to the BLOB vector property to be updated.
Returns
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

Definition at line 696 of file indidriver.c.

◆ IUSnoopLight()

int IUSnoopLight ( XMLEle root,
ILightVectorProperty lvp 
)

Update a snooped light vector property from the given XML root element.

Parameters
rootXML root elememnt containing the snopped property content
lvpa pointer to the light vector property to be updated.
Returns
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.
Examples
dome.cpp.

Definition at line 612 of file indidriver.c.

◆ IUSnoopNumber()

int IUSnoopNumber ( XMLEle root,
INumberVectorProperty nvp 
)

Update a snooped number vector property from the given XML root element.

Parameters
rootXML root elememnt containing the snopped property content
nvpa pointer to the number vector property to be updated.
Returns
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

Definition at line 531 of file indidriver.c.

◆ IUSnoopSwitch()

int IUSnoopSwitch ( XMLEle root,
ISwitchVectorProperty svp 
)

Update a snooped switch vector property from the given XML root element.

Parameters
rootXML root elememnt containing the snopped property content
svpa pointer to the switch vector property to be updated.
Returns
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

Definition at line 654 of file indidriver.c.

◆ IUSnoopText()

int IUSnoopText ( XMLEle root,
ITextVectorProperty tvp 
)

Update a snooped text vector property from the given XML root element.

Parameters
rootXML root elememnt containing the snopped property content
tvpa pointer to the text vector property to be updated.
Returns
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

Definition at line 576 of file indidriver.c.

◆ IUUpdateBLOB()

int IUUpdateBLOB ( IBLOBVectorProperty bvp,
int  sizes[],
int  blobsizes[],
char *  blobs[],
char *  formats[],
char *  names[],
int  n 
)

Update all BLOB members in a BLOB vector property.

Parameters
bvpa pointer to a BLOB vector property.
sizessizes of the blobs.
blobsizessize of the blobs, raw without compression.
blobsa pointer to the BLOB members
namesthe names of the IBLOB members to update.
formatsThe blob format or extension.
nthe number of IBLOB members to update.
Returns
0 if update successful, -1 otherwise. Update will fail in case of property name mismatch.
Examples
simpleskeleton.cpp.

Definition at line 285 of file indidriver.c.

◆ IUUpdateMinMax()

void IUUpdateMinMax ( const INumberVectorProperty nvp)

Function to update the min and max elements of a number in the client.

Parameters
nvppointer to an INumberVectorProperty.
Warning
This call is not INDI protocol compliant. It sends setNumberVector along with updated Min/Max/Step values so that the client updates the range accordingly for this property. In the INDI-compliant paradigm, it is NOT possible to update min/max/step step of an existing number property and the only way is to do so is to delete and redefine the number property again. However, due to the many problems with approach in device drivers, INDI Library defines this function to simplify the update process without requiring a complete delete/define cycle.

Definition at line 1849 of file indidriver.c.

◆ IUUpdateNumber()

int IUUpdateNumber ( INumberVectorProperty nvp,
double  values[],
char *  names[],
int  n 
)

Update all numbers in a number vector property.

Parameters
nvpa pointer to a number vector property.
valuesthe states of the new INumber members.
namesthe names of the INumber members to update.
nthe number of INumber members to update.
Returns
0 if update successful, -1 otherwise. Update will fail if values are out of scope, or in case of property name mismatch.
Examples
simpleskeleton.cpp.

Definition at line 225 of file indidriver.c.

◆ IUUpdateSwitch()

int IUUpdateSwitch ( ISwitchVectorProperty svp,
ISState states,
char *  names[],
int  n 
)

Update all switches in a switch vector property.

Parameters
svpa pointer to a switch vector property.
statesthe states of the new ISwitch members.
namesthe names of the ISwtich members to update.
nthe number of ISwitch members to update.
Returns
0 if update successful, -1 otherwise.
Examples
dome.cpp, and simpleskeleton.cpp.

Definition at line 171 of file indidriver.c.

◆ IUUpdateText()

int IUUpdateText ( ITextVectorProperty tvp,
char *  texts[],
char *  names[],
int  n 
)

Update all text members in a text vector property.

Parameters
tvpa pointer to a text vector property.
textsa pointer to the text members
namesthe names of the IText members to update.
nthe number of IText members to update.
Returns
0 if update successful, -1 otherwise. Update will fail in case of property name mismatch.

Definition at line 259 of file indidriver.c.

◆ permStr()

const char* permStr ( IPerm  p)
Returns
Returns a string representation of the supplied permission value.

Definition at line 1294 of file indicom.c.

◆ pstateStr()

const char* pstateStr ( IPState  s)
Returns
Returns a string representation of the supplied property state.
Examples
simpleskeleton.cpp.

Definition at line 1194 of file indicom.c.

◆ ruleStr()

const char* ruleStr ( ISRule  r)
Returns
Returns a string representation of the supplied switch rule.

Definition at line 1280 of file indicom.c.

◆ sstateStr()

const char* sstateStr ( ISState  s)
Returns
Returns a string representation of the supplied switch status.

Definition at line 1267 of file indicom.c.

◆ xmlv1()

void xmlv1 ( )

Definition at line 1308 of file indicom.c.