return ret_val;
}
-Device *Factory::create_w1_device(int family_code_param,
+Device *Factory::create_device(int family_code_param,
string device_id_param,
dirent *direntry_param) {
Device *ret_val;
ret_val = NULL;
type = get_device_type_by_family_code(family_code_param);
if (type.empty() == false) {
- ret_val = create_w1_device(family_code_param,
+ ret_val = create_device(family_code_param,
type,
device_id_param,
direntry_param);
return ret_val;
}
-Device *Factory::create_w1_device(int device_w1_family_code_param,
+Device *Factory::create_device(int device_w1_family_code_param,
string device_type_param,
string device_id_param,
dirent *direntry_param) {
return ret_val;
}
-Device *Factory::create_w1_device(string device_type_param,
+Device *Factory::create_device(string device_type_param,
string device_id_param) {
int family_code;
Device *ret_val;
if (device_type_param.empty() == false) {
family_code = get_family_code_by_device_type(device_type_param);
if (family_code != -1) {
- ret_val = create_w1_device(family_code, device_type_param, device_id_param, NULL);
+ ret_val = create_device(family_code, device_type_param, device_id_param, NULL);
}
}
return ret_val;
}
-Device *Factory::create_w1_device(dirent *direntry_param,
+Device *Factory::create_device(dirent *direntry_param,
int *err_code_param) {
string folder_name;
string tmp_str;
if (suc_flg == true) {
log_debug("1-wire device family code: %#x\n", family_code);
device_id = folder_name.substr(pos + 1, folder_name.length() - pos);
- ret_val = Factory::create_w1_device(family_code,
+ ret_val = Factory::create_device(family_code,
device_id,
direntry_param);
if ((ret_val == NULL) &&
is_subdir = FileUtil::is_subdirectory(W1_SCAN_ROOTDIR, direntry);
if (is_subdir == true) {
err_flg = 0;
- device = create_w1_device(direntry, &err_flg);
+ device = create_device(direntry, &err_flg);
if (device != NULL) {
ret_val.push_back(device);
}
// reader device is not in the list of active devices. create and add it to list as in-active one...
type = reader->get_device_type();
if (type.empty() == false) {
- device = create_w1_device(type, id1);
+ device = create_device(type, id1);
if (device != NULL) {
ret_val.push_back(device);
}
static std::list<plp::Device *> get_device_list();
private:
//int parse_family_code(string folder_name);
- static plp::Device *create_w1_device(int family_code_param, string device_type_param, string device_id_param, dirent *direntry_param);
- static plp::Device *create_w1_device(int family_code, string device_id, dirent *direntry_param);
- static plp::Device *create_w1_device(string device_type_param, string device_id_param);
- static plp::Device *create_w1_device(dirent *direntry_param, int *err_code_param);
+ static plp::Device *create_device(int family_code_param, string device_type_param, string device_id_param, dirent *direntry_param);
+ static plp::Device *create_device(int family_code, string device_id, dirent *direntry_param);
+ static plp::Device *create_device(string device_type_param, string device_id_param);
+ static plp::Device *create_device(dirent *direntry_param, int *err_code_param);
static std::list<plp::DataReader *> get_data_reader_list();
static int get_family_code_by_device_type(string device_type_param);
static string get_device_type_by_family_code(int family_code_param);
dec_precision = get_data_decimal_precision();
pthread_mutex_lock(&plock);
- log_debug("memory cache size: %lu\n", memory_cache.size());
+ /* needs to be casted to long unsigned int value is "unsigned int" in some
+ toolchains and that would otherwise cause an warning/error
+ */
+ log_debug("memory cache size: %lu\n", (long unsigned int)memory_cache.size());
StoreDay::save(id, &memory_cache, dec_precision);
while(memory_cache.empty() == false) {
data = memory_cache.back();
}
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
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();
}
}
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) {