Tizen Native API  5.5
Feedback

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.

Related Features

This API is related with the following features:

It is recommended to design feature related codes in your application for reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature List.

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

Enumeration for the Feedback API error codes.

Since :
2.4
Enumerator:
FEEDBACK_ERROR_NONE 

Successful

FEEDBACK_ERROR_OPERATION_FAILED 

Operation failed

FEEDBACK_ERROR_INVALID_PARAMETER 

Invalid parameter

FEEDBACK_ERROR_NOT_SUPPORTED 

Not supported in this device

FEEDBACK_ERROR_PERMISSION_DENIED 

Permission denied

FEEDBACK_ERROR_NOT_INITIALIZED 

Not initialized

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 :
2.4
Enumerator:
FEEDBACK_PATTERN_TAP 

Feedback pattern when general touch

FEEDBACK_PATTERN_SIP 

Feedback pattern when touch text key

FEEDBACK_PATTERN_KEY0 

Feedback pattern when touch numeric 0 key

FEEDBACK_PATTERN_KEY1 

Feedback pattern when touch numeric 1 key

FEEDBACK_PATTERN_KEY2 

Feedback pattern when touch numeric 2 key

FEEDBACK_PATTERN_KEY3 

Feedback pattern when touch numeric 3 key

FEEDBACK_PATTERN_KEY4 

Feedback pattern when touch numeric 4 key

FEEDBACK_PATTERN_KEY5 

Feedback pattern when touch numeric 5 key

FEEDBACK_PATTERN_KEY6 

Feedback pattern when touch numeric 6 key

FEEDBACK_PATTERN_KEY7 

Feedback pattern when touch numeric 7 key

FEEDBACK_PATTERN_KEY8 

Feedback pattern when touch numeric 8 key

FEEDBACK_PATTERN_KEY9 

Feedback pattern when touch numeric 9 key

FEEDBACK_PATTERN_KEY_STAR 

Feedback pattern when touch star key

FEEDBACK_PATTERN_KEY_SHARP 

Feedback pattern when touch sharp key

FEEDBACK_PATTERN_KEY_BACK 

Feedback pattern when touch backspace key

FEEDBACK_PATTERN_HOLD 

Feedback pattern when touch hold

FEEDBACK_PATTERN_HW_TAP 

Feedback pattern when press hardware key

FEEDBACK_PATTERN_HW_HOLD 

Feedback pattern when holding press hardware key

FEEDBACK_PATTERN_MESSAGE 

Feedback pattern when incoming a message

FEEDBACK_PATTERN_EMAIL 

Feedback pattern when incoming an email

FEEDBACK_PATTERN_WAKEUP 

Feedback pattern when alert wake up call

FEEDBACK_PATTERN_SCHEDULE 

Feedback pattern when alert schedule alarm

FEEDBACK_PATTERN_TIMER 

Feedback pattern when alert timer

FEEDBACK_PATTERN_GENERAL 

Feedback pattern when alert general event

FEEDBACK_PATTERN_POWERON 

Feedback pattern when power on

FEEDBACK_PATTERN_POWEROFF 

Feedback pattern when power off

FEEDBACK_PATTERN_CHARGERCONN 

Feedback pattern when connecting charger

FEEDBACK_PATTERN_CHARGING_ERROR 

Feedback pattern when occuring charging error

FEEDBACK_PATTERN_FULLCHARGED 

Feedback pattern when full charged

FEEDBACK_PATTERN_LOWBATT 

Feedback pattern when low battery

FEEDBACK_PATTERN_LOCK 

Feedback pattern when lock

FEEDBACK_PATTERN_UNLOCK 

Feedback pattern when unlock

FEEDBACK_PATTERN_VIBRATION_ON 

Feedback pattern when turn on vibration mode

FEEDBACK_PATTERN_SILENT_OFF 

Feedback pattern when turn off silent mode

FEEDBACK_PATTERN_BT_CONNECTED 

Feedback pattern when connecting with bluetooth

FEEDBACK_PATTERN_BT_DISCONNECTED 

Feedback pattern when disconnecting with bluetooth

FEEDBACK_PATTERN_LIST_REORDER 

Feedback pattern when list reorder

FEEDBACK_PATTERN_LIST_SLIDER 

Feedback pattern when list slider sweep

FEEDBACK_PATTERN_VOLUME_KEY 

Feedback pattern when pressed volume key

FEEDBACK_PATTERN_SYSTEM_SHORT 

Feedback pattern for short feedback (Since 4.0)

FEEDBACK_PATTERN_SYSTEM_ERROR 

Feedback pattern for error (Since 4.0)

FEEDBACK_PATTERN_SYSTEM_LONG 

Feedback pattern for long feedback (Since 4.0)

FEEDBACK_PATTERN_SYSTEM_MID 

Feedback pattern for normal feedback (Since 4.0)

FEEDBACK_PATTERN_END_EFFECT 

Feedback pattern for end of effect (Since 4.0)

FEEDBACK_PATTERN_GENERAL_STRONG_BUZZ 

Feedback pattern for strong buzz (Since 4.0)

Enumeration for feedback interface type.

Since :
2.4
Enumerator:
FEEDBACK_TYPE_NONE 

Feedback type none

FEEDBACK_TYPE_SOUND 

Feedback type for sound

FEEDBACK_TYPE_VIBRATION 

Feedback type for vibration


Function Documentation

int feedback_deinitialize ( void  )

Deinitializes feedback API.

This function must be called when feedback functions are no longer needed.

Since :
2.4
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_NONESuccessful
FEEDBACK_ERROR_NOT_INITIALIZEDNot initialized
FEEDBACK_ERROR_NOT_SUPPORTEDNot supported device
Precondition:
feedback_initialize()
See also:
feedback_initialize()
int feedback_initialize ( void  )

Initializes feedback API.

Since :
2.4
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_NONESuccessful
FEEDBACK_ERROR_NOT_SUPPORTEDNot supported device
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 :
2.4
Parameters:
[in]typeThe pattern type
[in]patternThe pre-defined pattern
[out]statusTrue means the pattern is supported, otherwise not supported
Returns:
0 on success, otherwise a negative error value
Return values:
FEEDBACK_ERROR_NONESuccessful
FEEDBACK_ERROR_OPERATION_FAILEDOperation not permitted
FEEDBACK_ERROR_INVALID_PARAMETERInvalid parameter
FEEDBACK_ERROR_NOT_SUPPORTEDNot supported device
FEEDBACK_ERROR_NOT_INITIALIZEDNot initialized
Precondition:
feedback_initialize()

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 :
2.4
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]patternThe pre-defined pattern
Returns:
0 on success, otherwise a negative error value
Return values:
FEEDBACK_ERROR_NONESuccessful
FEEDBACK_ERROR_OPERATION_FAILEDOperation not permitted
FEEDBACK_ERROR_INVALID_PARAMETERInvalid parameter
FEEDBACK_ERROR_NOT_SUPPORTEDNot supported device
FEEDBACK_ERROR_NOT_INITIALIZEDNot initialized
Precondition:
feedback_initialize()

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 :
2.4
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]typeThe pattern type
[in]patternThe pre-defined pattern
Returns:
0 on success, otherwise a negative error value
Return values:
FEEDBACK_ERROR_NONESuccessful
FEEDBACK_ERROR_OPERATION_FAILEDOperation not permitted
FEEDBACK_ERROR_INVALID_PARAMETERInvalid parameter
FEEDBACK_ERROR_NOT_SUPPORTEDNot supported device
FEEDBACK_ERROR_PERMISSION_DENIEDPermission denied
FEEDBACK_ERROR_NOT_INITIALIZEDNot 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 :
2.4
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_NONESuccessful
FEEDBACK_ERROR_OPERATION_FAILEDOperation not permitted
FEEDBACK_ERROR_NOT_SUPPORTEDNot supported device
FEEDBACK_ERROR_PERMISSION_DENIEDPermission denied
FEEDBACK_ERROR_NOT_INITIALIZEDNot initialized
Precondition:
feedback_initialize()