summaryrefslogtreecommitdiff
path: root/src/user-awareness-monitors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user-awareness-monitors.c')
-rw-r--r--src/user-awareness-monitors.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/user-awareness-monitors.c b/src/user-awareness-monitors.c
index 1d8a780..f2c6467 100644
--- a/src/user-awareness-monitors.c
+++ b/src/user-awareness-monitors.c
@@ -550,7 +550,7 @@ static int __ua_start_monitoring(unsigned int bitmask, char *service, ua_detecti
int ua_monitor_start_presence_detection(
ua_monitor_h handle,
- const char* service,
+ ua_service_h service_handle,
ua_detection_mode_e mode,
ua_presence_detected_cb callback,
void *user_data)
@@ -558,12 +558,21 @@ int ua_monitor_start_presence_detection(
FUNC_ENTRY;
int ret;
ua_monitor_s *monitor = (ua_monitor_s *)handle;
+ ua_service_info_s *service_info = (ua_service_info_s *)service_handle;
ua_detection_type_e detect = UA_PRESENCE_DETECTION;
+ char *service;
+ GSList *ua_services_list = _ua_service_get_services();
UA_VALIDATE_INPUT_PARAMETER(handle);
UA_VALIDATE_HANDLE(handle, ua_monitor_list);
retv_if(TRUE == monitor->presence_detection_started, UA_ERROR_NOW_IN_PROGRESS);
+ if (service_handle) {
+ UA_VALIDATE_HANDLE(service_handle, ua_services_list);
+ service = g_strdup(service_info->name);
+ } else
+ service = NULL;
+
if (monitor->service)
if ((service && g_strcmp0(monitor->service, service)) ||
(!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT)))
@@ -604,7 +613,7 @@ int ua_monitor_start_presence_detection(
int ua_monitor_start_absence_detection(
ua_monitor_h handle,
- const char* service,
+ ua_service_h service_handle,
ua_detection_mode_e mode,
ua_absence_detected_cb callback,
void *user_data)
@@ -612,12 +621,21 @@ int ua_monitor_start_absence_detection(
FUNC_ENTRY;
int ret;
ua_monitor_s *monitor = (ua_monitor_s *)handle;
+ ua_service_info_s *service_info = (ua_service_info_s *)service_handle;
ua_detection_type_e detect = UA_ABSENCE_DETECTION;
+ char *service;
+ GSList *ua_services_list = _ua_service_get_services();
UA_VALIDATE_INPUT_PARAMETER(handle);
UA_VALIDATE_HANDLE(handle, ua_monitor_list);
retv_if(TRUE == monitor->absence_detection_started, UA_ERROR_NOW_IN_PROGRESS);
+ if (service_handle) {
+ UA_VALIDATE_HANDLE(service_handle, ua_services_list);
+ service = g_strdup(service_info->name);
+ } else
+ service = NULL;
+
if (monitor->service)
if ((service && g_strcmp0(monitor->service, service)) ||
(!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT)))