]> pilppa.org Git - lib1wire.git/blobdiff - src_test/test_w1_datalog_write.cc
cleanups
[lib1wire.git] / src_test / test_w1_datalog_write.cc
index 08bd2392209e368b2b0c2495676bdb3bf16d9413..a0c0cc238ba707cc8400e4784da957130bd47f80 100644 (file)
 
 #include <plp/log.h>
 
-#include "DeviceConfig.hh"
+#include <plp/DeviceConfig.hh>
+#include <plp/Device.hh>
+
 #include "Factory.hh"
-#include "Device.hh"
 
 using namespace w1;
 using namespace std;
@@ -48,12 +49,12 @@ bool try_parse_long(const char *str, long *result) {
 }
 
 int main(int argc, char** argv) {
-       list<Device *>                  device_list;
        int                             read_count_total;
        long                            cnt_max_scans;
        long                            read_interval_seconds;
        string                          loc;
        Device                          *device;
+       list<Device *>                  device_list;
        list<Device *>::iterator        iter;
 
        // default values than can be overwritten with parameters
@@ -100,7 +101,7 @@ int main(int argc, char** argv) {
                                log_info("closing the application, max read count reached. (%ld)\n", cnt_max_scans);
                                break;
                        }
-                       for(iter = device_list.begin(); iter != device_list.end(); iter++) {
+                       for (iter = device_list.begin(); iter != device_list.end(); iter++) {
                                device = (Device *)*iter;
                                if (device->get_lifecycle_state() == LIFECYCLE_STATUS__AVAILABLE) {
                                        device->printout();
@@ -114,11 +115,13 @@ int main(int argc, char** argv) {
                }
        }
        else {
-               log_debug("could not find 1-wire devices.\n");
+               log_debug("could not find devices.\n");
        }
+       log_debug("trying to start emptying list\n");
        while (device_list.empty() == false) {
                device  = device_list.back();
                device_list.pop_back();
+               log_debug("calling delete\n");
                delete(device);
        }
        return 0;