From: Yongjin Kim Date: Fri, 19 Jun 2015 02:19:10 +0000 (+0900) Subject: Add Auth & Storage functions operated with Service Provider APIs X-Git-Tag: submit/tizen/20150619.054812^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=663b51eacf057f52475706744537215a7d10d607;p=platform%2Fcore%2Fconvergence%2Fplugin%2Fservice-plugin-sample.git Add Auth & Storage functions operated with Service Provider APIs Change-Id: I58f24d0e9002032430a24265277bf71f9bf7cd3e Signed-off-by: Yongjin Kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d93a92a..592750d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/org.tizen.service-plugin-sample.manifest b/org.tizen.service-plugin-sample.manifest index 3bbf232..7fb42c7 100644 --- a/org.tizen.service-plugin-sample.manifest +++ b/org.tizen.service-plugin-sample.manifest @@ -14,6 +14,7 @@ + diff --git a/org.tizen.service-plugin-sample.xml b/org.tizen.service-plugin-sample.xml index 8fa7370..02842d5 100644 --- a/org.tizen.service-plugin-sample.xml +++ b/org.tizen.service-plugin-sample.xml @@ -8,10 +8,7 @@ - - - - + diff --git a/packaging/org.tizen.service-plugin-sample.spec b/packaging/org.tizen.service-plugin-sample.spec index 2e8f89e..eaeb770 100644 --- a/packaging/org.tizen.service-plugin-sample.spec +++ b/packaging/org.tizen.service-plugin-sample.spec @@ -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 diff --git a/src/service_plugin_sample.c b/src/service_plugin_sample.c index f15f71a..b6ecf08 100644 --- a/src/service_plugin_sample.c +++ b/src/service_plugin_sample.c @@ -21,6 +21,7 @@ #include #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; }