4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __DD_HAPTIC_H__
21 #define __DD_HAPTIC_H__
29 * @defgroup CAPI_SYSTEM_DEVICED_HAPTIC_MODULE Haptic
30 * @ingroup CAPI_SYSTEM_DEVICED
31 * @brief This file provides the API for control of haptic
32 * @section CAPI_SYSTEM_DEVICED_HAPTI_MODULE_HEADER Required Header
33 * \#include <dd-haptic.h>
37 * @addtogroup CAPI_SYSTEM_DEVICED_HAPTIC_MODULE
42 * @brief The handle of haptic device
44 typedef void* haptic_device_h;
47 * @brief The handle of haptic effect
49 typedef void* haptic_effect_h;
52 * @brief Enumerations of device id for the Haptic API.
53 * @details We support two motors now.
56 HAPTIC_DEVICE_0 = 0x0, /**< 1st motor */
57 HAPTIC_DEVICE_1 = 0x1, /**< 2nd motor */
58 HAPTIC_DEVICE_ALL = 0x4, /**< both of them */
62 * @brief Enumerations of priority level for the Haptic API.
66 HAPTIC_PRIORITY_MIN = 0, /**< Minimum effect priority for developers (default) */
67 HAPTIC_PRIORITY_MIDDLE, /**< Maximum effect priority for developers */
68 HAPTIC_PRIORITY_HIGH, /**< Maximum effect priority for OEMs */
72 * @brief Enumerations of feedback level for the Haptic API.
73 * @details Haptic level means vibration power (intensity).
77 HAPTIC_FEEDBACK_0 = 0, /**< feedback level 0 */
78 HAPTIC_FEEDBACK_1 = 20, /**< feedback level 1 */
79 HAPTIC_FEEDBACK_2 = 40, /**< feedback level 2 */
80 HAPTIC_FEEDBACK_3 = 60, /**< feedback level 3 */
81 HAPTIC_FEEDBACK_4 = 80, /**< feedback level 4 */
82 HAPTIC_FEEDBACK_5 = 100, /**< feedback level 5 */
83 HAPTIC_FEEDBACK_AUTO, /**< feedback level auto */
87 * @brief Enumerations of unlimited duration for the Haptic API.
90 HAPTIC_DURATION_UNLIMITED = 0xFFFFFFFF,
94 * @brief Enumerations of iteration count for the Haptic API.
98 HAPTIC_ITERATION_ONCE = 1,
99 HAPTIC_ITERATION_INFINITE = 256,
100 } haptic_iteration_e;
103 * @brief Enumerations of effect or device state for the Haptic API.
107 HAPTIC_STATE_STOP = 0,
108 HAPTIC_STATE_PLAYING,
112 * @brief Enumerations of error codes for the Haptic API.
116 HAPTIC_ERROR_NONE = 0, //TIZEN_ERROR_NONE, /**< Successful */
117 HAPTIC_ERROR_INVALID_PARAMETER = -1, //TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
118 HAPTIC_ERROR_FILE_EXISTS = -2, //TIZEN_ERROR_FILE_EXISTS, /**< File exists */
119 HAPTIC_ERROR_NOT_INITIALIZED = -3, //TIZEN_ERROR_SYSTEM_CLASS | 0x26, /**< Not initialized */
120 HAPTIC_ERROR_OPERATION_FAILED = -4, //TIZEN_ERROR_SYSTEM_CLASS | 0x28, /**< Operation failed */
121 HAPTIC_ERROR_NOT_SUPPORTED_DEVICE = -5, //TIZEN_ERROR_SYSTEM_CLASS | 0x30, /**< Not supported device */
125 * @brief Gets the number of the vibrators.
127 * @remarks The index HAPTIC_DEVICE_ALL is reserved meaning for all vibrators at a time.
129 * @param[in] device_number A number of vibrators
131 * @return 0 on success, otherwise a negative error value.
132 * @retval #HAPTIC_ERROR_NONE Successful
133 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
134 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
135 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
137 int haptic_get_count(int *device_number);
140 * @brief Opens a haptic-vibration device.
142 * @details Internally, it makes a connection to the vibrator.
144 * @remarks If this function is not called in advance, other functions will return #HAPTIC_ERROR_NOT_INITIALIZED.
145 * @remarks Haptic API must be closed by haptic_close().
147 * @return 0 on success, otherwise a negative error value.
148 * @retval #HAPTIC_ERROR_NONE Successful
149 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
150 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
151 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
153 * @see haptic_close()
155 int haptic_open(haptic_device_e device, haptic_device_h *device_handle);
158 * @brief Closes a haptic-vibration device.
160 * @details Internally, it disconnects the connection to vibrator.
162 * @return 0 on success, otherwise a negative error value.
163 * @retval #HAPTIC_ERROR_NONE Successful
164 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
165 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
166 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
167 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
171 int haptic_close(haptic_device_h device_handle);
174 * @brief Vibrates during the specified time with a constant intensity.
176 * This function can be used to start monotonous vibration for specified time.
179 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n
180 * And default value of feedback and priority is used.\n
181 * feedback level is reserved for auto chaning to save variable in the settings.\n
182 * priority level uses HAPTIC_PRIORITY_MIN.
184 * @param[in] device_handle The device handle from haptic_open()
185 * @param[in] duration The play duration in milliseconds
186 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
188 * @return 0 on success, otherwise a negative error value.
189 * @retval #HAPTIC_ERROR_NONE Successful
190 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
191 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
192 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
193 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
195 * @see haptic_vibrate_monotone_with_detail()
196 * @see haptic_vibrate_file()
197 * @see haptic_vibrate_buffer()
198 * @see haptic_get_count()
200 int haptic_vibrate_monotone(haptic_device_h device_handle, int duration, haptic_effect_h *effect_handle);
203 * @brief Vibrates during the specified time with a constant intensity.
205 * This function can be used to start monotonous vibration for specified time.
208 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.
210 * @param[in] device_handle The device handle from haptic_open()
211 * @param[in] duration The play duration in milliseconds
212 * @param[in] feedback The amount of the intensity variation
213 * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH
214 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
216 * @return 0 on success, otherwise a negative error value.
217 * @retval #HAPTIC_ERROR_NONE Successful
218 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
219 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
220 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
221 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
223 * @see haptic_vibrate_monotone()
224 * @see haptic_vibrate_file_with_detail()
225 * @see haptic_vibrate_buffer_with_detail()
226 * @see haptic_get_count()
228 int haptic_vibrate_monotone_with_detail(haptic_device_h device_handle,
230 haptic_feedback_e feedback,
231 haptic_priority_e priority,
232 haptic_effect_h *effect_handle);
235 * @brief Vibrates a predefined rhythmic haptic-vibration pattern file.
237 * This function can be used to play a haptic-vibration pattern file.
240 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n
241 * And default value of feedback and priority is used.\n
242 * feedback level is reserved for auto chaning to save variable in the settings.\n
243 * priority level uses HAPTIC_PRIORITY_MIN.
245 * @param[in] device_handle The device handle from haptic_open()
246 * @param[in] file_path Vibration pattern file with path
247 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
249 * @return 0 on success, otherwise a negative error value.
250 * @retval #HAPTIC_ERROR_NONE Successful
251 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
252 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
253 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
254 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
256 * @see haptic_vibrate_file_with_detail()
257 * @see haptic_vibrate_monotone()
258 * @see haptic_vibrate_buffer()
259 * @see haptic_get_count()
261 int haptic_vibrate_file(haptic_device_h device_handle, const char *file_path, haptic_effect_h *effect_handle);
264 * @brief Vibrates a predefined rhythmic haptic-vibration pattern file.
266 * This function can be used to play a haptic-vibration pattern file.
269 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.
271 * @param[in] device_handle The device handle from haptic_open()
272 * @param[in] file_path Vibration pattern file with path
273 * @param[in] iteration The number of times to repeat the effect
274 * @param[in] feedback The amount of the intensity variation
275 * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH
276 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
278 * @return 0 on success, otherwise a negative error value.
279 * @retval #HAPTIC_ERROR_NONE Successful
280 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
281 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
282 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
283 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
285 * @see haptic_vibrate_file()
286 * @see haptic_vibrate_monotone_with_detail()
287 * @see haptic_vibrate_buffer_with_detail()
288 * @see haptic_get_count()
290 int haptic_vibrate_file_with_detail(haptic_device_h device_handle,
291 const char *file_path,
292 haptic_iteration_e iteration,
293 haptic_feedback_e feedback,
294 haptic_priority_e priority,
295 haptic_effect_h *effect_handle);
298 * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer.
300 * This function can be used to play a haptic-vibration pattern buffer.
303 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n
304 * And default value of feedback and priority is used.\n
305 * feedback level is reserved for auto chaning to save variable in the settings.\n
306 * priority level uses HAPTIC_PRIORITY_MIN.
308 * @param[in] device_handle The device handle from haptic_open()
309 * @param[in] vibe_buffer Pointer to the vibration pattern
310 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
312 * @return 0 on success, otherwise a negative error value.
313 * @retval #HAPTIC_ERROR_NONE Successful
314 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
315 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
316 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
317 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
319 * @see haptic_vibrate_buffer_with_detail()
320 * @see haptic_vibrate_monotone()
321 * @see haptic_vibrate_file()
322 * @see haptic_get_count()
324 int haptic_vibrate_buffer(haptic_device_h device_handle, const unsigned char *vibe_buffer, haptic_effect_h *effect_handle);
327 * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer.
329 * This function can be used to play a haptic-vibration pattern buffer.
332 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.
334 * @param[in] device_handle The device handle from haptic_open()
335 * @param[in] vibe_buffer Pointer to the vibration pattern
336 * @param[in] iteration The number of times to repeat the effect
337 * @param[in] feedback The amount of the intensity variation
338 * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH
339 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
341 * @return 0 on success, otherwise a negative error value.
342 * @retval #HAPTIC_ERROR_NONE Successful
343 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
344 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
345 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
346 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
348 * @see haptic_vibrate_buffer()
349 * @see haptic_vibrate_monotone_with_detail()
350 * @see haptic_vibrate_file_with_detail()
351 * @see haptic_get_count()
353 int haptic_vibrate_buffer_with_detail(haptic_device_h device_handle,
354 const unsigned char *vibe_buffer,
355 haptic_iteration_e iteration,
356 haptic_feedback_e feedback,
357 haptic_priority_e priority,
358 haptic_effect_h *effect_handle);
361 * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer.
363 * This function can be used to play a haptic-vibration pattern buffer.
366 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n
367 * And default value of feedback and priority is used.\n
368 * feedback level is reserved for auto chaning to save variable in the settings.\n
369 * priority level uses HAPTIC_PRIORITY_MIN.
371 * @param[in] device_handle The device handle from haptic_open()
372 * @param[in] vibe_buffer Pointer to the vibration pattern
373 * @param[in] size Size to the vibration pattern
374 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
376 * @return 0 on success, otherwise a negative error value.
377 * @retval #HAPTIC_ERROR_NONE Successful
378 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
379 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
380 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
381 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
383 * @see haptic_vibrate_buffer_with_detail()
384 * @see haptic_vibrate_monotone()
385 * @see haptic_vibrate_file()
386 * @see haptic_get_count()
388 int haptic_vibrate_buffers(haptic_device_h device_handle,
389 const unsigned char *vibe_buffer,
391 haptic_effect_h *effect_handle);
394 * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer.
396 * This function can be used to play a haptic-vibration pattern buffer.
399 * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.
401 * @param[in] device_handle The device handle from haptic_open()
402 * @param[in] vibe_buffer Pointer to the vibration pattern
403 * @param[in] size Size to the vibration pattern
404 * @param[in] iteration The number of times to repeat the effect
405 * @param[in] feedback The amount of the intensity variation
406 * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH
407 * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect
409 * @return 0 on success, otherwise a negative error value.
410 * @retval #HAPTIC_ERROR_NONE Successful
411 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
412 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
413 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
414 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
416 * @see haptic_vibrate_buffer()
417 * @see haptic_vibrate_monotone_with_detail()
418 * @see haptic_vibrate_file_with_detail()
419 * @see haptic_get_count()
421 int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle,
422 const unsigned char *vibe_buffer,
424 haptic_iteration_e iteration,
425 haptic_feedback_e feedback,
426 haptic_priority_e priority,
427 haptic_effect_h *effect_handle);
430 * @brief Stops the current vibration effect which is being played.
431 * @details This function can be used to stop each effect started by haptic_vibrate_xxx().
435 * @param[in] device_handle The device handle from haptic_open()
436 * @param[in] effect_handle The effect handle from haptic_vibrate_xxx()
438 * @return 0 on success, otherwise a negative error value.
439 * @retval #HAPTIC_ERROR_NONE Successful
440 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
441 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
442 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
443 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
445 * @see haptic_vibrate_buffer()
446 * @see haptic_vibrate_monotone()
447 * @see haptic_vibrate_file()
448 * @see haptic_get_count()
449 * @see haptic_stop_all_effects()
451 int haptic_stop_effect(haptic_device_h device_handle, haptic_effect_h effect_handle);
454 * @brief Stops all vibration effects which are being played.
455 * @details This function can be used to stop all effects started by haptic_vibrate_xxx().
459 * @param[in] device_handle The device handle from haptic_open()
461 * @return 0 on success, otherwise a negative error value.
462 * @retval #HAPTIC_ERROR_NONE Successful
463 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
464 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
465 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
466 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
468 * @see haptic_vibrate_buffer()
469 * @see haptic_vibrate_monotone()
470 * @see haptic_vibrate_file()
471 * @see haptic_get_count()
472 * @see haptic_stop_effect()
474 int haptic_stop_all_effects(haptic_device_h device_handle);
477 * @brief Gets the status of the effect.
478 * @details This function can be used to get the status of the effect wheter the effect are playing or not.
482 * @param[in] device_handle The device handle from haptic_open()
483 * @param[in] effect_handle The effect handle from haptic_vibrate_xxx()
484 * @param[out] state The pointer to variable that will receive the status of the effect.
486 * @return 0 on success, otherwise a negative error value.
487 * @retval #HAPTIC_ERROR_NONE Successful
488 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
489 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
490 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
491 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
493 * @see haptic_vibrate_buffer()
494 * @see haptic_vibrate_monotone()
495 * @see haptic_vibrate_file()
496 * @see haptic_get_count()
497 * @see haptic_stop_effect()
498 * @see haptic_stop_all_effects()
500 int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h effect_handle, haptic_state_e *state);
504 * effect element for haptic.
507 int haptic_duration; /**< Start time of the effect element in millisecond */
508 int haptic_level; /**< Duration of the effect element in millisecond */
509 } haptic_effect_element_s;
512 * @brief Creates an effect buffer.
513 * @details This function can be used to create an effect buffer using effeclt_element variable.
517 * @param[out] vibe_buffer Pointer to the vibration pattern
518 * @param[in] max_bufsize The size of the buffer pointed to by vibe_buffer
519 * @param[in] elem_arr Pointer to an haptic_effect_element_s structure
520 * @param[in] max_elemcnt The size fo the buffer pointed to by elem_arr
522 * @return 0 on success, otherwise a negative error value.
523 * @retval #HAPTIC_ERROR_NONE Successful
524 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
525 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
526 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
527 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
529 * @see haptic_save_effect()
531 int haptic_create_effect(unsigned char *vibe_buffer,
533 haptic_effect_element_s *elem_arr,
537 * @brief Save an effect buffer to the file.
538 * @details This function can be used to save an effect buffer to the file using third parameter.
542 * @param[in] vibe_buffer Pointer to the vibration pattern
543 * @param[in] max_bufsize The size of the buffer pointed to by vibe_buffer
544 * @param[in] file_path The pointer to the character buffer containing the path to save
546 * @return 0 on success, otherwise a negative error value.
547 * @retval #HAPTIC_ERROR_NONE Successful
548 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
549 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
550 * @retval #HAPTIC_ERROR_FILE_EXISTS File exists
551 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
552 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
554 * @see haptic_create_effect()
556 int haptic_save_effect(const unsigned char *vibe_buffer,
558 const char *file_path);
561 * @brief Gets a duration time value from file.
562 * @details This function can be used to get a duration time value from the file using second parameter.
566 * @param[in] device_handle The device handle from haptic_open()
567 * @param[in] file_path The pointer to the character buffer containing the path to save
568 * @param[out] duration The pointer to the duration time value
570 * @return 0 on success, otherwise a negative error value.
571 * @retval #HAPTIC_ERROR_NONE Successful
572 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
573 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
574 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
575 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
577 * @see haptic_get_buffer_duration()
579 int haptic_get_file_duration(haptic_device_h device_handle, const char *file_path, int *duration);
582 * @brief Gets a duration time value from buffer.
583 * @details This function can be used to get a duration time value from the buffer using second parameter.
587 * @param[in] device_handle The device handle from haptic_open()
588 * @param[in] vibe_buffer Pointer to the vibration pattern buffer
589 * @param[out] duration The pointer to the duration time value
591 * @return 0 on success, otherwise a negative error value.
592 * @retval #HAPTIC_ERROR_NONE Successful
593 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
594 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
595 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
596 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
598 * @see haptic_get_file_duration()
600 int haptic_get_buffer_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int *duration);
603 * @brief Gets a duration time value from buffer.
604 * @details This function can be used to get a duration time value from the buffer using second parameter.
608 * @param[in] device_handle The device handle from haptic_open()
609 * @param[in] vibe_buffer Pointer to the vibration pattern buffer
610 * @param[in] size Size to the vibration pattern buffer
611 * @param[out] buffer_duration The pointer to the duration time value
613 * @return 0 on success, otherwise a negative error value.
614 * @retval #HAPTIC_ERROR_NONE Successful
615 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
616 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
617 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
618 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
620 * @see haptic_get_file_duration()
622 int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int size, int *buffer_duration);
625 * @brief Save an effect buffer to the led file.
626 * @details This function can be used to save an effect buffer to the led file which name is third parameter.
629 * Third parameter should be compatible with ledplayer file.
631 * @param[in] vibe_buffer Pointer to the vibration pattern
632 * @param[in] max_bufsize The size of the buffer pointed to by vibe_buffer
633 * @param[in] file_path The pointer to the character buffer containing the path to save
635 * @return 0 on success, otherwise a negative error value.
636 * @retval #HAPTIC_ERROR_NONE Successful
637 * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
638 * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
639 * @retval #HAPTIC_ERROR_FILE_EXISTS File exists
640 * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
641 * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
643 * @see haptic_save_effect()
645 int haptic_save_led(const unsigned char *vibe_buffer, int max_bufsize, const char *file_path);
648 * @} end of CAPI_SYSTEM_DEVICED_HAPTIC_MODULE