#include <time.h>
+#include "W1Store.hh"
#include "W1Device.hh"
using namespace w1;
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;
}
}
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);
else {
cout << "could not open file " << file_path << " for writing data." << endl;
}
+*/
}