X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=src%2FW1Device.cc;h=fef721c55ff7fc757767d9570de0ec66af7567cd;hb=c7979a0225a21182f68d40374723a649d032908d;hp=7f52c43f5795341c5943eb8610c5fd71f43d96a4;hpb=8d60415d0ff1fd01d65e9d57291e6fd5c454959c;p=lib1wire.git diff --git a/src/W1Device.cc b/src/W1Device.cc index 7f52c43..fef721c 100644 --- a/src/W1Device.cc +++ b/src/W1Device.cc @@ -9,6 +9,7 @@ #include +#include "W1Store.hh" #include "W1Device.hh" using namespace w1; @@ -71,15 +72,18 @@ void W1Device::printout() { string W1Device::get_formatted_data() { string ret_val; + string val; - ret_val = get_formatted_data(get_value()); + val = get_value(); + ret_val = get_formatted_data(val); return ret_val; } string W1Device::get_formatted_data(string value) { string ret_val; - ret_val = get_time() + ": device type = " + get_devicetype_name() + ", id = " + id + ", value = " + value + " " + get_unit(); + ret_val = get_time() + "|" + get_devicetype_name() + "|" + id + "|" + value + " " + get_unit(); + add_to_memory_cache(ret_val); return ret_val; } @@ -89,6 +93,8 @@ void W1Device::add_to_memory_cache(std::string formatted_data) { } void W1Device::store() { + W1Store::store(id, memory_cache); +/* string file_path = "/tmp/" + id + ".txt"; string text_line; ofstream data_file(file_path.c_str(), ios::app); @@ -109,4 +115,5 @@ void W1Device::store() { else { cout << "could not open file " << file_path << " for writing data." << endl; } +*/ }