* @pre
* @post
*
- * @see ua_device_foreach_added()
+ * @see ua_foreach_devices()
*/
typedef bool (*ua_registered_dev_cb)(
ua_device_h device_handle,
*
* @remarks The @a device_handle should be destroyed by using #ua_user_destroy().
*
+ * @param[in] mac_type The MAC address type of the device
+ * @param[in] mac_address The device's MAC address.
+ * @param[in] device_id The device ID.
+ *
* @param[out] device_handle The device handle
*
* @return 0 on success, otherwise a negative error value
*
* @see ua_device_destroy()
*/
-int ua_device_create(
- ua_device_h * device_handle);
+int ua_device_create(ua_mac_type_e mac_type,
+ const char* mac_address,
+ const char *device_id,
+ ua_device_h *device_handle);
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*/
int ua_device_clone(
ua_device_h *cloned,
- ua_device_h origin);
+ ua_device_h origin) TIZEN_DEPRECATED_API;
/**
int ua_device_destroy(
ua_device_h device_handle);
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets parent user handle from device.
- * @since_tizen 6.5
- *
- * @param[in] device_handle The device handle
- * @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_device_get_parent_user(
- ua_device_h device_handle,
- ua_user_h *user_handle);
-
-/**
- * @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Gets parent service handle from device.
- * @since_tizen 6.5
- *
- * @param[in] device_handle The device handle
- * @param[out] service_handle The service 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_device_get_parent_service(
- ua_device_h device_handle,
- ua_service_h *service_handle);
-
/**
* @ingroup CAPI_NETWORK_UA_MODULE
* @brief Sets a device type info for a device.
*/
int ua_device_set_mac_type(
ua_device_h device_handle,
- ua_mac_type_e mac_type);
+ ua_mac_type_e mac_type) TIZEN_DEPRECATED_API;
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*/
int ua_device_set_mac_address(
ua_device_h device_handle,
- const char *mac_address);
+ const char *mac_address) TIZEN_DEPRECATED_API;
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*/
int ua_device_set_device_id(
ua_device_h device_handle,
- const char *device_id);
+ const char *device_id) TIZEN_DEPRECATED_API;
/**
* @ingroup CAPI_NETWORK_UA_MODULE
*
* @see ua_registered_dev_cb()
*/
-int ua_device_foreach_added(
+int ua_foreach_devices(
ua_registered_dev_cb foreach_cb,
void *user_data);
return ret;
}
-int ua_device_create(ua_device_h *device_handle)
+int ua_device_create(ua_mac_type_e mac_type,
+ const char *mac_address,
+ const char *device_id,
+ ua_device_h *device_handle)
{
FUNC_ENTRY;
ua_dev_info_s *device = NULL;
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(device_handle);
+ UA_VALIDATE_INPUT_PARAMETER(mac_address);
+ UA_VALIDATE_INPUT_PARAMETER(device_id);
+
+ retv_if(UA_MAC_TYPE_NONE >= mac_type, UA_ERROR_INVALID_PARAMETER);
+ retv_if(UA_MAC_TYPE_INVALID <= mac_type, UA_ERROR_INVALID_PARAMETER);
+ retv_if((strlen(mac_address) != (UA_MAC_ADDRESS_STRING_LEN -1)),
+ UA_ERROR_INVALID_PARAMETER);
device = g_malloc0(sizeof(ua_dev_info_s));
if (!device) {
}
device->user = NULL;
- device->mac = NULL;
device->bssid = NULL;
device->ipv4 = NULL;
device->ipv6 = NULL;
- device->device_id = NULL;
- device->type = 0;
+ device->type = mac_type;
+ device->device_id = g_strdup(device_id);
device->pairing_required = FALSE;
device->state = UA_PRSENCE_STATE_INVALID;
device->os = UA_OS_TYPE_NOT_DEFINE;
device->isadded = false;
device->discriminant = true;
+ device->mac = g_strdup(mac_address);
/* Add device to list of devices */
*device_handle = (ua_device_h)device;
return UA_ERROR_NONE;
}
-int ua_device_get_parent_user(ua_device_h handle, ua_user_h *user_handle)
-{
- FUNC_ENTRY;
-
- UA_CHECK_INIT_STATUS();
- UA_VALIDATE_INPUT_PARAMETER(handle);
-
- ua_dev_info_s *device = (ua_dev_info_s *)handle;
-
- UA_VALIDATE_INPUT_PARAMETER(user_handle);
- UA_PRINT_DEVICE_HANDLE(handle);
-
- if (device->user == NULL) {
- int ret = _ua_intr_get_default_user(user_handle);
- if (ret != UA_ERROR_NONE) {
- UA_ERR("Failed to get default user with error");
- return ret;
- }
- } else {
- *user_handle = device->user;
- }
-
- FUNC_EXIT;
- return UA_ERROR_NONE;
-}
-
-int ua_device_get_parent_service(ua_device_h handle, ua_service_h *service_handle)
-{
- FUNC_ENTRY;
-
- UA_CHECK_INIT_STATUS();
- UA_VALIDATE_INPUT_PARAMETER(handle);
-
- ua_dev_info_s *device = (ua_dev_info_s *)handle;
- ua_user_info_s *user = NULL;
- ua_service_info_s *service = NULL;
-
- UA_VALIDATE_INPUT_PARAMETER(service_handle);
- UA_PRINT_DEVICE_HANDLE(handle);
-
- if (device->user == NULL) {
- int ret = _ua_intr_get_default_user((ua_user_h *)user);
- if (ret != UA_ERROR_NONE) {
- UA_ERR("Failed to get default user with error");
- return ret;
- }
- } else {
- user = device->user;
- }
-
- if (!user)
- return UA_ERROR_NOT_FOUND;
-
- if (user->service_handle == NULL) {
- int ret = ua_service_get_default_service((ua_service_h *)service);
- if (ret != UA_ERROR_NONE) {
- UA_ERR("Failed to get default service with error");
- return ret;
- }
- } else {
- service = user->service_handle;
- }
-
- *service_handle = service;
-
- FUNC_EXIT;
- return UA_ERROR_NONE;
-}
-
int ua_device_set_mac_type(ua_device_h handle, ua_mac_type_e mac_type)
{
FUNC_ENTRY;
int ret;
gboolean status = false;
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_create");
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(handle);
int ret;
gboolean status = false;
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_device_create");
UA_CHECK_INIT_STATUS();
UA_VALIDATE_INPUT_PARAMETER(handle);
UA_VALIDATE_INPUT_PARAMETER(device_id);
ua_dev_info_s *device;
uam_user_info_s uam_user;
+ UA_DEPRECATED_LOG(__FUNCTION__, "");
UA_CHECK_INIT_STATUS();
/* LCOV_EXCL_START */
return UA_ERROR_NONE;
}
-int ua_device_foreach_added(
+int ua_foreach_devices(
ua_registered_dev_cb foreach_cb,
void *user_data)
{
FUNC_ENTRY;
int ret;
- UA_DEPRECATED_LOG(__FUNCTION__, "TODO");
+ UA_DEPRECATED_LOG(__FUNCTION__, "ua_user_foreach_devices");
+ UA_CHECK_INIT_STATUS();
ret = ua_user_foreach_devices(user_handle, foreach_cb, user_data);
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
+ uat_mac_type_e mac_type = UAT_MAC_TYPE_MAX;
msg("ua_device_create");
g_device_h = NULL;
}
- ret = ua_device_create(&g_device_h);
+ if (strlen(g_device_type)) {
+ mac_type = (unsigned char)strtol(g_device_type, NULL, 10);
+ snprintf(g_device_type_str, MENU_DATA_SIZE, "%s",
+ uat_get_str_from_uat_mac_type(mac_type));
+ }
+
+ ret = ua_device_create(uat_convert_idx_to_device_type(mac_type),
+ g_mac_addr_str, g_device_id_str, &g_device_h);
msg(" - ua_device_create() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
}
-static int run_ua_device_set_mac_type(
- MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
- uat_mac_type_e mac_type = UAT_MAC_TYPE_MAX;
-
- msg("ua_device_set_mac_type");
-
- if (strlen(g_device_type)) {
- mac_type = (unsigned char)strtol(g_device_type, NULL, 10);
- snprintf(g_device_type_str, MENU_DATA_SIZE, "%s",
- uat_get_str_from_uat_mac_type(mac_type));
- }
-
- ret = ua_device_set_mac_type(g_device_h, uat_convert_idx_to_device_type(mac_type));
-
- msg(" - ua_device_set_mac_type() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_device_set_os_info(
MManager *mm, struct menu_data *menu)
{
return RET_SUCCESS;
}
-static int run_ua_device_set_mobile_id(
- MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
-
- msg("ua_device_set_device_id");
-
- ret = ua_device_set_device_id(g_device_h, g_device_id_str);
-
- msg(" - ua_device_set_device_id() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
-static int run_ua_device_set_mac_address(
- MManager *mm, struct menu_data *menu)
-{
- int ret = UA_ERROR_NONE;
-
- msg("ua_device_set_mac_address");
-
- ret = ua_device_set_mac_address(g_device_h, g_mac_addr_str);
-
- msg(" - ua_device_set_mac_address() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
-
- return RET_SUCCESS;
-}
-
static int run_ua_device_get_wifi_bssid(
MManager *mm, struct menu_data *menu)
{
return RET_SUCCESS;
}
-static int run_ua_device_foreach_added(
+static int run_ua_foreach_devices(
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_device_foreach_added");
+ msg("ua_foreach_devices");
uat_clear_device_list();
- ret = ua_device_foreach_added(_foreach_added_device_cb, NULL);
+ ret = ua_foreach_devices(_foreach_added_device_cb, NULL);
- msg(" - ua_device_foreach_added() ret: [0x%X] [%s]",
+ msg(" - ua_foreach_devices() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
return RET_SUCCESS;
}
-static struct menu_data menu_ua_device_type[] = {
- { "1", "type (1:BT 2:BLE 3:Wi-Fi 4:P2P)",
+static struct menu_data menu_ua_device_create[] = {
+ { "1", "device_id",
+ NULL, NULL, g_device_id_str },
+ { "2", "type (1:BT 2:BLE 3:Wi-Fi 4:P2P)",
NULL, NULL, g_device_type },
- { "2", "run", NULL,
- run_ua_device_set_mac_type, NULL },
+ { "3", "MAC",
+ NULL, NULL, g_mac_addr_str },
+ { "4", "run", NULL,
+ run_ua_device_create, NULL },
{ NULL, NULL, },
};
{ NULL, NULL, },
};
-static struct menu_data menu_ua_mobile_id[] = {
- { "1", "device_id",
- NULL, NULL, g_device_id_str },
- { "2", "run", NULL,
- run_ua_device_set_mobile_id, NULL },
- { NULL, NULL, },
-};
-
-static struct menu_data menu_ua_mac_address[] = {
- { "1", "MAC",
- NULL, NULL, g_mac_addr_str },
- { "2", "run", NULL,
- run_ua_device_set_mac_address, NULL },
- { NULL, NULL, },
-};
-
static struct menu_data menu_ua_ipv4_address[] = {
{ "1", "IPv4 address",
NULL, NULL, g_ipv4_address_str },
struct menu_data menu_ua_devices[] = {
{ "1", "ua_device_create",
- NULL, run_ua_device_create, NULL },
+ menu_ua_device_create, NULL, NULL},
{ "2", "ua_device_destroy",
NULL, run_ua_device_destroy, NULL },
- { "3", "ua_device_set_mac_type",
- menu_ua_device_type, NULL, g_device_type_str},
- { "4", "ua_device_set_os_info",
+ { "3", "ua_device_set_os_info",
menu_ua_os_type, NULL, g_os_type_str },
- { "5", "ua_device_set_device_id",
- menu_ua_mobile_id, NULL, g_device_id_str },
- { "6", "ua_device_set_mac_address",
- menu_ua_mac_address, NULL, g_mac_addr_str },
- { "7", "ua_device_set_discriminant",
+ { "4", "ua_device_set_discriminant",
menu_ua_discrminiant, NULL, g_discriminant},
- { "8", "ua_device_set_wifi_ipv4_address",
+ { "5", "ua_device_set_wifi_ipv4_address",
menu_ua_ipv4_address, NULL, g_ipv4_address_str },
- { "13", "ua_device_get_wifi_bssid",
+ { "11", "ua_device_get_wifi_bssid",
NULL, run_ua_device_get_wifi_bssid, NULL },
- { "14", "ua_device_get_by_mac_address",
+ { "12", "ua_device_get_by_mac_address",
menu_ua_devlist_by_mac, NULL, NULL },
- { "15", "ua_device_get_by_device_id",
+ { "13", "ua_device_get_by_device_id",
menu_ua_devlist_by_device_id, NULL, NULL },
- { "16", "ua_device_update",
+ { "14", "ua_device_update",
NULL, run_ua_device_update, NULL },
- { "17", "ua_device_foreach_added",
- NULL, run_ua_device_foreach_added, NULL },
+ { "15", "ua_foreach_devices",
+ NULL, run_ua_foreach_devices, NULL },
{ NULL, NULL, },
};
}
struct menu_data menu_sel_device[] = {
- { "1", "Device list", NULL, run_ua_device_foreach_added, g_selected_device_idx},
+ { "1", "Device list", NULL, run_ua_foreach_devices, g_selected_device_idx},
{ "2", "Apply", NULL, uat_select_device, NULL },
{ NULL, NULL, },
};