Sun, 27 Jul 2014 21:04:57 +0200
Small fix
103
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | #ifndef _MASH_H |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | #define _MASH_H |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | #define TRUE 1 |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | #define FALSE 0 |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | #include "../config.h" |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | #include <stdlib.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | #include <stdio.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | #include <stdint.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | #include <stdarg.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | #include <string.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | #include <ctype.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | #include <sys/types.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include <sys/stat.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | #include <sys/time.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | #include <time.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | #include <fcntl.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | #include <syslog.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | #include <unistd.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include <errno.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | #include <signal.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | #include <getopt.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | #include <limits.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | #include <sys/socket.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | #include <arpa/inet.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | #include <netdb.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | #include <poll.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | #include <libxml/xmlmemory.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | #include <libxml/parser.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | /* mosquitto */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | #include <mosquitto.h> |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | #define MBSE_SS(x) (x)?(x):"(null)" |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | /* rdconfig.c */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | typedef struct _key_list { |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | char *key; |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | int (*prc)(char **); |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | char **dest; |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | } key_list; |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | typedef struct _w1_therm { |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | struct _w1_therm *next; |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | char *master; /* Master for this device */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | int bus; /* Reserved for ds2482-800 */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | char *name; /* Name of this device */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | char *alias; /* Friendly name */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | int present; /* 1=present, 0=absent */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | int lastval; /* Last valid value */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | int update; /* Value updated */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | } w1_therm; |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | typedef struct _sys_config { |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | char *name; /* Configuration name */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | int my_port; /* my client/server port */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | w1_therm *w1therms; /* 1-wire temp sensors */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | int lcd_cols; /* LCD display columns */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | int lcd_rows; /* LCD display rows */ |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | } sys_config; |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | void killconfig(void); |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | int rdconfig(char *); |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | int wrconfig(char *); |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | #ifdef HAVE_WIRINGPI_H |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | PI_THREAD (my_sensors_loop); |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | #endif |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | #endif |
99c47a8a61cb
Added the mash sourcecode, this does nothing useful yet.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 |