lib/mbselib.h

Wed, 23 Apr 2014 21:17:44 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 23 Apr 2014 21:17:44 +0200
changeset 9
91218bc77abc
parent 8
e584bc0177df
child 12
102c44bb8c9d
permissions
-rw-r--r--

Config now reads sensors configuration

#ifndef	_MBSELIB_H
#define	_MBSELIB_H

#include "../config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <syslog.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <getopt.h>

#include <mosquitto.h>


#define TRUE 1
#define FALSE 0

#define MBSE_SS(x) (x)?(x):"(null)"

/* rdconfig.c */
typedef struct _key_list {
    char	*key;
    int		(*prc)(char **);
    char	**dest;
} key_list;

typedef struct _w1_therm {
    struct _w1_therm    *next;
    char                *master;                /* Master for this device       */
    int                 bus;                    /* Reserved for ds2482-800      */
    char                *name;                  /* Name of this device          */
    char                *alias;                 /* Friendly name                */
    int                 present;                /* 1=present, 0=absent          */
    int                 lastval;                /* Last valid value             */
} w1_therm;

typedef struct _sys_config {
    char		*name;			/* Configuration name		*/
    char		*mosq_host;		/* mosquitto server hostname	*/
    int			mosq_port;		/* mosquitto server port	*/
    w1_therm		*w1therms;		/* 1-wire temp sensors		*/
} sys_config;



void killconfig(void);
int  rdconfig(void);


/* xutil.c */
char *xmalloc(size_t);
char *xstrcpy(char *);
char *xstrcat(char *, char *);

#endif

mercurial