summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLokesh <l.kasana@samsung.com>2019-12-05 09:17:51 (GMT)
committersaerome.kim <saerome.kim@samsung.com>2019-12-05 12:15:53 (GMT)
commit8c9c2a2feda1fb6742a8314f4334ed3dad1cf651 (patch)
treef213c18dc1eac5dd73b5fb920333f99ad2adb090
parentc452b256fbfbcc73db8c7cc1c0f7ef54392af7d8 (diff)
downloaduser-awareness-8c9c2a2feda1fb6742a8314f4334ed3dad1cf651.zip
user-awareness-8c9c2a2feda1fb6742a8314f4334ed3dad1cf651.tar.gz
user-awareness-8c9c2a2feda1fb6742a8314f4334ed3dad1cf651.tar.bz2
Check sensors of monitor when setting AND/OR condition
Instead of global avialable sensors. Change-Id: Ief7c3ee87a5f3adbea790d6d7e1e966e1499002c Signed-off-by: Lokesh <l.kasana@samsung.com>
-rw-r--r--src/user-awareness-monitors.c14
1 files changed, 4 insertions, 10 deletions
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;