Trivial changes : cbor file path, connectivity api 85/140485/1
authorJin Yoon <jinny.yoon@samsung.com>
Tue, 25 Jul 2017 06:36:30 +0000 (15:36 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Tue, 25 Jul 2017 06:36:30 +0000 (15:36 +0900)
Change-Id: Ic38d0a5500903e6d775e2ecc83017ed468c7ffab

CMakeLists.txt
inc/connectivity.h
packaging/org.tizen.position-finder-client.spec
src/connectivity.c
src/control.c
tizen-manifest.xml

index df415a6..8c75592 100644 (file)
@@ -3,6 +3,7 @@ PROJECT(position-finder-client 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-client/data")
 SET(CMAKE_VERBOSE_MAKEFILE 0)
 
 SET(PROJECT_ROOT_DIR "${CMAKE_SOURCE_DIR}")
@@ -43,6 +44,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-client.xml)
 INSTALL(DIRECTORY DESTINATION ${PREFIX}/data)
 INSTALL(FILES ${PROJECT_ROOT_DIR}/shared/res/position_finder_client.png DESTINATION ${SYS_ICONS_DIR})
-INSTALL(FILES ${PROJECT_ROOT_DIR}/res/iotcon-test-svr-db-client.dat DESTINATION ${INSTALL_RESDIR})
+INSTALL(FILES ${PROJECT_ROOT_DIR}/res/iotcon-test-svr-db-client.dat DESTINATION ${INSTALL_DATADIR})
 
 # End of a file
index 820dc3f..c63684c 100644 (file)
@@ -27,6 +27,6 @@
 typedef struct _connectivity_resource_s connectivity_resource_s;
 typedef void (*connectivity_observe_resource_cb)(connectivity_resource_s *resource_info, void *resource_data, void *user_data);
 
-extern int connectivity_observe_resource(connectivity_observe_resource_cb cb, void *user_data);
+extern int connectivity_observe_resource(const char *type, connectivity_observe_resource_cb cb, void *user_data);
 
 #endif /* __POSITION_FINDER_CONNECTIVITY_H__ */
index 1aa2429..c206ec6 100644 (file)
@@ -29,6 +29,7 @@ Thing Illumination
 %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-client/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
@@ -60,14 +61,14 @@ make %{?jobs:-j%jobs}
 
 %post
 /sbin/ldconfig
-chsmack -a "User::App::Shared" %{_pkg_data_dir}/*.dat
-chmod 666 %{_pkg_data_dir}/*.dat
+chsmack -a "User::Pkg::org.tizen.position-finder-client" %{_pkg_rw_data_dir}/*.dat
+chmod 666 %{_pkg_rw_data_dir}/*.dat
 
 %postun -p /sbin/ldconfig
 
 %files
 %manifest org.tizen.position-finder-client.manifest
-%{_pkg_dir}/res/*.dat
+%{_pkg_rw_data_dir}/*.dat
 %defattr(-,root,root,-)
 %{_pkg_dir}/bin/position-finder-client
 %{_sys_packages_dir}/org.tizen.position-finder-client.xml
index 8ed0524..a252313 100644 (file)
@@ -25,8 +25,8 @@
 #include "log.h"
 #include "connectivity.h"
 
+#define CBOR_FILE "/home/owner/apps_rw/org.tizen.position-finder-client/data/iotcon-test-svr-db-client.dat"
 #define DOOR_RESOURCE_URI_PREFIX "/door"
-#define DOOR_RESOURCE_TYPE "org.tizen.door"
 
 struct _connectivity_observe_resource_cb_s {
        connectivity_observe_resource_cb cb;
@@ -38,6 +38,7 @@ struct _connectivity_resource_s {
        char *device_id;
        char *host_address;
        char *device_name;
+       char *type;
        char *uri_path;
        iotcon_presence_h presence;
        iotcon_remote_resource_h resource;
@@ -327,7 +328,7 @@ static int _register_presence(iotcon_remote_resource_h resource, connectivity_re
        /* FIXME : We need to remove presence_cb when not needed */
        ret = iotcon_add_presence_cb(resource_host,
                        connectivity_type,
-                       DOOR_RESOURCE_TYPE,
+                       info->type,
                        _presence_cb,
                        NULL,
                        &info->presence);
@@ -414,7 +415,7 @@ int connectivity_init(void)
 {
        int ret = -1;
 
-       ret = iotcon_initialize("/usr/apps/org.tizen.position-finder-client/res/iotcon-test-svr-db-client.dat");
+       ret = iotcon_initialize(CBOR_FILE);
        if (IOTCON_ERROR_NONE != ret) {
                _E("iotcon_initialize() Fail(%d)", ret);
                return -1;
@@ -431,7 +432,7 @@ int connectivity_fini(void)
        return 0;
 }
 
-int connectivity_observe_resource(connectivity_observe_resource_cb cb, void *user_data)
+int connectivity_observe_resource(const char *type, connectivity_observe_resource_cb cb, void *user_data)
 {
        int ret = -1;
        iotcon_query_h query = NULL;
@@ -445,7 +446,7 @@ int connectivity_observe_resource(connectivity_observe_resource_cb cb, void *use
        ret = iotcon_query_create(&query);
        goto_if(IOTCON_ERROR_NONE != ret, error);
 
-       ret = iotcon_query_set_resource_type(query, DOOR_RESOURCE_TYPE);
+       ret = iotcon_query_set_resource_type(query, type);
        goto_if(IOTCON_ERROR_NONE != ret, error);
 
        ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS,
@@ -460,6 +461,8 @@ int connectivity_observe_resource(connectivity_observe_resource_cb cb, void *use
 
 error:
        iotcon_query_destroy(query);
-       if (cb_info) free(cb_info);
+       if (cb_info) {
+               free(cb_info);
+       }
        return -1;
 }
index 643f0fb..049d57c 100644 (file)
@@ -25,7 +25,8 @@
 #include "log.h"
 #include "connectivity.h"
 
-#define MAX_QUEUE_ELEMENTS 20
+#define MAX_QUEUE_ELEMENTS 120
+#define DOOR_RESOURCE_TYPE "org.tizen.door"
 
 static void _start_internal_function(void);
 static void _stop_internal_function(void);
@@ -57,7 +58,7 @@ bool service_app_create(void *data)
 
        _start_internal_function();
 
-       ret = connectivity_observe_resource(_observe_resource_cb, NULL);
+       ret = connectivity_observe_resource(DOOR_RESOURCE_TYPE, _observe_resource_cb, NULL);
        retv_if(ret == -1, false);
 
     return true;
index f32f3c9..d80c783 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.position-finder-client" version="1.0.0">
     <profile name="mobile"/>
-    <service-application appid="org.tizen.position-finder-client" auto-restart="false" exec="position-finder-client" multiple="false" nodisplay="false" on-boot="false" taskmanage="true" type="capp">
+    <service-application appid="org.tizen.position-finder-client" auto-restart="false" exec="position-finder-client" multiple="false" nodisplay="false" on-boot="true" taskmanage="true" type="capp">
         <label>Position Filnder Client</label>
         <icon>position_finder_client.png</icon>
     </service-application>