summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/user-awareness-private.h11
-rw-r--r--packaging/capi-network-ua.spec2
-rw-r--r--src/user-awareness-device.c25
-rw-r--r--src/user-awareness-event-handler.c28
-rw-r--r--src/user-awareness-users.c5
5 files changed, 67 insertions, 4 deletions
diff --git a/include/user-awareness-private.h b/include/user-awareness-private.h
index 4e173f6..31fca40 100644
--- a/include/user-awareness-private.h
+++ b/include/user-awareness-private.h
@@ -504,6 +504,17 @@ void _ua_get_uam_payload_from_ua(uam_ble_payload_s *uam_payload, ua_ble_payload_
*/
ua_ble_payload_s* _ua_payload_clone(ua_ble_payload_s *org_payload);
+/**
+ * @brief Add a device handle to internal device-list.
+ * @since_tizen 5.5
+ *
+ * @param[in] dev_info Device handle.
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int _ua_device_add_info_to_list(ua_dev_info_s* dev_info);
/**
* @brief Destroys a device handle.
diff --git a/packaging/capi-network-ua.spec b/packaging/capi-network-ua.spec
index 2348fa5..a8d117a 100644
--- a/packaging/capi-network-ua.spec
+++ b/packaging/capi-network-ua.spec
@@ -1,6 +1,6 @@
Name: capi-network-ua
Summary: User Awareness Framework CAPI
-Version: 0.12.6
+Version: 0.12.7
Release: 1
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
diff --git a/src/user-awareness-device.c b/src/user-awareness-device.c
index 77b8c06..ba42d3e 100644
--- a/src/user-awareness-device.c
+++ b/src/user-awareness-device.c
@@ -343,6 +343,31 @@ int _ua_is_device_exist(char *device_id, char *mac, ua_mac_type_e type,
return UA_ERROR_NONE;
}
+
+
+int _ua_device_add_info_to_list(ua_dev_info_s* dev_info)
+{
+ FUNC_ENTRY;
+ int ret;
+ ua_dev_info_s* device_info;
+ UA_VALIDATE_INPUT_PARAMETER(dev_info);
+
+ if (NULL != __ua_get_device_from_list(
+ dev_info->device_id, dev_info->mac, dev_info->type))
+ return UA_ERROR_ALREADY_DONE; // LCOV_EXCL_LINE
+
+ ret = ua_device_clone((ua_device_h)&device_info, dev_info);
+ if (UA_ERROR_NONE != ret) {
+ UA_ERR("_ua_device_add_info_to_list failed [%s]", _ua_get_error_string(ret));
+ return ret;
+ }
+
+ ua_devices_list = g_slist_append(ua_devices_list, device_info);
+
+ FUNC_EXIT;
+ return UA_ERROR_NONE;
+}
+
void _ua_handle_device_added(int result, uam_device_info_s *uam_info)
{
FUNC_ENTRY;
diff --git a/src/user-awareness-event-handler.c b/src/user-awareness-event-handler.c
index 1c0f3a5..74e2a63 100644
--- a/src/user-awareness-event-handler.c
+++ b/src/user-awareness-event-handler.c
@@ -240,6 +240,25 @@ static void __ua_event_handler(int event, uam_event_data_s *event_param,
}
/* LCOV_EXCL_STOP */
+static bool __foreach_added_device_cb(
+ ua_device_h handle, void *user_data)
+{
+ int ret;
+ ua_dev_info_s* dev_info;
+ retv_if(NULL == handle, false);
+
+ dev_info = (ua_dev_info_s*)handle;
+
+ ret = _ua_device_add_info_to_list(dev_info);
+
+ if (ret != UA_ERROR_NONE)
+ return false;
+ else
+ return true;
+
+ return true;
+}
+
static bool __foreach_intr_registered_service_info(
ua_service_h handle, void *user_data)
{
@@ -288,6 +307,15 @@ int ua_initialize(void)
return ret;
}
+ ret = ua_device_foreach_added(__foreach_added_device_cb, NULL);
+ if (UA_ERROR_NONE != ret) {
+ /* LCOV_EXCL_START */
+ UA_ERR("Failed with error: %s(0x%X)",
+ _ua_get_error_string(ret), ret);
+ return ret;
+ /* LCOV_EXCL_STOP */
+ }
+
ret = _ua_intr_foreach_registered_services(__foreach_intr_registered_service_info, NULL);
if (UA_ERROR_NONE != ret) {
/* LCOV_EXCL_START */
diff --git a/src/user-awareness-users.c b/src/user-awareness-users.c
index adf1bcd..ee9982b 100644
--- a/src/user-awareness-users.c
+++ b/src/user-awareness-users.c
@@ -24,7 +24,7 @@
GSList *ua_users_list;
-extern GSList *ua_devices_list;
+extern GSList *ua_devices_list;
extern GSList *ua_devices_db_list;
extern ua_callback_s user_callbacks[UA_USER_EVENT_MAX];
@@ -298,7 +298,7 @@ void _ua_set_user_last_presence_timestamp(ua_user_h user_handle,
FUNC_EXIT;
}
- int _ua_intr_foreach_registered_users(_ua_intr_registered_user_cb foreach_cb,
+int _ua_intr_foreach_registered_users(_ua_intr_registered_user_cb foreach_cb,
void *user_data)
{
int ret;
@@ -572,7 +572,6 @@ int ua_user_remove(ua_user_h user_handle)
retv_if(NULL == user->account, UA_ERROR_INVALID_PARAMETER);
-
g_strlcpy(account, user->account, UAM_USER_ACCOUNT_MAX_STRING_LEN);
ret = _ua_get_error_code(_uam_remove_user(account));