summaryrefslogtreecommitdiff
path: root/include/feedback.h
blob: 2012c0c62addca30d1a66ea654cdbb32efb8ea66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */




#ifndef __TIZEN_UIX_FEEDBACK_H__
#define __TIZEN_UIX_FEEDBACK_H__

#include <tizen_error.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file feedback.h
 * @brief This file contains the feedback and that's resource API
 */

/**
 * @addtogroup CAPI_UIX_FEEDBACK_MODULE
 * @{
 * @breif
 * This is a feedback API of the UIX Service.
 * @}
 */

/**
 * @addtogroup CAPI_UIX_FEEDBACK_MODULE
 * @{
 */

/**
 * @brief Enumerations of the system pre-defined patterns for feedback interface
 * @details 
 * Each feedback pattern can have separate media files of each types.
 * But Depending on vendor design, pattern may not have any type of file.
 *
 */
typedef enum
{
    FEEDBACK_PATTERN_TOUCH_TAP,        /**< feedback pattern when touch */
    FEEDBACK_PATTERN_TOUCH_MULTI_TAP,  /**< feedback pattern when multi touch */
    FEEDBACK_PATTERN_TOUCH_KEY,        /**< feedback pattern when touch key */
    FEEDBACK_PATTERN_TOUCH_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_e;

/**
 * @brief Enumerations of the type for feedback interface
 * @details
 *
 */
typedef enum
{
    FEEDBACK_TYPE_SOUND,        /**< sound feedback pattern (.wav file) */
    FEEDBACK_TYPE_VIBRATION,    /**< vibration feedback pattern (.ivt file) */
} feedback_type_e;

/**
 * @brief Enumerations of error codes for the Feedback API.
 */
typedef enum
{
    FEEDBACK_ERROR_NONE                = TIZEN_ERROR_NONE,                  /**< Successful */
    FEEDBACK_ERROR_INVALID_PARAMETER   = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid parameter */
    FEEDBACK_ERROR_NOT_INITIALIZED     = TIZEN_ERROR_SYSTEM_CLASS | 0x52, /**< Has not yet been Initialized */
    FEEDBACK_ERROR_OPERATION_FAILED    = TIZEN_ERROR_SYSTEM_CLASS | 0x55, /**< Operation failed */
} feedback_error_e;                                                     

/**
 * @brief Initializes feedback API.
 *
 * @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 
 * 
 * @see feedback_deinitialize()
 */
int feedback_initialize(void);

/**
 * @brief Deinitializes feedback API.
 *
 * @details This function must be called when feedback functions are no longer needed.
 *
 * @return 0 on success, otherwise a negative error value.  
 * @retval #FEEDBACK_ERROR_NONE                 Successful
 * @retval #FEEDBACK_ERROR_OPERATION_FAILED     Operation failed
 *
 * @see feedback_initialize()
 */
int feedback_deinitialize(void);

/**
 * @brief Plays various types of reactions that are pre-defined.
 *
 * @details
 * This functon can be used to react to pre-defined actions. \n
 * It play various types of system pre-defined media or vibration patterns.
 *
 * @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.
 *
 * @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
 */
int feedback_play(feedback_pattern_e pattern);

/**
 * @brief Gets the 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.
 *
 * @remarks @a path must be released with free() by you.
 *
 * @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
 * 
 * @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
 * 
 */
int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e pattern, char **path);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif // __TIZEN_UIX_FEEDBACK_H__