Subversion Repositories heating

Rev

Rev 54 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2015 by Andreas Theofilu. All rights reserved!
 *
 * All rights reserved. No warranty, explicit or implicit, provided.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Andreas Theofilu and his suppliers, if any.
 * The intellectual and technical concepts contained
 * herein are proprietary to Andreas Theofilu and its suppliers and
 * may be covered by European and Foreign Patents, patents in process,
 * and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Andreas Theofilu.
 * 
 * Author: Andreas Theofilu <andreas@theosys.at>
 */
#ifndef __CONFIG_H__
#define __CONFIG_H__

#include <pthread.h>

#include <iostream>   // std::cout
#include <string>     // std::basic_string, std::char_traits
#include <cctype>     // std::tolower
#include <cstddef>    // std::size_t

#include "helper.h"

pthread_attr_t pattr;

typedef struct CONFIGURE
{
        // Part 1: Daemon
        int port;                                       // Port number the daemon will listen on
        char pidfile[128];                      // The where the daemon writes it current PID
        char user[32];                          // The user the daemon will use to run
        char group[32];                         // The group the daemon will use to run
        int html_port;                          // The port number a HTML server should listen on
        // Part 2: heating
        char heatconf[128];                     // Path to config file of heating
        char home[128];                         // Path to directory with working database
        char serial[128];                       // Path to serial device with digital thermometer
        // Part 3: Development
        bool debug;
}CONFIGURE;

extern CONFIGURE Configure;
extern bool bcmInitialized;

class config : private helper
{
        public:
                config();
                bool is_initialized() { return initialized; }
                CONFIGURE getConfig();

        private:
                void readConf();

                bool initialized;
};

#endif