From: jy910.yun Date: Thu, 6 Sep 2012 03:59:06 +0000 (+0900) Subject: if there isnt' haptic resource, it plays monotone X-Git-Tag: 2.0_alpha~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e0f199122a2c108e2c8df745293b03ad557b60b;p=platform%2Fcore%2Fsystem%2Flibsvi.git if there isnt' haptic resource, it plays monotone --- diff --git a/packaging/libsvi.spec b/packaging/libsvi.spec index 800d25a..24bd566 100755 --- a/packaging/libsvi.spec +++ b/packaging/libsvi.spec @@ -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 +- if there isnt' haptic resource, it plays monotone +- Tag : libsvi_0.1.2-8 + * Mon Aug 20 2012 - Jiyoung Yun - 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 --- 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 {