Activate connectivity's notification of sensoring data 09/139009/1
authorJin Yoon <jinny.yoon@samsung.com>
Mon, 17 Jul 2017 01:20:13 +0000 (10:20 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Mon, 17 Jul 2017 01:20:13 +0000 (10:20 +0900)
Change-Id: Icf999e52e7eb2391fffd8d48ec24e4b497a8a0f4

CMakeLists.txt
packaging/org.tizen.position-finder-server.spec
src/connectivity.c
src/controller.c

index 285988a7e1538aa889f06a66ff6ec6150f2f7219..e8a5c06dafbc010ed95228ca3726bccbaec8118b 100644 (file)
@@ -3,6 +3,7 @@ PROJECT(position-finder-server C)
 
 SET(INSTALL_EXEC_PREFIX "${INSTALL_PREFIX}/bin")
 SET(INSTALL_RESDIR "${INSTALL_PREFIX}/res")
+SET(INSTALL_DATADIR "/home/owner/apps_rw/org.tizen.position-finder-server/data")
 SET(CMAKE_VERBOSE_MAKEFILE 0)
 
 SET(PROJECT_ROOT_DIR "${CMAKE_SOURCE_DIR}")
@@ -51,6 +52,6 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_EXEC_PREFIX})
 INSTALL(FILES ${PROJECT_ROOT_DIR}/tizen-manifest.xml DESTINATION ${SYS_PACKAGES_DIR} RENAME org.tizen.position-finder-server.xml)
 INSTALL(DIRECTORY DESTINATION ${PREFIX}/data)
 INSTALL(FILES ${PROJECT_ROOT_DIR}/shared/res/position_finder_server.png DESTINATION ${SYS_ICONS_DIR})
-INSTALL(FILES ${PROJECT_ROOT_DIR}/res/iotcon-test-svr-db-server.dat DESTINATION ${INSTALL_RESDIR})
+INSTALL(FILES ${PROJECT_ROOT_DIR}/res/iotcon-test-svr-db-server.dat DESTINATION ${INSTALL_DATADIR})
 
 # End of a file
index 4a97b6e63d8c678f26165663760dc4917102784f..19dc681ffcee1f8e4d18fded2076c77df3a599af 100644 (file)
@@ -30,6 +30,7 @@ Server for Position Finder
 %define _pkg_dir %{TZ_SYS_RO_APP}/%{alias}
 %define _pkg_shared_dir %{_pkg_dir}/shared
 %define _pkg_data_dir %{_pkg_dir}/data
+%define _pkg_rw_data_dir /home/owner/apps_rw/org.tizen.position-finder-server/data
 %define _sys_icons_dir %{_pkg_shared_dir}/res
 %define _sys_packages_dir %{TZ_SYS_RO_PACKAGES}
 %define _sys_license_dir %{TZ_SYS_SHARE}/license
@@ -61,14 +62,15 @@ make %{?jobs:-j%jobs}
 
 %post
 /sbin/ldconfig
-chsmack -a "User::App::Shared" %{_pkg_dir}/res/*.dat
-chmod 666 %{_pkg_dir}/res/*.dat
+chsmack -a "User::Pkg::org.tizen.position-finder-server" %{_pkg_rw_data_dir}/*.dat
+chmod 666 %{_pkg_rw_data_dir}/*.dat
 
 %postun -p /sbin/ldconfig
 
 %files
 %manifest org.tizen.position-finder-server.manifest
-%{_pkg_dir}/res/*.dat
+%{_pkg_rw_data_dir}/*.dat
+/home/owner/apps_rw/org.tizen.position-finder-server/data/iotcon-test-svr-db-server.dat
 %defattr(-,root,root,-)
 %{_pkg_dir}/bin/position-finder-server
 %{_sys_packages_dir}/org.tizen.position-finder-server.xml
index c27234eb14ff19fa34d611de9c464efb2266f26c..7522fb76a877d4bcb2d975555bd499078104f9a1 100644 (file)
@@ -375,7 +375,7 @@ int connectivity_init(const char *device_name)
 {
        int ret = -1;
 
-       ret = iotcon_initialize("/usr/apps/org.tizen.position-finder-server/res/iotcon-test-svr-db-server.dat");
+       ret = iotcon_initialize("/home/owner/apps_rw/org.tizen.position-finder-server/data/iotcon-test-svr-db-server.dat");
        retv_if(IOTCON_ERROR_NONE != ret, -1);
 
        ret = iotcon_set_device_name(device_name);
index cfb109a51e631c01dacc9f10d09d8b67b1df4935..d551c30ca5ffa5687a4a46874643414e701901d2 100644 (file)
@@ -55,18 +55,19 @@ static Eina_Bool _infrared_motion_getter_timer(void *data)
        int gpio_num[3] = { 16, 23, 26 };
        int i = 0;
        int value[3] = { 0, };
+       int detected = 0;
+       app_data *ad = data;
 
        for (i = 0; i < 3; i++) {
                if (resource_read_infrared_motion_sensor(gpio_num[i], &value[i]) == -1) {
                        _E("Failed to get Infrared Motion value [GPIO:%d]", gpio_num[i]);
                        continue;
                }
-               _I("[GPIO:%d] Infrared Motion Value is [%d]", gpio_num[i], value[i]);
+               detected |= value[i];
        }
 
-
-       //@TODO: Send the data to Analyzer using connectivity APIs
-
+       if (connectivity_notify(ad->resource_info, detected) == -1)
+               _E("Cannot notify message");
 #else
        int value = 0;