]> pilppa.org Git - lib1wire.git/blobdiff - src/Factory.cc
configuration data related changes
[lib1wire.git] / src / Factory.cc
index bcd43ec09478daf1c9408894d12b2e515b5574f1..76f1a1381ec2e626e1b5a8b4081d3ac03dab2d17 100644 (file)
@@ -101,6 +101,7 @@ Device *Factory::create_device(int device_w1_family_code_param,
                        dirent *direntry_param) {
        Device          *ret_val;
        DeviceConfig    *config;
+       bool            succ;
 
        ret_val = NULL;
        if (device_type_param.empty() == false) {
@@ -124,11 +125,11 @@ Device *Factory::create_device(int device_w1_family_code_param,
                        config  = DeviceConfig::get_device_config(device_id_param);
                        if (config != NULL) {
                                // if not, create default device config
-                               device_type_param       = config->get_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE);
-                               if (device_type_param.empty() == true) {
+                               succ    = config->get_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE, device_type_param);
+                               if (succ == false) {
                                        device_type_param       = ret_val->get_type();
-                                       config->set_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE, device_type_param);
-                                       config->set_config_value(DEVICE_CONFIG_VALUE_KEY__ID, ret_val->get_id());
+                                       config->set_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE, device_type_param, false);
+                                       config->set_config_value(DEVICE_CONFIG_VALUE_KEY__ID, ret_val->get_id(), true);
                                }
                                delete(config);
                        }
@@ -246,8 +247,8 @@ list<Device *> Factory::get_device_list() {
                }
                if (found == false) {
                        // 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) {
+                       found   = reader->get_device_type(type);
+                       if (found == true) {
                                device  = create_device(type, id1);
                                if (device != NULL) {
                                        ret_val.push_back(device);