diff options
author | pr.jung <pr.jung@samsung.com> | 2018-05-02 19:11:22 +0900 |
---|---|---|
committer | pr.jung <pr.jung@samsung.com> | 2018-05-15 16:57:52 +0900 |
commit | 40e201a944a48856b6e11cfeafa51a6b35bcf457 (patch) | |
tree | 505ead0a820423c4fb0931f766391b1f9ffc7299 | |
parent | dfb96281565e232d1dcff70a49de9b6b8498a83d (diff) | |
download | libsvi-40e201a944a48856b6e11cfeafa51a6b35bcf457.tar.gz libsvi-40e201a944a48856b6e11cfeafa51a6b35bcf457.tar.bz2 libsvi-40e201a944a48856b6e11cfeafa51a6b35bcf457.zip |
Add haptic featuresubmit/tizen/20180611.005638accepted/tizen/unified/20180611.132133
Change-Id: Ia4368aaf2dde249acda91105a0e4a71f5b750fe6
Signed-off-by: pr.jung <pr.jung@samsung.com>
-rwxr-xr-x | doc/feedback_doc.h | 13 | ||||
-rw-r--r-- | include/feedback-internal.h | 2 | ||||
-rw-r--r-- | include/feedback.h | 4 | ||||
-rw-r--r-- | src/feedback.c | 4 | ||||
-rw-r--r-- | src/sound.c | 2 | ||||
-rw-r--r-- | src/vibrator.c | 15 |
6 files changed, 34 insertions, 6 deletions
diff --git a/doc/feedback_doc.h b/doc/feedback_doc.h index ef3b17f..24d3ce5 100755 --- a/doc/feedback_doc.h +++ b/doc/feedback_doc.h @@ -29,6 +29,19 @@ * @section CAPI_SYSTEM_FEEDBACK_MODULE_OVERVIEW Overview * The FEEDBACK API is responsible for playing simple sound and vibration. * It plays sound using mm-sound library and vibration with system framework. + + * @section CAPI_SYSTEM_FEEDBACK_FEATURE Related Features + * This API is related with the following features:\n + * - %http://tizen.org/feature/feedback.vibration\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature List</b>.</a> + * * */ diff --git a/include/feedback-internal.h b/include/feedback-internal.h index d846d64..939f1af 100644 --- a/include/feedback-internal.h +++ b/include/feedback-internal.h @@ -20,7 +20,7 @@ #define __FEEDBACK_INTERNAL_H__ #include <tizen_error.h> -#include "feedback-ids.h" +#include <feedback-ids.h> #include "feedback-ids-internal.h" #ifdef __cplusplus diff --git a/include/feedback.h b/include/feedback.h index f9b1f1f..533eb07 100644 --- a/include/feedback.h +++ b/include/feedback.h @@ -22,7 +22,7 @@ #include <tizen.h> #include <tizen_error.h> -#include "feedback-ids.h" +#include <feedback-ids.h> #ifdef __cplusplus extern "C" { @@ -65,6 +65,7 @@ typedef enum { * @return @c 0 on success, * otherwise a negative error value * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device * @post feedback_deinitialize() * @see feedback_deinitialize() */ @@ -83,6 +84,7 @@ int feedback_initialize(void); * otherwise a negative error value * @retval #FEEDBACK_ERROR_NONE Successful * @retval #FEEDBACK_ERROR_NOT_INITIALIZED Not initialized + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device * @pre feedback_initialize() * @see feedback_initialize() */ diff --git a/src/feedback.c b/src/feedback.c index f8617dd..f8e0dab 100644 --- a/src/feedback.c +++ b/src/feedback.c @@ -463,7 +463,7 @@ API int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e patt } if (type == FEEDBACK_TYPE_VIBRATION) - return FEEDBACK_ERROR_NOT_SUPPORTED; + return FEEDBACK_ERROR_INVALID_PARAMETER; if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= profile->max_pattern) { @@ -502,7 +502,7 @@ API int feedback_set_resource_path(feedback_type_e type, feedback_pattern_e patt if (type == FEEDBACK_TYPE_VIBRATION) { _E("Not supported type"); //LCOV_EXCL_LINE - return FEEDBACK_ERROR_NOT_SUPPORTED; + return FEEDBACK_ERROR_INVALID_PARAMETER; } /* proper device set path */ diff --git a/src/sound.c b/src/sound.c index f6fb699..3daa6f7 100644 --- a/src/sound.c +++ b/src/sound.c @@ -28,7 +28,7 @@ #include <vconf.h> #include <mm_sound_private.h> -#include "feedback-ids.h" +#include <feedback-ids.h> #include "profiles.h" #include "devices.h" #include "log.h" diff --git a/src/vibrator.c b/src/vibrator.c index 5292fa8..616bfee 100644 --- a/src/vibrator.c +++ b/src/vibrator.c @@ -25,6 +25,7 @@ #include <limits.h> #include <vconf.h> #include <sys/stat.h> +#include <system_info.h> #include "feedback.h" #include "profiles.h" @@ -49,7 +50,9 @@ enum haptic_iteration { #define DEFAULT_DURATION 100 #define SIP_DURATION 60 -#define WHITESPACE " \t" +#define WHITESPACE " \t" + +#define VIBRATION_FEATURE "http://tizen.org/feature/feedback.vibration" static int vibstatus; static unsigned int v_handle; @@ -156,6 +159,16 @@ static int get_priority(feedback_pattern_e pattern) static void vibrator_init(void) { int ret; + bool haptic_avail; + + ret = system_info_get_platform_bool(VIBRATION_FEATURE, &haptic_avail); + if (ret < 0) { + v_handle = -ENOTSUP; + return; + } else if (ret == 0 && !haptic_avail) { + v_handle = -ENOTSUP; + return; + } /* Vibration Init */ ret = haptic_open(); |