revise the haptic buffer size and add new haptic buffer definition on haptic.h file... 72/15172/1
authorjy910.yun <jy910.yun@samsung.com>
Mon, 10 Jun 2013 02:46:39 +0000 (11:46 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 16 Jan 2014 15:26:26 +0000 (16:26 +0100)
Change-Id: Iae474f69968bc7edef6e71c7a022e41e3d390e1f
Signed-off-by: jy910.yun <jy910.yun@samsung.com>
haptic/include/haptic.h
src/shared/haptic.c

index adad7a2..dba0254 100644 (file)
@@ -421,6 +421,62 @@ int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle,
                                       haptic_effect_h *effect_handle);
 
 /**
+ * @param[out] effect_handle   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   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().
  *
index af44a58..5f2addb 100644 (file)
@@ -48,6 +48,7 @@
 #define METHOD_CREATE_EFFECT           "CreateEffect"
 #define METHOD_SAVE_BINARY                     "SaveBinary"
 
+#define TEMP_BUFFER_SIZE                       (64*1024)
 
 /* START of Static Function Section */
 static unsigned char* convert_file_to_buffer(const char *file_name, int *size)
@@ -414,7 +415,7 @@ API int haptic_vibrate_buffer(haptic_device_h device_handle, const unsigned char
 {
        return haptic_vibrate_buffers_with_detail(device_handle,
                                                                                         vibe_buffer,
-                                                                                        0,
+                                                                                        TEMP_BUFFER_SIZE,
                                                                                         HAPTIC_ITERATION_ONCE,
                                                                                         HAPTIC_FEEDBACK_AUTO,
                                                                                         HAPTIC_PRIORITY_MIN,
@@ -430,7 +431,7 @@ API int haptic_vibrate_buffer_with_detail(haptic_device_h device_handle,
 {
        return haptic_vibrate_buffers_with_detail(device_handle,
                                                                                         vibe_buffer,
-                                                                                        0,
+                                                                                        TEMP_BUFFER_SIZE,
                                                                                         iteration,
                                                                                         feedback,
                                                                                         priority,
@@ -774,7 +775,7 @@ API int haptic_get_buffer_duration(haptic_device_h device_handle, const unsigned
 {
        return haptic_get_buffers_duration(device_handle,
                                                                        vibe_buffer,
-                                                                       0,
+                                                                       TEMP_BUFFER_SIZE,
                                                                        buffer_duration);
 }