summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhay Agarwal <ay.agarwal@samsung.com>2019-10-07 13:17:08 +0900
committersaerome.kim <saerome.kim@samsung.com>2019-10-07 16:17:28 +0900
commit24927fd39dacde31a8e6596256027268ea27c354 (patch)
tree510eb277b1d7bbe7d072960b66156dd48b82df32
parent703866f6516575088da83bdef1006ba64280b7b5 (diff)
downloaduser-awareness-24927fd39dacde31a8e6596256027268ea27c354.tar.gz
user-awareness-24927fd39dacde31a8e6596256027268ea27c354.tar.bz2
user-awareness-24927fd39dacde31a8e6596256027268ea27c354.zip
Provide device added errors to applications through callback
This commit provides the errors received from ua-manager in adding a device. This also provide modifications to always reset the callback states. Change-Id: I65b5a0be9807576027435918cbf769ef9b74403e Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
-rw-r--r--packaging/capi-network-ua.spec2
-rw-r--r--src/user-awareness-device.c10
-rw-r--r--src/user-awareness-event-handler.c1
-rw-r--r--src/user-awareness-users.c5
4 files changed, 11 insertions, 7 deletions
diff --git a/packaging/capi-network-ua.spec b/packaging/capi-network-ua.spec
index 64d76ec..3c28c33 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.11.1
+Version: 0.11.2
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 59fee1b..133f18c 100644
--- a/src/user-awareness-device.c
+++ b/src/user-awareness-device.c
@@ -346,20 +346,20 @@ int _ua_is_device_exist(char *device_id, char *mac, ua_mac_type_e type,
void _ua_handle_device_added(int result, uam_device_info_s *uam_info)
{
FUNC_ENTRY;
- ua_dev_info_s *dev;
+ ua_dev_info_s *dev = NULL;
result = _ua_get_error_code(result);
if (UA_ERROR_NONE != result) {
dev = __ua_get_device_from_list(uam_info->device_id,
uam_info->mac, _to_ua_mac_type(uam_info->type));
- ret_if(NULL == dev);
- UA_ERR("Add device failed for Id:[%s] MAC type:[0x%4.4X]",
- dev->device_id, dev->type);
+ if (NULL != dev)
+ UA_ERR("Add device failed for Id:[%s] MAC type:[0x%4.4X]",
+ dev->device_id, dev->type);
} else {
dev = __ua_add_device_info_to_list(uam_info);
- ret_if(NULL == dev);
}
+ UA_INFO("Always invoke device added callback and reset callback");
if (user_callbacks[UA_USER_EVENT_DEVICE_ADDED].callback) {
((ua_user_device_added_cb)user_callbacks[UA_USER_EVENT_DEVICE_ADDED].callback)(
result, dev, user_callbacks[UA_USER_EVENT_DEVICE_ADDED].user_data);
diff --git a/src/user-awareness-event-handler.c b/src/user-awareness-event-handler.c
index 86baeca..5511d66 100644
--- a/src/user-awareness-event-handler.c
+++ b/src/user-awareness-event-handler.c
@@ -164,7 +164,6 @@ static void __ua_event_handler(int event, uam_event_data_s *event_param,
uam_device_info_s *dev_info = NULL;
dev_info = event_param->data;
- ret_if(NULL == dev_info);
_ua_handle_device_added(event_param->result, dev_info);
break;
diff --git a/src/user-awareness-users.c b/src/user-awareness-users.c
index c9551f2..2194add 100644
--- a/src/user-awareness-users.c
+++ b/src/user-awareness-users.c
@@ -801,6 +801,11 @@ int ua_user_add_device(ua_user_h user_handle, ua_device_h device_handle,
retv_if((UA_MAC_TYPE_NONE >= device->type), UA_ERROR_INVALID_PARAMETER);
retv_if((UA_MAC_TYPE_INVALID <= device->type), UA_ERROR_INVALID_PARAMETER);
+ if (user_callbacks[UA_USER_EVENT_DEVICE_ADDED].callback) {
+ UA_INFO("Add device callback not NULL, REQUEST is in PROGRESS");
+ return UA_ERROR_NOW_IN_PROGRESS;
+ }
+
temp_handle = device->user;
if (user_handle == NULL) {
/* LCOV_EXCL_START */