X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=src_test%2Ftest_w1.cc;h=e0ceb1d4c4f4eec634d07798d87480c7d8d36f1f;hb=c7979a0225a21182f68d40374723a649d032908d;hp=3a07a0a37ab780f8322b69cc26312edabe639738;hpb=8d60415d0ff1fd01d65e9d57291e6fd5c454959c;p=lib1wire.git diff --git a/src_test/test_w1.cc b/src_test/test_w1.cc index 3a07a0a..e0ceb1d 100644 --- a/src_test/test_w1.cc +++ b/src_test/test_w1.cc @@ -10,21 +10,28 @@ #include +#include "W1Store.hh" #include "W1Scanner.hh" using namespace w1; using namespace std; -int main(int argc, char** argv) -{ +int main(int argc, char** argv) { W1Scanner *scanner; list device_list; int round; int interval_seconds; int store_interval; + string location; - interval_seconds = 60; - store_interval = 10; + location = "/tmp/"; + if (argc > 1) { + location = argv[1]; + log_info("storage location: %s\n", location.c_str()); + } + W1Store::set_location(location.c_str()); + interval_seconds = 3; + store_interval = 3; scanner = new W1Scanner(); device_list = scanner->get_device_list(); round = 0; @@ -34,12 +41,7 @@ int main(int argc, char** argv) for(list::iterator list_iter = device_list.begin(); list_iter != device_list.end(); list_iter++) { W1Device *device = (W1Device *)*list_iter; -/* - string name = device->get_name(); - string value = device->get_value(); - string unit = device->get_unit(); - cout << name << ": " << value << " " << unit << endl; -*/ + device->printout(); sleep(1); if (round >= store_interval) {