autofill_auth_info_destroy(aih);
}
+
+static void __error_info_recv_cb(void *user_data, rpc_port_autofill_error_info_h error_info_h)
+{
+ autofill_error_info_h eih = NULL;
+ autofill_h ah = user_data;
+
+ int error_code = 0;
+ char *app_id = NULL;
+ char *error_message = NULL;
+
+ autofill_error_info_create(&eih);
+
+ rpc_port_autofill_error_info_get_app_id(error_info_h, &app_id);
+ rpc_port_autofill_error_info_get_error_code(error_info_h, &error_code);
+ rpc_port_autofill_error_info_get_error_message(error_info_h, &error_message);
+
+ autofill_error_info_set_app_id(eih, app_id);
+ autofill_error_info_set_error_code(eih, error_code);
+ autofill_error_info_set_error_message(eih, error_message);
+
+ LOGD("error code : %d, message : %s", error_code, error_message);
+
+ if (app_id)
+ free(app_id);
+
+ if (error_message)
+ free(error_message);
+
+ if (ah) {
+ if (ah->autofill_error_info_received_cb)
+ ah->autofill_error_info_received_cb(ah, eih, ah->autofill_error_info_data);
+ }
+ else {
+ LOGW("no user data");
+ }
+
+ autofill_error_info_destroy(eih);
+}
//LCOV_EXCL_STOP
static void __on_connected(rpc_port_proxy_AutofillAppPort_h h, void *user_data)
LOGI("connected");
rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb = rpc_port_AutofillAppPort_autofill_fill_response_received_cb_create(__fill_response_recv_cb, false, ah);
rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_received_cb = rpc_port_AutofillAppPort_autofill_auth_info_received_cb_create(__auth_info_recv_cb, false, ah);
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_h error_info_received_cb = rpc_port_AutofillAppPort_autofill_error_info_received_cb_create(__error_info_recv_cb, false, ah);
- int r = rpc_port_proxy_AutofillAppPort_invoke_Register(h, ah->context_id, auth_info_received_cb, fill_response_received_cb);
+ int r = rpc_port_proxy_AutofillAppPort_invoke_Register(h, ah->context_id, auth_info_received_cb, fill_response_received_cb, error_info_received_cb);
if (r != 0)
LOGW("[ERROR] Failed to invoke Register");
ah->connection_callback = NULL;
ah->autofill_fill_response_received_cb = NULL;
ah->autofill_auth_info_received_cb = NULL;
+ ah->autofill_error_info_received_cb = NULL;
if (ah->rpc_h) {
rpc_port_proxy_AutofillAppPort_destroy(ah->rpc_h);
return AUTOFILL_ERROR_NONE;
}
}
+
+EXPORT_API int autofill_error_info_set_received_cb(autofill_h ah, autofill_error_info_received_cb callback, void *user_data)
+{
+ if (!ah || !callback) {
+ LOGW("[ERROR] Invalid parameter");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ ah->autofill_error_info_received_cb = callback;
+ ah->autofill_error_info_data = user_data;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_error_info_unset_received_cb(autofill_h ah)
+{
+ if (!ah) {
+ LOGW("[ERROR] Invalid parameter");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ ah->autofill_error_info_received_cb = NULL;
+ ah->autofill_error_info_data = NULL;
+
+ return AUTOFILL_ERROR_NONE;
+}
\ No newline at end of file
typedef void (*autofill_auth_info_received_cb)(autofill_h ah, autofill_auth_info_h auth_info, void *user_data);
/**
+ * @brief Called when receiving the error information.
+ * @since_tizen 5.5
+ * @remarks @a ah should not be freed and can be used only in the callback.
+ * @remarks @a error_info should not be freed and can be used only in the callback.
+ * @param[in] ah The autofill handle
+ * @param[in] error_info The autofill error information handle
+ * @param[in] user_data The user data passed from the callback function
+ * @see autofill_error_info_set_received_cb()
+ */
+typedef void (*autofill_error_info_received_cb)(autofill_h ah, autofill_error_info_h error_info, void *user_data);
+
+/**
* @brief Creates a handle for autofill.
* @since_tizen 5.5
* @remarks If the function succeeds, @a ah handle must be released with autofill_destroy().
int autofill_commit(autofill_h ah, autofill_save_view_info_h vi);
/**
+ * @brief Sets the callback to receive the error information.
+ * @since_tizen 5.5
+ * @param[in] ah The autofill handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see autofill_error_info_unset_received_cb()
+ */
+int autofill_error_info_set_received_cb(autofill_h ah, autofill_error_info_received_cb callback, void *user_data);
+
+/**
+ * @brief Unsets the callback to receive the error information.
+ * @since_tizen 5.5
+ * @param[in] ah The autofill handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see autofill_error_info_set_received_cb()
+ */
+int autofill_error_info_unset_received_cb(autofill_h ah);
+
+/**
* @}
*/
typedef struct autofill_save_view_info_s *autofill_save_view_info_h;
/**
+ * @brief The autofill error information handle.
+ * @since_tizen 5.5
+ */
+typedef struct autofill_error_info_s *autofill_error_info_h;
+
+/**
* @brief Called for each autofill information in view info.
* @since_tizen 5.5
* @remarks @a item should not be freed and can be used only in the callback.
int autofill_save_item_get_value(autofill_save_item_h it, char **value);
/**
+ * @brief Creates autofill error information.
+ * @since_tizen 5.5
+ * @remarks If the function succeeds, @a ei handle must be released with autofill_error_info_destroy().
+ * @param[out] ei The autofill error information handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUTOFILL_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int autofill_error_info_create(autofill_error_info_h *ei);
+
+/**
+ * @brief Destroys autofill error information.
+ * @since_tizen 5.5
+ * @param[in] ei The autofill error information handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_error_info_destroy(autofill_error_info_h ei);
+
+/**
+ * @brief Sets the app id in autofill error information.
+ * @since_tizen 5.5
+ * @param[in] ei The autofill error information handle
+ * @param[in] app_id The app ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_error_info_set_app_id(autofill_error_info_h ei, const char *app_id);
+
+/**
+ * @brief Gets the app id in autofill error information.
+ * @since_tizen 5.5
+ * @remarks @a app_id must be released using free().
+ * @param[in] ei The autofill error information handle
+ * @param[out] app_id The app ID
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure
+ */
+int autofill_error_info_get_app_id(autofill_error_info_h ei, char **app_id);
+
+/**
+ * @brief Sets the error code in autofill error information.
+ * @since_tizen 5.5
+ * @param[in] ei The autofill error information handle
+ * @param[in] error_code The autofill error code
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_error_info_set_error_code(autofill_error_info_h ei, autofill_error_e error_code);
+
+/**
+ * @brief Gets the error code in autofill error information.
+ * @since_tizen 5.5
+ * @param[in] ei The autofill error information handle
+ * @param[out] error_code The autofill error code
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_error_info_get_error_code(autofill_error_info_h ei, autofill_error_e *error_code);
+
+/**
+ * @brief Sets the error message in autofill error information.
+ * @since_tizen 5.5
+ * @param[in] ei The autofill error information handle
+ * @param[in] error_message The autofill error message
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_error_info_set_error_message(autofill_error_info_h ei, const char *error_message);
+
+/**
+ * @brief Gets the error message in autofill error information.
+ * @since_tizen 5.5
+ * @remarks @a error_message must be released using free().
+ * @param[in] ei The autofill error information handle
+ * @param[out] error_message The autofill error message
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure
+ */
+int autofill_error_info_get_error_message(autofill_error_info_h ei, char **error_message);
+
+/**
* @}
*/
AUTOFILL_ERROR_NOT_INITIALIZED = TIZEN_ERROR_AUTOFILL | 0x0001, /**< Not initialized */
AUTOFILL_ERROR_OPERATION_FAILED = TIZEN_ERROR_AUTOFILL | 0x0002, /**< Operation failed */
AUTOFILL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ AUTOFILL_ERROR_AUTHENTICATION_FAILED = TIZEN_ERROR_AUTOFILL | 0x0003, /**< Authentication failed */
+ AUTOFILL_ERROR_COMMIT_FAILED = TIZEN_ERROR_AUTOFILL | 0x0004, /**< Failed to save autofill data */
+ AUTOFILL_ERROR_FILL_RESPONSE_FAILED = TIZEN_ERROR_AUTOFILL | 0x0005, /**< Failed to response fill request */
} autofill_error_e;
/**
autofill_auth_info_received_cb autofill_auth_info_received_cb;
void *autofill_auth_info_data;
+
+ autofill_error_info_received_cb autofill_error_info_received_cb;
+ void *autofill_error_info_data;
};
struct autofill_view_info_s {
int autofill_service_unset_terminate_received_cb(void);
/**
+ * @brief Sends error to the autofill client.
+ * @since_tizen 5.5
+ * @param[in] context_id The autofill context identification value of an associated autofill client handle
+ * @param[in] h The autofill error info handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int autofill_service_send_error_info(int context_id, autofill_error_info_h h);
+
+/**
* @}
*/
rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h g_auth_info_cb;
rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h g_fill_response_received_cb;
+rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_h g_send_error_cb;
typedef struct {
char *app_id;
rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb;
rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb;
+ rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_h send_error_cb;
} autofill_svc_s;
static GList *__client_list = NULL;
static autofill_svc_s *__create_client(const char *app_id,
rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb,
- rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb)
+ rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb,
+ rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_h send_error_cb)
{
LOGD("");
autofill_svc_s *handle;
return NULL;
}
+ rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_clone(send_error_cb, &handle->send_error_cb);
+ if (!handle->send_error_cb) {
+ LOGE("Out of memory");
+ free(handle->app_id);
+ free(handle);
+ return NULL;
+ }
+
return handle;
}
if (handle->fill_response_received_cb)
rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_destroy(handle->fill_response_received_cb);
+ if (handle->send_error_cb)
+ rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_destroy(handle->send_error_cb);
+
if (handle->app_id)
free(handle->app_id);
free(sender);
}
-static int __message_register(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb, rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb, void *user_data)
+static int __message_register(rpc_port_stub_AutofillSvcPort_context_h context,
+ rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb,
+ rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb,
+ rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_h send_error_cb,
+ void *user_data)
{
LOGD("");
char *sender = NULL;
LOGD("sender(%s)", sender);
autofill_svc_s *client;
- client = __create_client(sender, auth_info_cb, fill_response_received_cb);
+ client = __create_client(sender, auth_info_cb, fill_response_received_cb, send_error_cb);
free(sender);
if (!client)
rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_clone(auth_info_cb, &g_auth_info_cb);
rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_clone(fill_response_received_cb, &g_fill_response_received_cb);
-
- LOGD("auth info : %p, fill response : %p", g_auth_info_cb, g_fill_response_received_cb);
+ rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_clone(send_error_cb, &g_send_error_cb);
__client_list = g_list_append(__client_list, client);
return AUTOFILL_ERROR_NONE;
}
+
+EXPORT_API int autofill_service_send_error_info(int context_id, autofill_error_info_h h)
+{
+ char *app_id = NULL;
+ char *error_message = NULL;
+ autofill_error_e error_code;
+ rpc_port_autofill_svc_error_info_h error_info_h = NULL;
+
+ if (!h) {
+ LOGW("[ERROR] Invalid parameter");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ autofill_error_info_get_app_id(h, &app_id);
+ autofill_error_info_get_error_code(h, &error_code);
+ autofill_error_info_get_error_message(h, &error_message);
+
+ /* create error info */
+ rpc_port_autofill_svc_error_info_create(&error_info_h);
+ rpc_port_autofill_svc_error_info_set_app_id(error_info_h, app_id);
+ rpc_port_autofill_svc_error_info_set_error_code(error_info_h, error_code);
+ rpc_port_autofill_svc_error_info_set_error_message(error_info_h, error_message);
+
+ int ret = rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_invoke(g_send_error_cb, context_id, error_info_h);
+
+ if (app_id)
+ free(app_id);
+
+ if (error_message)
+ free(error_message);
+
+ rpc_port_autofill_svc_error_info_destroy(error_info_h);
+
+ return ret;
+}
\ No newline at end of file
list<autofill_response_group> response_groups;
}
+struct autofill_error_info {
+ string app_id;
+ int error_code;
+ string error_message;
+}
+
interface AutofillAppPort {
void autofill_auth_info_received_cb(autofill_auth_info auth_info) delegate;
void autofill_fill_response_received_cb(autofill_fill_response response) delegate;
- int Register(int context_id, autofill_auth_info_received_cb auth_info_cb, autofill_fill_response_received_cb fill_response_cb);
+ void autofill_error_info_received_cb(autofill_error_info error_info) delegate;
+ int Register(int context_id, autofill_auth_info_received_cb auth_info_cb, autofill_fill_response_received_cb fill_response_cb, autofill_error_info_received_cb error_info_cb);
void Unregister(int context_id) async;
int request_auth_info(int context_id, autofill_view_info vi);
list<autofill_svc_response_group> response_groups;
}
+struct autofill_svc_error_info {
+ string app_id;
+ int error_code;
+ string error_message;
+}
+
interface AutofillSvcPort {
void autofill_svc_auth_info_cb(int context_id, autofill_svc_auth_info auth_info) delegate;
void autofill_svc_fill_response_cb(int context_id, autofill_svc_fill_response response) delegate;
- int Register(autofill_svc_auth_info_cb auth_info_cb, autofill_svc_fill_response_cb fill_response_cb);
+ void autofill_svc_send_error_cb(int context_id, autofill_svc_error_info error_info) delegate;
+ int Register(autofill_svc_auth_info_cb auth_info_cb, autofill_svc_fill_response_cb fill_response_cb, autofill_svc_send_error_cb send_error_cb);
void Unregister() async;
void request_auth_info(int context_id, autofill_svc_view_info vi) async;