Tizen Native API
3.0
|
The FEEDBACK API provides functions to play sound or vibration associated with properties.
Required Header
#include <feedback.h>
Overview
The FEEDBACK API is responsible for playing simple sound and vibration. It plays sound using mm-sound library and vibration with system framework.
Functions | |
int | feedback_initialize (void) |
Initializes feedback API. | |
int | feedback_deinitialize (void) |
Deinitializes feedback API. | |
int | feedback_play (feedback_pattern_e pattern) |
Plays various types of reactions that are pre-defined. | |
int | feedback_play_type (feedback_type_e type, feedback_pattern_e pattern) |
Plays specific type of reactions that are pre-defined. | |
int | feedback_stop (void) |
Stops various types of reactions. | |
int | feedback_is_supported_pattern (feedback_type_e type, feedback_pattern_e pattern, bool *status) |
Checks if the pattern is supported. |
Enumeration Type Documentation
enum feedback_error_e |
Enumeration for the Feedback API error codes.
- Since :
- 3.0
enum feedback_pattern_e |
Enumeration for feedback interface of the system pre-defined patterns.
Each feedback pattern can have separate media files of each types. But depending on vendor design, pattern may not have any type of file.
- Since :
- 3.0
- Enumerator:
enum feedback_type_e |
Function Documentation
int feedback_deinitialize | ( | void | ) |
Deinitializes feedback API.
This function must be called when feedback functions are no longer needed.
- Since :
- 3.0
- Remarks:
- If you don't want to use feedback anymore, you need to deinitialize with this function. And for controlling haptic device, the privilege should be set to, http://tizen.org/privilege/haptic. If you don't have the haptic privilege, this function deinitializes only sound. It does not return any error in this case.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
FEEDBACK_ERROR_NONE Successful FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
- Precondition:
- feedback_initialize()
- See also:
- feedback_initialize()
int feedback_initialize | ( | void | ) |
Initializes feedback API.
- Since :
- 3.0
- Remarks:
- If this function is not called in advance, other function will return FEEDBACK_ERROR_NOT_INITIALIZED. And for controlling haptic device, the privilege should be set to, http://tizen.org/privilege/haptic. If you don't have the haptic privilege, this function initializes only sound. It does not return any error in this case.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
FEEDBACK_ERROR_NONE Successful
- Postcondition:
- feedback_deinitialize()
- See also:
- feedback_deinitialize()
int feedback_is_supported_pattern | ( | feedback_type_e | type, |
feedback_pattern_e | pattern, | ||
bool * | status | ||
) |
Checks if the pattern is supported.
This function can be used to check if a specific pattern is supported.
- Since :
- 3.0
- Parameters:
-
[in] type The pattern type [in] pattern The pre-defined pattern [out] status True means the pattern is supported, otherwise not supported
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
FEEDBACK_ERROR_NONE Successful FEEDBACK_ERROR_OPERATION_FAILED Operation not permitted FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter FEEDBACK_ERROR_NOT_SUPPORTED Not supported device FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
- Precondition:
- feedback_initialize()
int feedback_play | ( | feedback_pattern_e | pattern | ) |
Plays various types of reactions that are pre-defined.
This function can be used to react to pre-defined actions.
It play various types of system pre-defined media or vibration patterns.
- Since :
- 3.0
- Remarks:
- Currently, there are two types of reactions: sound and vibration.
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 the 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.
- Parameters:
-
[in] pattern The pre-defined pattern
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
FEEDBACK_ERROR_NONE Successful FEEDBACK_ERROR_OPERATION_FAILED Operation not permitted FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter FEEDBACK_ERROR_NOT_SUPPORTED Not supported device FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
- Precondition:
- feedback_initialize()
int feedback_play_type | ( | feedback_type_e | type, |
feedback_pattern_e | pattern | ||
) |
Plays specific type of reactions that are pre-defined.
This function can be used to react to pre-defined actions.
It play specific type of system pre-defined pattern.
- Since :
- 3.0
- Remarks:
- Currently, there are two types of reactions: sound and vibration.
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.
- Parameters:
-
[in] type The pattern type [in] pattern The pre-defined pattern
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
FEEDBACK_ERROR_NONE Successful FEEDBACK_ERROR_OPERATION_FAILED Operation not permitted FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter FEEDBACK_ERROR_NOT_SUPPORTED Not supported device FEEDBACK_ERROR_PERMISSION_DENIED Permission denied FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
- Precondition:
- feedback_initialize()
int feedback_stop | ( | void | ) |
Stops various types of reactions.
This function can be used to stop reaction to pre-defined actions.
It stops system pre-defined vibration patterns.
- Since :
- 3.0
- Remarks:
- This function does not support to stop media sound actions.
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.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
FEEDBACK_ERROR_NONE Successful FEEDBACK_ERROR_OPERATION_FAILED Operation not permitted FEEDBACK_ERROR_NOT_SUPPORTED Not supported device FEEDBACK_ERROR_PERMISSION_DENIED Permission denied FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
- Precondition:
- feedback_initialize()