3 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2015 by Andreas Theofilu. All rights reserved!
|
|
|
3 |
*
|
|
|
4 |
* All rights reserved. No warranty, explicit or implicit, provided.
|
|
|
5 |
*
|
|
|
6 |
* NOTICE: All information contained herein is, and remains
|
|
|
7 |
* the property of Andreas Theofilu and his suppliers, if any.
|
|
|
8 |
* The intellectual and technical concepts contained
|
|
|
9 |
* herein are proprietary to Andreas Theofilu and its suppliers and
|
|
|
10 |
* may be covered by European and Foreign Patents, patents in process,
|
|
|
11 |
* and are protected by trade secret or copyright law.
|
|
|
12 |
* Dissemination of this information or reproduction of this material
|
|
|
13 |
* is strictly forbidden unless prior written permission is obtained
|
|
|
14 |
* from Andreas Theofilu.
|
|
|
15 |
*
|
|
|
16 |
* Author: Andreas Theofilu <andreas@theosys.at>
|
|
|
17 |
*/
|
|
|
18 |
#ifndef __CONFIG_H__
|
|
|
19 |
#define __CONFIG_H__
|
|
|
20 |
|
56 |
andreas |
21 |
#include <pthread.h>
|
|
|
22 |
|
3 |
andreas |
23 |
#include <iostream> // std::cout
|
|
|
24 |
#include <string> // std::basic_string, std::char_traits
|
|
|
25 |
#include <cctype> // std::tolower
|
|
|
26 |
#include <cstddef> // std::size_t
|
|
|
27 |
|
|
|
28 |
#include "helper.h"
|
|
|
29 |
|
56 |
andreas |
30 |
pthread_attr_t pattr;
|
|
|
31 |
|
3 |
andreas |
32 |
typedef struct CONFIGURE
|
|
|
33 |
{
|
|
|
34 |
// Part 1: Daemon
|
17 |
andreas |
35 |
int port; // Port number the daemon will listen on
|
|
|
36 |
char pidfile[128]; // The where the daemon writes it current PID
|
|
|
37 |
char user[32]; // The user the daemon will use to run
|
|
|
38 |
char group[32]; // The group the daemon will use to run
|
|
|
39 |
int html_port; // The port number a HTML server should listen on
|
3 |
andreas |
40 |
// Part 2: heating
|
|
|
41 |
char heatconf[128]; // Path to config file of heating
|
|
|
42 |
char home[128]; // Path to directory with working database
|
5 |
andreas |
43 |
char serial[128]; // Path to serial device with digital thermometer
|
3 |
andreas |
44 |
// Part 3: Development
|
|
|
45 |
bool debug;
|
|
|
46 |
}CONFIGURE;
|
|
|
47 |
|
|
|
48 |
extern CONFIGURE Configure;
|
54 |
andreas |
49 |
extern bool bcmInitialized;
|
3 |
andreas |
50 |
|
|
|
51 |
class config : private helper
|
|
|
52 |
{
|
|
|
53 |
public:
|
|
|
54 |
config();
|
|
|
55 |
bool is_initialized() { return initialized; }
|
|
|
56 |
CONFIGURE getConfig();
|
|
|
57 |
|
|
|
58 |
private:
|
|
|
59 |
void readConf();
|
|
|
60 |
|
|
|
61 |
bool initialized;
|
|
|
62 |
};
|
|
|
63 |
|
|
|
64 |
#endif
|