summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsaerome.kim <saerome.kim@samsung.com>2019-10-21 20:55:53 +0900
committersaerome.kim <saerome.kim@samsung.com>2019-11-01 12:49:13 +0900
commitd9a8ff5283b54bdc59d2c75b578e7549bebe1934 (patch)
tree5dcf684ea0d30aebe51c35894595287148c021d7 /include
parent1a1d16753a8e4c8cfbb2336c99375ca500c3a71d (diff)
downloaduser-awareness-d9a8ff5283b54bdc59d2c75b578e7549bebe1934.tar.gz
user-awareness-d9a8ff5283b54bdc59d2c75b578e7549bebe1934.tar.bz2
user-awareness-d9a8ff5283b54bdc59d2c75b578e7549bebe1934.zip
Add functionality to report instant sensor status change
- Problem: in ABSENCE case, even the motion sensor detects ABSENCE ua-manager reports this ABSENCE state after the detection window complete. - Cause: If ABSENCE case, the ABSENCE can be jurged only when the detction window complete. - Solution: Whenever the sensor status is changed, plugin reports status changed event immediately so that the user can recognize ABSENCE event takes place during uncompleted ABSENCE detection window. Change-Id: I49254770cbab1c55aac7b9b893c5eec8d54139cf Signed-off-by: saerome.kim <saerome.kim@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/user-awareness-private.h14
-rw-r--r--include/user-awareness.h83
2 files changed, 97 insertions, 0 deletions
diff --git a/include/user-awareness-private.h b/include/user-awareness-private.h
index d1ccf18..7e6478e 100644
--- a/include/user-awareness-private.h
+++ b/include/user-awareness-private.h
@@ -189,6 +189,7 @@ typedef struct {
ua_scan_completed_cb scan_device_cb; /**< Callback to let apps know scanned registered devices */
ua_presence_detected_cb presence_cb; /**< User presence detection callback */
ua_absence_detected_cb absence_cb; /**< Absence detection callback */
+ ua_callback_s sensor_status_cb; /**< Senser status changed callback */
char *service; /**< Service name */
GSList *user_state; /**< User current state i.e presence or absence */
void *user_data; /**< User data */
@@ -200,6 +201,7 @@ typedef struct {
* @since_tizen 5.5
*/
typedef struct {
+ unsigned int status; /**< Sensor status 1:PRESENCE 2:ABSENCE */
ua_sensor_h handle;
ua_sensor_e bitmask;
long int timestamp;
@@ -386,6 +388,18 @@ void _ua_monitor_handle_user_absence_detected(
uam_sensor_info_s *sensor_info, char *service, char *account);
/**
+ * @brief Calls the sensor status changed callback when notified of sensor status changed.
+ * @since_tizen 5.5
+ *
+ * @param[in] info Sensor information
+ *
+ * @exception
+ * @pre
+ * @post
+ */
+void _ua_monitor_handle_sensor_status_changed(uam_sensor_info_s *info);
+
+/**
* @brief Destroys a monitor handle.
* @since_tizen 5.5
*
diff --git a/include/user-awareness.h b/include/user-awareness.h
index 8ee579a..839f7d8 100644
--- a/include/user-awareness.h
+++ b/include/user-awareness.h
@@ -247,6 +247,16 @@ typedef enum {
/**
* @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Enumerations for sensor status
+ * @since_tizen 5.5
+ */
+typedef enum {
+ UA_SENSOR_PRESENCE = 0x01, /**< Sensor reports PRESENCE status */
+ UA_SENSOR_ABSENCE = 0x02 /**< Sensor reports ABSENCE status */
+} ua_sensor_status_e;
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
* @brief The handle of sensor information.
* @since_tizen 5.5
*/
@@ -600,6 +610,35 @@ typedef bool (*ua_service_added_device_cb)(
/**
* @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Callback to be invoked if a sensor status changed (presence <-> absence)
+ * immediately during detection operation.
+ * @since_tizen 5.5
+ *
+ * @remarks The @a handle should not be released.
+ * @remarks The @a handle can be used only in the callback.
+ * @remarks The @a sensor_handles should not be released.
+ * @remarks The @a sensor_handles can be used only in the callback.
+ *
+ * @param[in] status #UA_SENSOR_PRESENCE is sensor detects presence. \n
+ * #UA_SENSOR_ABSENCE is sensor detects presence.
+ * @param[in] sensor Sensor type for which status was changed.
+ * @param[in] handle The monitor handle for which sensor type was added.
+ * @param[in] sensor_handles The list of sensor handles on which user is not detected.
+ * @param[in] user_data The user data passed in ua_monitor_set_sensor_status_cb().
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_monitor_set_sensor_state_cb()
+ */
+typedef void (*ua_sensor_status_changed_cb)(
+ ua_sensor_status_e status,
+ ua_monitor_h handle,
+ ua_sensor_h sensor_handle,
+ void *user_data);
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
* @brief Initializes an user awareness framework.
* @since_tizen 5.5
*
@@ -866,6 +905,50 @@ int ua_monitor_unset_sensor_state_cb(
/**
* @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Sets sensor status changed callback.
+ * @since_tizen 5.5
+ *
+ * @param[in] handle The monitor handle
+ * @param[in] callback Sensor status changed callback
+ * @param[in] user_data The user data to be passed in sensor state changed callback.
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ * @see ua_monitor_unset_sensor_state_cb()
+ */
+int ua_monitor_set_sensor_status_cb(
+ ua_monitor_h handle,
+ ua_sensor_status_changed_cb callback,
+ void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Unsets sensor status changed callback.
+ * @since_tizen 5.5
+ *
+ * @param[in] handle The monitor 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
+ *
+ * @see ua_monitor_set_sensor_state_cb()
+ */
+int ua_monitor_unset_sensor_status_cb(
+ ua_monitor_h handle);
+
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
* @brief Sets absence detected callback for all users.
* @since_tizen 5.5
*