* @since_tizen 6.5
*/
typedef struct {
+ ua_service_h service_handle; /**< Service handle */
ua_user_h user_handle; /**< User handle */
ua_presence_state_e state; /**< Presence state */
unsigned int sensor_bitmask; /**< Detected user devices bitmask */
typedef void (*ua_sensor_status_changed_cb)(
ua_monitor_h handle,
ua_sensor_h sensor_handle,
+ ua_sensor_e sensor_type,
+ ua_sensor_status_e status,
void *user_data);
/**
*
* @see UA_SCAN_TIME_MULTIPLIER
* @see ua_scan_completed_cb()
- * @see ua_monitor_cancel_scan_devices()
+ * @see ua_monitor_stop_scan_devices()
*/
int ua_monitor_start_scan_devices(
ua_monitor_h handle,
*
* @see ua_monitor_start_scan_devices()
*/
-int ua_monitor_cancel_scan_devices(ua_monitor_h monitor);
+int ua_monitor_stop_scan_devices(ua_monitor_h monitor);
/**
int ua_device_destroy(
ua_device_h device_handle);
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets parent user handle from device.
+ * @since_tizen 6.5
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] user_handle The user handle
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int ua_device_get_parent_user(
+ ua_device_h device_handle,
+ ua_user_h *user_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Gets parent service handle from device.
+ * @since_tizen 6.5
+ *
+ * @param[in] device_handle The device handle
+ * @param[out] service_handle The service handle
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+int ua_device_get_parent_service(
+ ua_device_h device_handle,
+ ua_service_h *service_handle);
+
/**
* @ingroup CAPI_NETWORK_UA_MODULE
* @brief Sets a device type info for a device.
return UA_ERROR_NONE;
}
+int ua_device_get_parent_user(ua_device_h handle, ua_user_h *user_handle)
+{
+ FUNC_ENTRY;
+
+ UA_CHECK_INIT_STATUS();
+ UA_VALIDATE_INPUT_PARAMETER(handle);
+
+ ua_dev_info_s *device = (ua_dev_info_s *)handle;
+
+ UA_VALIDATE_INPUT_PARAMETER(user_handle);
+ UA_PRINT_DEVICE_HANDLE(handle);
+
+ if (device->user == NULL) {
+ int ret = _ua_intr_get_default_user(user_handle);
+ if (ret != UA_ERROR_NONE) {
+ UA_ERR("Failed to get default user with error");
+ return ret;
+ }
+ } else {
+ *user_handle = device->user;
+ }
+
+ FUNC_EXIT;
+ return UA_ERROR_NONE;
+}
+
+int ua_device_get_parent_service(ua_device_h handle, ua_service_h *service_handle)
+{
+ FUNC_ENTRY;
+
+ UA_CHECK_INIT_STATUS();
+ UA_VALIDATE_INPUT_PARAMETER(handle);
+
+ ua_dev_info_s *device = (ua_dev_info_s *)handle;
+ ua_user_info_s *user = NULL;
+ ua_service_info_s *service = NULL;
+
+ UA_VALIDATE_INPUT_PARAMETER(service_handle);
+ UA_PRINT_DEVICE_HANDLE(handle);
+
+ if (device->user == NULL) {
+ int ret = _ua_intr_get_default_user((ua_user_h *)user);
+ if (ret != UA_ERROR_NONE) {
+ UA_ERR("Failed to get default user with error");
+ return ret;
+ }
+ } else {
+ user = device->user;
+ }
+
+ if (user->service_handle == NULL) {
+ int ret = ua_service_get_default_service((ua_service_h *)service);
+ if (ret != UA_ERROR_NONE) {
+ UA_ERR("Failed to get default service with error");
+ return ret;
+ }
+ } else {
+ service = user->service_handle;
+ }
+
+ *service_handle = service;
+
+ FUNC_EXIT;
+ return UA_ERROR_NONE;
+}
+
int ua_device_set_mac_type(ua_device_h handle, ua_mac_type_e mac_type)
{
FUNC_ENTRY;
if (monitor->sensor_status_cb.callback)
((ua_sensor_status_changed_cb)monitor->sensor_status_cb.callback)(
(ua_monitor_h)monitor, (ua_sensor_h)sensor_info,
+ sensor_info->bitmask, sensor_info->status,
monitor->sensor_status_cb.user_data);
}
_ua_free_sensor_info(sensor_info);
return UA_ERROR_NONE;
}
-int ua_monitor_cancel_scan_devices(ua_monitor_h handle)
+int ua_monitor_stop_scan_devices(ua_monitor_h handle)
{
FUNC_ENTRY;
int ret;
FUNC_ENTRY;
int ret;
- ua_service_info_s* service_info = (ua_service_info_s*)service_handle;
+ ua_service_info_s* service_info = (ua_service_info_s *)service_handle;
ua_user_info_s* user_info = (ua_user_info_s*)user_handle;
UA_CHECK_INIT_STATUS();
return ret;
}
+ user_info->service_handle = service_handle;
+
FUNC_EXIT;
return UA_ERROR_NONE;
}
return RET_SUCCESS;
}
-static int run_ua_monitor_cancel_scan_devices(
+static int run_ua_monitor_stop_scan_devices(
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
- msg("ua_monitor_cancel_scan_devices,");
+ msg("ua_monitor_stop_scan_devices,");
check_if(NULL == g_ua_mon_h);
- ret = ua_monitor_cancel_scan_devices(g_ua_mon_h);
+ ret = ua_monitor_stop_scan_devices(g_ua_mon_h);
- msg("ua_monitor_cancel_scan_devices,() ret: [0x%X] [%s]",
+ msg("ua_monitor_stop_scan_devices,() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
return RET_SUCCESS;
{ "8", "ua_monitor_start_device_scan",
menu_start_device_scan, NULL, NULL },
- { "9", "ua_monitor_cancel_scan_devices",
- NULL, run_ua_monitor_cancel_scan_devices, NULL },
+ { "9", "ua_monitor_stop_scan_devices",
+ NULL, run_ua_monitor_stop_scan_devices, NULL },
{ "10", "ua_enable_low_power_mode",
NULL, run_ua_enable_low_power_mode, NULL },
}
static void __sensor_status_changed_cb(ua_monitor_h handle,
- ua_sensor_h sensor_handle, void *user_data)
+ ua_sensor_h sensor_handle, ua_sensor_e sensor_type,
+ ua_sensor_status_e status, void *user_data)
{
int ret;
- ua_sensor_e sensor;
- ua_sensor_status_e status;
unsigned long long timestamp;
char *pbuf = uat_get_time();
msgc("\n[%s]", pbuf);
free(pbuf);
- ret = ua_sensor_get_status(sensor_handle, &status);
- if (UA_ERROR_NONE != ret) {
- msg(" - ua_sensor_get_status() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
- }
- ret = ua_sensor_get_bitmask(sensor_handle, &sensor);
- if (UA_ERROR_NONE != ret) {
- msg(" - ua_sensor_get_bitmask() ret: [0x%X] [%s]",
- ret, uat_get_error_str(ret));
- }
-
msgc("[%s] Sensor Status Changed -> %s",
- uat_get_sensor_bitmask_str(sensor),
+ uat_get_sensor_bitmask_str(sensor_type),
status == UA_SENSOR_PRESENCE ? "PRESENCE" : "ABSENCE");
ret = ua_sensor_get_timestamp(sensor_handle, ×tamp);
}
msgc("[%s] timestamp [%llu]",
- uat_get_sensor_bitmask_str(sensor), timestamp);
+ uat_get_sensor_bitmask_str(sensor_type), timestamp);
}
int _uat_monitor_create()