To support feedback stop according to the feedback type.
With this, it is possible to stop sound feedback play.
"http://tizen.org/privilege/haptic" haptic privilege is required to stop the vibrator.
Change-Id: I4798f805be9f2a6bebc0d6f7da68011a98c3e4f1
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
int feedback_set_theme_index_internal(feedback_type_e feedback_type, unsigned int index_of_theme);
/**
+ * @brief Stops various types of reactions by feedback type.
+ * @details This function can be used to stop reaction to pre-defined actions.
+ * It stops system pre-defined vibration and sound patterns.
+ * @since_tizen 7.0
+ * @remarks To stop vibrator feedback, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * @param[in] feedback_type The feedback type
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #FEEDBACK_ERROR_NONE Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation not permitted
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @retval #FEEDBACK_ERROR_PERMISSION_DENIED Permission denied
+ */
+int feedback_stop_type_internal(feedback_type_e feedback_type);
+
+/**
* @}
*/
return ret;
}
//LCOV_EXCL_STOP
+
+int devices_stop_by_type(feedback_type_e feedback_type)
+{
+ GList *elem;
+ const struct device_ops *dev;
+
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
+ if (dev->type == feedback_type)
+ return dev->stop();
+ }
+
+ return -ENOTSUP;
+}
int devices_play(int pattern, bool always);
int devices_play_soundpath(int pattern, const char *soundpath, bool always);
int devices_stop(void);
+int devices_stop_by_type(feedback_type_e feedback_type);
#define DEVICE_OPS_REGISTER(dev) \
static void __CONSTRUCTOR__ module_init(void) \
return FEEDBACK_ERROR_NONE;
}
//LCOV_EXCL_STOP
+
+API int feedback_stop_type_internal(feedback_type_e feedback_type)
+{
+ int err;
+
+ pthread_mutex_lock(&fmutex);
+ if (!init_cnt) {
+ _E("Not initialized");
+ pthread_mutex_unlock(&fmutex);
+ return FEEDBACK_ERROR_NOT_INITIALIZED;
+ }
+ pthread_mutex_unlock(&fmutex);
+
+ err = devices_stop_by_type(feedback_type);
+ if (err == -ENOTSUP)
+ return FEEDBACK_ERROR_NOT_SUPPORTED;
+ if (err == -ECOMM || err == -EACCES)
+ return FEEDBACK_ERROR_PERMISSION_DENIED;
+ if (err < 0)
+ return FEEDBACK_ERROR_OPERATION_FAILED;
+
+ return FEEDBACK_ERROR_NONE;
+}