* @remarks The @a service_handle can be used only in the callback.
*
* @param[in] service_handle The service handle.
- * @param[in] user_data User data passed in ua_service_foreach_added().
+ * @param[in] user_data User data passed in ua_foreach_services().
*
* @exception
* @pre
* @post
*
- * @see ua_service_foreach_added()
+ * @see ua_foreach_services()
*/
typedef bool (*ua_service_added_cb)(
ua_service_h service_handle,
*
* @param[in] service_handle The service handle.
* @param[in] user_handle The user handle.
- * @param[in] user_data User data passed in ua_service_foreach_added_users().
+ * @param[in] user_data User data passed in ua_service_foreach_users().
*
* @exception
* @pre
* @post
*
- * @see ua_service_foreach_added_users()
+ * @see ua_service_foreach_users()
*/
typedef bool (*ua_service_added_user_cb)(
ua_service_h service_handle,
*
* @remarks The @a service_handle should be destroyed by using #ua_service_destroy().
*
- * @param[in] service_handle The service handle
+ * @param[in] name The service name information
+ * @param[out] service_handle The service handle
*
* @return 0 on success, otherwise a negative error value
* @retval #UA_ERROR_NONE Successful
* @see ua_service_destroy()
*/
int ua_service_create(
- ua_service_h *service_handle);
+ const char *name,
+ ua_service_h *service_handle);
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*/
int ua_service_set_name(
ua_service_h service_handle,
- const char *name);
+ const char *name) TIZEN_DEPRECATED_API;
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*
* @see ua_service_added_cb()
*/
-int ua_service_foreach_added(
+int ua_foreach_services(
ua_service_added_cb foreach_cb,
void *user_data);
*
* @see ua_service_added_user_cb()
*/
-int ua_service_foreach_added_users(
+int ua_service_foreach_users(
ua_service_h service_handle,
ua_service_added_user_cb foreach_cb,
void *user_data);
return ret;
}
-int ua_service_create(ua_service_h *service_handle)
+int ua_service_create(const char *name,
+ ua_service_h *service_handle)
{
FUNC_ENTRY;
ua_service_info_s *service = NULL;
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(service_handle);
+ UA_VALIDATE_INPUT_PARAMETER(name);
+ retv_if((strlen(name) > UAM_SERVICE_MAX_STRING_LEN),
+ UA_ERROR_INVALID_PARAMETER);
service = g_malloc0(sizeof(ua_service_info_s));
if (!service) {
return UA_ERROR_OUT_OF_MEMORY;
/* LCOV_EXCL_STOP */
}
- service->name = NULL;
+ service->name = g_strdup(name);
/* Add service to list of services*/
*service_handle = (ua_service_h)service;
{
FUNC_ENTRY;
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_service_create");
+
ua_service_info_s *service = (ua_service_info_s *)service_handle;
UA_CHECK_INIT_STATUS();
ua_service_info_s* service_info = (ua_service_info_s*)service_handle;
ua_dev_info_s* dev_info = (ua_dev_info_s*)device_handle;
- UA_DEPRECATED_LOG(__FUNCTION__, "TODO");
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_service_add_user");
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(service_handle);
ua_service_info_s* service_info = (ua_service_info_s*)service_handle;
ua_dev_info_s* dev_info = (ua_dev_info_s*)device_handle;
- UA_DEPRECATED_LOG(__FUNCTION__, "TODO");
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_service_remove_user");
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(service_handle);
return UA_ERROR_NONE;
}
-int ua_service_foreach_added(ua_service_added_cb foreach_cb,
+int ua_foreach_services(ua_service_added_cb foreach_cb,
void *user_data)
{
FUNC_ENTRY;
return UA_ERROR_NONE;
}
-int ua_service_foreach_added_users(
+int ua_service_foreach_users(
ua_service_h service_handle,
ua_service_added_user_cb foreach_cb,
void *user_data)
g_service_h = NULL;
}
- ret = ua_service_create(&g_service_h);
+ ret = ua_service_create(g_service_str, &g_service_h);
msg(" - ua_service_create() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
}
-static int run_ua_service_set_name(MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
-
- msg("ua_service_set_name");
-
- check_if(NULL == g_service_h);
-
- ret = ua_service_set_name(g_service_h, g_service_str);
-
- msg(" - ua_service_set_name() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_service_set_detection_threshold(MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
return RET_SUCCESS;
}
-static int run_ua_service_foreach_added(
+static int run_ua_foreach_services(
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_service_foreach_added");
+ msg("ua_foreach_services");
uat_clear_service_list();
- ret = ua_service_foreach_added(_foreach_added_service_cb, NULL);
+ ret = ua_foreach_services(_foreach_added_service_cb, NULL);
- msg(" - ua_service_foreach_added() ret: [0x%X] [%s]",
+ msg(" - ua_foreach_services() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
}
-static int run_ua_service_foreach_added_users(
+static int run_ua_service_foreach_users(
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_service_foreach_added_users");
+ msg("ua_service_foreach_users");
check_if(NULL == g_service_h);
uat_clear_user_list();
- ret = ua_service_foreach_added_users(g_service_h,
+ ret = ua_service_foreach_users(g_service_h,
_service_foreach_added_user_cb, NULL);
- msg(" - ua_service_foreach_added_users() ret: [0x%X] [%s]",
+ msg(" - ua_service_foreach_users() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
}
-static struct menu_data menu_ua_service_set_name[] = {
+static struct menu_data menu_ua_service_create[] = {
{ "1", "name", NULL,
NULL, g_service_str },
{ "2", "run", NULL,
- run_ua_service_set_name, NULL },
+ run_ua_service_create, NULL },
{ NULL, NULL, },
};
struct menu_data menu_sel_service[] = {
{ "1", "Service list", NULL,
- run_ua_service_foreach_added, g_selected_service_id},
+ run_ua_foreach_services, g_selected_service_id},
{ "2", "Apply", NULL, uat_select_service, NULL },
{ NULL, NULL, },
};
struct menu_data menu_sel_service_added_user[] = {
{ "1", "User list", NULL,
- run_ua_service_foreach_added_users, g_selected_user_idx},
+ run_ua_service_foreach_users, g_selected_user_idx},
{ "2", "Apply", NULL, uat_select_user, NULL },
{ NULL, NULL, },
};
struct menu_data menu_ua_services[] = {
{ "1", "ua_service_create",
- NULL, run_ua_service_create, NULL },
- { "2", "ua_service_set_name",
- menu_ua_service_set_name, NULL, g_service_str },
- { "3", "ua_service_set_detection_threshold",
+ menu_ua_service_create, NULL, g_service_str },
+ { "2", "ua_service_set_detection_threshold",
menu_ua_service_set_detection_threshold, NULL, NULL },
- { "4", "ua_service_add",
+ { "3", "ua_service_add",
NULL, run_ua_service_add, NULL },
- { "5", "ua_service_update",
+ { "4", "ua_service_update",
NULL, run_ua_service_update, NULL },
- { "6", "ua_service_remove",
+ { "5", "ua_service_remove",
NULL, run_ua_service_remove, NULL},
- { "7", "ua_service_destroy",
+ { "6", "ua_service_destroy",
NULL, run_ua_service_destroy, NULL},
- { "8", "ua_service_get_default_service",
+ { "7", "ua_service_get_default_service",
NULL, run_ua_service_get_default_service, NULL },
- { "9", "ua_service_get_by_name",
+ { "8", "ua_service_get_by_name",
menu_ua_service_get_by_name, NULL, NULL },
- { "10", ANSI_COLOR_LIGHTMAGENTA "ua_service_foreach_added" ANSI_COLOR_NORMAL,
+ { "9", ANSI_COLOR_LIGHTMAGENTA "ua_foreach_services" ANSI_COLOR_NORMAL,
menu_sel_service, NULL, NULL },
{ "21", ANSI_COLOR_LIGHTGREEN "ua_service_add_device" ANSI_COLOR_NORMAL,
NULL, run_ua_service_add_device, NULL },
menu_ua_service_add_user, NULL, NULL },
{ "32", ANSI_COLOR_LIGHTRED "ua_service_remove_user" ANSI_COLOR_NORMAL,
menu_ua_service_remove_user, NULL, NULL },
- { "33", ANSI_COLOR_LIGHTMAGENTA "ua_service_foreach_added_users" ANSI_COLOR_NORMAL,
+ { "33", ANSI_COLOR_LIGHTMAGENTA "ua_service_foreach_users" ANSI_COLOR_NORMAL,
menu_sel_service_added_user, NULL, NULL },
{ NULL, NULL, },
};