summaryrefslogtreecommitdiff
path: root/include/feedback-internal.h
blob: 690c03069c69859fc51003da6bf8dc4a8053cc51 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/*
 * libfeedback
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 *
 * 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 __FEEDBACK_INTERNAL_H__
#define __FEEDBACK_INTERNAL_H__

#include <tizen_error.h>
#include <feedback-ids.h>
#include "feedback-ids-internal.h"
#include "feedback-ids-product.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file feedback-internal.h
 * @brief This file contains the feedback internal API
 */

#define FEEDBACK_SUCCEEDED(n)                ((n) == FEEDBACK_ERROR_NONE)
#define FEEDBACK_FAILED(n)                   ((n) != FEEDBACK_ERROR_NONE)

/**
 *
 * @brief Plays specific type of reactions that are pre-defined.
 * @details
 * 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
 *
 * @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
 *
 * @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 Plays various types of reactions that are pre-defined.
 * @details This function can be used to react to pre-defined actions. \n
 *          It play various types of system pre-defined media or vibration patterns.
 * @since_tizen 4.0
 * @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 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.
 * @param[in] pattern The pre-defined internal pattern
 * @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_NOT_INITIALIZED Not initialized
 * @pre feedback_initialize()
 */
int feedback_play_internal(feedback_pattern_internal_e pattern);

/**
 * @brief Plays various types of reactions that are pre-defined.
 * @details This function can be used to react to pre-defined actions. \n
 *          It play various types of system pre-defined media or vibration patterns.
 * @since_tizen 5.5
 * @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 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.
 * @param[in] pattern The pre-defined internal pattern
 * @param[in] soundpath The resource file path for sound (can't be NULL)
 * @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_NOT_INITIALIZED Not initialized
 * @pre feedback_initialize()
 */
int feedback_play_soundpath_internal(feedback_pattern_internal_e internal_pattern, const char *soundpath);

/**
 * @brief Plays specific type of reactions that are pre-defined.
 * @details This function can be used to react to pre-defined actions. \n
 *          It play specific type of system pre-defined pattern.
 * @since_tizen 4.0
 * @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.
 *          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 internal pattern
 * @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
 * @retval #FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
 * @pre feedback_initialize()
 */
int feedback_play_type_internal(feedback_type_e type, feedback_pattern_internal_e pattern);


/**
 * @brief Plays specific type of reactions that are pre-defined.
 * @details This function can be used to react to pre-defined actions. \n
 *          It play specific type of system pre-defined pattern.
 * @since_tizen 4.0
 * @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.
 *          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 internal pattern
 * @param[in] soundpath The resource file path for sound
 * @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
 * @retval #FEEDBACK_ERROR_NOT_INITIALIZED Not initialized
 * @pre feedback_initialize()
 */
int feedback_play_type_soundpath_internal(feedback_type_e type, feedback_pattern_internal_e internal_pattern, const char *soundpath);

/**
 * @brief Gets the number of theme supported.
 * @details This function gets the number of theme described in the config file.
 *          The range of counted theme will be 1~N according to conf file.
 * @since_tizen 7.0
 * @param[in] type The feedback type
 * @param[out] count_of_theme The number of theme supported
 * @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_NOT_INITIALIZED Not initialized
 * @pre feedback_initialize()
 */
int feedback_get_count_of_theme_internal(feedback_type_e feedback_type, unsigned int *count_of_theme);

/**
 * @brief Gets the current id of theme selected.
 * @details This function gets the current theme id selected.
 *          The theme id is positive value according to conf file.
 * @since_tizen 7.0
 * @param[in] type The feedback type
 * @param[out] id_of_theme The current id of theme selected
 * @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
 */
int feedback_get_theme_id_internal(feedback_type_e feedback_type, unsigned int *id_of_theme);

/**
 * @brief Sets the current id of theme.
 * @details This function sets the theme id.
 *          The theme id is positive value according to conf file.
 *          Please put the accurate theme id value.
 * @since_tizen 7.0
 * @remarks For setting feedback theme id, the privilege should be set to, %http://tizen.org/privilege/systemsettings.admin.
 *          If app doesn't have the privilege, it returns FEEDBACK_ERROR_PERMISSION_DENIED error.
 * @param[in] type The feedback type
 * @param[in] id_of_theme The id of theme will be selected
 * @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_set_theme_id_internal(feedback_type_e feedback_type, unsigned int id_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);

/**
 * @brief Gets the array of theme id supported.
 * @details This function gets all theme id as defined in the conf file.
 *          The theme id is positive value according to conf file.
 * @since_tizen 7.0
 * @param[in] type The feedback type
 * @param[out] count_of_theme This means size of theme id array
 * @param[out] theme_ids The theme id array
 * @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
 */
int feedback_get_theme_ids_internal(feedback_type_e feedback_type, unsigned int *count_of_theme, unsigned int **theme_ids);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif //__FEEDBACK_INTERNAL_H__