, StartOffline(false)
, WebcheckEnabled(false)
, ExternalLogOnlyOnce(false)
+ , DialupMode(false)
+ , DialupBurstPeriodSeconds(120)
+ , DialupSleepSeconds(10 * 60)
{
// Available service description config options
po::options_description opt_desc_service("Service description options");
("external_warning_level",po::value<int>()->default_value(0),"Warning messages of which loglevel should be passed to external programm.")
("external_log_only_once",po::value<bool>()->default_value(false),"Log the same external message only once until next reload or restart.")
("start_offline",po::value<bool>()->default_value(false),"Start in offline mode.")
+ ("dialup_mode",po::value<bool>()->default_value(false),"Enable dialup mode (sleep periods between network traffic)")
+ ("dialup_burst_period_seconds",po::value<int>()->default_value(120),"Seconds of normal operation before entering dialup mode")
+ ("dialup_sleep_seconds",po::value<int>()->default_value(10 * 60),"Seconds to sleep between network traffic")
;
// Define valid command line parameters
/**
* Constructor with Logger and Serviceholder objects. Available command line and config file options with their default values are defined here.
+ * @todo Move the program options init code to a function used by both constructors
*/
Config::Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder)
: Log(_log)
, StartOffline(false)
, WebcheckEnabled(false)
, ExternalLogOnlyOnce(false)
+ , DialupMode(false)
+ , DialupBurstPeriodSeconds(120)
+ , DialupSleepSeconds(10 * 60)
{
// Available service description config options
po::options_description opt_desc_service("Service description options");
("external_warning_level",po::value<int>()->default_value(0),"Warning messages of which loglevel should be passed to external programm.")
("external_log_only_once",po::value<bool>()->default_value(false),"Log the same external message only once until next reload or restart.")
("start_offline",po::value<bool>()->default_value(false),"Start in offline mode.")
+ ("dialup_mode",po::value<bool>()->default_value(false),"Enable dialup mode (sleep periods between network traffic)")
+ ("dialup_burst_period_seconds",po::value<int>()->default_value(120),"Seconds of normal operation before entering dialup mode")
+ ("dialup_sleep_seconds",po::value<int>()->default_value(10 * 60),"Seconds to sleep between network traffic")
;
// Define valid command line parameters
if ( VariablesMap.count("start_offline") )
StartOffline = VariablesMap["start_offline"].as<bool>();
+ if ( VariablesMap.count("dialup_mode") )
+ DialupMode = VariablesMap["dialup_mode"].as<bool>();
+ if ( VariablesMap.count("dialup_burst_period_seconds") )
+ DialupBurstPeriodSeconds = VariablesMap["dialup_burst_period_seconds"].as<int>();
+ if ( VariablesMap.count("dialup_sleep_seconds") )
+ DialupSleepSeconds = VariablesMap["dialup_sleep_seconds"].as<int>();
}
catch( const po::unknown_option& e )
{
if ( VariablesMap.count("start_offline") )
StartOffline = VariablesMap["start_offline"].as<bool>();
+ if ( VariablesMap.count("dialup_mode") )
+ DialupMode = VariablesMap["dialup_mode"].as<bool>();
+ if ( VariablesMap.count("dialup_burst_period_seconds") )
+ DialupBurstPeriodSeconds = VariablesMap["dialup_burst_period_seconds"].as<int>();
+ if ( VariablesMap.count("dialup_sleep_seconds") )
+ DialupSleepSeconds = VariablesMap["dialup_sleep_seconds"].as<int>();
}
catch( const po::unknown_option& e ) // at the moment 04-08-2009 this exception is never thrown :-(
{
{
return ExternalLogOnlyOnce;
}
+
+
+/**
+ * Get member DialupMode
+ * @return DIalupMode
+*/
+bool Config::get_dialup_mode() const
+{
+ return DialupMode;
+}
+
+/**
+ * Get member DialupBurstPeriodSeconds
+ * @return DialupBurstPeriodSeconds
+*/
+int Config::get_dialup_burst_period_seconds() const
+{
+ return DialupBurstPeriodSeconds;
+}
+
+/**
+ * Get member DialupSleepSeconds
+ * @return DialupSleepSeconds
+*/
+int Config::get_dialup_sleep_seconds() const
+{
+ return DialupSleepSeconds;
+}