}
//LCOV_EXCL_STOP
-EXPORT_API int autofill_initialize(autofill_connection_status_changed_cb callback, void *user_data)
+EXPORT_API int autofill_initialize()
{
LOGD("autofill initialize");
int ret;
+ if (rpc_h) {
+ LOGI("already initialized\n");
+ return AUTOFILL_ERROR_NONE;
+ }
+
rpc_port_proxy_AutofillAppPort_callback_s rpc_callback = {
.connected = __on_connected,
.disconnected = __on_disconnected,
.rejected = __on_rejected
};
+ ret = rpc_port_proxy_AutofillAppPort_create(AUTOFILL_DAEMON_APP_ID, &rpc_callback, NULL, &rpc_h);
+ if (ret != RPC_PORT_ERROR_NONE) {
+ LOGW("Failed to create rpc port. err = %d", ret);
+ return AUTOFILL_ERROR_OUT_OF_MEMORY;
+ }
+
+ return ret;
+}
+
+EXPORT_API int autofill_deinitialize()
+{
+ LOGD("autofill deinitialize");
+
+ connection_callback = NULL;
+ g_autofill_fill_response_cb = NULL;
+ g_autofill_auth_info_cb = NULL;
+
+ return autofill_disconnect();
+}
+
+EXPORT_API int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data)
+{
+ LOGD("autofill connect");
+
+ int ret;
+
if (!callback) {
LOGW("parameter is NULL\n");
return AUTOFILL_ERROR_INVALID_PARAMETER;
}
- if (rpc_h) {
- LOGI("already connected\n");
- return AUTOFILL_ERROR_NONE;
+ if (!rpc_h) {
+ return AUTOFILL_ERROR_NOT_INITIALIZED;
}
connection_callback = callback;
connection_userdata = user_data;
- ret = rpc_port_proxy_AutofillAppPort_create(AUTOFILL_DAEMON_APP_ID, &rpc_callback, NULL, &rpc_h);
- if (ret != RPC_PORT_ERROR_NONE) {
- LOGW("Failed to create rpc port. err = %d", ret);
- return AUTOFILL_ERROR_OUT_OF_MEMORY;
- }
-
ret = rpc_port_proxy_AutofillAppPort_connect(rpc_h);
switch (ret) {
case RPC_PORT_ERROR_NONE:
return ret;
}
-EXPORT_API int autofill_deinitialize()
+EXPORT_API int autofill_disconnect()
{
- LOGD("autofill deinitialize");
+ LOGD("autofill disconnect");
if (rpc_h) {
rpc_port_proxy_AutofillAppPort_destroy(rpc_h);
* @retval #AUTOFILL_ERROR_NONE No error
* @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied
*/
-int autofill_initialize(autofill_connection_status_changed_cb callback, void *user_data);
+int autofill_initialize();
/**
* @brief Autofill deinitialize
*/
int autofill_deinitialize();
+/**
+ * @brief Autofill connect
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/appmanager.launch \n
+ * %http://tizen.org/privilege/datasharing
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied
+ */
+int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data);
+
+/**
+ * @brief Autofill disconnect
+ *
+ * @since_tizen 5.5
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/appmanager.launch \n
+ * %http://tizen.org/privilege/datasharing
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_PERMISSION_DENIED Permission denied
+ */
+int autofill_disconnect();
+
// auth
/**
* @brief Request of authentication information
#include <stdlib.h>
#include <service_app.h>
#include <dlog.h>
-#include <glib.h>
#include "autofill_service.h"
#ifdef LOG_TAG
autofill_auth_info_set_view_id(auth_info, view_id);
autofill_auth_info_set_exist_autofill_data(auth_info, true);
- autofill_auth_info_set_need_authentication(auth_info, false);
- autofill_auth_info_set_service_name(auth_info, "Samsung Pass444");
- autofill_auth_info_set_service_message(auth_info, "Login with Samsung Pass333");
- autofill_auth_info_set_service_logo_image_path(auth_info, "/usr/apps/com.samsung.samsungpass/shared/samsung_pass.png");
+ autofill_auth_info_set_need_authentication(auth_info, false); // Use true in real situation
+ autofill_auth_info_set_service_name(auth_info, "Samsung Pass");
+ autofill_auth_info_set_service_message(auth_info, "Login with Samsung Pass");
+ autofill_auth_info_set_service_logo_image_path(auth_info, "/usr/apps/com.samsung.samsungpass/shared/res/samsung_pass.png");
LOGD("send auth info");
autofill_service_send_auth_info(auth_info);
/**
- * Ecore example illustrating how to use ecore imf.
- *
- * @verbatim
- * gcc -o ecore_imf_example ecore_imf_example.c `pkg-config --cflags --libs ecore evas eina ecore-evas ecore-imf ecore-imf-evas`
- * @endverbatim
+ * Example illustrating how to use autofill library.
*/
#include <Ecore.h>
#include <Evas.h>
#include <stdio.h>
#include <app.h>
-#include <autofill.h>
#include <dlog.h>
#include <efl_extension.h>
+#include <autofill.h>
+
#define WIDTH 720
#define HEIGHT 1280
char *service_name = NULL;
char *service_message = NULL;
char *service_logo_image_path = NULL;
+ char *view_id = NULL;
+ autofill_auth_info_get_view_id(auth_info_h, &view_id);
autofill_auth_info_get_exist_autofill_data(auth_info_h, &exist_autofill_data);
autofill_auth_info_get_need_authentication(auth_info_h, &need_authentication);
autofill_auth_info_get_service_message(auth_info_h, &service_message);
autofill_auth_info_get_service_logo_image_path(auth_info_h, &service_logo_image_path);
- LOGD("exist : %d, need_auth : %d, service name : %s, logo path : %s, message : '%s'", exist_autofill_data, need_authentication, service_name, service_logo_image_path, service_message);
+ LOGD("view id : %s, exist : %d, need_auth : %d, view_id, service name : %s, logo path : %s, message : '%s'", exist_autofill_data, need_authentication, service_name, service_logo_image_path, service_message);
+
+ if (view_id)
+ free(view_id);
if (service_message)
free(service_message);
ecore_imf_init();
- ret = autofill_initialize(connection_status_changed_cb, NULL);
+ ret = autofill_initialize();
if (ret == AUTOFILL_ERROR_NONE)
LOGD("Succeeded to initialize");
else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED)
else
LOGW("Failed to initialize. error : %d", ret);
+ ret = autofill_connect(connection_status_changed_cb, NULL);
+ if (ret == AUTOFILL_ERROR_NONE)
+ LOGD("Succeeded to connect");
+ else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED)
+ LOGW("permission denied");
+ else
+ LOGW("Failed to connect. error : %d", ret);
+
// create a new window, with size=WIDTHxHEIGHT and default engine
ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);