Add Auth & Storage functions operated with Service Provider APIs 97/41897/1 accepted/tizen/mobile/20150619.083813 accepted/tizen/mobile/20150710.003647 accepted/tizen/tv/20150619.083833 accepted/tizen/tv/20150710.003703 accepted/tizen/wearable/20150619.083846 accepted/tizen/wearable/20150710.003716 submit/tizen/20150619.054812 submit/tizen/20150619.074507 submit/tizen/20150709.103716
authorYongjin Kim <youth.kim@samsung.com>
Fri, 19 Jun 2015 02:19:10 +0000 (11:19 +0900)
committerYongjin Kim <youth.kim@samsung.com>
Fri, 19 Jun 2015 02:19:10 +0000 (11:19 +0900)
Change-Id: I58f24d0e9002032430a24265277bf71f9bf7cd3e
Signed-off-by: Yongjin Kim <youth.kim@samsung.com>
CMakeLists.txt
org.tizen.service-plugin-sample.manifest
org.tizen.service-plugin-sample.xml
packaging/org.tizen.service-plugin-sample.spec
src/service_plugin_sample.c

index d93a92a912fc7a08ac9eb569e0ad04fa2aaa14e4..592750da0ebbe6a4dd4d2fc1cefca59d9bd91c7f 100644 (file)
@@ -18,11 +18,11 @@ pkg_check_modules(pkgs REQUIRED
        elementary
        efl-extension
        evas
-#      ecore-x
        ecore
        ecore-input
        capi-appfw-application
        dlog
+       service-adaptor
 )
 
 FOREACH(flag ${pkgs_CFLAGS})
@@ -31,6 +31,9 @@ ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 
+ADD_DEFINITIONS("-DSERVICE_ADAPTOR_DEBUGGING")
+ADD_DEFINITIONS("-D_SERVICE_ADAPTOR_IPC_CLIENT")
+
 ADD_EXECUTABLE(${SERVICE-PLUGIN-SAMPLE-BIN} ${SRCS})
 TARGET_LINK_LIBRARIES(${SERVICE-PLUGIN-SAMPLE-BIN} ${pkgs_LDFLAGS} "-pie")
 INSTALL(TARGETS ${SERVICE-PLUGIN-SAMPLE-BIN} DESTINATION /opt/usr/apps/${SERVICE-PLUGIN-SAMPLE}/bin)
index 3bbf232fdbc7509c440855f434d4a88d580fe972..7fb42c7e19285208256455d3f1c5ad9492aa7677 100644 (file)
@@ -14,6 +14,7 @@
                <smack request="system::media" type="rwxat" />
                <smack request="system::share" type="rwxat" />
                <smack request="xorg" type="w" />
+               <smack request="service-adaptor" type="rw" />
         </request>
        </define>
        <assign>
index 8fa73709fb197c9bd0ac4174e85eebd942656aa1..02842d5a42440fa7f152e779befcfed5dc47a8bb 100644 (file)
@@ -8,10 +8,7 @@
                <label>service plugin sample</label>
                <label xml:lang="en-us">plugin sample</label>
                <label xml:lang="ko-kr">plugin sample</label>
-               <app-control>
-                       <operation name="http://tizen.org/appcontrol/operation/sa/new"/>
-               </app-control>
-               <metadata key="service-adaptor" value="1001"/>
+               <metadata key="service-adaptor" value="service plugin sample"/>
        </ui-application>
        <account>
                <account-provider appid="org.tizen.service-plugin-sample" multiple-accounts-support="true" providerid="plugin sample">
index 2e8f89ea9d0d14f6358bf783e14d3588d6ad85a9..eaeb77019d168679b40d925cf50f25db62ed278d 100644 (file)
@@ -12,11 +12,12 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(efl-extension)
 BuildRequires:  pkgconfig(appcore-efl)
 BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(service-adaptor)
 BuildRequires:  cmake
 BuildRequires:  edje-bin
+#BuildRequires:  service-adaptor-devel
 
 %description
 plugin sample
index f15f71a0aa91e3096af107cf2daaae3fe8b74fe8..b6ecf08e8970c547b7c6472fc5609968d5fa6b36 100644 (file)
@@ -21,6 +21,7 @@
 #include <dlog.h>
 
 #include "service_plugin_sample.h"
+#include "service_provider.h"
 
 typedef struct appdata {
        Evas_Object *win;
@@ -28,6 +29,38 @@ typedef struct appdata {
        Evas_Object *label;
 } appdata_s;
 
+service_provider_h service_provider = NULL;
+
+service_adaptor_error_e _connect()
+{
+       SLOGI("connect");
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e _disconnect()
+{
+       SLOGI("disconnect");
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e _oauth1_get_access_token(char **access_token)
+{
+       SLOGI("oauth1_get_access_token");
+
+       *access_token = strdup("test");
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e _cloud_remove_file(const char *cloud_path)
+{
+       SLOGI("cloud_remove_file: %s", cloud_path);
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
 static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
 {
        ui_app_exit();
@@ -88,7 +121,10 @@ static bool app_create(void *data)
 
 static void app_control(app_control_h app_control, void *data)
 {
+       SLOGI("app_control");
+
        /* Handle the launch request. */
+       service_provider_message(service_provider, app_control, data);
 }
 
 static void app_pause(void *data)
@@ -142,6 +178,24 @@ int main(int argc, char *argv[])
        appdata_s ad = {0,};
        int ret = 0;
 
+       /*Service Plugin Client*/
+       service_provider_create(&service_provider);
+       service_provider->connect = _connect;
+       service_provider->disconnect = _disconnect;
+
+       auth_provider_h auth_provider = NULL;
+       auth_provider_create(&auth_provider);
+       auth_provider->oauth1_get_access_token = _oauth1_get_access_token;
+
+       service_provider_set_auth_provider(service_provider, auth_provider);
+
+       storage_provider_h storage_provider = NULL;
+       storage_provider_create(&storage_provider);
+       storage_provider->cloud_remove_file = _cloud_remove_file;
+
+       service_provider_set_storage_provider(service_provider, storage_provider);
+       /*Service Plugin Client*/
+
        ui_app_lifecycle_callback_s event_callback = {0,};
        app_event_handler_h handlers[5] = {NULL, };
 
@@ -161,9 +215,12 @@ int main(int argc, char *argv[])
        ret = ui_app_main(argc, argv, &event_callback, &ad);
        if (ret != APP_ERROR_NONE)
        {
-//             dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
-               printf("app_main() is failed. err = %d", ret);
+               SLOGE(LOG_TAG, "app_main() is failed. err = %d", ret);
        }
 
+       service_provider_unset_auth_provider(service_provider);
+       service_provider_unset_storage_provider(service_provider);
+       service_provider_destroy(service_provider);
+
        return ret;
 }