support multi handle, not use default handle
authorjy910.yun <jy910.yun@samsung.com>
Fri, 29 Mar 2013 15:13:26 +0000 (00:13 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Fri, 29 Mar 2013 15:17:22 +0000 (00:17 +0900)
when requested device open, this patchset will create unique handle.

Change-Id: Iac26b9afeec9f731468c72ea8d9004fcac0b0820

tizen/DEVICE/CMakeLists.txt
tizen/DEVICE/include/file.h
tizen/DEVICE/src/file.c
tizen/DEVICE/src/haptic.c [moved from tizen/DEVICE/src/haptic_module_internal.c with 91% similarity]
tizen/DEVICE/src/sysnoti.c
tizen/SIMULATOR/CMakeLists.txt
tizen/SIMULATOR/src/haptic.c [moved from tizen/SIMULATOR/src/haptic_module_internal.c with 100% similarity]

index 706764e..5c6a7fb 100644 (file)
@@ -1,7 +1,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
 SET(SRCS
-       src/haptic_module_internal.c
+       src/haptic.c
        src/file.c
        src/sysnoti.c)
 
index 54ced39..bfc3a23 100644 (file)
@@ -60,17 +60,15 @@ typedef struct _HapticElement {
 } HapticElement;
 
 int GetHapticLevelMax(int *max);
-int SetHapticEnable(int value);
-int SetHapticLevel(int value);
-int SetHapticOneshot(int value);
 
-int InitializeHapticBuffer(unsigned char *vibe_buffer, int max_bufsize);
-int InsertHapticElement(unsigned char *vibe_buffer, int max_bufsize, HapticElement *element);
-int GetHapticBufferSize(const unsigned char *vibe_buffer, int *size);
-int GetHapticBufferDuration(const unsigned char *vibe_buffer, int *duration);
-int PlayHapticBuffer(const unsigned char *vibe_buffer, int iteration, int level, int *effect_handle);
-int OpenHapticDevice(void);
-int CloseHapticDevice(void);
-int StopHaptic(void);
+int InitializeBuffer(unsigned char *vibe_buffer, int max_bufsize);
+int InsertElement(unsigned char *vibe_buffer, int max_bufsize, HapticElement *element);
+int GetBufferSize(const unsigned char *vibe_buffer, int *size);
+int GetBufferDuration(const unsigned char *vibe_buffer, int *duration);
+int PlayOneshot(int handle, int duration, int level);
+int PlayBuffer(int handle, const unsigned char *vibe_buffer, int iteration, int level);
+int Stop(int handle);
+int OpenDevice(int handle);
+int CloseDevice(int handle);
 
 #endif // __FIEL_H__
index 47f3ec5..0f6b626 100644 (file)
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <errno.h>
 #include <pthread.h>
 #include <device-node.h>
 #define MAX_LEVEL                              255.0f
 #define DEFAULT_EFFECT_HANDLE  0x02
 
+#define PREDEF_HAPTIC           "haptic"
+
 enum {
-       PLAY_HAPTIC = 0,
-       STOP_HAPTIC,
-       LEVEL_HAPTIC,
+       OPEN = 0,
+       CLOSE,
+       PLAY,
+       ONESHOT,
+       STOP,
+       LEVEL,
 };
 
 typedef struct {
+       int handle;
        unsigned char **ppbuffer;
        int channels;
        int length;
@@ -77,8 +84,8 @@ static int _create_thread(void* data, void*(*func)(void*))
 
 static int _cancel_thread(void)
 {
-       int *ptr = NULL;
-       int ret = -1;
+       int *ptr;
+       int ret;
 
        if (!tid) {
                MODULE_LOG("pthread not initialized");
@@ -106,13 +113,29 @@ static int _cancel_thread(void)
        return 0;
 }
 
+static int __haptic_predefine_action(int handle, int prop, int val)
+{
+       char buf_pid[32];
+       char buf_prop[32];
+       char buf_handle[32];
+       char buf_val[32];
+
+       snprintf(buf_pid, sizeof(buf_pid), "%d", getpid());
+       snprintf(buf_prop, sizeof(buf_prop), "%d", prop);
+       snprintf(buf_handle, sizeof(buf_handle), "%d", handle);
+       snprintf(buf_val, sizeof(buf_val), "%d", val);
+
+       MODULE_LOG("pid : %s, prop : %s, handle : %s", buf_pid, buf_prop, buf_handle);
+       return __haptic_call_predef_action(PREDEF_HAPTIC, 4, buf_pid, buf_prop, buf_handle, buf_val);
+}
+
 static void __clean_up(void *arg)
 {
        BUFFER *pbuffer = (BUFFER*)arg;
-       int i = 0;
+       int i;
 
        MODULE_LOG("clean up handler!!! : %d", tid);
-       __haptic_predefine_action(STOP_HAPTIC, NULL);
+       __haptic_predefine_action(pbuffer->handle, STOP, NULL);
 
        for (i = 0; i < pbuffer->channels; ++i) {
                free(pbuffer->ppbuffer[i]);
@@ -129,7 +152,7 @@ static void __clean_up(void *arg)
 static void* __play_cb(void *arg)
 {
        BUFFER *pbuffer = (BUFFER*)arg;
-       int i = -1, j = -1, k = -1, value = -1;
+       int i, j, k;
        unsigned char ch;
        unsigned char prev = -1;
 
@@ -137,7 +160,7 @@ static void* __play_cb(void *arg)
 
        pthread_cleanup_push(__clean_up, arg);
 
-       __haptic_predefine_action(PLAY_HAPTIC, NULL);
+       __haptic_predefine_action(pbuffer->handle, PLAY, NULL);
 
        /* Copy buffer from source buffer */
        for (i = 0; i < pbuffer->iteration; i++) {
@@ -145,7 +168,7 @@ static void* __play_cb(void *arg)
                        for (k = 0; k < pbuffer->channels; ++k) {
                                ch = pbuffer->ppbuffer[k][j];
                                if (ch != prev) {
-                                       __haptic_predefine_action(LEVEL_HAPTIC, ch);
+                                       __haptic_predefine_action(pbuffer->handle, LEVEL, ch);
                                        prev = ch;
                                }
                                usleep(BITPERMS * 1000);
@@ -159,7 +182,7 @@ static void* __play_cb(void *arg)
 
 int GetHapticLevelMax(int *max)
 {
-       int status = -1;
+       int status;
        status = device_get_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_LEVEL_MAX, max);
        if (status < 0) {
                MODULE_ERROR("device_get_property fail : %d", status);
@@ -168,51 +191,16 @@ int GetHapticLevelMax(int *max)
        return 0;
 }
 
-int SetHapticEnable(int value)
+int InitializeBuffer(unsigned char *vibe_buffer, int max_bufsize)
 {
-       int status = -1;
-       status = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_ENABLE, value);
-       if (status < 0) {
-               MODULE_ERROR("device_set_property fail : %d", status);
-               return -1;
-       }
-       return 0;
-}
-
-int SetHapticLevel(int value)
-{
-       int status = -1;
-       status = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_LEVEL, value);
-       if (status < 0) {
-               MODULE_ERROR("device_set_property fail : %d", status);
-               return -1;
-       }
-       return 0;
-}
-
-int SetHapticOneshot(int value)
-{
-       int status = -1;
-       status = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_ONESHOT, value);
-       if (status < 0) {
-               MODULE_ERROR("device_set_property fail : %d", status);
-               return -1;
-       }
-       return 0;
-}
-
-int InitializeHapticBuffer(unsigned char *vibe_buffer, int max_bufsize)
-{
-       HapticFile *pfile = NULL;
+       HapticFile *pfile;
 
        if (max_bufsize < sizeof(HapticFile)) {
-               MODULE_ERROR("buffer lacks a memory : size(%d) minimum size(%d)", max_bufsize, sizeof(HapticFile));
+               MODULE_ERROR("buffer lacks a memory : size(%d) minimum size(%d)",
+                                       max_bufsize, sizeof(HapticFile));
                return -1;
        }
 
-       MODULE_LOG("FormatChunk : %d, DataChunk : %d, HapticFile : %d", sizeof(FormatChunk), sizeof(DataChunk), sizeof(HapticFile));
-       MODULE_LOG("Bufsize : %d", max_bufsize);
-
        memset(vibe_buffer, 0, sizeof(char)*max_bufsize);
 
        pfile = (HapticFile*)vibe_buffer;
@@ -230,14 +218,14 @@ int InitializeHapticBuffer(unsigned char *vibe_buffer, int max_bufsize)
        return 0;
 }
 
-int InsertHapticElement(unsigned char *vibe_buffer, int max_bufsize, HapticElement *element)
+int InsertElement(unsigned char *vibe_buffer, int max_bufsize, HapticElement *element)
 {
-       HapticFile *pfile = NULL;
-       int databuf = -1;
-       int needbuf = -1;
+       HapticFile *pfile;
+       int databuf;
+       int needbuf;
        int duration;
        unsigned char level;
-       int i = -1;
+       int i;
 
        pfile = (HapticFile*)vibe_buffer;
        if (_check_valid_haptic_format(pfile) < 0) {
@@ -267,9 +255,9 @@ int InsertHapticElement(unsigned char *vibe_buffer, int max_bufsize, HapticEleme
        return 0;
 }
 
-int GetHapticBufferSize(const unsigned char *vibe_buffer, int *size)
+int GetBufferSize(const unsigned char *vibe_buffer, int *size)
 {
-       HapticFile *pfile = NULL;
+       HapticFile *pfile;
 
        pfile = (HapticFile*)vibe_buffer;
        if (_check_valid_haptic_format(pfile) < 0) {
@@ -281,9 +269,9 @@ int GetHapticBufferSize(const unsigned char *vibe_buffer, int *size)
        return 0;
 }
 
-int GetHapticBufferDuration(const unsigned char *vibe_buffer, int *duration)
+int GetBufferDuration(const unsigned char *vibe_buffer, int *duration)
 {
-       HapticFile *pfile = NULL;
+       HapticFile *pfile;
 
        pfile = (HapticFile*)vibe_buffer;
        if (_check_valid_haptic_format(pfile) < 0) {
@@ -295,13 +283,37 @@ int GetHapticBufferDuration(const unsigned char *vibe_buffer, int *duration)
        return 0;
 }
 
-int PlayHapticBuffer(const unsigned char *vibe_buffer, int iteration, int level, int *effect_handle)
+int PlayOneshot(int handle, int duration, int level)
 {
-       HapticFile *pfile = NULL;
-       unsigned char **ppbuffer = NULL;
+       char buf_pid[32];
+       char buf_prop[32];
+       char buf_handle[32];
+       char buf_duration[32];
+       char buf_level[32];
+
+       if (_cancel_thread() < 0) {
+               MODULE_ERROR("_cancel_thread fail");
+               return -1;
+       }
+
+       snprintf(buf_pid, sizeof(buf_pid), "%d", getpid());
+       snprintf(buf_prop, sizeof(buf_prop), "%d", ONESHOT);
+       snprintf(buf_handle, sizeof(buf_handle), "%d", handle);
+       snprintf(buf_duration, sizeof(buf_duration), "%d", duration);
+       snprintf(buf_level, sizeof(buf_level), "%d", level);
+
+       MODULE_LOG("pid : %s, prop : %s, handle : %s", buf_pid, buf_prop, buf_handle);
+       return __haptic_call_predef_action(PREDEF_HAPTIC, 5, buf_pid, buf_prop,
+                                                                               buf_handle, buf_duration, buf_level);
+}
+
+int PlayBuffer(int handle, const unsigned char *vibe_buffer, int iteration, int level)
+{
+       HapticFile *pfile;
+       unsigned char **ppbuffer;
        unsigned int channels, length, align;
        unsigned char data;
-       int i = -1, j = -1;
+       int i, j;
 
        pfile = (HapticFile*)vibe_buffer;
        if (_check_valid_haptic_format(pfile) < 0) {
@@ -339,6 +351,7 @@ int PlayHapticBuffer(const unsigned char *vibe_buffer, int iteration, int level,
                }
        }
 
+       gbuffer.handle = handle;
        gbuffer.ppbuffer = ppbuffer;
        gbuffer.channels = channels;
        gbuffer.length = length;
@@ -350,22 +363,57 @@ int PlayHapticBuffer(const unsigned char *vibe_buffer, int iteration, int level,
                return -1;
        }
 
-       *effect_handle = DEFAULT_EFFECT_HANDLE;
        return 0;
 }
 
-int StopHaptic(void)
+int Stop(int handle)
 {
-       __haptic_predefine_action(STOP_HAPTIC, NULL);
+       char buf_pid[32];
+       char buf_prop[32];
+       char buf_handle[32];
 
-       return 0;
+       if (_cancel_thread() < 0) {
+               MODULE_ERROR("_cancel_thread fail");
+               return -1;
+       }
+
+       snprintf(buf_pid, sizeof(buf_pid), "%d", getpid());
+       snprintf(buf_prop, sizeof(buf_prop), "%d", STOP);
+       snprintf(buf_handle, sizeof(buf_handle), "%d", handle);
+
+       MODULE_LOG("pid : %s, prop : %s, handle : %s", buf_pid, buf_prop, buf_handle);
+       return __haptic_call_predef_action(PREDEF_HAPTIC, 3, buf_pid, buf_prop, buf_handle);
 }
 
-int CloseHapticDevice(void)
+int OpenDevice(int handle)
 {
+       char buf_pid[32];
+       char buf_prop[32];
+       char buf_handle[32];
+
+       snprintf(buf_pid, sizeof(buf_pid), "%d", getpid());
+       snprintf(buf_prop, sizeof(buf_prop), "%d", OPEN);
+       snprintf(buf_handle, sizeof(buf_handle), "%d", handle);
+
+       MODULE_LOG("pid : %s, prop : %s, handle : %s", buf_pid, buf_prop, buf_handle);
+       return __haptic_call_predef_action(PREDEF_HAPTIC, 3, buf_pid, buf_prop, buf_handle);
+}
+
+int CloseDevice(int handle)
+{
+       char buf_pid[32];
+       char buf_prop[32];
+       char buf_handle[32];
+
        if (_cancel_thread() < 0) {
                MODULE_ERROR("_cancel_thread fail");
                return -1;
        }
-       return 0;
+
+       snprintf(buf_pid, sizeof(buf_pid), "%d", getpid());
+       snprintf(buf_prop, sizeof(buf_prop), "%d", CLOSE);
+       snprintf(buf_handle, sizeof(buf_handle), "%d", handle);
+
+       MODULE_LOG("pid : %s, prop : %s, handle : %s", buf_pid, buf_prop, buf_handle);
+       return __haptic_call_predef_action(PREDEF_HAPTIC, 3, buf_pid, buf_prop, buf_handle);
 }
similarity index 91%
rename from tizen/DEVICE/src/haptic_module_internal.c
rename to tizen/DEVICE/src/haptic.c
index 863d69b..688e61e 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <time.h>
 #include <vconf.h>
 
 #include <haptic_plugin_intf.h>
@@ -34,7 +35,7 @@
 #define EXTAPI __attribute__ ((visibility("default")))
 #endif
 
-#define DEFAULT_MOTOR_COUNT    1
+#define DEFAULT_MOTOR_COUNT            1
 #define DEFAULT_DEVICE_HANDLE  0x01
 #define DEFAULT_EFFECT_HANDLE  0x02
 #define HAPTIC_FEEDBACK_AUTO   101
@@ -205,11 +206,10 @@ static int __save_file(const unsigned char *vibe_buferf, int size, const char *f
        return 0;
 }
 
-static int __vibrate(const unsigned char *vibe_buffer, int iteration, int feedback, int priority, int *effect_handle)
+static int __vibrate(int device_handle, const unsigned char *vibe_buffer, int iteration, int feedback, int priority)
 {
        int status;
        int level;
-       int handle;
 
        assert(vibe_buffer);
 
@@ -217,17 +217,19 @@ static int __vibrate(const unsigned char *vibe_buffer, int iteration, int feedba
        if (status != HAPTIC_MODULE_ERROR_NONE)
                return status;
 
-       status = PlayHapticBuffer(vibe_buffer, iteration, level, &handle);
+       status = PlayBuffer(device_handle, vibe_buffer, iteration, level);
        if (status < 0) {
-               MODULE_ERROR("PlayHapticBuffer fail: %d", status);
+               MODULE_ERROR("PlayHapticBuffer fail : %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
        }
 
-       if (effect_handle)
-               *effect_handle = handle;
-
        return 0;
 }
+
+static void *_create_handle(void)
+{
+       return ((getpid()<<16)|time(NULL));
+}
 /* END of Static Function Section */
 
 
@@ -237,19 +239,28 @@ static int _get_device_count(int *count)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
        *count = DEFAULT_MOTOR_COUNT;
-
        return HAPTIC_MODULE_ERROR_NONE;
 }
 
 static int _open_device(int device_index, int *device_handle)
 {
+       int handle;
+       int status;
+
        if (device_index < HAPTIC_MODULE_DEVICE_0 || device_index > HAPTIC_MODULE_DEVICE_ALL)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
        if (device_handle == NULL)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       *device_handle = DEFAULT_DEVICE_HANDLE;
+       handle = _create_handle();
+       status = OpenDevice(handle);
+       if (status < 0) {
+               MODULE_ERROR("OpenHapticDevice fail :%d", status);
+               return HAPTIC_MODULE_OPERATION_FAILED;
+       }
+
+       *device_handle = handle;
        return HAPTIC_MODULE_ERROR_NONE;
 }
 
@@ -260,7 +271,7 @@ static int _close_device(int device_handle)
        if (device_handle < 0)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       status = CloseHapticDevice();
+       status = CloseDevice(device_handle);
        if (status < 0) {
                MODULE_ERROR("CloseHapticDevice fail : %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
@@ -272,7 +283,7 @@ static int _close_device(int device_handle)
 static int _vibrate_monotone(int device_handle, int duration, int feedback, int priority, int *effect_handle)
 {
        int status;
-       int input_feedback;
+       int level;
 
        if (device_handle < 0)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
@@ -292,24 +303,17 @@ static int _vibrate_monotone(int device_handle, int duration, int feedback, int
        if (feedback == HAPTIC_MODULE_FEEDBACK_MIN)
                return HAPTIC_MODULE_ERROR_NONE;
 
-       status = __to_level(feedback, &input_feedback);
+       status = __to_level(feedback, &level);
        if (status != HAPTIC_MODULE_ERROR_NONE)
                return status;
 
-       status = SetHapticLevel(input_feedback);
+       status = PlayOneshot(device_handle, duration, level);
        if (status < 0) {
-               MODULE_ERROR("SetHapticLevel fail : %d", status);
-               return HAPTIC_MODULE_OPERATION_FAILED;
-       }
-
-       status = SetHapticOneshot(duration);
-       if (status < 0) {
-               MODULE_ERROR("SetHapticOneshot fail : %d", status);
+               MODULE_ERROR("PlayOneshot fail : %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
        }
 
        *effect_handle = DEFAULT_EFFECT_HANDLE;
-
        return HAPTIC_MODULE_ERROR_NONE;
 }
 
@@ -345,7 +349,7 @@ static int _vibrate_file(int device_handle, const char *file_path, int iteration
                return HAPTIC_MODULE_OPERATION_FAILED;
        }
 
-       status = __vibrate(vibe_buffer, iteration, feedback , priority, effect_handle);
+       status = __vibrate(device_handle, vibe_buffer, iteration, feedback, priority);
        free(vibe_buffer);
 
        return status;
@@ -374,7 +378,7 @@ static int _vibrate_buffer(int device_handle, const unsigned char *vibe_buffer,
        if (feedback == HAPTIC_MODULE_FEEDBACK_MIN)
                return HAPTIC_MODULE_ERROR_NONE;
 
-       return __vibrate(vibe_buffer, iteration, feedback, priority, effect_handle);
+       return __vibrate(device_handle, vibe_buffer, iteration, feedback, priority);
 }
 
 static int _stop_effect(int device_handle, int effect_handle)
@@ -387,7 +391,7 @@ static int _stop_effect(int device_handle, int effect_handle)
        if (effect_handle < 0)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       status = StopHaptic();
+       status = Stop(device_handle);
        if (status < 0) {
                MODULE_ERROR("StopHaptic fail : %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
@@ -403,7 +407,7 @@ static int _stop_all_effects(int device_handle)
        if (device_handle < 0)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       status = StopHaptic();
+       status = Stop(device_handle);
        if (status < 0) {
                MODULE_ERROR("StopHaptic fail : %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
@@ -469,7 +473,7 @@ static int _create_effect(unsigned char *vibe_buffer, int max_bufsize, haptic_mo
        if (max_elemcnt < 0)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       status = InitializeHapticBuffer(vibe_buffer, max_bufsize);
+       status = InitializeBuffer(vibe_buffer, max_bufsize);
        if (status < 0) {
                MODULE_ERROR("InitializeHapticBuffer fail: %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
@@ -481,7 +485,7 @@ static int _create_effect(unsigned char *vibe_buffer, int max_bufsize, haptic_mo
                elem.level = elem_arr[i].haptic_level;
                MODULE_LOG("%d) duration : %d, level : %d", i, elem_arr[i].haptic_duration, elem_arr[i].haptic_level);
 
-               status = InsertHapticElement(vibe_buffer, max_bufsize, &elem);
+               status = InsertElement(vibe_buffer, max_bufsize, &elem);
                if (status < 0) {
                        MODULE_ERROR("InsertHapticElement fail: %d", status);
                        return HAPTIC_MODULE_OPERATION_FAILED;
@@ -505,7 +509,7 @@ static int _save_effect(const unsigned char *vibe_buffer, int max_bufsize, const
        if (file_path == NULL)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       status = GetHapticBufferSize(vibe_buffer, &size);
+       status = GetBufferSize(vibe_buffer, &size);
        if (status < 0) {
                MODULE_ERROR("GetHapticBufferSize fail: %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
@@ -518,7 +522,7 @@ static int _get_file_duration(int device_handle, const char *file_path, int *fil
 {
        int status;
        unsigned char *vibe_buffer;
-       int duration = -1;
+       int duration;
 
        if (device_handle < 0)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
@@ -535,11 +539,10 @@ static int _get_file_duration(int device_handle, const char *file_path, int *fil
                return HAPTIC_MODULE_OPERATION_FAILED;
        }
 
-       status = GetHapticBufferDuration(vibe_buffer, &duration);
+       status = GetBufferDuration(vibe_buffer, &duration);
        free(vibe_buffer);
        if (status < 0) {
                MODULE_ERROR("GetHapticBufferDuration fail: %d", status);
-               free(vibe_buffer);
                return HAPTIC_MODULE_OPERATION_FAILED;
        }
 
@@ -561,14 +564,13 @@ static int _get_buffer_duration(int device_handle, const unsigned char *vibe_buf
        if (buffer_duration == NULL)
                return HAPTIC_MODULE_INVALID_ARGUMENT;
 
-       status = GetHapticBufferDuration(vibe_buffer, &duration);
+       status = GetBufferDuration(vibe_buffer, &duration);
        if (status < 0) {
                MODULE_ERROR("GetHapticBufferDuration fail: %d", status);
                return HAPTIC_MODULE_OPERATION_FAILED;
        }
 
        *buffer_duration = duration;
-
        return HAPTIC_MODULE_ERROR_NONE;
 }
 
index 55e5a34..52e51b4 100644 (file)
@@ -130,7 +130,7 @@ static int __sysnoti_send(struct sysnoti_type *msg)
        return ret;
 }
 
-static int __haptic_call_predef_action(const char *type, int num, ...)
+int __haptic_call_predef_action(const char *type, int num, ...)
 {
        struct sysnoti_type msg;
        char *args;
@@ -158,16 +158,3 @@ static int __haptic_call_predef_action(const char *type, int num, ...)
        return __sysnoti_send(&msg);
 }
 
-void __haptic_predefine_action(int prop, int val)
-{
-       char pid_buf[255];
-       char prop_buf[255];
-       char val_buf[255];
-
-       snprintf(pid_buf, sizeof(pid_buf), "%d", getpid());
-       snprintf(prop_buf, sizeof(prop_buf), "%d", prop);
-       snprintf(val_buf, sizeof(val_buf), "%d", val);
-
-       MODULE_LOG("pid : %d, type : %d, val : %d", getpid(), prop, val);
-       __haptic_call_predef_action(PREDEF_HAPTIC, HAPTIC_PARAM_CNT, pid_buf, prop_buf, val_buf);
-}
index 9d46f44..57ba588 100644 (file)
@@ -3,7 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 SET(DEPENDENTS "dlog haptic-plugin")
 
 SET(SRCS
-       src/haptic_module_internal.c)
+       src/haptic.c)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(rpkgs REQUIRED ${DEPENDENTS})