*/
int haptic_open(haptic_device_e device, haptic_device_h *device_handle);
-
/**
* @brief Closes a haptic-vibration device.
*
haptic_effect_h *effect_handle);
/**
+ * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer.
+ * @details
+ * This function can be used to play a haptic-vibration pattern buffer.
+ *
+ * @remark
+ * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n
+ * And default value of feedback and priority is used.\n
+ * feedback level is reserved for auto chaning to save variable in the settings.\n
+ * priority level uses HAPTIC_PRIORITY_MIN.
+ *
+ * @param[in] device_handle The device handle from haptic_open()
+ * @param[in] vibe_buffer Pointer to the vibration pattern
+ * @param[in] size Size to the vibration pattern
+ * @param[out] effect_handle [DEPRECATED] Pointer to the variable that will receive a handle to the playing effect
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #HAPTIC_ERROR_NONE Successful
+ * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
+ *
+ * @see haptic_vibrate_buffer_with_detail()
+ * @see haptic_vibrate_monotone()
+ * @see haptic_vibrate_file()
+ * @see haptic_get_count()
+ */
+int haptic_vibrate_buffers(haptic_device_h device_handle,
+ const unsigned char *vibe_buffer,
+ int size,
+ haptic_effect_h *effect_handle);
+
+/**
+ * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer.
+ * @details
+ * This function can be used to play a haptic-vibration pattern buffer.
+ *
+ * @remark
+ * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.
+ *
+ * @param[in] device_handle The device handle from haptic_open()
+ * @param[in] vibe_buffer Pointer to the vibration pattern
+ * @param[in] size Size to the vibration pattern
+ * @param[in] iteration The number of times to repeat the effect
+ * @param[in] feedback The amount of the intensity variation
+ * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH
+ * @param[out] effect_handle [DEPRECATED] Pointer to the variable that will receive a handle to the playing effect
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #HAPTIC_ERROR_NONE Successful
+ * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
+ *
+ * @see haptic_vibrate_buffer()
+ * @see haptic_vibrate_monotone_with_detail()
+ * @see haptic_vibrate_file_with_detail()
+ * @see haptic_get_count()
+ */
+int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle,
+ const unsigned char *vibe_buffer,
+ int size,
+ haptic_iteration_e iteration,
+ haptic_feedback_e feedback,
+ haptic_priority_e priority,
+ haptic_effect_h *effect_handle);
+
+/**
* @brief Stops the current vibration effect which is being played.
* @details This function can be used to stop each effect started by haptic_vibrate_xxx().
*
int haptic_get_buffer_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int *duration);
/**
+ * @brief Gets a duration time value from buffer.
+ * @details This function can be used to get a duration time value from the buffer using second parameter.
+ *
+ * @remark
+ *
+ * @param[in] device_handle The device handle from haptic_open()
+ * @param[in] vibe_buffer Pointer to the vibration pattern buffer
+ * @param[in] size Size to the vibration pattern buffer
+ * @param[out] duration The pointer to the duration time value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #HAPTIC_ERROR_NONE Successful
+ * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device
+ *
+ * @see haptic_get_file_duration()
+ */
+int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int size, int *buffer_duration);
+
+/**
* @brief Save an effect buffer to the led file.
* @details This function can be used to save an effect buffer to the led file which name is third parameter.
*
API
int haptic_vibrate_buffer(haptic_device_h device_handle, const unsigned char *vibe_buffer, haptic_effect_h *effect_handle)
{
- return haptic_vibrate_buffer_with_detail(device_handle,
+ return haptic_vibrate_buffers_with_detail(device_handle,
vibe_buffer,
+ 0,
HAPTIC_ITERATION_ONCE,
HAPTIC_FEEDBACK_AUTO,
HAPTIC_PRIORITY_MIN,
haptic_priority_e priority,
haptic_effect_h *effect_handle)
{
+ return haptic_vibrate_buffers_with_detail(device_handle,
+ vibe_buffer,
+ 0,
+ iteration,
+ feedback,
+ priority,
+ effect_handle);
+}
+
+API
+int haptic_vibrate_buffers(haptic_device_h device_handle,
+ const unsigned char *vibe_buffer,
+ int size,
+ haptic_effect_h *effect_handle)
+{
+ return haptic_vibrate_buffers_with_detail(device_handle,
+ vibe_buffer,
+ size,
+ HAPTIC_ITERATION_ONCE,
+ HAPTIC_FEEDBACK_AUTO,
+ HAPTIC_PRIORITY_MIN,
+ effect_handle);
+}
+
+API
+int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle,
+ const unsigned char *vibe_buffer,
+ int size,
+ haptic_iteration_e iteration,
+ haptic_feedback_e feedback,
+ haptic_priority_e priority,
+ haptic_effect_h *effect_handle)
+{
int ret;
int handle;
API
int haptic_stop_effect(haptic_device_h device_handle, haptic_effect_h effect_handle)
{
- int ret;
-
- if (__handle_cnt == 0) {
- HAPTIC_ERROR("Not initialized");
- return HAPTIC_ERROR_NOT_INITIALIZED;
- }
-
- if (device_handle < 0) {
- HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle);
- return HAPTIC_ERROR_INVALID_PARAMETER;
- }
-
- if (effect_handle < 0) {
- HAPTIC_ERROR("Invalid parameter : effect_handle(%d)", effect_handle);
- return HAPTIC_ERROR_INVALID_PARAMETER;
- }
-
- if (!plugin_intf || !plugin_intf->haptic_internal_stop_effect) {
- HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_stop_effect == NULL");
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
-
- ret = plugin_intf->haptic_internal_stop_effect((int)device_handle, (int)effect_handle);
- if (ret != HAPTIC_MODULE_ERROR_NONE) {
- HAPTIC_ERROR("haptic_internal_stop_effect is failed : %d", ret);
- return HAPTIC_ERROR_OPERATION_FAILED;
- }
-
- return HAPTIC_ERROR_NONE;
+ return haptic_stop_all_effects(device_handle);
}
API
API
int haptic_get_buffer_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int *buffer_duration)
{
+ return haptic_get_buffers_duration(device_handle,
+ vibe_buffer,
+ 0,
+ buffer_duration);
+}
+
+API
+API int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int size, int *buffer_duration)
+{
int ret;
int duration;