summaryrefslogtreecommitdiff
path: root/include/feedback.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/feedback.h')
-rw-r--r--include/feedback.h151
1 files changed, 67 insertions, 84 deletions
diff --git a/include/feedback.h b/include/feedback.h
index 532e24e..a63713e 100644
--- a/include/feedback.h
+++ b/include/feedback.h
@@ -19,8 +19,11 @@
#ifndef __FEEDBACK_H__
#define __FEEDBACK_H__
+#include <tizen.h>
#include <tizen_error.h>
#include "feedback-ids.h"
+/* TODO Will be removed */
+#include "feedback-internal.h"
#ifdef __cplusplus
extern "C" {
@@ -38,7 +41,7 @@ extern "C" {
/**
* @brief Enumerations of error codes for the Feedback API.
- * @since_tizen 2.3
+ * @since_tizen 2.4
*/
typedef enum
{
@@ -46,24 +49,22 @@ typedef enum
FEEDBACK_ERROR_OPERATION_FAILED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */
FEEDBACK_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
FEEDBACK_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported in this device */
- FEEDBACK_ERROR_NOT_INITIALIZED = TIZEN_ERROR_SYSTEM_CLASS | 0x52, /**< Has not yet been Initialized */
+ FEEDBACK_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ FEEDBACK_ERROR_NOT_INITIALIZED = TIZEN_ERROR_FEEDBACK | 0x01, /**< Not initialized */
} feedback_error_e;
-#define FEEDBACK_SUCCEEDED(n) ((n) == FEEDBACK_ERROR_NONE)
-#define FEEDBACK_FAILED(n) ((n) != FEEDBACK_ERROR_NONE)
-
/**
* @brief Initializes feedback API.
*
- * @since_tizen 2.3
+ * @since_tizen 2.4
*
* @remarks
* If this function is not called in advance, other function will return #FEEDBACK_ERROR_NOT_INITIALIZED.
*
* @return 0 on success, otherwise a negative error value.
* @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ *
+ * @post feedback_deinitialize()
*
* @see feedback_deinitialize()
*/
@@ -73,12 +74,13 @@ int feedback_initialize(void);
* @brief Deinitializes feedback API.
* @details This function must be called when feedback functions are no longer needed.
*
- * @since_tizen 2.3
+ * @since_tizen 2.4
*
* @return 0 on success, otherwise a negative error value.
* @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @pre feedback_initialize()
*
* @see feedback_initialize()
*/
@@ -90,19 +92,27 @@ int feedback_deinitialize(void);
* This functon can be used to react to pre-defined actions. \n
* It play various types of system pre-defined media or vibration patterns.
*
- * @since_tizen 2.3
+ * @since_tizen 2.4
*
* @remarks
* Currently, there are two types of reactions: sound and vibration. \n
* Depending on the settings, some types cannot operate.
* For example, when set to silent mode, the device doesn't produce any sound.
+ * If to play one of devices is successful, this function regards as success.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, it only works sound operation.
+ * It does not return any error in this case.
*
* @param[in] pattern The pre-defined pattern
*
* @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @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_NOT_INITIALIZED Not initialized
+ *
+ * @pre feedback_initialize()
*/
int feedback_play(feedback_pattern_e pattern);
@@ -113,104 +123,77 @@ int feedback_play(feedback_pattern_e pattern);
* This function can be used to react to pre-defined actions. \n
* It play specific type of system pre-defined pattern.
*
- * @since_tizen 2.3
+ * @since_tizen 2.4
*
* @remarks
- * Currently, there are two types of reactions: sound and vibration.
+ * Currently, there are two types of reactions: sound and vibration. \n
+ * Depending on the settings, some types cannot operate.
+ * For example, when set to silent mode, the device doesn't produce any sound.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, it returns FEEDBACK_ERROR_PERMISSION_DENIED error.
*
* @param[in] type The pattern type
* @param[in] pattern The pre-defined pattern
*
* @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @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
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
+ *
+ * @pre feedback_initialize()
*/
int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern);
/**
- *
- * @brief Plays specific type of reactions that are pre-defined.
+ * @brief Stop various types of reactions
* @details
- * This function can be used to react to pre-defined actions. \n
- * It play specific type of system pre-defined pattern.
+ * This functon can be used to stop react to pre-defined actions. \n
+ * It stops system pre-defined vibration patterns.
*
- * @since_tizen 2.3
+ * @since_tizen 2.4
*
* @remarks
- * Currently, there are two types of reactions: sound and vibration.
- *
- * @param[in] type string The pattern type
- * @param[in] pattern string The pre-defined pattern
+ * This function does not support to stop media sound actions. \n
+ * In this case, it will return FEEDBACK_ERROR_NOT_SUPPORTED error.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, it only works sound operation.
+ * It does not return any error in this case.
*
* @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
- */
-int feedback_play_type_by_name(char *type, char *pattern);
-
-/**
- * @brief Stop various types of reactions
- * @details
- * This functon can be used to stop react to pre-defined actions. \n
- * It stops various types of system pre-defined media or vibration patterns.
- *
- * @since_tizen 2.3
+ * @retval #FEEDBACK_ERROR_NONE Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation not permitted
+ * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @retval #FEEDBACK_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @pre feedback_initialize()
*/
int feedback_stop(void);
/**
- * @brief Gets the file path of resource for the given feedback type and pattern.
+ * @brief Checks if the pattern is supported
* @details
- * Depending on the type of each pattern resouorce has a different format. \n
- * Currently, System supports two pattern types. \n
- * #FEEDBACK_TYPE_SOUND type uses .wav format. \n
- * #FEEDBACK_TYPE_VIBRATION type uses .ivt format. \n
- * If the given pattern doesn't have a file for the type, @a path will return NULL.
- *
- * @since_tizen 2.3
+ * This functon can be used to check if a specific pattern is supported.
*
- * @remarks @a path must be released with free() by you.
+ * @since_tizen 2.4
*
- * @param[in] type The pattern type
- * @param[in] pattern The pre-defined pattern
- * @param[out] path The file path of resource for feedback type and pattern
+ * @param[in] type The pattern type
+ * @param[in] pattern The pre-defined pattern
+ * @param[out] status True means the pattern is supported, otherwise not supported.
*
* @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
- */
-int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e pattern, char **path);
-
-/**
- * @brief Sets the new file path of resource for the given feedback type and pattern.
- * @details
- * Depending on the type of each pattern resouorce has a different format. \n
- * Currently, System supports two pattern types. \n
- * #FEEDBACK_TYPE_SOUND type uses .wav format. \n
- * #FEEDBACK_TYPE_VIBRATION type uses .ivt format. \n
- * If the given pattern doesn't have a file for the type, @a path will return NULL.
- *
- * @since_tizen 2.3
- *
- * @param[in] type The pattern type
- * @param[in] pattern The pre-defined pattern
- * @param[in] path The new file path of resource for feedback type and pattern
+ * @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_NOT_INITIALIZED Not initialized
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE Successful
- * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device
+ * @pre feedback_initialize()
*/
-int feedback_set_resource_path(feedback_type_e type, feedback_pattern_e pattern, char *path);
+int feedback_is_supported_pattern(feedback_type_e type, feedback_pattern_e pattern, bool *status);
/**
* @}