* @param[in] handle The monitor handle
* @param[in] device_handle The device handle to detected device's information. When scan
* is complete, it is set to NULL.
- * @param[in] user_data The user data passed in ua_monitor_start_scan_devices()
+ * @param[in] user_data The user data passed in ua_monitor_start_scan()
*
* @exception
* @pre
* @post
*
- * @see ua_monitor_start_scan_devices()
+ * @see ua_monitor_start_scan()
*/
typedef void (*ua_scan_completed_cb)(
ua_active_scan_type_e type,
* @param[in] sensor Sensor type, In case monitor has more than one sensor and detection
* mode is not #UA_DETECT_MODE_ANY_SENSOR, sensor will be set to last sensor which
* reported user presence before invoking callback.
+ * @param[in] service_handle The service handle with which presence detection start was invoked.
* @param[in] device_handle The first device handle on which sensor is detected.
* @param[in] sensor_handle The sensor handle for the detected sensor.
* @param[in] user_data The user data passed in ua_monitor_start_presence_detection()
int result,
ua_monitor_h handle,
ua_sensor_e sensor,
+ ua_service_h service_handle,
ua_device_h device_handle,
ua_sensor_h sensor_handle,
void *user_data);
* @remarks The @a sensor_handle can be used only in the callback.
*
* @param[in] result The result of the requested operation.
- * @param[in] handle The monitor handle with which absence detection start was invoked. \n
- * @param[in] sensor Sensor type by which absence was detected. \n
+ * @param[in] handle The monitor handle with which absence detection start was invoked.
+ * @param[in] service_handle The service handle with which absence detection start was invoked.
+ * @param[in] sensor Sensor type by which absence was detected.
* In case monitor has more than one sensor and detection mode is not
* #UA_DETECT_MODE_ANY_SENSOR, sensor will be set to #UA_SENSOR_MAX before
* invoking callback.
typedef void (*ua_absence_detected_cb)(
int result,
ua_monitor_h handle,
+ ua_service_h service_handle,
ua_sensor_e sensor,
ua_sensor_h sensor_handle,
void *user_data);
*
* @see UA_SCAN_TIME_MULTIPLIER
* @see ua_scan_completed_cb()
- * @see ua_monitor_stop_scan_devices()
+ * @see ua_monitor_stop_scan()
*/
-int ua_monitor_start_scan_devices(
+int ua_monitor_start_scan(
ua_monitor_h handle,
int scan_time_multiplier,
ua_scan_completed_cb callback,
/**
* @ingroup CAPI_NETWORK_UA_MODULE
- * @brief Stops ua_monitor_start_scan_devices().
+ * @brief Stops ua_monitor_start_scan().
* @since_tizen 6.5
*
* @param[in] monitor UA monitor's handle
* @pre
* @post
*
- * @see ua_monitor_start_scan_devices()
+ * @see ua_monitor_start_scan()
*/
-int ua_monitor_stop_scan_devices(ua_monitor_h monitor);
+int ua_monitor_stop_scan(ua_monitor_h monitor);
/**
for (l = ua_monitor_list; NULL != l; l = g_slist_next(l)) {
ua_monitor_s *monitor = l->data;
+ ua_service_info_s *service = NULL;
+ ua_service_h service_handle = NULL;
if (!monitor || g_strcmp0(monitor->service, svc_name))
continue;
if (monitor->presence_mode != UA_DETECT_MODE_ANY_SENSOR) {
- UA_INFO("monitor->sensor_bitmask: 0x%8.8X, monitor->presence_detected_bitmask: 0x%8.8X",
- monitor->sensor_bitmask, monitor->presence_detected_bitmask);
- if (monitor->sensor_bitmask == monitor->presence_detected_bitmask) {
- if (monitor->presence_cb)
+ /* Send callbacks for 'ALL' mode */
+ UA_INFO("monitor->sensor_bitmask: 0x%8.8X, " \
+ "monitor->presence_detected_bitmask: 0x%8.8X",
+ monitor->sensor_bitmask,
+ monitor->presence_detected_bitmask);
+
+ if (monitor->sensor_bitmask
+ == monitor->presence_detected_bitmask) {
+ if (monitor->presence_cb) {
+ service = __ua_get_service_from_list(
+ monitor->service);
+ if (service)
+ service_handle = service->service_handle;
+
monitor->presence_cb(UA_ERROR_NONE, monitor,
- monitor->presence_detected_bitmask, NULL, NULL, monitor->user_data);
+ monitor->presence_detected_bitmask,
+ service_handle, NULL, NULL,
+ monitor->user_data);
+ }
}
}
FUNC_ENTRY;
ua_sensor_e bitmask = sensor_info->bitmask;
ua_sensor_h sensor_handle;
+ ua_service_info_s *service = NULL;
+ ua_service_h service_handle = NULL;
int ret;
ret = ua_sensor_get_by_sensor_info(sensor_info, &sensor_handle);
UA_INFO("UA_DETECT_MODE_ALL_SENSOR [%d][%d]",
bitmask, monitor->presence_detected_bitmask);
- if (((bitmask == UA_SENSOR_BLE) && (monitor->sensor_bitmask & UA_SENSOR_WIFI))
- || ((bitmask == UA_SENSOR_WIFI) && (monitor->sensor_bitmask & UA_SENSOR_BLE)))
- monitor->presence_detected_bitmask |= (UA_SENSOR_BLE | UA_SENSOR_WIFI);
+ if (((bitmask == UA_SENSOR_BLE)
+ && (monitor->sensor_bitmask & UA_SENSOR_WIFI))
+ || ((bitmask == UA_SENSOR_WIFI)
+ && (monitor->sensor_bitmask & UA_SENSOR_BLE)))
+ monitor->presence_detected_bitmask |=
+ (UA_SENSOR_BLE | UA_SENSOR_WIFI);
else
monitor->presence_detected_bitmask |= bitmask;
UA_INFO("UA_DETECT_MODE_ANY_SENSOR [%d][%d]",
bitmask, monitor->presence_detected_bitmask);
- if (monitor->presence_cb)
+ if (monitor->presence_cb) {
+ service = __ua_get_service_from_list(monitor->service);
+ if (service)
+ service_handle = service->service_handle;
monitor->presence_cb(UA_ERROR_NONE, monitor,
- bitmask, device_handle, sensor_handle, monitor->user_data);
+ bitmask, service_handle, device_handle,
+ sensor_handle, monitor->user_data);
+ }
}
break;
for (l = ua_monitor_list; NULL != l; l = g_slist_next(l)) {
ua_monitor_s *monitor = l->data;
+ ua_service_info_s *service = NULL;
+ ua_service_h service_handle = NULL;
if (!monitor || g_strcmp0(monitor->service, svc_name))
continue;
monitor->sensor_bitmask, monitor->absence_detected_bitmask);
if (monitor->sensor_bitmask == monitor->absence_detected_bitmask) {
- if (monitor->absence_cb)
- monitor->absence_cb(UA_ERROR_NONE, monitor,
- monitor->absence_detected_bitmask, NULL, monitor->user_data);
+ if (monitor->absence_cb) {
+ service = __ua_get_service_from_list(monitor->service);
+ if (service)
+ service_handle = service->service_handle;
+
+ monitor->absence_cb(UA_ERROR_NONE, monitor,
+ service_handle, monitor->absence_detected_bitmask,
+ NULL, monitor->user_data);
+ }
}
}
-
if (monitor->absence_user_cb.callback) {
for (l1 = monitor->user_state; NULL != l1; l1 = g_slist_next(l1)) {
ua_user_state_info_s *user_state = l1->data;
ua_sensor_e bitmask = sensor_info->bitmask;
ret_if(NULL == monitor);
ua_sensor_h sensor_handle;
+ ua_service_info_s *service = NULL;
+ ua_service_h service_handle = NULL;
if (account) {
for (l = monitor->user_state; l; l = g_slist_next(l)) {
_ua_get_error_string(ret));
}
+ service = __ua_get_service_from_list(monitor->service);
+ if (service)
+ service_handle = service->service_handle;
+
switch (monitor->absence_mode) {
case UA_DETECT_MODE_ALL_SENSOR:
break;
case UA_DETECT_MODE_ANY_SENSOR:
/* First add user info to local users list and then invoke callback */
if (account) {
- all_absence = __ua_check_all_users_absence_state(monitor->user_state, bitmask);
+ all_absence = __ua_check_all_users_absence_state(
+ monitor->user_state, bitmask);
if (all_absence) {
if (monitor->absence_cb)
monitor->absence_cb(UA_ERROR_NONE, monitor,
- bitmask, sensor_handle, monitor->user_data);
+ service_handle, bitmask, sensor_handle,
+ monitor->user_data);
}
} else {
if (monitor->absence_cb)
monitor->absence_cb(UA_ERROR_NONE, monitor,
- bitmask, sensor_handle, monitor->user_data);
+ service_handle, bitmask, sensor_handle,
+ monitor->user_data);
}
break;
return UA_ERROR_NONE;
}
-int ua_monitor_start_scan_devices(
+int ua_monitor_start_scan(
ua_monitor_h handle,
int scan_time,
ua_scan_completed_cb callback,
return UA_ERROR_NONE;
}
-int ua_monitor_stop_scan_devices(ua_monitor_h handle)
+int ua_monitor_stop_scan(ua_monitor_h handle)
{
FUNC_ENTRY;
int ret;
void _print_device_info(ua_device_h handle);
void _sensor_presence_detected_cb(int result, ua_monitor_h monitor,
- ua_sensor_e sensor, ua_device_h device_handle, ua_sensor_h sensor_handle,
+ ua_sensor_e sensor, ua_service_h service_handle,
+ ua_device_h device_handle, ua_sensor_h sensor_handle,
void *user_data);
void _sensor_absence_detected_cb(int result, ua_monitor_h monitor,
- ua_sensor_e sensor, ua_sensor_h sensor_handle, void *user_data);
+ ua_service_h service_handle, ua_sensor_e sensor,
+ ua_sensor_h sensor_handle, void *user_data);
bool _foreach_registered_user_cb(
ua_user_h user_handle, void *user_data);
bool _foreach_added_service_cb(
}
void _sensor_presence_detected_cb(int result, ua_monitor_h monitor,
- ua_sensor_e sensor, ua_device_h device_handle, ua_sensor_h sensor_handle,
+ ua_sensor_e sensor, ua_service_h service_handle,
+ ua_device_h device_handle, ua_sensor_h sensor_handle,
void *user_data)
{
char *pbuf = uat_get_time();
msgb("\n[%s]", pbuf);
free(pbuf);
+ int ret;
+ char *service_name = NULL;
+
+ ret = ua_service_get_name(g_service_h, &service_name);
+ if (UA_ERROR_NONE != ret) {
+ msg(" - ua_service_get_name() ret: [0x%X] [%s]",
+ ret, uat_get_error_str(ret));
+ }
+ msgb("Presence detected for service [%s]", service_name);
if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
msgb("[%s] PRESENCE detected [%s]",
}
void _sensor_absence_detected_cb(int result, ua_monitor_h monitor,
- ua_sensor_e sensor, ua_sensor_h sensor_handle, void *user_data)
+ ua_service_h service_handle, ua_sensor_e sensor,
+ ua_sensor_h sensor_handle, void *user_data)
{
char *pbuf = uat_get_time();
msgp("\n[%s]", pbuf);
free(pbuf);
+ int ret;
+ char *service_name = NULL;
+
+ ret = ua_service_get_name(g_service_h, &service_name);
+ if (UA_ERROR_NONE != ret) {
+ msg(" - ua_service_get_name() ret: [0x%X] [%s]",
+ ret, uat_get_error_str(ret));
+ }
+ msgb("Absence detected for service [%s]", service_name);
if (UA_SENSOR_BLE == (UA_SENSOR_BLE & sensor)) {
msgp("[%s] ABSENCE detected [%s]",
return RET_SUCCESS;
}
-static int run_ua_monitor_start_scan_devices(
+static int run_ua_monitor_start_scan(
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
unsigned int scantimemultiplier = 0;
- msg("ua_monitor_start_scan_devices");
+ msg("ua_monitor_start_scan");
check_if(NULL == g_ua_mon_h);
if (strlen(g_scan_time_multiplier))
scantimemultiplier = (unsigned int)strtol(g_scan_time_multiplier, NULL, 10);
- ret = ua_monitor_start_scan_devices(g_ua_mon_h, scantimemultiplier,
+ ret = ua_monitor_start_scan(g_ua_mon_h, scantimemultiplier,
__ua_test_scan_completed_cb, NULL);
msg(" - ua_monitor_stop_absence_detection() ret: [0x%X] [%s]",
return RET_SUCCESS;
}
-static int run_ua_monitor_stop_scan_devices(
+static int run_ua_monitor_stop_scan(
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_monitor_stop_scan_devices,");
+ msg("ua_monitor_stop_scan,");
check_if(NULL == g_ua_mon_h);
- ret = ua_monitor_stop_scan_devices(g_ua_mon_h);
+ ret = ua_monitor_stop_scan(g_ua_mon_h);
- msg("ua_monitor_stop_scan_devices,() ret: [0x%X] [%s]",
+ msg("ua_monitor_stop_scan,() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
static struct menu_data menu_start_device_scan[] = {
{ "1", "Device scan time multiplier", NULL, NULL, g_scan_time_multiplier},
- { "2", "run", NULL, run_ua_monitor_start_scan_devices, NULL },
+ { "2", "run", NULL, run_ua_monitor_start_scan, NULL },
{ NULL, NULL, },
};
{ "8", "ua_monitor_start_device_scan",
menu_start_device_scan, NULL, NULL },
- { "9", "ua_monitor_stop_scan_devices",
- NULL, run_ua_monitor_stop_scan_devices, NULL },
+ { "9", "ua_monitor_stop_scan",
+ NULL, run_ua_monitor_stop_scan, NULL },
{ "10", "ua_enable_low_power_mode",
NULL, run_ua_enable_low_power_mode, NULL },