refines
authorJeonghoon Park <jh1979.park@samsung.com>
Mon, 30 Jul 2018 10:45:53 +0000 (19:45 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Mon, 30 Jul 2018 10:45:53 +0000 (19:45 +0900)
inc/co2-sensor.h
src/co2-sensor.c
src/co2.c

index 404437a..cc65b32 100644 (file)
@@ -33,8 +33,8 @@ void co2_sensor_close(void);
 double co2_sensor_value_to_voltage(unsigned int value);
 
 /* Not implemented, please see c source code */
-int co2_sensor_voltage_to_ppm(double voltage);
-int co2_sensor_value_to_ppm(unsigned int value);
+unsigned int co2_sensor_voltage_to_ppm(double voltage);
+unsigned int co2_sensor_value_to_ppm(unsigned int value);
 
 #endif /* __CO2_SENSOR_H__ */
 
index 5f0abc2..d269b9a 100644 (file)
@@ -57,7 +57,7 @@ double co2_sensor_value_to_voltage(unsigned int value)
 }
 
 /* Not implemented, please see c source code */
-int co2_sensor_voltage_to_ppm(double voltage)
+unsigned int co2_sensor_voltage_to_ppm(double voltage)
 {
        int ppm = 0;
 
@@ -67,7 +67,7 @@ int co2_sensor_voltage_to_ppm(double voltage)
        return ppm;
 }
 
-int co2_sensor_value_to_ppm(unsigned int value)
+unsigned int co2_sensor_value_to_ppm(unsigned int value)
 {
        /* You can use this function after implementing co2_sensor_voltage_to_ppm() function */
        return co2_sensor_voltage_to_ppm(co2_sensor_value_to_voltage(value));
index 5fe4367..249eee5 100644 (file)
--- a/src/co2.c
+++ b/src/co2.c
@@ -25,7 +25,7 @@
 #include "sensor-data.h"
 #include "co2-sensor.h"
 
-#define JSON_PATH "device_def.json"
+#define JSON_NAME "device_def.json"
 #define SENSOR_URI_CO2 "/capability/airQualitySensor/main/0"
 #define SENSOR_KEY_CO2 "airQuality"
 #define SENSOR_KEY_RANGE "range"
@@ -182,17 +182,16 @@ static int __things_init(void)
                return -1;
        }
 
-       snprintf(app_json_path, sizeof(app_json_path), "%s%s", app_res_path, JSON_PATH);
-
        if (0 != st_things_set_configuration_prefix_path(app_res_path, app_data_path)) {
                _E("st_things_set_configuration_prefix_path() failed!!");
                free(app_res_path);
                free(app_data_path);
                return -1;
        }
+       free(app_data_path);
 
+       snprintf(app_json_path, sizeof(app_json_path), "%s%s", app_res_path, JSON_NAME);
        free(app_res_path);
-       free(app_data_path);
 
        if (0 != st_things_initialize(app_json_path, &easysetup_complete)) {
                _E("st_things_initialize() failed!!");