if there isnt' haptic resource, it plays monotone
authorjy910.yun <jy910.yun@samsung.com>
Thu, 6 Sep 2012 03:59:06 +0000 (12:59 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Thu, 6 Sep 2012 03:59:06 +0000 (12:59 +0900)
packaging/libsvi.spec
svi.c

index 800d25a..24bd566 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       libsvi
 Summary:    SVI
 Version:    0.1.2
-Release:    7
+Release:    8
 Group:      System/Libraries
 License:    Apache License, Version 2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -50,6 +50,10 @@ rm -rf %{buildroot}
 %{_libdir}/pkgconfig/svi.pc
 
 %changelog
+* Thr Sep 06 2012 - Jiyoung Yun <jy910.yun@samsung.com>
+- if there isnt' haptic resource, it plays monotone
+- Tag : libsvi_0.1.2-8
+
 * Mon Aug 20 2012 - Jiyoung Yun <jy910.yun@samsung.com>
 - Re-uploaded because prev commit is not supply on tizen_build project
 - Tag : libsvi_0.1.2-7
diff --git a/svi.c b/svi.c
index 75a942a..bb797ed 100755 (executable)
--- a/svi.c
+++ b/svi.c
@@ -300,6 +300,7 @@ API int svi_play_vib(int handle, vibration_type vibration_key)
 {
        int ret_vib = SVI_SUCCESS;
        int vib_lev = 0;
+       int file_status = -1;
 
        if (handle < 0) {
                SVILOG("ERROR!! Please call svi_init() for vibration init ");
@@ -317,22 +318,32 @@ API int svi_play_vib(int handle, vibration_type vibration_key)
 
                        if (vibstatus != 0) {
 
+                               file_status = 1;
                                struct stat buf;
                                if(stat(haptic_file[vibration_key], &buf)) { /*check file existence*/
                                        SVILOG("ERROR!! %s is not presents", haptic_file[vibration_key]);
                                        if(__svi_restore_default_file(SVI_TYPE_VIB, vibration_key) == SVI_ERROR) {
                                                SVILOG("ERROR!! __svi_restore_default_file(%d/%d) error", SVI_TYPE_VIB, vibration_key);
-                                               return SVI_ERROR;
+                                               file_status = 0;
+                                               SVILOG("file_status is changed (status : %d)", file_status);
                                        } else {
                                                SVILOG("%s is restored", haptic_file[vibration_key]);
                                        }
                                }
 
                                int ret = 0;
-                               ret = device_haptic_play_file(handle, haptic_file[vibration_key], 1, vib_lev);
-                               if(ret < 0) {
-                                       SVILOG("ERROR!! device_haptic_play_file(%s) returned error(%d).", haptic_file[vibration_key], ret);
-                                       return SVI_ERROR;
+                               if (file_status == 0) {
+                                       ret = device_haptic_play_monotone_with_feedback_level(handle, 1000, vib_level);
+                                       if (ret < 0) {
+                                               SVILOG("ERROR!! device_haptic_play_monotone_with_feedback_level returned error(%d).", ret);
+                                               return SVI_ERROR;
+                                       }
+                               } else {
+                                       ret = device_haptic_play_file(handle, haptic_file[vibration_key], 1, vib_lev);
+                                       if(ret < 0) {
+                                               SVILOG("ERROR!! device_haptic_play_file(%s) returned error(%d).", haptic_file[vibration_key], ret);
+                                               return SVI_ERROR;
+                                       }
                                }
                        }
                } else {