From: Lokesh Date: Thu, 5 Dec 2019 09:17:51 +0000 (+0530) Subject: Check sensors of monitor when setting AND/OR condition X-Git-Tag: submit/tizen/20191205.122156~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b08a88507ea7f3bc8516b47da3393800cf3dec69;p=platform%2Fcore%2Fapi%2Fuser-awareness.git Check sensors of monitor when setting AND/OR condition Instead of global avialable sensors. Change-Id: Ib7210dae128e3e627b027cfb1b877132046fb07b Signed-off-by: Lokesh --- diff --git a/src/user-awareness-monitors.c b/src/user-awareness-monitors.c index 735642b..04f69ce 100644 --- a/src/user-awareness-monitors.c +++ b/src/user-awareness-monitors.c @@ -1257,7 +1257,6 @@ int ua_monitor_set_user_presence_condition( { FUNC_ENTRY; ua_monitor_s *monitor = (ua_monitor_s *)handle; - unsigned int available_sensors = 0; UA_VALIDATE_INPUT_PARAMETER(handle); UA_VALIDATE_HANDLE(handle, ua_monitor_list); @@ -1276,15 +1275,13 @@ int ua_monitor_set_user_presence_condition( return UA_ERROR_INVALID_PARAMETER; } - _uam_get_available_sensors(&available_sensors); - - if (bitmask_and != (available_sensors & bitmask_and)) { + if (bitmask_and != (monitor->sensor_bitmask & bitmask_and)) { UA_ERR("AND bitmask out of range"); FUNC_EXIT; return UA_ERROR_INVALID_PARAMETER; } - if (bitmask_or != (available_sensors & bitmask_or)) { + if (bitmask_or != (monitor->sensor_bitmask & bitmask_or)) { UA_ERR("OR bitmask out of range"); FUNC_EXIT; return UA_ERROR_INVALID_PARAMETER; @@ -1306,7 +1303,6 @@ int ua_monitor_set_user_absence_condition( { FUNC_ENTRY; ua_monitor_s *monitor = (ua_monitor_s *)handle; - unsigned int available_sensors = 0; UA_VALIDATE_INPUT_PARAMETER(handle); UA_VALIDATE_HANDLE(handle, ua_monitor_list); @@ -1325,15 +1321,13 @@ int ua_monitor_set_user_absence_condition( return UA_ERROR_INVALID_PARAMETER; } - _uam_get_available_sensors(&available_sensors); - - if (bitmask_and != (available_sensors & bitmask_and)) { + if (bitmask_and != (monitor->sensor_bitmask & bitmask_and)) { UA_ERR("AND bitmask out of range"); FUNC_EXIT; return UA_ERROR_INVALID_PARAMETER; } - if (bitmask_or != (available_sensors & bitmask_or)) { + if (bitmask_or != (monitor->sensor_bitmask & bitmask_or)) { UA_ERR("OR bitmask out of range"); FUNC_EXIT; return UA_ERROR_INVALID_PARAMETER;