From: Jiwon Park Date: Wed, 21 Nov 2018 06:54:43 +0000 (+0900) Subject: Make it into Tizen Studio project X-Git-Url: http://review.tizen.org/git/?p=apps%2Fnative%2Fsmart-surveillance-camera.git;a=commitdiff_plain;h=5157035f98c72b1e09a62aa3e13dda69b1b913a7 Make it into Tizen Studio project Change-Id: Ie7891c47964e67fdcb28131694fda1164c6644ef --- diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..b7a9bc7 --- /dev/null +++ b/.cproject @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.exportMap b/.exportMap new file mode 100644 index 0000000..de30516 --- /dev/null +++ b/.exportMap @@ -0,0 +1,5 @@ +{ + global: main; + _IO_*; + local: *; +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a781462 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +Debug/ +.sign/ +crash-info/ diff --git a/.project b/.project new file mode 100644 index 0000000..0c3f462 --- /dev/null +++ b/.project @@ -0,0 +1,46 @@ + + + SmartSurveillanceCamera + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + 1542777126002 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-*/.tpk + + + + 1542777126003 + + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-project_def.prop + + + + diff --git a/.smartthingsapp b/.smartthingsapp new file mode 100644 index 0000000..e69de29 diff --git a/.tproject b/.tproject new file mode 100644 index 0000000..903a965 --- /dev/null +++ b/.tproject @@ -0,0 +1,12 @@ + + + + + iot-headed-5.0 + + + + + + + diff --git a/CMakeLists.txt b/CMakeLists.txt index aaab0c4..ab78b5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") LINK_DIRECTORIES(${PROJECT_ROOT_DIR}/lib) SET(ST_API_LIBS st_thing_master_api st_thing_resource_api) -INCLUDE_DIRECTORIES(${PROJECT_ROOT_DIR}/include) +INCLUDE_DIRECTORIES(${PROJECT_ROOT_DIR}/inc) FILE(GLOB APP_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c) diff --git a/include/controller.h b/inc/controller.h similarity index 100% rename from include/controller.h rename to inc/controller.h diff --git a/include/controller_image.h b/inc/controller_image.h similarity index 100% rename from include/controller_image.h rename to inc/controller_image.h diff --git a/include/controller_mv.h b/inc/controller_mv.h similarity index 100% rename from include/controller_mv.h rename to inc/controller_mv.h diff --git a/include/exif.h b/inc/exif.h similarity index 100% rename from include/exif.h rename to inc/exif.h diff --git a/include/log.h b/inc/log.h similarity index 100% rename from include/log.h rename to inc/log.h diff --git a/include/motion.h b/inc/motion.h similarity index 100% rename from include/motion.h rename to inc/motion.h diff --git a/include/resource_camera.h b/inc/resource_camera.h similarity index 100% rename from include/resource_camera.h rename to inc/resource_camera.h diff --git a/include/resource_servo_motor_sg90.h b/inc/resource_servo_motor_sg90.h similarity index 100% rename from include/resource_servo_motor_sg90.h rename to inc/resource_servo_motor_sg90.h diff --git a/include/servo-h.h b/inc/servo-h.h similarity index 100% rename from include/servo-h.h rename to inc/servo-h.h diff --git a/include/servo-type.h b/inc/servo-type.h similarity index 100% rename from include/servo-type.h rename to inc/servo-type.h diff --git a/include/servo-v.h b/inc/servo-v.h similarity index 100% rename from include/servo-v.h rename to inc/servo-v.h diff --git a/include/smartthings.h b/inc/smartthings.h similarity index 100% rename from include/smartthings.h rename to inc/smartthings.h diff --git a/include/smartthings_notification.h b/inc/smartthings_notification.h similarity index 100% rename from include/smartthings_notification.h rename to inc/smartthings_notification.h diff --git a/include/smartthings_payload.h b/inc/smartthings_payload.h similarity index 100% rename from include/smartthings_payload.h rename to inc/smartthings_payload.h diff --git a/include/smartthings_resource.h b/inc/smartthings_resource.h similarity index 100% rename from include/smartthings_resource.h rename to inc/smartthings_resource.h diff --git a/include/st_thing_master.h b/inc/st_thing_master.h similarity index 100% rename from include/st_thing_master.h rename to inc/st_thing_master.h diff --git a/include/st_thing_resource.h b/inc/st_thing_resource.h similarity index 100% rename from include/st_thing_resource.h rename to inc/st_thing_resource.h diff --git a/include/switch.h b/inc/switch.h similarity index 100% rename from include/switch.h rename to inc/switch.h diff --git a/src/controller.c b/src/controller.c index 61c0ea1..6d2b5f2 100644 --- a/src/controller.c +++ b/src/controller.c @@ -41,8 +41,8 @@ #define IMAGE_FILE_PREFIX "CAM_" #define EVENT_INTERVAL_SECOND 0.5f -#define TEMP_IMAGE_FILENAME "/tmp/tmp.jpg" -#define LATEST_IMAGE_FILENAME "/tmp/latest.jpg" +//#define TEMP_IMAGE_FILENAME "/opt/usr/home/owner/apps_rw/org.tizen.smart-surveillance-camera/shared/data/tmp.jpg" +//#define LATEST_IMAGE_FILENAME "/opt/usr/home/owner/apps_rw/org.tizen.smart-surveillance-camera/shared/data/latest.jpg" // #define ENABLE_SMARTTHINGS #define APP_CALLBACK_KEY "controller" @@ -66,6 +66,9 @@ typedef struct app_data_s { Ecore_Thread *image_writter_thread; pthread_mutex_t mutex; + + char* temp_image_filename; + char* latest_image_filename; } app_data; static long long int __get_monotonic_ms(void) @@ -152,11 +155,11 @@ static void __thread_write_image_file(void *data, Ecore_Thread *th) } pthread_mutex_unlock(&ad->mutex); - ret = controller_image_save_image_file(TEMP_IMAGE_FILENAME, width, height, buffer, image_info, strlen(image_info)); + ret = controller_image_save_image_file(ad->temp_image_filename, width, height, buffer, image_info, strlen(image_info)); if (ret) { _E("failed to save image file"); } else { - ret = rename(TEMP_IMAGE_FILENAME, LATEST_IMAGE_FILENAME); + ret = rename(ad->temp_image_filename, ad->latest_image_filename); if (ret != 0 ) _E("Rename fail"); } @@ -467,6 +470,18 @@ static bool service_app_create(void *data) { app_data *ad = (app_data *)data; + char* shared_data_path = app_get_shared_data_path(); + if (shared_data_path == NULL) { + _E("Failed to get shared data path"); + goto ERROR; + } + ad->temp_image_filename = g_strconcat(shared_data_path, "tmp.jpg", NULL); + ad->latest_image_filename = g_strconcat(shared_data_path, "latest.jpg", NULL); + free(shared_data_path); + + _D("%s", ad->temp_image_filename); + _D("%s", ad->latest_image_filename); + controller_image_initialize(); pthread_mutex_init(&ad->mutex, NULL); @@ -529,6 +544,8 @@ static void service_app_terminate(void *data) Ecore_Thread *thread_id = NULL; unsigned char *buffer = NULL; char *info = NULL; + gchar *temp_image_filename; + gchar *latest_image_filename; _D("App Terminated - enter"); resource_camera_close(); @@ -556,9 +573,15 @@ static void service_app_terminate(void *data) ad->latest_image_buffer = NULL; info = ad->latest_image_info; ad->latest_image_info = NULL; + temp_image_filename = ad->temp_image_filename; + ad->temp_image_filename = NULL; + latest_image_filename = ad->latest_image_filename; + ad->latest_image_filename = NULL; pthread_mutex_unlock(&ad->mutex); free(buffer); free(info); + g_free(temp_image_filename); + g_free(latest_image_filename); pthread_mutex_destroy(&ad->mutex); free(ad); diff --git a/tizen-manifest.xml b/tizen-manifest.xml new file mode 100644 index 0000000..fa90998 --- /dev/null +++ b/tizen-manifest.xml @@ -0,0 +1,23 @@ + + + + + + smartsurveillancecamera.png + + + + + + + http://tizen.org/privilege/appdir.shareddata + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/softap + http://tizen.org/privilege/internet + http://tizen.org/privilege/datasharing + http://tizen.org/privilege/camera + http://tizen.org/privilege/peripheralio + http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.resource + http://com.samsung.tizen.smartthings-thing/appdefined/smartthings-thing.master + +