* @pre
* @post
*
- * @see ua_user_foreach_added()
+ * @see ua_foreach_users()
* @see ua_service_foreach_added_user()
* @see ua_user_destroy()
*/
* @brief Gets default user handle.
* @since_tizen 6.5
*
- *TODO lk, shall we destroy??
* @remarks The @a user_handle should be released using #ua_user_destroy().
*
* @param[out] user_handle The user handle
*/
int ua_user_get_default_user(ua_user_h *user_handle) TIZEN_DEPRECATED_API;
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets default user handle.
+ * @since_tizen 6.5
+ *
+ * @remarks The @a user_handle should be released using #ua_user_destroy().
+ *
+ * @param[out] user_handle The user handle
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_user_get_account()
+ */
+int ua_get_default_user(ua_user_h *user_handle);
+
/**
* @internal
* @ingroup CAPI_NETWORK_UA_MODULE
*/
int ua_user_foreach_added(ua_registered_user_cb foreach_cb, void *user_data) TIZEN_DEPRECATED_API;
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Retrieves the user handle of all the registered users.
+ * @since_tizen 6.5
+ *
+ * @param[in] foreach_cb Callback function to be invoked with user handle.
+ * @param[in] user_data The user data to be passed when callback is called.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #UA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #UA_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_registered_user_cb()
+ */
+int ua_foreach_users(
+ ua_registered_user_cb foreach_cb,
+ void *user_data);
+
/**
* @internal
* @ingroup CAPI_NETWORK_UA_MODULE
* @remarks The @a user_handle can be used only in the callback.
*
* @param[in] user_handle The user handle.
- * @param[in] user_data User data passed in ua_user_foreach_added().
+ * @param[in] user_data User data passed in ua_foreach_users().
*
* @exception
* @pre
* @post
*
- * @see ua_user_foreach_added()
+ * @see ua_foreach_users()
*/
typedef bool (*ua_registered_user_cb)(
ua_user_h user_handle,
*
* @remarks The @a user_handle should be destroyed by using #ua_user_destroy().
*
- * @param[in] user_handle The user handle
+ * @param[in] account Account information
+ * @param[out] user_handle The user handle
*
* @return 0 on success, otherwise a negative error value
* @retval #UA_ERROR_NONE Successful
*
* @see ua_user_destroy()
*/
-int ua_user_create(
+int ua_user_create(const char *account,
ua_user_h *user_handle);
/**
* @since_tizen 6.5
*
* @remarks The @a user_handle should not be released.
- * @remarks The @a user_handle can be used only in the fuction.
+ * @remarks The @a user_handle can be used only in the function.
+ *
+ * @param[in] account The user account information
+ * @param[out] user_handle The user handle
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
*
+ * @exception
+ * @pre
+ * @post
+ *
+ */
+int ua_user_get_handle_by_account(const char* account,
+ ua_user_h *user_handle) TIZEN_DEPRECATED_API;
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets user handle by account.
+ * @since_tizen 6.5
+ *
+ * @remarks The @a user_handle should not be released.
+ * @remarks The @a user_handle can be used only in the function.
+ *
+ * @param[in] service_handle The service handle
* @param[in] account The user account information
* @param[out] user_handle The user handle
*
* @post
*
*/
-int ua_user_get_handle_by_account(const char* account, ua_user_h *user_handle);
+int ua_service_get_user_by_account(ua_service_h service_handle,
+ const char* account, ua_user_h *user_handle);
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*
* @see ua_registered_dev_cb()
*/
-int ua_user_foreach_added_devices(
+int ua_user_foreach_devices(
ua_user_h user_handle,
ua_registered_dev_cb foreach_cb,
void *user_data);
return ret;
}
-int ua_user_create(ua_user_h *user_handle)
+int ua_user_create(const char *account,
+ ua_user_h *user_handle)
{
FUNC_ENTRY;
ua_user_info_s *user = NULL;
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(user_handle);
+ UA_VALIDATE_INPUT_PARAMETER(account);
+
+ retv_if((strlen(account) > UAM_USER_ACCOUNT_MAX_STRING_LEN),
+ UA_ERROR_INVALID_PARAMETER);
user = g_malloc0(sizeof(ua_user_info_s));
if (!user) {
/* LCOV_EXCL_STOP */
}
user->state = UA_PRSENCE_STATE_INVALID;
- user->account = NULL;
+ user->account = g_strdup(account);
/* Add user to list of users*/
*user_handle = (ua_user_h)user;
FUNC_ENTRY;
int ret;
- UA_DEPRECATED_LOG(__FUNCTION__, "");
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_get_default_user");
+
+ UA_CHECK_INIT_STATUS();
+ UA_VALIDATE_INPUT_PARAMETER(user_handle);
+
+ ret = _ua_intr_get_default_user(user_handle);
+
+ FUNC_EXIT;
+ return ret;
+}
+
+int ua_get_default_user(ua_user_h *user_handle)
+{
+ FUNC_ENTRY;
+ int ret;
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(user_handle);
return UA_ERROR_NONE;
}
-int ua_user_get_handle_by_account(const char* account, ua_user_h *user_handle)
+int ua_user_get_handle_by_account(const char* account,
+ ua_user_h *user_handle)
{
FUNC_ENTRY;
+ UA_DEPRECATED_LOG(__FUNCTION__,
+ "ua_service_get_user_by_account");
+
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(account);
UA_VALIDATE_INPUT_PARAMETER(user_handle);
{
FUNC_ENTRY;
- UA_DEPRECATED_LOG(__FUNCTION__, "TODO");
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_foreach_users");
+
+ UA_CHECK_INIT_STATUS();
+ UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
+
+ int ret = _ua_foreach_registered_users(foreach_cb, user_data);
+
+ FUNC_EXIT;
+ return ret;
+}
+
+int ua_foreach_users(
+ ua_registered_user_cb foreach_cb,
+ void *user_data)
+{
+ FUNC_ENTRY;
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
return UA_ERROR_NONE;
}
-int ua_user_remove_device_by_device_id(const char *device_id,
- ua_mac_type_e mac_type)
+int ua_user_remove_device_by_device_id(
+ const char *device_id, ua_mac_type_e mac_type)
{
FUNC_ENTRY;
int ret;
return UA_ERROR_NONE;
}
-int ua_user_foreach_added_devices(
+int ua_user_foreach_devices(
ua_user_h user_handle,
ua_registered_dev_cb foreach_cb,
void *user_data)
return ret;
}
-
/* LCOV_EXCL_STOP */
ua_user_destroy(g_user_h);
g_user_h = NULL;
}
- ua_user_get_default_user(&g_user_h);
+ ua_get_default_user(&g_user_h);
}
ret = ua_user_get_account(g_user_h, &account);
g_user_h = NULL;
}
- ret = ua_user_create(&g_user_h);
+ ret = ua_user_create(g_user_account_str, &g_user_h);
msg(" - ua_user_create() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
}
-static int run_ua_user_set_account(MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
-
- msg("ua_user_set_account");
-
- check_if(NULL == g_user_h);
-
- ret = ua_user_set_account(g_user_h, g_user_account_str);
-
- msg(" - ua_user_set_account() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_user_set_name(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
return RET_SUCCESS;
}
-static int run_ua_user_get_default_user(MManager *mm, struct menu_data *menu)
+static int run_ua_get_default_user(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_user_get_default_user");
+ msg("ua_get_default_user");
if (g_user_h) {
ua_user_destroy(g_user_h);
g_user_h = NULL;
}
- ret = ua_user_get_default_user(&g_user_h);
+ ret = ua_get_default_user(&g_user_h);
if (UA_ERROR_NONE == ret)
update_user_info();
return RET_SUCCESS;
}
-static int run_ua_user_get_by_account(MManager *mm, struct menu_data *menu)
+static int run_ua_service_get_user_by_account(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
ua_user_h user_handle;
- msg("ua_user_get_handle_by_account");
+ msg("ua_service_get_user_by_account");
- ret = ua_user_get_handle_by_account(g_user_account_str, &user_handle);
+ ret = ua_service_get_user_by_account(g_service_h,
+ g_user_account_str, &user_handle);
- msg(" - ua_user_get_handle_by_account() ret: [0x%X] [%s]",
+ msg(" - ua_service_get_user_by_account() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
if (UA_ERROR_NONE == ret) {
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_user_foreach_added");
+ msg("ua_foreach_users");
uat_clear_user_list();
- ret = ua_user_foreach_added(_foreach_registered_user_cb, NULL);
+ ret = ua_foreach_users(_foreach_registered_user_cb, NULL);
- msg(" - ua_user_foreach_added() ret: [0x%X] [%s]",
+ msg(" - ua_foreach_users() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
return RET_SUCCESS;
}
-static int run_ua_user_foreach_added_devices(MManager *mm, struct menu_data *menu)
+static int run_ua_user_foreach_devices(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
ua_user_h user_handle;
- msg("ua_user_foreach_added_devices");
+ msg("ua_user_foreach_devices");
- ret = ua_user_get_handle_by_account(g_user_account_str, &user_handle);
+ ret = ua_service_get_user_by_account(g_service_h,
+ g_user_account_str, &user_handle);
if (UA_ERROR_NONE == ret) {
msgb("User Handle [%p]", user_handle);
ua_user_destroy(g_user_h);
g_user_h = user_handle;
update_user_info();
} else {
- msg(" - ua_user_get_handle_by_account() ret: [0x%X] [%s]",
+ msg(" - ua_service_get_user_by_account() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
}
uat_clear_device_list();
- ret = ua_user_foreach_added_devices(g_user_h,
+ ret = ua_user_foreach_devices(g_user_h,
_user_foreach_added_device_cb, NULL);
- msg(" - ua_user_foreach_added_devices() ret: [0x%X] [%s]",
+ msg(" - ua_user_foreach_devices() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
return RET_SUCCESS;
}
-static struct menu_data menu_ua_user_account[] = {
+static struct menu_data menu_ua_user_create[] = {
{ "1", "account",
NULL, NULL, g_user_account_str },
{ "2", "run", NULL,
- run_ua_user_set_account, NULL },
+ run_ua_user_create, NULL },
{ NULL, NULL, },
};
{ NULL, NULL, },
};
-static struct menu_data menu_ua_user_get_handle_by_account[] = {
+static struct menu_data menu_ua_service_get_user_by_account[] = {
{ "1", "account",
NULL, NULL, g_user_account_str},
{ "2", "run", NULL,
- run_ua_user_get_by_account, NULL },
+ run_ua_service_get_user_by_account, NULL },
{ NULL, NULL, },
};
struct menu_data menu_ua_user_added_devlist[] = {
{ "1", "Device list", NULL,
- run_ua_user_foreach_added_devices, g_selected_device_idx},
+ run_ua_user_foreach_devices, g_selected_device_idx},
{ "2", "Apply", NULL, run_select_device, NULL },
{ NULL, NULL, },
};
struct menu_data menu_ua_users[] = {
{ "1", "ua_user_create",
- NULL, run_ua_user_create, NULL },
+ menu_ua_user_create, NULL, NULL },
{ "2", "ua_user_destroy",
NULL, run_ua_user_destroy, NULL },
- { "3", "ua_user_set_account",
- menu_ua_user_account, NULL, g_user_account_str },
- { "4", "ua_user_set_name",
+ { "3", "ua_user_set_name",
menu_ua_user_name, NULL, g_user_name_str },
- { "5", "ua_user_add",
+ { "4", "ua_user_add",
NULL, run_ua_user_add, NULL },
- { "6", "ua_user_remove",
+ { "5", "ua_user_remove",
NULL, run_ua_user_remove, NULL},
- { "8", "ua_user_get_default_user",
- NULL, run_ua_user_get_default_user, NULL },
- { "9", "ua_user_get_handle_by_account",
- menu_ua_user_get_handle_by_account, NULL, NULL },
- { "10", ANSI_COLOR_LIGHTMAGENTA "ua_user_foreach_added" ANSI_COLOR_NORMAL,
+ { "6", "ua_get_default_user",
+ NULL, run_ua_get_default_user, NULL },
+ { "7", "ua_service_get_user_by_account",
+ menu_ua_service_get_user_by_account, NULL, NULL },
+ { "8", ANSI_COLOR_LIGHTMAGENTA "ua_foreach_users" ANSI_COLOR_NORMAL,
menu_sel_added_user, NULL, NULL },
{ "11", ANSI_COLOR_LIGHTGREEN "ua_user_add_device" ANSI_COLOR_NORMAL,
NULL, run_ua_user_add_device, NULL },
NULL, run_ua_user_remove_device, NULL },
{ "13", "ua_user_remove_device_by_device_id",
menu_ua_rm_dev_by_device_id, NULL, NULL },
- { "14", ANSI_COLOR_LIGHTMAGENTA "ua_user_foreach_added_devices" ANSI_COLOR_NORMAL,
+ { "14", ANSI_COLOR_LIGHTMAGENTA "ua_user_foreach_devices" ANSI_COLOR_NORMAL,
menu_ua_user_added_devlist, NULL, NULL },
{ NULL, NULL, },
};