示例#1
0
文件: hacs.cs 项目: aheil/hacs
        static void Main(string[] args)
        {
            #region ConsoleOutputLogger
            ConsoleOutputLogger ConsoleOutputLogger = new xs1_data_logging.ConsoleOutputLogger();
            ConsoleOutputLogger.verbose = true;
            ConsoleOutputLogger.writeLogfile = false;
            #endregion

            #region Logo
            ConsoleOutputLogger.WriteLine("home automation control server " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            ConsoleOutputLogger.WriteLine("(C) 2010-2012 Daniel Kirstenpfad - http://github.com/bietiekay/hacs");
            #endregion

            ConsoleOutputLogger.writeLogfile = true;

            TinyOnDiskStorage actor_data_store = new TinyOnDiskStorage("actor-data", false,xs1_data_logging.Properties.Settings.Default.DataObjectCacheSize);
            ConsoleOutputLogger.WriteLine("Initialized actor-data storage: "+actor_data_store.InMemoryIndex.Count);
            TinyOnDiskStorage sensor_data_store = new TinyOnDiskStorage("sensor-data", false,xs1_data_logging.Properties.Settings.Default.DataObjectCacheSize);
            ConsoleOutputLogger.WriteLine("Initialized sensor-data storage: "+sensor_data_store.InMemoryIndex.Count);
            TinyOnDiskStorage unknown_data_store = new TinyOnDiskStorage("unknown-data", false,xs1_data_logging.Properties.Settings.Default.DataObjectCacheSize);
            ConsoleOutputLogger.WriteLine("Initialized unknown-data storage: "+unknown_data_store.InMemoryIndex.Count);

            //List<Thread> LoggingThreads = new List<Thread>();
            ScriptingTimerThread _ScriptingTimerThread;

            ScriptingActorConfiguration.ReadConfiguration(Properties.Settings.Default.ScriptingActorConfigurationFilename);
            PowerSensorConfiguration.ReadConfiguration(Properties.Settings.Default.PowerSensorConfigurationFilename);
            ScriptingTimerConfiguration.ReadConfiguration(Properties.Settings.Default.ScriptingTimerConfigurationFilename);
            SensorCheckIgnoreConfiguration.ReadConfiguration(Properties.Settings.Default.SensorCheckIgnoreFile);
            HTTPProxyConfiguration.ReadConfiguration(Properties.Settings.Default.HTTPProxyConfigurationFilename);

            #region Logging and Actor Handling
            ConsoleOutputLogger.WriteLineToScreenOnly("Starting Logging for Server: " + Properties.Settings.Default.XS1);
            LoggingThread _Thread = new LoggingThread(Properties.Settings.Default.XS1, ConsoleOutputLogger, actor_data_store, sensor_data_store, unknown_data_store,Properties.Settings.Default.Username,Properties.Settings.Default.Password,Properties.Settings.Default.ConfigurationCacheMinutes);
            Thread LoggingThread = new Thread(new ThreadStart(_Thread.Run));
            LoggingThread.Start();
            #endregion

            #region Scripting Timer Handling
            ConsoleOutputLogger.WriteLineToScreenOnly("Starting Scripting Timer Handling.");
            _ScriptingTimerThread = new ScriptingTimerThread(_Thread,ConsoleOutputLogger);
            Thread ScriptingTThread = new Thread(new ThreadStart(_ScriptingTimerThread.Run));
            ScriptingTThread.Start();
            #endregion
        }
示例#2
0
 public ScriptingTimerThread(LoggingThread __LoggingThreadInstance, ConsoleOutputLogger Logger)
 {
     _LoggingThreadInstance = __LoggingThreadInstance;
     ConsoleOutputLogger = Logger;
 }