TwiceAsNice  2019-02-18
Macros | Enumerations | Functions | Variables
indidriver.c File Reference
#include "indidriver.h"
#include "base64.h"
#include "eventloop.h"
#include "indicom.h"
#include "indidevapi.h"
#include "locale_compat.h"
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
Include dependency graph for indidriver.c:

Macros

#define MAXRBUF   2048
 

Enumerations

enum  {
  INDI_NUMBER, INDI_SWITCH, INDI_TEXT, INDI_LIGHT,
  INDI_BLOB, INDI_UNKNOWN
}
 

Functions

int isPropDefined (const char *property_name, const char *device_name)
 
char * escapeXML (const char *s, unsigned int MAX_BUF_SIZE)
 
void IDDelete (const char *dev, const char *name, const char *fmt,...)
 Function Drivers call to inform Clients a Property is no longer available, or the entire device is gone if name is NULL. More...
 
void IDSnoopDevice (const char *snooped_device, const char *snooped_property)
 Function a Driver calls to snoop on another Device. 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 *p)
 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 *p)
 Register a new timer function, fp, to be called with ud as argument after ms. More...
 
void IERmTimer (int timerid)
 Remove the timer with the given timerid, as returned from IEAddTimer. More...
 
int IEAddWorkProc (IE_WPF *fp, void *p)
 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)
 
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 IUFillSwitch (ISwitch *sp, const char *name, const char *label, ISState s)
 Assign attributes for a switch property. More...
 
void IUFillLight (ILight *lp, const char *name, const char *label, IPState s)
 Assign attributes for a light property. 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. More...
 
void IUFillText (IText *tp, const char *name, const char *label, const char *initialText)
 Assign attributes for a text property. More...
 
void IUFillBLOB (IBLOB *bp, const char *name, const char *label, const char *format)
 Assign attributes for a BLOB property. 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. 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. 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. 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. 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. 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 clientMsgCB (int fd, void *arg)
 
int dispatch (XMLEle *root, char msg[])
 
int IUReadConfig (const char *filename, const char *dev, const char *property, int silent, char errmsg[])
 Loads and processes a configuration file. More...
 
void IUSaveDefaultConfig (const char *source_config, const char *dest_config, const char *dev)
 Copies an existing configuration file into a default configuration file. More...
 
int IUGetConfigNumber (const char *dev, const char *property, const char *member, double *value)
 IUGetConfigNumber Opens configuration file and reads number property. More...
 
void IDMessage (const char *dev, const char *fmt,...)
 Function Drivers call to send log messages to Clients. More...
 
FILE * IUGetConfigFP (const char *filename, const char *dev, const char *mode, char errmsg[])
 Open a configuration file for writing and return a configuration file FILE pointer. More...
 
void IUSaveConfigTag (FILE *fp, int ctag, const char *dev, int silent)
 Add opening or closing tag to a configuration file. More...
 
void IUSaveConfigNumber (FILE *fp, const INumberVectorProperty *nvp)
 Add a number vector property value to the configuration file. More...
 
void IUSaveConfigText (FILE *fp, const ITextVectorProperty *tvp)
 Add a text vector property value to the configuration file. More...
 
void IUSaveConfigSwitch (FILE *fp, const ISwitchVectorProperty *svp)
 Add a switch vector property value to the configuration file. More...
 
void IUSaveConfigBLOB (FILE *fp, const IBLOBVectorProperty *bvp)
 Add a BLOB vector property value to the configuration file. More...
 
void IDDefText (const ITextVectorProperty *tvp, const char *fmt,...)
 Tell client to create a text vector property. More...
 
void IDDefNumber (const INumberVectorProperty *n, const char *fmt,...)
 Tell client to create a number number property. More...
 
void IDDefSwitch (const ISwitchVectorProperty *s, const char *fmt,...)
 Tell client to create a switch vector property. More...
 
void IDDefLight (const ILightVectorProperty *lvp, const char *fmt,...)
 Tell client to create a light vector property. More...
 
void IDDefBLOB (const IBLOBVectorProperty *b, const char *fmt,...)
 Tell client to create a BLOB vector property. More...
 
void IDSetText (const ITextVectorProperty *tvp, const char *fmt,...)
 Tell client to update an existing text vector property. More...
 
void IDSetNumber (const INumberVectorProperty *nvp, const char *fmt,...)
 Tell client to update an existing number vector property. More...
 
void IDSetSwitch (const ISwitchVectorProperty *svp, const char *fmt,...)
 Tell client to update an existing switch vector property. More...
 
void IDSetLight (const ILightVectorProperty *lvp, const char *fmt,...)
 Tell client to update an existing light vector property. More...
 
void IDSetBLOB (const IBLOBVectorProperty *bvp, const char *fmt,...)
 Tell client to update an existing BLOB vector property. More...
 
void IUUpdateMinMax (const INumberVectorProperty *nvp)
 Function to update the min and max elements of a number in the client. More...
 
int IUFindIndex (const char *needle, char **hay, unsigned int n)
 Returns the index of the string in a string array. More...
 

Variables

pthread_mutex_t stdout_mutex = PTHREAD_MUTEX_INITIALIZER
 

Macro Definition Documentation

◆ MAXRBUF

#define MAXRBUF   2048

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

INDI property type

Enumerator
INDI_NUMBER 
INDI_SWITCH 
INDI_TEXT 
INDI_LIGHT 
INDI_BLOB 
INDI_UNKNOWN 

Function Documentation

◆ clientMsgCB()

void clientMsgCB ( int  fd,
void *  arg 
)

◆ dispatch()

int dispatch ( XMLEle root,
char  msg[] 
)

◆ escapeXML()

char* escapeXML ( const char *  s,
unsigned int  MAX_BUF_SIZE 
)

◆ isPropDefined()

int isPropDefined ( const char *  property_name,
const char *  device_name 
)

Variable Documentation

◆ stdout_mutex

pthread_mutex_t stdout_mutex = PTHREAD_MUTEX_INITIALIZER