1 #include "Configuration.h"
3 namespace remote
{ namespace diku_mch
{
5 void Configuration::read( int ac
, char** av
)
9 // command line options
10 po::options_description
cmdline_options("commandlineoptions");
11 cmdline_options
.add_options()
13 po::value
<std::string
>()->default_value("/etc/diku_mch.cfg"),
14 "Path to the configuration file.")
16 po::value
<int>()->default_value(false),
19 // declare all configuration groups
20 po::options_description
config("Configuration");
24 po::value
<std::string
>()->default_value("/proc/tty/driver/usbserial"),
25 "Path to the usbserial device file.")
27 po::value
<std::string
>()->default_value("/proc/bus/usb/devices"),
28 "Path to the usb system device file.")
30 po::value
<std::string
>()->default_value("/var/run/motehost.events"),
31 "Path to the fifo notifying the motehost of mote hotplug events.")
33 po::value
<uint64_t>()->default_value(0x0050C237),
34 "The initial part of MAC adresses for DIG528-2 boards.")
36 po::value
<std::string
>()->default_value("0050"),
37 "USB Vendor ID for the DIG528-2 boards.")
39 po::value
<std::string
>()->default_value("c237"),
40 "USB Product ID for the DIG528-2 boards.")
41 ("usbSerialDevicePath",
42 po::value
<std::string
>()->default_value("/dev/ttyUSB%u"),
43 "Path pattern of usb devices.")
45 po::value
<uint16_t>()->default_value(10000),
46 "Maximum size in bytes of the device info files.")
48 po::value
<std::string
>(),
49 "DNS or IP address of the mote server.")
51 po::value
<uint16_t>()->default_value(10001),
52 "Port number to use for connecting to the mote server.")
53 ("serverConnectionRetryInterval",
54 po::value
<uint64_t>()->default_value(30),
55 "Number of seconds to wait between server connection retries.")
56 ("moteProgrammerPath",
57 po::value
<std::string
>()->default_value("/usr/bin/hc08sprg"),
58 "Path to the DIG528-2 flash programmer.")
60 po::value
<std::string
>()->default_value("/var/run/motehost_flash%u.s19"),
61 "Temporary naming of flash image files.")
64 store(po::parse_command_line(ac
, av
, cmdline_options
), vm
);
67 // get the configuration settings from a file
68 std::ifstream
ifs(Configuration::vm
["config-file"].as
<std::string
>().c_str());
69 store(parse_config_file(ifs
, config
), vm
);
73 po::variables_map
Configuration::vm
;