long store_interval;
string location;
bool err_flg;
+ W1Device *device;
// default values than can be overwritten with parameters
location = "/tmp/";
- scan_interval = 600;
- store_interval = 6;
+ scan_interval = 2; //600;
+ store_interval = 2;
if (argc > 1) {
location = argv[1];
log_info("storage location: %s\n", location.c_str());
try_parse_long(argv[3], &store_interval);
}
log_info("start scanning, data saved to location: %s, scan interval: %d, store interval: %d\n", location.c_str(), scan_interval, store_interval);
- W1Store::set_location_base_dir(location.c_str());
+ W1Store::set_store_base_dir(location.c_str());
scanner = new W1Scanner();
device_list = scanner->get_device_list();
round = 0;
+ int t = 0;
if (device_list.size() > 0) {
- while(1) {
+ while(t < 3) {
+ t++;
round++;
for(list<W1Device *>::iterator list_iter = device_list.begin(); list_iter != device_list.end(); list_iter++) {
- W1Device *device = (W1Device *)*list_iter;
+ device = (W1Device *)*list_iter;
device->printout();
sleep(1);
else {
log_debug("could not find 1-wire devices.\n");
}
+ while (device_list.empty() == false) {
+ device = device_list.back();
+ device_list.pop_back();
+ delete(device);
+ }
+
+ delete(scanner);
return 0;
}