diff options
author | Jeonghoon Park <jh1979.park@samsung.com> | 2018-07-09 20:49:07 +0900 |
---|---|---|
committer | Jeonghoon Park <jh1979.park@samsung.com> | 2018-07-09 20:49:07 +0900 |
commit | fb289630dbd67e52731e7e4d64e317f9841888aa (patch) | |
tree | 838f8e9139eb0cb5940946c619ed6c7202cb4c2c | |
parent | d6790d07df384b38d74f795b75fd98d1e3d35c5f (diff) | |
download | st-things-co2-meter-fb289630dbd67e52731e7e4d64e317f9841888aa.tar.gz st-things-co2-meter-fb289630dbd67e52731e7e4d64e317f9841888aa.tar.bz2 st-things-co2-meter-fb289630dbd67e52731e7e4d64e317f9841888aa.zip |
remove unused files
-rw-r--r-- | src/co2.c | 55 | ||||
-rw-r--r-- | src/common_handlers.c | 52 | ||||
-rw-r--r-- | src/resource_capability_airqualitysensor_main_0.c | 28 | ||||
-rw-r--r-- | src/thing.c | 114 |
4 files changed, 0 insertions, 249 deletions
diff --git a/src/co2.c b/src/co2.c deleted file mode 100644 index 9a9ae5c..0000000 --- a/src/co2.c +++ /dev/null @@ -1,55 +0,0 @@ -#include <tizen.h> -#include <service_app.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "st_things.h" -#include "thing.h" -#include "log.h" - -static bool service_app_create(void *user_data) -{ - FN_CALL; - - return true; -} - -static void service_app_terminate(void *user_data) -{ - FN_CALL; -} - -static void service_app_control(app_control_h app_control, void *user_data) -{ - FN_CALL; - if (app_control == NULL) { - ERR("app_control is NULL"); - return; - } - - int ret; - char *value = NULL; - ret = app_control_get_extra_data(app_control, "cmd", &value); - DBG("value: [%s]", value); - if (value == NULL) - init_thing(); - else - ERR("Unknown command"); - - free(value); -} - -int main(int argc, char *argv[]) -{ - FN_CALL; - - char ad[50] = {0,}; - service_app_lifecycle_callback_s event_callback; - - event_callback.create = service_app_create; - event_callback.terminate = service_app_terminate; - event_callback.app_control = service_app_control; - - return service_app_main(argc, argv, &event_callback, ad); -} diff --git a/src/common_handlers.c b/src/common_handlers.c deleted file mode 100644 index 29b6c9d..0000000 --- a/src/common_handlers.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * common_handlers.c - * - * Created on: Jul 6, 2018 - * Author: jpark - */ - -#include <unistd.h> -#include <stdio.h> -#include <stdbool.h> -#include "st_things.h" -#include "log.h" - -/* callback functions */ -bool handle_reset_request(void) -{ - DBG("Received a request for RESET."); - - // TODO: Write your implementation in this section. - return false; // FIXME: Modify this line with the appropriate return value. -} - -void handle_reset_result(bool result) -{ - DBG("Reset %s.\n", result ? "succeeded" : "failed"); - - // TODO: Write your implementation in this section. -} - -bool handle_ownership_transfer_request(void) -{ - DBG("Received a request for Ownership-transfer."); - - // TODO: Write your implementation in this section. - return true; // FIXME: Modify this line with the appropriate return value. -} - -void handle_things_status_change(st_things_status_e things_status) -{ - DBG("Things status is changed: %d\n", things_status); - - // TODO: Write your implementation in this section. -} - -bool init_user() { - FN_CALL; - - bool ret = false; - - // TODO: Write your implementation in this section. - return ret; // FIXME: Modify this line with the appropriate return value. -} diff --git a/src/resource_capability_airqualitysensor_main_0.c b/src/resource_capability_airqualitysensor_main_0.c deleted file mode 100644 index c2ac876..0000000 --- a/src/resource_capability_airqualitysensor_main_0.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * resource_capability_airqualitysensor_main_0.c - * - * Created on: Jul 6, 2018 - * Author: jpark - */ - -#include <stdio.h> -#include <stdbool.h> -#include "st_things.h" -#include "log.h" - - -static const char* PROP_AIRQUALITY = "airQuality"; -static const char* PROP_RANGE = "range"; - -bool handle_get_request_on_resource_capability_airqualitysensor_main_0(st_things_get_request_message_s* req_msg, st_things_representation_s* resp_rep) -{ - DBG("Received a GET request on %s\n", req_msg->resource_uri); - - if (req_msg->has_property_key(req_msg, PROP_AIRQUALITY)) { - // TODO: Write your implementation in this section. - } - if (req_msg->has_property_key(req_msg, PROP_RANGE)) { - // TODO: Write your implementation in this section. - } - return false; // FIXME: Modify this line with the appropriate return value. -} diff --git a/src/thing.c b/src/thing.c deleted file mode 100644 index 72a6d02..0000000 --- a/src/thing.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * thing.c - * - * Created on: Jul 6, 2018 - * Author: jpark - */ - - -#include <stdio.h> -#include <string.h> -#include <stdbool.h> -#include <app_common.h> -#include "st_things.h" -#include "thing.h" -#include "log.h" - -#define JSON_PATH "device_def.json" - -static const char* RES_CAPABILITY_AIRQUALITYSENSOR_MAIN_0 = "/capability/airQualitySensor/main/0"; - -/* OCF callback functions */ -extern bool handle_reset_request(void); -extern void handle_reset_result(bool result); -extern bool handle_ownership_transfer_request(void); -extern void handle_things_status_change(st_things_status_e things_status); - -/* get and set request handlers */ -extern bool handle_get_request_on_resource_capability_airqualitysensor_main_0(st_things_get_request_message_s* req_msg, st_things_representation_s* resp_rep); - -extern bool init_user(); - -/* handle : for getting request on resources */ -bool handle_get_request(st_things_get_request_message_s* req_msg, st_things_representation_s* resp_rep) -{ - DBG("resource_uri [%s]", req_msg->resource_uri); - - if (0 == strcmp(req_msg->resource_uri, RES_CAPABILITY_AIRQUALITYSENSOR_MAIN_0)) { - return handle_get_request_on_resource_capability_airqualitysensor_main_0(req_msg, resp_rep); - } - - ERR("not supported uri"); - return false; -} - -/* handle : for setting request on resources */ -bool handle_set_request(st_things_set_request_message_s* req_msg, st_things_representation_s* resp_rep) -{ - DBG("resource_uri [%s]", req_msg->resource_uri); - - - ERR("not supported uri"); - return false; -} - -/* initialize */ -void init_thing() -{ - FN_CALL; - static bool binitialized = false; - if (binitialized) { - DBG("Already initialized!!"); - return; - } - - bool easysetup_complete = false; - - char app_json_path[128] = {0,}; - char *app_res_path = NULL; - char *app_data_path = NULL; - - app_res_path = app_get_resource_path(); - if (!app_res_path) { - ERR("app_res_path is NULL!!"); - return; - } - - app_data_path = app_get_data_path(); - if (!app_data_path) { - ERR("app_data_path is NULL!!"); - free(app_res_path); - return; - } - - snprintf(app_json_path, sizeof(app_json_path), "%s/%s", app_res_path, JSON_PATH); - - if (0 != st_things_set_configuration_prefix_path((const char *)app_res_path, (const char *)app_data_path)) { - ERR("st_things_set_configuration_prefix_path() failed!!"); - free(app_res_path); - free(app_data_path); - return; - } - - free(app_res_path); - free(app_data_path); - - if (0 != st_things_initialize(app_json_path, &easysetup_complete)) { - ERR("st_things_initialize() failed!!"); - return; - } - - binitialized = true; - init_user(); - - DBG("easysetup_complete:[%d] ", easysetup_complete); - - st_things_register_request_cb(handle_get_request, handle_set_request); - st_things_register_reset_cb(handle_reset_request, handle_reset_result); - st_things_register_user_confirm_cb(handle_ownership_transfer_request); - st_things_register_things_status_change_cb(handle_things_status_change); - - st_things_start(); - - FN_END; -} |