Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:51:45 +0000 (01:51 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:51:45 +0000 (01:51 +0900)
22 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [changed mode: 0755->0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
SLP_FEEDBACK_PG.h [new file with mode: 0644]
feedback.pc.in [new file with mode: 0644]
include/feedback-file.h [new file with mode: 0644]
include/feedback-ids.h [new file with mode: 0644]
include/feedback-internal.h [new file with mode: 0644]
include/feedback-log.h [new file with mode: 0644]
include/feedback.h [new file with mode: 0644]
include/svi-file.h [new file with mode: 0755]
include/svi-ids.h
include/svi-log.h
include/svi.h
packaging/libfeedback.manifest [new file with mode: 0644]
packaging/libfeedback.spec [new file with mode: 0644]
packaging/libsvi.manifest [new file with mode: 0644]
src/feedback-internal.c [new file with mode: 0644]
src/feedback.c [new file with mode: 0644]
src/svi.c [new file with mode: 0644]
svi.pc.in [changed mode: 0755->0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..d14debe
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Jiyoung Yun <jy910.yun@samsung.com>\r
old mode 100755 (executable)
new mode 100644 (file)
index 3e6345a..ce62db9
@@ -1,48 +1,74 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(svi C)
+PROJECT(feedback C)
 
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(EXEC_PREFIX "\${prefix}")
 SET(LIBDIR "\${prefix}/lib")
 SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
 SET(VERSION 0.1.4)
-SET(TESTSVI svi_test)
 
-SET(SRCS svi.c)
-SET(TEST_SRCS test/svi_test.c)
+SET(SRCS
+       src/feedback.c
+       src/feedback-internal.c)
+
+SET(HEADERS
+       SLP_FEEDBACK_PG.h
+       include/feedback.h
+       include/feedback-ids.h)
+
+SET(SVI_NAME svi)
+
+SET(SVI_HEADERS
+       include/svi.h
+       include/svi-ids.h)
+
+SET(SVI_SRCS
+       src/svi.c)
+
+SET(DEPENDENTS "vconf haptic mm-keysound dlog")
+SET(PC_DEPENDENTS "capi-base-common")
+
+SET(PC_NAME ${PROJECT_NAME})
+SET(PC_REQUIRED ${PC_DEPENDENTS})
+SET(PC_LDFLAGS -l${PROJECT_NAME})
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED vconf devman_haptic mm-keysound dlog)
+pkg_check_modules(pkgs REQUIRED ${DEPENDENTS})
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 
-ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
-ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
-ADD_DEFINITIONS("-DDATAFS=\"$ENV{DATADIR}\"")
-
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0)
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 
-ADD_EXECUTABLE(${TESTSVI} ${TEST_SRCS})
-TARGET_LINK_LIBRARIES(${TESTSVI} ${exppkgs_LDFLAGS})
-TARGET_LINK_LIBRARIES(${TESTSVI} ${PROJECT_NAME})
+ADD_LIBRARY(${SVI_NAME} SHARED ${SVI_SRCS})
+SET_TARGET_PROPERTIES(${SVI_NAME} PROPERTIES SOVERSION 0)
+SET_TARGET_PROPERTIES(${SVI_NAME} PROPERTIES VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${SVI_NAME} -L${CMAKE_BINARY_DIR} -lfeedback)
+TARGET_LINK_LIBRARIES(${SVI_NAME} ${pkgs_LDFLAGS})
 
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-#CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
+CONFIGURE_FILE(${SVI_NAME}.pc.in ${SVI_NAME}.pc @ONLY)
+
+FOREACH(hfile ${HEADERS})
+       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME})
+ENDFOREACH(hfile)
+
+FOREACH(hfile ${SVI_HEADERS})
+       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${SVI_NAME})
+ENDFOREACH(hfile)
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(TARGETS ${SVI_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/svi.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/svi-ids.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/SLP_SVI_PG.h DESTINATION include/${PROJECT_NAME})
-INSTALL(TARGETS ${TESTSVI} DESTINATION bin)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SVI_NAME}.pc DESTINATION lib/pkgconfig)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..a06208b
--- /dev/null
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..ccdad52
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
diff --git a/SLP_FEEDBACK_PG.h b/SLP_FEEDBACK_PG.h
new file mode 100644 (file)
index 0000000..5ab2fbd
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ *  libsvi
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seokkyu Jang <seokkyu.jang@samsung.com>
+ * Contact: Sangil Yoon <si83.yoon@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ *
+ * @ingroup    SLP_PG
+ * @defgroup    SVI_PG SVI
+@{
+
+@par SVI Programming Guide
+
+<h1 class="pg">Brief Information</h1>
+- Sound & Vibration UI
+- Convenient API
+- Header File : svi.h
+
+<h1 class="pg"> Introduction</h1>
+<h2 class="pg"> Purpose of this document</h2>
+The purpose of this document is to describe how applications can use Sound and Vibration Interface Library APIs.\n
+This document gives only programming guidelines to application engineers.
+
+<h2 class="pg"> Scope</h2>
+The scope of this document is limited to Samsung platform Sound and Vibration Interface Library API usage.
+
+<h1 class="pg"> Architecture</h1>
+<h2 class="pg"> Architecture overview</h2>
+Sound and Vibration Interface Library (SVI) is responsible for playing simple sound and vibration.\n
+SVI play sound using mm-sound library and play vibration with device framework.
+
+@image html svi.png "SVI diagram" 
+
+<h2 class="pg"> SLP Features</h2>
+Sound and Vibration Interface Library has the following features:\n
+
+ - Play Sound
+       - It can play simple sound with predefined key.
+
+ - Play Vibration
+       - It can play simple vibration with predefined key.
+
+<h2 class="pg">API list and description</h2>
+ - int svi_init(int *handle)
+       - Unload sound profile and status, and close haptic device.
+
+ - int svi_fini(int handle)
+       - Finalize audio ui library.
+       - Unload sound profile and status, and close haptic device.
+
+ - int svi_play_sound(int handle, sound_type sound_key)
+       - Play simple sound.
+
+ - int svi_play_vib(int handle, vibration_type vibration_key)
+       - Play simple vibration.
+
+ - int svi_play(int handle, vibration_type vibration_key, sound_type sound_key)
+       - Play simple sound and vibration.
+
+<h1 class="pg">Programming with Sound & Vibration UI</h1>
+
+<h2 class="pg">Defines</h2>
+@code
+#define SVI_SUCCESS    0
+#define SVI_ERROR      -1
+@endcode
+
+<h2 class="pg">Functions</h2>
+@code
+int svi_init(int *handle)
+int svi_fini(int handle)
+int svi_play_sound(int handle, sound_type sound_key)
+int svi_play_vib(int handle, vibration_type vibration_key)
+int svi_play(int handle, vibration_type vibration_key, sound_type sound_key)
+@endcode
+
+<h2 class="pg">Example code</h2>
+@code
+#include <svi.h>
+
+int r = 0;
+int handle = 0;
+
+r = svi_init(&handle);
+if (r != SVI_SUCCESS){
+
+       printf("Cannot initialize svi.\n");     
+
+} else {
+
+       r = svi_play (handle, SVI_VIB_TOUCH, SVI_SND_TOUCH1);
+       if (r != SVI_SUCCESS) {
+               printf("Cannot play sound or vibration.\n");
+       }
+
+       r = svi_play_sound (handle, SVI_SND_TOUCH1);
+       if (r != SVI_SUCCESS) {
+               printf("Cannot play sound.\n");
+       }
+
+       r = svi_play_vib (handle, SVI_VIB_TOUCH);
+       if (r != SVI_SUCCESS) {
+               printf("Cannot play vibration.\n");
+       }
+
+       r = svi_fini(handle);
+       if (r != SVI_SUCCESS) {
+               printf("Cannot close svi.\n");  
+       }
+}
+@endcode
+
+<h2 class="pg">Vibration IDs</h2>
+@code
+       SVI_VIB_TOUCH_TOUCH
+       SVI_VIB_TOUCH_SIP
+       SVI_VIB_TOUCH_HOLD
+       SVI_VIB_TOUCH_MULTI_TAP
+       SVI_VIB_TOUCH_HW_TAP
+       SVI_VIB_TOUCH_HW_HOLD
+       SVI_VIB_TOUCH_KEY00
+       SVI_VIB_TOUCH_KEY01
+       SVI_VIB_TOUCH_KEY02
+       SVI_VIB_TOUCH_KEY03
+       SVI_VIB_TOUCH_KEY04
+       SVI_VIB_TOUCH_KEY05
+       SVI_VIB_TOUCH_KEY06
+       SVI_VIB_TOUCH_KEY07
+       SVI_VIB_TOUCH_KEY08
+       SVI_VIB_TOUCH_KEY09
+       SVI_VIB_TOUCH_KEY_STAR
+       SVI_VIB_TOUCH_KEY_SHARP
+       SVI_VIB_NOTIFICATION_INCOMING_CALL01
+       SVI_VIB_NOTIFICATION_INCOMING_CALL02
+       SVI_VIB_NOTIFICATION_INCOMING_CALL03
+       SVI_VIB_NOTIFICATION_MESSAGE
+       SVI_VIB_NOTIFICATION_EMAIL
+       SVI_VIB_NOTIFICATION_WAKEUP
+       SVI_VIB_NOTIFICATION_SCHEDULE
+       SVI_VIB_NOTIFICATION_TIMER
+       SVI_VIB_NOTIFICATION_GENERAL
+       SVI_VIB_OPERATION_POWER_ON
+       SVI_VIB_OPERATION_POWER_OFF
+       SVI_VIB_OPERATION_CHARGERCONN
+       SVI_VIB_OPERATION_FULLCHARGED
+       SVI_VIB_OPERATION_LOWBATT
+       SVI_VIB_OPERATION_LOCK
+       SVI_VIB_OPERATION_UNLOCK
+       SVI_VIB_OPERATION_CALLCONNECT
+       SVI_VIB_OPERATION_DISCALLCONNECT
+       SVI_VIB_OPERATION_MINUTEMINDER
+       SVI_VIB_OPERATION_VIBRATION
+       SVI_VIB_OPERATION_NEWCHAT
+       SVI_VIB_OPERATION_SENDCHAT
+       SVI_VIB_OPERATION_ONOFFSLIDER
+       SVI_VIB_OPERATION_SHUTTER
+@endcode
+
+<h2 class="pg">Sound IDs</h2>
+@code
+       SVI_SND_TOUCH_TOUCH1
+       SVI_SND_TOUCH_TOUCH2
+       SVI_SND_TOUCH_TOUCH3
+       SVI_SND_TOUCH_SIP
+       SVI_SND_TOUCH_HOLD
+       SVI_SND_TOUCH_MULTI_TAP
+       SVI_SND_TOUCH_HW_TAP
+       SVI_SND_TOUCH_HW_HOLD
+       SVI_SND_TOUCH_KEY00
+       SVI_SND_TOUCH_KEY01
+       SVI_SND_TOUCH_KEY02
+       SVI_SND_TOUCH_KEY03
+       SVI_SND_TOUCH_KEY04
+       SVI_SND_TOUCH_KEY05
+       SVI_SND_TOUCH_KEY06
+       SVI_SND_TOUCH_KEY07
+       SVI_SND_TOUCH_KEY08
+       SVI_SND_TOUCH_KEY09
+       SVI_SND_TOUCH_KEY_STAR
+       SVI_SND_TOUCH_KEY_SHARP
+       SVI_SND_OPERATION_POWERON
+       SVI_SND_OPERATION_POWEROF
+       SVI_SND_OPERATION_CHARGERCONN
+       SVI_SND_OPERATION_FULLCHARGED
+       SVI_SND_OPERATION_LOWBATT
+       SVI_SND_OPERATION_LOCK
+       SVI_SND_OPERATION_UNLOCK
+       SVI_SND_OPERATION_CALLCONN
+       SVI_SND_OPERATION_CALLDISCONN
+       SVI_SND_OPERATION_MINUTE_MINDER
+       SVI_SND_OPERATION_VIBRATION
+       SVI_SND_OPERATION_NEWCHAT
+       SVI_SND_OPERATION_SENTCHAT
+       SVI_SND_OPERATION_ONOFFSLIDER
+       SVI_SND_OPERATION_SCRCAPTURE
+@endcode
+
+*/
+
+/**
+@}
+*/
diff --git a/feedback.pc.in b/feedback.pc.in
new file mode 100644 (file)
index 0000000..392a254
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
diff --git a/include/feedback-file.h b/include/feedback-file.h
new file mode 100644 (file)
index 0000000..b86b28d
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __FEEDBACK_FILE_H__
+#define __FEEDBACK_FILE_H__
+
+#define FEEDBACK_DATA_DIR "/opt/share/svi/"
+#define FEEDBACK_ORIGIN_DATA_DIR "/usr/share/svi/"
+
+#define FEEDBACK_SOUND_DIR FEEDBACK_DATA_DIR"sound/"
+#define FEEDBACK_SOUND_TOUCH_DIR FEEDBACK_SOUND_DIR"touch/"
+#define FEEDBACK_SOUND_OPER_DIR FEEDBACK_SOUND_DIR"operation/"
+
+#define FEEDBACK_HAPTIC_DIR FEEDBACK_DATA_DIR"haptic/"
+#define FEEDBACK_HAPTIC_TOUCH_DIR FEEDBACK_HAPTIC_DIR"touch/"
+#define FEEDBACK_HAPTIC_OPER_DIR FEEDBACK_HAPTIC_DIR"operation/"
+#define FEEDBACK_HAPTIC_NOTI_DIR FEEDBACK_HAPTIC_DIR"notification/"
+#define FEEDBACK_HAPTIC_DEFAULT_DIR FEEDBACK_HAPTIC_DIR"default/"
+
+const char* snd_file[] = {
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       FEEDBACK_SOUND_TOUCH_DIR"touch.wav",
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       FEEDBACK_SOUND_TOUCH_DIR"sip.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"sip_backspace.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"sip.wav",
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       FEEDBACK_SOUND_TOUCH_DIR"key0.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key1.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key2.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key3.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key4.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key5.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key6.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key7.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key8.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"key9.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"keyasterisk.wav",
+       FEEDBACK_SOUND_TOUCH_DIR"keysharp.wav",
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       NULL,
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       NULL,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       NULL,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       NULL,
+
+       /* NOTIFICATION : INCOMING : MESSAGE */
+       NULL,
+       /* NOTIFICATION : INCOMING : MESSAGE ALERT ON CALL */
+       NULL,
+       /* NOTIFICATION : INCOMING : EMAIL */
+       NULL,
+       /* NOTIFICATION : INCOMING : EMAIL ALERT ON CALL */
+       NULL,
+       /* NOTIFICATION : ALARM : WAKEUP */
+       NULL,
+       /* NOTIFICATION : ALARM : WAKEUP ALERT ON CALL */
+       NULL,
+       /* NOTIFICATION : ALARM : SCHEDULE */
+       NULL,
+       /* NOTIFICATION : ALARM : SCHEDULE ALERT ON CALL */
+       NULL,
+       /* NOTIFICATION : ALARM : TIMER */
+       NULL,
+       /* NOTIFICATION : ALARM : TIMER ALERT ON CALL */
+       NULL,
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) */
+       NULL,
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) ALERT ON CALL */
+       NULL,
+
+       /* OPERATION : POWER ON/OFF */
+       FEEDBACK_SOUND_OPER_DIR"power_on.wav",
+       NULL,
+       /* OPERATION : CHARGECONN */
+       FEEDBACK_SOUND_OPER_DIR"charger_connection.wav",
+       /* OPERATION : CHARGECONN ALERT ON CALL */
+       FEEDBACK_SOUND_OPER_DIR"charger_connection.wav",
+       /* OPERATION : FULLCHAREGED */
+       FEEDBACK_SOUND_OPER_DIR"fully_charged.wav",
+       /* OPERATION : FULLCHAREGED ALERT ON CALL */
+       FEEDBACK_SOUND_OPER_DIR"fully_charged.wav",
+       /* OPERATION : LOW BATTERY */
+       FEEDBACK_SOUND_OPER_DIR"low_battery.wav",
+       /* OPERATION : LOW BATTERY ALERT ON CALL */
+       FEEDBACK_SOUND_OPER_DIR"low_battery.wav",
+       /* OPERATION : LOCK/UNLOCK */
+       FEEDBACK_SOUND_OPER_DIR"lock.wav",
+       FEEDBACK_SOUND_OPER_DIR"unlock.wav",
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       FEEDBACK_SOUND_OPER_DIR"call_connect.wav",
+       FEEDBACK_SOUND_OPER_DIR"call_disconnect.wav",
+       /* OPERATION : MINUTE MINDER */
+       FEEDBACK_SOUND_OPER_DIR"minute_minder.wav",
+       /* OPERATION : VIBRATION */
+       NULL,
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       FEEDBACK_SOUND_OPER_DIR"shutter.wav",
+       /* OPERATION : LIST RE-ORDER */
+       FEEDBACK_SOUND_OPER_DIR"list_reorder.wav",
+       /* OPERATION : LIST SLIDER */
+       FEEDBACK_SOUND_OPER_DIR"slider_sweep.wav",
+       /* OPERATION : VOLUME KEY */
+       FEEDBACK_SOUND_OPER_DIR"volume_control.wav",
+
+};
+
+const char* haptic_file[] = {
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       NULL,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       NULL,
+       NULL,
+       NULL,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       FEEDBACK_HAPTIC_TOUCH_DIR"touch.tht",
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       FEEDBACK_HAPTIC_TOUCH_DIR"touch.tht",
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       NULL,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       NULL,
+
+       /* NOTIFICATION : INCOMING : MESSAGE */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : INCOMING : MESSAGE ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : INCOMING : EMAIL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : INCOMING : EMAIL ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : ALARM : WAKEUP */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : ALARM : WAKEUP ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : ALARM : SCHEDULE */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : ALARM : SCHEDULE ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : ALARM : TIMER */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : ALARM : TIMER ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+
+       /* OPERATION : POWER ON/OFF */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : CHARGECONN */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : CHARGECONN ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : FULLCHAREGED */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : FULLCHAREGED ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : LOW BATTERY */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : LOW BATTERY ALERT ON CALL */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : LOCK/UNLOCK */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : MINUTE MINDER */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : VIBRATION */
+       FEEDBACK_HAPTIC_DEFAULT_DIR"Basic_call.tht",
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       NULL,
+       /* OPERATION : LIST RE-ORDER */
+       NULL,
+       /* OPERATION : LIST SLIDER */
+       NULL,
+       /* OPERATION : VOLUME KEY */
+       NULL,
+};
+
+#endif //__FEEDBACK_FILE_H__
diff --git a/include/feedback-ids.h b/include/feedback-ids.h
new file mode 100644 (file)
index 0000000..6cdbd8a
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __FEEDBACK_IDS_H__
+#define __FEEDBACK_IDS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file feedback-ids.h
+ * @brief This file contains the feedback API
+ */
+
+/**
+ * @addtogroup FEEDBACK
+ * @{
+ */
+
+/**
+ * @brief Enumerations of the type for feedback interface
+ * @details
+ *
+ */
+typedef enum
+{
+       FEEDBACK_TYPE_NONE,
+       FEEDBACK_TYPE_SOUND,
+       FEEDBACK_TYPE_VIBRATION,
+       FEEDBACK_TYPE_END
+} feedback_type_e;
+
+/**
+ * @brief Enumerations of the system pre-defined patterns for feedback interface
+ * @details
+ * Each feedback pattern can have separate media files of each types.
+ * But Depending on vendor design, pattern may not have any type of file.
+ *
+ */
+typedef enum
+{
+       FEEDBACK_PATTERN_NONE = -1,
+
+       FEEDBACK_PATTERN_TAP = 0,                       /**< feedback pattern when general touch */
+       FEEDBACK_PATTERN_SIP,                           /**< feedback pattern when touch text key */
+       FEEDBACK_PATTERN_SIP_BACKSPACE,                 /**< feedback pattern when touch backspace key */
+       FEEDBACK_PATTERN_MAX_CHARACTER,                 /**< feedback pattern when max character */
+       FEEDBACK_PATTERN_KEY0,                          /**< feedback pattern when touch numeric 0 key */
+       FEEDBACK_PATTERN_KEY1,                          /**< feedback pattern when touch numeric 1 key */
+       FEEDBACK_PATTERN_KEY2,                          /**< feedback pattern when touch numeric 2 key */
+       FEEDBACK_PATTERN_KEY3,                          /**< feedback pattern when touch numeric 3 key */
+       FEEDBACK_PATTERN_KEY4,                          /**< feedback pattern when touch numeric 4 key */
+       FEEDBACK_PATTERN_KEY5,                          /**< feedback pattern when touch numeric 5 key */
+       FEEDBACK_PATTERN_KEY6,                          /**< feedback pattern when touch numeric 6 key */
+       FEEDBACK_PATTERN_KEY7,                          /**< feedback pattern when touch numeric 7 key */
+       FEEDBACK_PATTERN_KEY8,                          /**< feedback pattern when touch numeric 8 key */
+       FEEDBACK_PATTERN_KEY9,                          /**< feedback pattern when touch numeric 9 key */
+       FEEDBACK_PATTERN_KEY_STAR,                      /**< feedback pattern when touch star key */
+       FEEDBACK_PATTERN_KEY_SHARP,                     /**< feedback pattern when touch sharp key */
+       FEEDBACK_PATTERN_HOLD,                          /**< feedback pattern when touch hold */
+       FEEDBACK_PATTERN_MULTI_TAP,                     /**< feedback pattern when multi touch */
+       FEEDBACK_PATTERN_HW_TAP,                        /**< feedback pattern when press hardware key */
+       FEEDBACK_PATTERN_HW_HOLD,                       /**< feedback pattern when holding press hardware key */
+
+       FEEDBACK_PATTERN_MESSAGE,                       /**< feedback pattern when incoming a message */
+       FEEDBACK_PATTERN_MESSAGE_ON_CALL,               /**< feedback pattern when incoming a message on call */
+       FEEDBACK_PATTERN_EMAIL,                         /**< feedback pattern when incoming an email */
+       FEEDBACK_PATTERN_EMAIL_ON_CALL,                 /**< feedback pattern when incoming an email on call */
+       FEEDBACK_PATTERN_WAKEUP,                        /**< feedback pattern when alert wake up call */
+       FEEDBACK_PATTERN_WAKEUP_ON_CALL,                /**< feedback pattern when alert wake up call on call */
+       FEEDBACK_PATTERN_SCHEDULE,                      /**< feedback pattern when alert schedule alarm */
+       FEEDBACK_PATTERN_SCHEDULE_ON_CALL,              /**< feedback pattern when alert schedule alarm on call */
+       FEEDBACK_PATTERN_TIMER,                         /**< feedback pattern when alert timer */
+       FEEDBACK_PATTERN_TIMER_ON_CALL,                 /**< feedback pattern when alert timer on call */
+       FEEDBACK_PATTERN_GENERAL,                       /**< feedback pattern when alert general event */
+       FEEDBACK_PATTERN_GENERAL_ON_CALL,               /**< feedback pattern when alert general event on call */
+
+       FEEDBACK_PATTERN_POWERON,               /**< feedback pattern when power on */
+       FEEDBACK_PATTERN_POWEROFF,              /**< feedback pattern when power off */
+       FEEDBACK_PATTERN_CHARGERCONN,           /**< feedback pattern when connecting charger */
+       FEEDBACK_PATTERN_CHARGERCONN_ON_CALL,   /**< feedback pattern when connecting charger on call */
+       FEEDBACK_PATTERN_FULLCHARGED,           /**< feedback pattern when full charged */
+       FEEDBACK_PATTERN_FULLCHARGED_ON_CALL,   /**< feedback pattern when full charged on call */
+       FEEDBACK_PATTERN_LOWBATT,               /**< feedback pattern when low battery */
+       FEEDBACK_PATTERN_LOWBATT_ON_CALL,       /**< feedback pattern when low battery on call */
+       FEEDBACK_PATTERN_LOCK,                  /**< feedback pattern when lock */
+       FEEDBACK_PATTERN_UNLOCK,                /**< feedback pattern when unlock */
+       FEEDBACK_PATTERN_CALLCONNECT,           /**< feedback pattern when connecting call */
+       FEEDBACK_PATTERN_DISCALLCONNECT,        /**< feedback pattern when disconnecting call */
+       FEEDBACK_PATTERN_MINUTEMINDER,          /**< feedback pattern when minute minder */
+       FEEDBACK_PATTERN_VIBRATION,             /**< feedback pattern when vibration */
+       FEEDBACK_PATTERN_SHUTTER,               /**< feedback pattern when screen capture or camera shutter */
+       FEEDBACK_PATTERN_LIST_REORDER,          /**< feedback pattern when list reorder */
+       FEEDBACK_PATTERN_SLIDER_SWEEP,          /**< feedback pattern when slider sweep */
+       FEEDBACK_PATTERN_VOLUME_KEY,            /**< feedback pattern when pressed volume key */
+
+       FEEDBACK_PATTERN_END,
+
+       /* START : Will be removed */
+       FEEDBACK_PATTERN_TOUCH_TAP = FEEDBACK_PATTERN_TAP,
+       FEEDBACK_PATTERN_TOUCH_MULTI_TAP = FEEDBACK_PATTERN_MULTI_TAP,
+       FEEDBACK_PATTERN_TOUCH_KEY = FEEDBACK_PATTERN_KEY0,
+       FEEDBACK_PATTERN_TOUCH_HOLD = FEEDBACK_PATTERN_HOLD,
+       /* END : Will be removed */
+
+} feedback_pattern_e;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__FEEDBACK_IDS_H__
diff --git a/include/feedback-internal.h b/include/feedback-internal.h
new file mode 100644 (file)
index 0000000..4d8f519
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __FEEDBACK_LEGACY_H__
+#define __FEEDBACK_LEGACY_H__
+
+#include "feedback-ids.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file feedback-legacy.h
+ * @brief This file contains the feedback legacy API
+ */
+
+typedef void* feedback_h;
+
+int _feedback_init(feedback_h *handle);
+int _feedback_fini(feedback_h handle);
+int _feedback_play_sound(feedback_h handle, feedback_pattern_e key);
+int _feedback_play_vibration(feedback_h handle, feedback_pattern_e key);
+int _feedback_set_path(feedback_type_e type, feedback_pattern_e key, char* path);
+int _feedback_get_path(feedback_type_e type, feedback_pattern_e key, char* buf, unsigned int buflen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SVI_H__
diff --git a/include/feedback-log.h b/include/feedback-log.h
new file mode 100644 (file)
index 0000000..f11dfbd
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __FEEDBACK_LOG_H__
+#define __FEEDBACK_LOG_H__
+
+#define FEATURE_FEEDBACK_DLOG
+
+#ifdef FEATURE_FEEDBACK_DLOG
+       #define LOG_TAG "FEEDBACK"
+       #include <dlog.h>
+       #define FEEDBACK_LOG(fmt, args...)       SLOGD(fmt, ##args)
+       #define FEEDBACK_ERROR(fmt, args...)     SLOGE(fmt, ##args)
+#else
+       #define FEEDBACK_LOG(x, ...)
+       #define FEEDBACK_ERROR(x, ...)
+#endif
+
+#endif //__FEEDBACK_LOG_H__
diff --git a/include/feedback.h b/include/feedback.h
new file mode 100644 (file)
index 0000000..787cea6
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __FEEDBACK_H__
+#define __FEEDBACK_H__
+
+#include <tizen_error.h>
+#include "feedback-ids.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file feedback.h
+ * @brief This file contains the feedback API
+ */
+
+/**
+ * @addtogroup FEEDBACK
+ * @{
+ * @breif
+ * This is a feedback API of the UIX Service.
+ * @}
+ */
+
+/**
+ * @addtogroup FEEDBACK
+ * @{
+ */
+
+/**
+ * @brief Enumerations of error codes for the Feedback API.
+ */
+typedef enum
+{
+    FEEDBACK_ERROR_NONE                = TIZEN_ERROR_NONE,                  /**< Successful */
+    FEEDBACK_ERROR_INVALID_PARAMETER   = TIZEN_ERROR_INVALID_PARAMETER,     /**< Invalid parameter */
+    FEEDBACK_ERROR_NOT_INITIALIZED     = TIZEN_ERROR_SYSTEM_CLASS | 0x52,   /**< Has not yet been Initialized */
+    FEEDBACK_ERROR_OPERATION_FAILED    = TIZEN_ERROR_SYSTEM_CLASS | 0x55,   /**< Operation failed */
+} feedback_error_e;
+
+#define FEEDBACK_SUCCEEDED(n)                ((n) == FEEDBACK_ERROR_NONE)
+#define FEEDBACK_FAILED(n)                   ((n) != FEEDBACK_ERROR_NONE)
+
+/**
+ * @brief Initializes feedback API.
+ *
+ * @remarks
+ * If this function is not called in advance, other function will return #FEEDBACK_ERROR_NOT_INITIALIZED.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FEEDBACK_ERROR_NONE               Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED   Operation failed
+ *
+ * @see feedback_deinitialize()
+ */
+int feedback_initialize(void);
+
+/**
+ * @brief Deinitializes feedback API.
+ *
+ * @details This function must be called when feedback functions are no longer needed.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FEEDBACK_ERROR_NONE                 Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED     Operation failed
+ *
+ * @see feedback_initialize()
+ */
+int feedback_deinitialize(void);
+
+/**
+ * @brief Plays various types of reactions that are pre-defined.
+ *
+ * @details
+ * This functon can be used to react to pre-defined actions. \n
+ * It play various types of system pre-defined media or vibration patterns.
+ *
+ * @remarks
+ * Currently, there are two types of reactions: sound and vibration. \n
+ * Depending on the settings, some types cannot operate.
+ * For example, when set to silent mode, the device doesn't produce any sound.
+ *
+ * @param[in] pattern   The pre-defined pattern
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FEEDBACK_ERROR_NONE               Successful
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int feedback_play(feedback_pattern_e pattern);
+
+/**
+ *
+ * @brief Plays specific type of reactions that are pre-defined.
+ *
+ * @details
+ * This function can be used to react to pre-defined actions. \n
+ * It play specific type of system pre-defined pattern.
+ *
+ * @remarks
+ * Currently, there are two types of reactions: sound and vibration.
+ *
+ * @param[in] type      The pattern type
+ * @param[in] pattern   The pre-defined pattern
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FEEDBACK_ERROR_NONE               Successful
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern);
+
+/**
+ * @brief Gets the file path of resource for the given feedback type and pattern.
+ *
+ * @details
+ * Depending on the type of each pattern resouorce has a different format. \n
+ * Currently, System supports two pattern types. \n
+ * #FEEDBACK_TYPE_SOUND type uses .wav format. \n
+ * #FEEDBACK_TYPE_VIBRATION type uses .ivt format. \n
+ * If the given pattern doesn't have a file for the type, @a path will return NULL.
+ *
+ * @remarks @a path must be released with free() by you.
+ *
+ * @param[in]  type      The pattern type
+ * @param[in]  pattern   The pre-defined pattern
+ * @param[out] path      The file path of resource for feedback type and pattern
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FEEDBACK_ERROR_NONE               Successful
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED   Operation failed
+ *
+ */
+int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e pattern, char **path);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__FEEDBACK_H__
diff --git a/include/svi-file.h b/include/svi-file.h
new file mode 100755 (executable)
index 0000000..119f769
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __SVI_FILE_H__
+#define __SVI_FILE_H__
+
+#define SVI_DATA_DIR "/opt/share/svi/"
+#define SVI_ORIGIN_DATA_DIR "/usr/share/svi/"
+
+#define SVI_SOUND_DIR SVI_DATA_DIR"sound/"
+#define SVI_SOUND_TOUCH_DIR SVI_SOUND_DIR"touch/"
+#define SVI_SOUND_OPER_DIR SVI_SOUND_DIR"operation/"
+
+#define SVI_HAPTIC_DIR SVI_DATA_DIR"haptic/"
+#define SVI_HAPTIC_TOUCH_DIR SVI_HAPTIC_DIR"touch/"
+#define SVI_HAPTIC_OPER_DIR SVI_HAPTIC_DIR"operation/"
+#define SVI_HAPTIC_NOTI_DIR SVI_HAPTIC_DIR"notification/"
+
+const char* snd_file[] = {
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       SVI_SOUND_TOUCH_DIR"touch1.wav",
+       SVI_SOUND_TOUCH_DIR"touch2.wav",
+       SVI_SOUND_TOUCH_DIR"touch3.wav",
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       SVI_SOUND_TOUCH_DIR"sip.wav",
+       SVI_SOUND_TOUCH_DIR"sip_backspace.wav",
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       SVI_SOUND_TOUCH_DIR"key0.wav",
+       SVI_SOUND_TOUCH_DIR"key1.wav",
+       SVI_SOUND_TOUCH_DIR"key2.wav",
+       SVI_SOUND_TOUCH_DIR"key3.wav",
+       SVI_SOUND_TOUCH_DIR"key4.wav",
+       SVI_SOUND_TOUCH_DIR"key5.wav",
+       SVI_SOUND_TOUCH_DIR"key6.wav",
+       SVI_SOUND_TOUCH_DIR"key7.wav",
+       SVI_SOUND_TOUCH_DIR"key8.wav",
+       SVI_SOUND_TOUCH_DIR"key9.wav",
+       SVI_SOUND_TOUCH_DIR"keyasterisk.wav",
+       SVI_SOUND_TOUCH_DIR"keysharp.wav",
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       SVI_SOUND_TOUCH_DIR"hold.wav",
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       SVI_SOUND_TOUCH_DIR"multi_tap.wav",
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       SVI_SOUND_TOUCH_DIR"hw_tap.wav",
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       SVI_SOUND_TOUCH_DIR"hw_hold.wav",
+
+       /* OPERATION : POWER ON/OFF */
+       SVI_SOUND_OPER_DIR"power_on.wav",
+       SVI_SOUND_OPER_DIR"power_off.wav",
+       /* OPERATION : CHARGECONN */
+       SVI_SOUND_OPER_DIR"charger_connection.wav",
+       /* OPERATION : FULLCHAREGED */
+       SVI_SOUND_OPER_DIR"fully_charged.wav",
+       /* OPERATION : LOW BATTERY */
+       SVI_SOUND_OPER_DIR"low_battery.wav",
+       /* OPERATION : LOCK/UNLOCK */
+       SVI_SOUND_OPER_DIR"lock.wav",
+       SVI_SOUND_OPER_DIR"unlock.wav",
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       SVI_SOUND_OPER_DIR"call_connect.wav",
+       SVI_SOUND_OPER_DIR"call_disconnect.wav",
+       /* OPERATION : MINUTE MINDER */
+       SVI_SOUND_OPER_DIR"minute_minder.wav",
+       /* OPERATION : VIBRATION */
+       SVI_SOUND_OPER_DIR"vibration.wav",
+       /* OPERATION : BALLOON MESSAGE SEND/RECV */
+       SVI_SOUND_OPER_DIR"new_chat.wav",
+       SVI_SOUND_OPER_DIR"sent_chat.wav",
+       /* OPERATION : ON/OFF SLIDER */
+       SVI_SOUND_OPER_DIR"on_off_slider.wav",
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       SVI_SOUND_OPER_DIR"shutter.wav",
+       /* OPERATION : LIST RE-ORDER */
+       SVI_SOUND_OPER_DIR"list_reorder.wav",
+       /* OPERATION : LIST SLIDER */
+       SVI_SOUND_OPER_DIR"slider_sweep.wav"
+};
+
+/* led_file and haptic_file should be managed in the same order */
+const char* haptic_file[] = {
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       SVI_HAPTIC_TOUCH_DIR"touch.ivt",
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       SVI_HAPTIC_TOUCH_DIR"sip.ivt",
+       SVI_HAPTIC_TOUCH_DIR"sip_backspace.ivt",
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       SVI_HAPTIC_TOUCH_DIR"key0.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key1.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key2.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key3.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key4.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key5.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key6.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key7.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key8.ivt",
+       SVI_HAPTIC_TOUCH_DIR"key9.ivt",
+       SVI_HAPTIC_TOUCH_DIR"keyasterisk.ivt",
+       SVI_HAPTIC_TOUCH_DIR"keysharp.ivt",
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       SVI_HAPTIC_TOUCH_DIR"hold.ivt",
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       SVI_HAPTIC_TOUCH_DIR"multi_tap.ivt",
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       SVI_HAPTIC_TOUCH_DIR"hw_tap.ivt",
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       SVI_HAPTIC_TOUCH_DIR"hw_hold.ivt",
+
+       /* NOTIFICATION : INCOMING : CALL */
+       SVI_HAPTIC_NOTI_DIR"incoming_call1.ivt",
+       SVI_HAPTIC_NOTI_DIR"incoming_call2.ivt",
+       SVI_HAPTIC_NOTI_DIR"incoming_call3.ivt",
+       SVI_HAPTIC_NOTI_DIR"incoming_call4.ivt",
+       SVI_HAPTIC_NOTI_DIR"incoming_call5.ivt",
+       SVI_HAPTIC_NOTI_DIR"incoming_call6.ivt",
+       /* NOTIFICATION : INCOMING : MESSAGE */
+       SVI_HAPTIC_NOTI_DIR"message.ivt",
+       /* NOTIFICATION : INCOMING : EMAIL */
+       SVI_HAPTIC_NOTI_DIR"email.ivt",
+       /* NOTIFICATION : ALARM : WAKEUP */
+       SVI_HAPTIC_NOTI_DIR"wakeup.ivt",
+       /* NOTIFICATION : ALARM : SCHEDULE */
+       SVI_HAPTIC_NOTI_DIR"schedule.ivt",
+       /* NOTIFICATION : ALARM : TIMER */
+       SVI_HAPTIC_NOTI_DIR"timer.ivt",
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) */
+       SVI_HAPTIC_NOTI_DIR"general.ivt",
+
+       /* OPERATION : POWER ON/OFF */
+       SVI_HAPTIC_OPER_DIR"power_on.ivt",
+       SVI_HAPTIC_OPER_DIR"power_off.ivt",
+       /* OPERATION : CHARGECONN */
+       SVI_HAPTIC_OPER_DIR"charger_connection.ivt",
+       /* OPERATION : FULLCHAREGED */
+       SVI_HAPTIC_OPER_DIR"fully_charged.ivt",
+       /* OPERATION : LOW BATTERY */
+       SVI_HAPTIC_OPER_DIR"low_battery.ivt",
+       /* OPERATION : LOCK/UNLOCK */
+       SVI_HAPTIC_OPER_DIR"lock.ivt",
+       SVI_HAPTIC_OPER_DIR"unlock.ivt",
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       SVI_HAPTIC_OPER_DIR"call_connect.ivt",
+       SVI_HAPTIC_OPER_DIR"call_disconnect.ivt",
+       /* OPERATION : MINUTE MINDER */
+       SVI_HAPTIC_OPER_DIR"minute_minder.ivt",
+       /* OPERATION : VIBRATION */
+       SVI_HAPTIC_OPER_DIR"vibration.ivt",
+       /* OPERATION : BALLOON MESSAGE SEND/RECV */
+       SVI_HAPTIC_OPER_DIR"new_chat.ivt",
+       SVI_HAPTIC_OPER_DIR"sent_chat.ivt",
+       /* OPERATION : ON/OFF SLIDER */
+       SVI_HAPTIC_OPER_DIR"on_off_slider.ivt",
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       SVI_HAPTIC_OPER_DIR"shutter.ivt",
+       /* OPERATION : LIST RE-ORDER */
+       SVI_HAPTIC_OPER_DIR"list_reorder.ivt",
+       /* OPERATION : LIST SLIDER */
+       SVI_HAPTIC_OPER_DIR"slider_sweep.ivt"
+};
+
+#endif //__SVI_FILE_H__
index 0a004d2..330bc86 100755 (executable)
 /*
- *  libsvi
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seokkyu Jang <seokkyu.jang@samsung.com>
- * Contact: Sangil Yoon <si83.yoon@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
+
 #ifndef __SVI_IDS_H__
 #define __SVI_IDS_H__
 
+typedef enum svi_type_t {
+       SVI_TYPE_NONE,
+       SVI_TYPE_SND,
+       SVI_TYPE_VIB,
+       SVI_TYPE_END
+} svi_type;
 
 typedef enum sound_type_t {
-    SVI_SND_NONE = -1,
+       SVI_SND_NONE = -1,
 
-    SVI_SND_TOUCH_TOUCH1 = 0,
-    SVI_SND_TOUCH_TOUCH2,
-    SVI_SND_TOUCH_TOUCH3,
-    SVI_SND_TOUCH_SIP,
-    SVI_SND_TOUCH_HOLD,
-    SVI_SND_TOUCH_MULTI_TAP,
-    SVI_SND_TOUCH_HW_TAP,
-    SVI_SND_TOUCH_HW_HOLD,
-
-    SVI_SND_TOUCH_KEY00,
-    SVI_SND_TOUCH_KEY01,
-    SVI_SND_TOUCH_KEY02,
-    SVI_SND_TOUCH_KEY03,
-    SVI_SND_TOUCH_KEY04,
-    SVI_SND_TOUCH_KEY05,
-    SVI_SND_TOUCH_KEY06,
-    SVI_SND_TOUCH_KEY07,
-    SVI_SND_TOUCH_KEY08,
-    SVI_SND_TOUCH_KEY09,
-    SVI_SND_TOUCH_KEY_STAR,
-    SVI_SND_TOUCH_KEY_SHARP,
-
-    SVI_SND_OPERATION_POWERON,
-    SVI_SND_OPERATION_POWEROFF,
-    SVI_SND_OPERATION_CHARGERCONN,
-    SVI_SND_OPERATION_FULLCHARGED,
-    SVI_SND_OPERATION_LOWBATT,
-    SVI_SND_OPERATION_LOCK,
-    SVI_SND_OPERATION_UNLOCK,
-    SVI_SND_OPERATION_CALLCONN,
-    SVI_SND_OPERATION_CALLDISCONN,
-    SVI_SND_OPERATION_MINUTE_MINDER,
-    SVI_SND_OPERATION_VIBRATION,
-    SVI_SND_OPERATION_NEWCHAT,
-    SVI_SND_OPERATION_SENTCHAT,
-    SVI_SND_OPERATION_ONOFFSLIDER,
-    SVI_SND_OPERATION_SCRCAPTURE,
-       
-    SVI_SND_ENUM_END = 100
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       SVI_SND_TOUCH_TOUCH1 = 0,
+       SVI_SND_TOUCH_TOUCH2,
+       SVI_SND_TOUCH_TOUCH3,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       SVI_SND_TOUCH_SIP,
+       SVI_SND_TOUCH_SIP_BACKSPACE,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       SVI_SND_TOUCH_KEY00,
+       SVI_SND_TOUCH_KEY01,
+       SVI_SND_TOUCH_KEY02,
+       SVI_SND_TOUCH_KEY03,
+       SVI_SND_TOUCH_KEY04,
+       SVI_SND_TOUCH_KEY05,
+       SVI_SND_TOUCH_KEY06,
+       SVI_SND_TOUCH_KEY07,
+       SVI_SND_TOUCH_KEY08,
+       SVI_SND_TOUCH_KEY09,
+       SVI_SND_TOUCH_KEY_STAR,
+       SVI_SND_TOUCH_KEY_SHARP,
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       SVI_SND_TOUCH_HOLD,
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       SVI_SND_TOUCH_MULTI_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       SVI_SND_TOUCH_HW_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       SVI_SND_TOUCH_HW_HOLD,
 
+       /* OPERATION : POWER ON/OFF */
+       SVI_SND_OPERATION_POWERON,
+       SVI_SND_OPERATION_POWEROFF,
+       /* OPERATION : CHARGECONN */
+       SVI_SND_OPERATION_CHARGERCONN,
+       /* OPERATION : FULLCHAREGED */
+       SVI_SND_OPERATION_FULLCHARGED,
+       /* OPERATION : LOW BATTERY */
+       SVI_SND_OPERATION_LOWBATT,
+       /* OPERATION : LOCK/UNLOCK */
+       SVI_SND_OPERATION_LOCK,
+       SVI_SND_OPERATION_UNLOCK,
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       SVI_SND_OPERATION_CALLCONN,
+       SVI_SND_OPERATION_CALLDISCONN,
+       /* OPERATION : MINUTE MINDER */
+       SVI_SND_OPERATION_MINUTE_MINDER,
+       /* OPERATION : VIBRATION */
+       SVI_SND_OPERATION_VIBRATION,
+       /* OPERATION : BALLOON MESSAGE SEND/RECV */
+       SVI_SND_OPERATION_NEWCHAT,
+       SVI_SND_OPERATION_SENTCHAT,
+       /* OPERATION : ON/OFF SLIDER */
+       SVI_SND_OPERATION_ONOFFSLIDER,
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       SVI_SND_OPERATION_SCRCAPTURE,
+       /* OPERATION : LIST RE-ORDER */
+       SVI_SND_OPERATION_LIST_REORDER,
+       /* OPERATION : LIST SLIDER */
+       SVI_SND_OPERATION_SLIDER_SWEEP,
+       SVI_SND_ENUM_END
 } sound_type;
 
 typedef enum vibration_type_t {
        SVI_VIB_NONE = -1,
 
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
        SVI_VIB_TOUCH_TOUCH = 0,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
        SVI_VIB_TOUCH_SIP,
-       SVI_VIB_TOUCH_HOLD,
-       SVI_VIB_TOUCH_MULTI_TAP,
-       SVI_VIB_TOUCH_HW_TAP,
-       SVI_VIB_TOUCH_HW_HOLD,
-
+       SVI_VIB_TOUCH_SIP_BACKSPACE,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
        SVI_VIB_TOUCH_KEY00,
        SVI_VIB_TOUCH_KEY01,
        SVI_VIB_TOUCH_KEY02,
@@ -91,34 +112,67 @@ typedef enum vibration_type_t {
        SVI_VIB_TOUCH_KEY09,
        SVI_VIB_TOUCH_KEY_STAR,
        SVI_VIB_TOUCH_KEY_SHARP,
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       SVI_VIB_TOUCH_HOLD,
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       SVI_VIB_TOUCH_MULTI_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       SVI_VIB_TOUCH_HW_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       SVI_VIB_TOUCH_HW_HOLD,
 
+       /* NOTIFICATION : INCOMING : CALL */
        SVI_VIB_NOTIFICATION_INCOMING_CALL01,
        SVI_VIB_NOTIFICATION_INCOMING_CALL02,
        SVI_VIB_NOTIFICATION_INCOMING_CALL03,
+       SVI_VIB_NOTIFICATION_INCOMING_CALL04,
+       SVI_VIB_NOTIFICATION_INCOMING_CALL05,
+       SVI_VIB_NOTIFICATION_INCOMING_CALL06,
+       /* NOTIFICATION : INCOMING : MESSAGE */
        SVI_VIB_NOTIFICATION_MESSAGE,
+       /* NOTIFICATION : INCOMING : EMAIL */
        SVI_VIB_NOTIFICATION_EMAIL,
+       /* NOTIFICATION : ALARM : WAKEUP */
        SVI_VIB_NOTIFICATION_WAKEUP,
+       /* NOTIFICATION : ALARM : SCHEDULE */
        SVI_VIB_NOTIFICATION_SCHEDULE,
+       /* NOTIFICATION : ALARM : TIMER */
        SVI_VIB_NOTIFICATION_TIMER,
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) */
        SVI_VIB_NOTIFICATION_GENERAL,
-    
+
+       /* OPERATION : POWER ON/OFF */
        SVI_VIB_OPERATION_POWER_ON,
        SVI_VIB_OPERATION_POWER_OFF,
+       /* OPERATION : CHARGECONN */
        SVI_VIB_OPERATION_CHARGERCONN,
-       SVI_VIB_OPERATION_FULLYCHARGED,
-       SVI_VIB_OPERATION_LOTBATT,
+       /* OPERATION : FULLCHAREGED */
+       SVI_VIB_OPERATION_FULLCHARGED,
+       /* OPERATION : LOW BATTERY */
+       SVI_VIB_OPERATION_LOWBATT,
+       /* OPERATION : LOCK/UNLOCK */
        SVI_VIB_OPERATION_LOCK,
        SVI_VIB_OPERATION_UNLOCK,
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
        SVI_VIB_OPERATION_CALLCONNECT,
        SVI_VIB_OPERATION_DISCALLCONNECT,
+       /* OPERATION : MINUTE MINDER */
        SVI_VIB_OPERATION_MINUTEMINDER,
+       /* OPERATION : VIBRATION */
        SVI_VIB_OPERATION_VIBRATION,
+       /* OPERATION : BALLOON MESSAGE SEND/RECV */
        SVI_VIB_OPERATION_NEWCHAT,
        SVI_VIB_OPERATION_SENDCHAT,
+       /* OPERATION : ON/OFF SLIDER */
        SVI_VIB_OPERATION_ONOFFSLIDER,
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
        SVI_VIB_OPERATION_SHUTTER,
+       /* OPERATION : LIST RE-ORDER */
+       SVI_VIB_OPERATION_LIST_REORDER,
+       /* OPERATION : LIST SLIDER */
+       SVI_VIB_OPERATION_SLIDER_SWEEP,
 
-       SVI_VIB_ENUM_END = 100
+       SVI_VIB_ENUM_END
 
 } vibration_type;
 
index a5c4bb0..eef6941 100755 (executable)
@@ -1,25 +1,21 @@
 /*
- *  libsvi
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seokkyu Jang <seokkyu.jang@samsung.com>
- * Contact: Sangil Yoon <si83.yoon@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
+
 #ifndef __SVI_LOG_H__
 #define __SVI_LOG_H__
 
index 34c97c8..bbef08a 100755 (executable)
@@ -1,25 +1,21 @@
 /*
- *  libsvi
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seokkyu Jang <seokkyu.jang@samsung.com>
- * Contact: Sangil Yoon <si83.yoon@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
+
 #ifndef __SVI_H__
 #define __SVI_H__
 
@@ -27,7 +23,7 @@
  * @addtogroup APPLICATION_FRAMEWORK
  * @{
  *
- * @defgroup    SVI SVI 
+ * @defgroup    SVI SVI
  * @brief       A library for playing sound and vibration.
  *
  * @section Header To use Them:
@@ -39,6 +35,7 @@
  * @code
        SVI_VIB_TOUCH_TOUCH
        SVI_VIB_TOUCH_SIP
+       SVI_VIB_TOUCH_SIP_BACKSPACE
        SVI_VIB_TOUCH_HOLD
        SVI_VIB_TOUCH_MULTI_TAP
        SVI_VIB_TOUCH_HW_TAP
        SVI_VIB_NOTIFICATION_SCHEDULE
        SVI_VIB_NOTIFICATION_TIMER
        SVI_VIB_NOTIFICATION_GENERAL
-    
+
        SVI_VIB_OPERATION_POWER_ON
        SVI_VIB_OPERATION_POWER_OFF
        SVI_VIB_OPERATION_CHARGERCONN
-       SVI_VIB_OPERATION_FULLYCHARGED
-       SVI_VIB_OPERATION_LOTBATT
+       SVI_VIB_OPERATION_FULLCHARGED
+       SVI_VIB_OPERATION_LOWBATT
        SVI_VIB_OPERATION_LOCK
        SVI_VIB_OPERATION_UNLOCK
        SVI_VIB_OPERATION_CALLCONNECT
@@ -82,6 +79,8 @@
        SVI_VIB_OPERATION_SENDCHAT
        SVI_VIB_OPERATION_ONOFFSLIDER
        SVI_VIB_OPERATION_SHUTTER
+       SVI_VIB_OPERATION_LIST_REORDER
+       SVI_VIB_OPERATION_SLIDER_SWEEP
  * @endcode
  *
  * @section Snd_IDs Sound IDs
@@ -90,6 +89,7 @@
     SVI_SND_TOUCH_TOUCH2
     SVI_SND_TOUCH_TOUCH3
     SVI_SND_TOUCH_SIP
+    SVI_SND_TOUCH_SIP_BACKSPACE
     SVI_SND_TOUCH_HOLD
     SVI_SND_TOUCH_MULTI_TAP
     SVI_SND_TOUCH_HW_TAP
     SVI_SND_OPERATION_SENTCHAT
     SVI_SND_OPERATION_ONOFFSLIDER
     SVI_SND_OPERATION_SCRCAPTURE
+    SVI_SND_OPERATION_LIST_REORDER
+    SVI_SND_OPERATION_SLIDER_SWEEP
  * @endcode
  */
 
@@ -141,9 +143,6 @@ extern "C"
 #define SVI_SUCCESS    0
 #define SVI_ERROR      -1
 
-#define SVI_TYPE_SND 0
-#define SVI_TYPE_VIB 1
-
 /**
  * \par Description:
  * Initialize audio ui library.\n
@@ -171,7 +170,7 @@ extern "C"
  * External Apps.
  *
  * \par Related functions:
- * svi_fini() 
+ * svi_fini()
  *
  * \par Known issues/bugs:
  * None
@@ -197,23 +196,23 @@ extern "C"
  * int handle = 0;
  *
  * r = svi_init(&handle); //Initialize SVI
- * 
+ *
  * if ( r != SVI_SUCCESS ) {
- *     printf("Cannot initialize SVI.\n");     
+ *     printf("Cannot initialize SVI.\n");
  *     svi_fini(handle); //If initialization is failed, finalize SVI directly
  * } else {
  *
- *     r = svi_play (handle, SVI_VIB_TOUCH_TOUCH, SVI_SND_TOUCH_TOUCH1); //Play sound and vibration 
+ *     r = svi_play (handle, SVI_VIB_TOUCH_TOUCH, SVI_SND_TOUCH_TOUCH1); //Play sound and vibration
  *     if (r != SVI_SUCCESS) {
  *             printf("Cannot play sound or vibration.\n");
  *     }
  *
  *     r = svi_fini(handle); //Finalize SVI
  *     if (r != SVI_SUCCESS) {
- *             printf("Cannot close SVI.\n");  
+ *             printf("Cannot close SVI.\n");
  *     }
  * }
- *                 
+ *
  * ...
  * \endcode
  */
@@ -247,7 +246,7 @@ int svi_init(int *handle);
  * External Apps.
  *
  * \par Related functions:
- * svi_init() 
+ * svi_init()
  *
  * \par Known issues/bugs:
  * None
@@ -273,9 +272,9 @@ int svi_init(int *handle);
  * int handle = 0;
  *
  * r = svi_init(&handle); //Initialize SVI
- * 
+ *
  * if ( r != SVI_SUCCESS ) {
- *     printf("Cannot initialize SVI.\n");     
+ *     printf("Cannot initialize SVI.\n");
  *     svi_fini(handle); //If initialization is failed, finalize SVI directly
  * } else {
  *
@@ -286,10 +285,10 @@ int svi_init(int *handle);
  *
  *     r = svi_fini(handle); //Finalize SVI
  *     if (r != SVI_SUCCESS) {
- *             printf("Cannot close SVI.\n");  
+ *             printf("Cannot close SVI.\n");
  *     }
  * }
- *                 
+ *
  * ...
  * \endcode
  */
@@ -348,25 +347,25 @@ int svi_fini(int handle);
  * ...
  * int r = 0;
  * int handle = 0;
- * 
+ *
  * r = svi_init(&handle); //Initialize SVI
- * 
+ *
  * if ( r != SVI_SUCCESS ) {
- *     printf("Cannot initialize SVI.\n");     
+ *     printf("Cannot initialize SVI.\n");
  *     svi_fini(handle); //If initialization is failed, finalize SVI directly
  * } else {
  *
- *     r = svi_play_sound (handle, SVI_SND_TOUCH_TOUCH1); //Play sound 
+ *     r = svi_play_sound (handle, SVI_SND_TOUCH_TOUCH1); //Play sound
  *     if (r != SVI_SUCCESS) {
  *             printf("Cannot play sound or vibration.\n");
  *     }
  *
  *     r = svi_fini(handle); //Finalize SVI
  *     if (r != SVI_SUCCESS) {
- *             printf("Cannot close SVI.\n");  
+ *             printf("Cannot close SVI.\n");
  *     }
  * }
- *                 
+ *
  * ...
  * \endcode
  */
@@ -424,11 +423,11 @@ int svi_play_sound(int handle, sound_type sound_key);
  * ...
  * int r = 0;
  * int handle = 0;
- * 
+ *
  * r = svi_init(&handle); //Initialize SVI
- * 
+ *
  * if ( r != SVI_SUCCESS ) {
- *     printf("Cannot initialize SVI.\n");     
+ *     printf("Cannot initialize SVI.\n");
  *     svi_fini(handle); //If initialization is failed, finalize SVI directly
  * } else {
  *
@@ -439,10 +438,10 @@ int svi_play_sound(int handle, sound_type sound_key);
  *
  *     r = svi_fini(handle); //Finalize SVI
  *     if (r != SVI_SUCCESS) {
- *             printf("Cannot close SVI.\n");  
+ *             printf("Cannot close SVI.\n");
  *     }
  * }
- *                 
+ *
  * ...
  * \endcode
  */
@@ -501,11 +500,11 @@ int svi_play_vib(int handle, vibration_type vibration_key);
  * ...
  * int r = 0;
  * int handle = 0;
- * 
+ *
  * r = svi_init(&handle); //Initialize SVI
- * 
+ *
  * if ( r != SVI_SUCCESS ) {
- *     printf("Cannot initialize SVI.\n");     
+ *     printf("Cannot initialize SVI.\n");
  *     svi_fini(handle); //If initialization is failed, finalize SVI directly.
  * } else {
  *
@@ -516,10 +515,10 @@ int svi_play_vib(int handle, vibration_type vibration_key);
  *
  *     r = svi_fini(handle); //Finalize SVI
  *     if (r != SVI_SUCCESS) {
- *             printf("Cannot close SVI.\n");  
+ *             printf("Cannot close SVI.\n");
  *     }
  * }
- *                 
+ *
  * ...
  * \endcode
  */
@@ -528,13 +527,77 @@ int svi_play(int handle, vibration_type vibration_key, sound_type sound_key);
 
 /**
  * \par Description:
- * Get filepath from predefined sound & vibration.\n
+ * Set filepath for sound & vibration pattern.\n
  *
  * \par Purpose:
- * This API is used for getting filepath of predefined sound or vibration.
+ * This API is used for setting filepath of sound & vibration pattern.
  *
  * \par Typical use case:
- * If user want to get filepath of sound or vibration for predefined simple pattern, he(or she) can use this API.
+ * In case that user want to set filepath of sound or vibration pattern.
+ *
+ * \par Method of function operation:
+ * SVI uses multimedia sound library and device manager library.
+ *
+ * \par Important notes:
+ * None
+ *
+ * \param svi_type     [in]    svi_type(sound, vibration).
+ * \param svi_enum     [in]    predefined enum_type.
+ * \param path         [in]    file path.
+ *
+ * \return Return Type (int) \n
+ * - SVI_SUCCESS       - \n
+ * - SVI_ERROR - \n
+ *
+ * \par Prospective clients:
+ * External Apps.
+ *
+ * \par Related functions:
+ * None
+ *
+ * \par Known issues/bugs:
+ * None
+ *
+ * \pre
+ * None
+ *
+ * \post
+ * None
+ *
+ * \see
+ * None
+ *
+ * \remarks
+ * None
+ *
+ * \par Sample code:
+ * \code
+ * ...
+ * #include <svi.h>
+ * ...
+ * int r = 0;
+ * char *path[512] = "/mnt/ums/sound/sound.wav";
+ *
+ * r = svi_set_path(SVI_SND_TYPE, SVI_SND_TOUCH_TOUCH1, path);
+ *
+ * if ( r != SVI_SUCCESS ) {
+ *     printf("Fail.\n");
+ * }
+ * ...
+ * \endcode
+ */
+/*================================================================================================*/
+int svi_set_path(int svi_type, int svi_enum, char* path);
+
+/**
+ * \par Description:
+ * Get filepath for sound & vibration pattern.\n
+ *
+ * \par Purpose:
+ * This API is used for getting filepath of sound & vibration pattern.
+ *
+ * \par Typical use case:
+ * In case that user want to get filepath of sound or vibration pattern.
  *
  * \par Method of function operation:
  * SVI uses multimedia sound library and device manager library.
@@ -578,13 +641,13 @@ int svi_play(int handle, vibration_type vibration_key, sound_type sound_key);
  * #include <svi.h>
  * ...
  * int r = 0;
- * char buf[256] = {0,};
- * 
+ * char buf[512] = {0,};
+ *
  * r = svi_get_path(SVI_SND_TYPE, SVI_SND_TOUCH_TOUCH1, buf, sizeof(buf));
- * 
+ *
  * if ( r != SVI_SUCCESS ) {
- *     printf("Fail.\n");      
- * }              
+ *     printf("Fail.\n");
+ * }
  * ...
  * \endcode
  */
diff --git a/packaging/libfeedback.manifest b/packaging/libfeedback.manifest
new file mode 100644 (file)
index 0000000..f13bba5
--- /dev/null
@@ -0,0 +1,9 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+       <assign>
+               <filesystem path="/usr/bin/svi_test" exec_label="_"/>
+       </assign>
+</manifest>
+
diff --git a/packaging/libfeedback.spec b/packaging/libfeedback.spec
new file mode 100644 (file)
index 0000000..cd1fa55
--- /dev/null
@@ -0,0 +1,94 @@
+Name:       libfeedback
+Summary:    Feedback library
+Version:    0.1.2
+Release:    21
+Group:      System/Libraries
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+Source1:       libsvi.manifest
+source2:       libfeedback.manifest
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(mm-keysound)
+BuildRequires:  pkgconfig(haptic)
+BuildRequires:  pkgconfig(capi-base-common)
+
+%description
+Feedback library for playing sound, vibration and led
+
+
+%package -n libfeedback-devel
+Summary:    Feedback library for (devel)
+Group:      Development/Libraries
+Requires:   libfeedback = %{version}-%{release}
+
+%description -n libfeedback-devel
+Feedback library for playing sound, vibration and led (devel)
+
+%package -n libsvi
+Summary:       SVI library
+Group:         Development/Libraries
+Requires:      libfeedback = %{version}-%{release}
+
+%description -n libsvi
+SVI library
+
+%package -n libsvi-devel
+Summary:       SVI library for (devel)
+Group:         Development/Libraries
+Requires:      libsvi = %{version}-%{release}
+
+%description -n libsvi-devel
+SVI library (devel)
+
+
+%prep
+%setup -q 
+
+%build
+cp %{SOURCE1} .
+cp %{SOURCE2} .
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+make
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest libfeedback.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libfeedback.so.*
+
+%files -n libfeedback-devel
+%defattr(-,root,root,-)
+%{_includedir}/feedback/*.h
+%{_libdir}/libfeedback.so
+%{_libdir}/pkgconfig/feedback.pc
+
+%files -n libsvi
+%manifest libsvi.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libsvi.so.*
+
+%files -n libsvi-devel
+%defattr(-,root,root-)
+%{_includedir}/svi/*.h
+%{_libdir}/libsvi.so
+%{_libdir}/pkgconfig/svi.pc
+
+%changelog
+* Mon Dec 10 2012 - Jae-young Hwang <j-zero.hwang@samsung.com>
+- Revise _feedback_play_vibration function for playing tht files.
+- Tag : libfeedback_0.1.2-17
+
+* Wed Nov 21 2012 - Jiyoung Yun <jy910.yun@samsung.com>
+- add FEEDBACK_PATTERN_MAX_CHARACTER enum
+- Tag : libfeedback_0.1.2-16
diff --git a/packaging/libsvi.manifest b/packaging/libsvi.manifest
new file mode 100644 (file)
index 0000000..81ace0c
--- /dev/null
@@ -0,0 +1,6 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
+
diff --git a/src/feedback-internal.c b/src/feedback-internal.c
new file mode 100644 (file)
index 0000000..8b73987
--- /dev/null
@@ -0,0 +1,524 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <mm_sound_private.h>
+#include <vconf.h>
+#include <haptic.h>
+
+#include <fcntl.h>
+#include <errno.h>
+
+#include "feedback.h"
+#include "feedback-internal.h"
+#include "feedback-file.h"
+#include "feedback-log.h"
+
+#define FEEDBACK_RETRY_CNT       1
+#define MAX_FILE_PATH          512
+
+static int soundon = -1;
+static int noti_level = -1;
+static int vib_level = -1;
+static int sndstatus = -1;
+static int vibstatus = -1;
+static int callstatus = -1;
+
+static void __feedback_soundon_cb(keynode_t *key, void* data)
+{
+       soundon = vconf_keynode_get_int(key);
+       FEEDBACK_LOG("[[[[[[[[[[[[[[soundon changed!! new soundon => %d", soundon);
+       return;
+}
+
+static void __feedback_vib_cb(keynode_t *key, void* data)
+{
+       vib_level = vconf_keynode_get_int(key);
+       FEEDBACK_LOG("[[[[[[[[[[[[[[vib_level changed!! new vib_level => %d", vib_level);
+       return;
+}
+
+static void __feedback_noti_cb(keynode_t *key, void* data)
+{
+       noti_level = vconf_keynode_get_int(key);
+       FEEDBACK_LOG("[[[[[[[[[[[[[[noti_level changed!! new noti_level => %d", noti_level);
+       return;
+}
+
+static void __feedback_sndstatus_cb(keynode_t *key, void* data)
+{
+       sndstatus = vconf_keynode_get_bool(key);
+       FEEDBACK_LOG("[[[[[[[[[[[[[[sndstatus changed!! new sndstatus => %d", sndstatus);
+       return;
+}
+
+static void __feedback_vibstatus_cb(keynode_t *key, void* data)
+{
+       vibstatus = vconf_keynode_get_bool(key);
+       FEEDBACK_LOG("[[[[[[[[[[[[[[vibstatus changed!! new vibstatus => %d", vibstatus);
+       return;
+}
+
+static void __feedback_callstatus_cb(keynode_t *key, void* data)
+{
+       callstatus = vconf_keynode_get_int(key);
+       FEEDBACK_LOG("[[[[[[[[[[[[[[callstatus changed!! new callstatus => %d", callstatus);
+       return;
+}
+
+static feedback_pattern_e __feedback_get_alert_on_call_key(feedback_pattern_e pattern)
+{
+       switch(pattern) {
+       case FEEDBACK_PATTERN_MESSAGE:
+       case FEEDBACK_PATTERN_EMAIL:
+       case FEEDBACK_PATTERN_WAKEUP:
+       case FEEDBACK_PATTERN_SCHEDULE:
+       case FEEDBACK_PATTERN_TIMER:
+       case FEEDBACK_PATTERN_GENERAL:
+       case FEEDBACK_PATTERN_CHARGERCONN:
+       case FEEDBACK_PATTERN_FULLCHARGED:
+       case FEEDBACK_PATTERN_LOWBATT:
+               return (feedback_pattern_e)(pattern+1);
+       default:
+               break;
+       }
+
+       return pattern;
+}
+
+static haptic_priority_e __feedback_get_priority(feedback_pattern_e pattern)
+{
+       if (pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD)
+               return HAPTIC_PRIORITY_MIN;
+
+       return HAPTIC_PRIORITY_MIDDLE;
+}
+
+static volume_type_t __feedback_get_volume_type(feedback_pattern_e pattern)
+{
+       if (pattern == FEEDBACK_PATTERN_TAP)
+               return VOLUME_TYPE_SYSTEM|VOLUME_GAIN_TOUCH;
+       else if (pattern >= FEEDBACK_PATTERN_KEY0 && pattern <= FEEDBACK_PATTERN_KEY_SHARP)
+               return VOLUME_TYPE_SYSTEM|VOLUME_GAIN_DIALER;
+       else if (pattern == FEEDBACK_PATTERN_VOLUME_KEY)
+               return VOLUME_TYPE_RINGTONE;
+
+       return VOLUME_TYPE_SYSTEM;
+}
+
+static int __feedback_get_haptic_level(feedback_pattern_e pattern)
+{
+       int level = -1;
+
+       if (pattern >= FEEDBACK_PATTERN_MESSAGE && pattern <= FEEDBACK_PATTERN_GENERAL_ON_CALL)
+               level = noti_level;
+       else
+               level = vib_level;
+
+       FEEDBACK_LOG("Call status : %d, pattern : %d, level : %d", callstatus, pattern, level);
+       if (callstatus != VCONFKEY_CALL_OFF) {
+               pattern = __feedback_get_alert_on_call_key(pattern);
+               FEEDBACK_LOG("Call status is connected or connecting. pattern changed : %d", pattern);
+
+               // if call status is ON, vibration magnitude is 20%
+               level = (int)(level*0.2f);
+               level = (level < 1) ? 1 : level;
+               FEEDBACK_LOG("level changed : %d", level);
+       }
+
+       // START : Temporary code
+       // Casue : Setting vconf of intensity(feedback) is between 0 and 5.
+       //         the vconf will be changed but not yet.
+       level = level*20;
+       // END
+
+       return level;
+}
+
+static bool __feedback_get_always_alert_case(feedback_pattern_e pattern)
+{
+       switch(pattern) {
+       case FEEDBACK_PATTERN_WAKEUP:
+       case FEEDBACK_PATTERN_WAKEUP_ON_CALL:
+               return true;
+       default:
+               break;
+       }
+       return false;
+}
+
+static int __feedback_change_symlink(const char *sym_path, const char *new_path)
+{
+       struct stat buf;
+
+       if (sym_path == NULL || strlen(sym_path) == 0) {
+               FEEDBACK_ERROR("Invalid parameter : sym_path(NULL)");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (new_path == NULL || strlen(new_path) == 0) {
+               FEEDBACK_ERROR("Invalid paramter : new_path(NULL)");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       // check symbolic link file existence
+       if (stat(sym_path, &buf)) {
+               FEEDBACK_ERROR("file(%s) is not presents", sym_path);
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       if (unlink(sym_path) < 0) {
+               FEEDBACK_LOG("unlink(%s) : %s", sym_path, strerror(errno));
+       }
+
+       if (symlink(new_path, sym_path) < 0) {
+               FEEDBACK_ERROR("symlink(%s) : %s", sym_path, strerror(errno));
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+static int __feedback_restore_default_file(feedback_type_e type, feedback_pattern_e pattern)
+{
+       const char *cur_path = NULL;
+       char default_path[MAX_FILE_PATH] = {0,};
+       char *temp = NULL;
+       int ret = -1;
+
+       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+               FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+               FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (type == FEEDBACK_TYPE_SOUND) {
+               cur_path = snd_file[pattern];
+       } else {
+               cur_path = haptic_file[pattern];
+       }
+
+       // if there isn't cur_path, it already returns before calling this api
+       if (cur_path == NULL || strlen(cur_path) == 0) {
+               FEEDBACK_ERROR("Invalid parameter : cur_path(NULL)");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       temp = strcat(default_path, FEEDBACK_ORIGIN_DATA_DIR);
+       strcat(temp, cur_path+strlen(FEEDBACK_DATA_DIR));
+       FEEDBACK_LOG("default_path : %s", default_path);
+
+       ret = __feedback_change_symlink(cur_path, default_path);
+       if (FEEDBACK_FAILED(ret)) {
+               FEEDBACK_ERROR("change_symlink is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+int _feedback_init(feedback_h *handle)
+{
+       haptic_device_h v_handle = NULL;
+       int ret = -1;
+
+       /* Sound Init */
+       if (vconf_get_int(VCONFKEY_SOUND_STATUS, &soundon) < 0) {
+               FEEDBACK_ERROR("vconf_get_int(VCONFKEY_SOUND_STATUS, &soundon) ==> FAIL!!");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) < 0) {
+               FEEDBACK_ERROR("vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) ==> FAIL!!");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       /* check vibration status */
+       if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) < 0) {
+               FEEDBACK_ERROR("vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) ==> FAIL!!");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       /* check vib_level */
+       if (vconf_get_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, &vib_level) < 0) {
+               FEEDBACK_ERROR("vconf_get_int(VCONFKEY_FEEDBACK_VIBRATION_LEVEL_INT, &vib_level) ==> FAIL!!");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       /* check noti_level */
+       if (vconf_get_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, &noti_level) < 0) {
+               FEEDBACK_ERROR("vconf_get_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, &noti_level) ==> FAIL!!");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       /* check call status */
+       if (vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) < 0) {
+               FEEDBACK_ERROR("vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) ==> FAIL!!");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       /* Vibration Init */
+       ret = haptic_open(HAPTIC_DEVICE_ALL, &v_handle);
+       if (ret != HAPTIC_ERROR_NONE) {
+               FEEDBACK_ERROR("haptic_open(HAPTIC_DEVICE_ALL, &v_handle) ==> FAIL!! : %d", ret);
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       /* add watch for status value */
+       vconf_notify_key_changed(VCONFKEY_SOUND_STATUS, __feedback_soundon_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __feedback_sndstatus_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, __feedback_vibstatus_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, __feedback_vib_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, __feedback_noti_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_CALL_STATE, __feedback_callstatus_cb, NULL);
+
+       FEEDBACK_LOG("vconf_get_int(VCONFKEY_SOUND_STATUS, &soundon) ==> %d", soundon);
+       FEEDBACK_LOG("vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) ==> %d", sndstatus);
+       FEEDBACK_LOG("vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) ==> %d", vibstatus);
+       FEEDBACK_LOG("vconf_get_int(VCONFKEY_FEEDBACK_VIBRATION_LEVEL_INT, &vib_level) ==> %d", vib_level);
+       FEEDBACK_LOG("vconf_get_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, &noti_level) ==> %d", noti_level);
+       FEEDBACK_LOG("vconf_get_int(VCONFKEY_CALL_STATUS, &callstatus) ==> %d", callstatus);
+
+       *handle = (feedback_h)v_handle;
+       return FEEDBACK_ERROR_NONE;
+}
+
+int _feedback_fini(feedback_h handle)
+{
+       int ret = -1;
+
+       if (handle <= 0) {
+               FEEDBACK_ERROR("Invalid parameter : handle(%d)", handle);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = haptic_close((haptic_device_h)handle);
+       if (ret != HAPTIC_ERROR_NONE) {
+               FEEDBACK_ERROR("haptic_close is failed : %d", ret);
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       vconf_ignore_key_changed(VCONFKEY_SOUND_STATUS, __feedback_soundon_cb);
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __feedback_sndstatus_cb);
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, __feedback_vibstatus_cb);
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, __feedback_vib_cb);
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, __feedback_noti_cb);
+       vconf_ignore_key_changed(VCONFKEY_CALL_STATE, __feedback_callstatus_cb);
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+int _feedback_play_sound(feedback_h handle, feedback_pattern_e pattern)
+{
+       int ret = -1;
+       int retry = FEEDBACK_RETRY_CNT;
+       struct stat buf;
+
+       if (handle <= 0) {
+               FEEDBACK_ERROR("Please call _feedback_init() for sound init ");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (sndstatus == 0 && !__feedback_get_always_alert_case(pattern)) {
+               FEEDBACK_LOG("Sound condition is OFF (sndstatus : %d)", sndstatus);
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (soundon == 1 && pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD) {
+               FEEDBACK_LOG("Touch feedback sound doesn't work during playing sound");
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (pattern == FEEDBACK_PATTERN_NONE) {
+               FEEDBACK_LOG("call _feedback_play_sound passing FEEDBACK_PATTERN_NONE");
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (snd_file[pattern] == NULL) {
+               FEEDBACK_LOG("This case(%d) does not play sound", pattern);
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (stat(snd_file[pattern], &buf)) {
+               FEEDBACK_ERROR("%s is not presents", snd_file[pattern]);
+               ret = __feedback_restore_default_file(FEEDBACK_TYPE_SOUND, pattern);
+               if (FEEDBACK_FAILED(ret)) {
+                       FEEDBACK_ERROR("__feedback_restore_default_file(%d/%d) error", FEEDBACK_TYPE_SOUND, pattern);
+                       return FEEDBACK_ERROR_OPERATION_FAILED;
+               }
+               FEEDBACK_LOG("%s is restored", snd_file[pattern]);
+       }
+
+       FEEDBACK_LOG("Call status : %d, pattern : %d", callstatus, pattern);
+       if (callstatus != VCONFKEY_CALL_OFF) {
+               pattern = __feedback_get_alert_on_call_key(pattern);
+               FEEDBACK_LOG("Call status is connected or connecting. pattern changed : %d", pattern);
+       }
+
+       do {
+               ret = mm_sound_play_keysound(snd_file[pattern], __feedback_get_volume_type(pattern));
+               if (ret == MM_ERROR_NONE) {
+                       FEEDBACK_LOG("Play success! SND filename is %s", snd_file[pattern]);
+                       return FEEDBACK_ERROR_NONE;
+               }
+               FEEDBACK_ERROR("mm_sound_play_keysound() returned error(%d)", ret);
+       } while(retry--);
+
+       return FEEDBACK_ERROR_OPERATION_FAILED;
+}
+
+int _feedback_play_vibration(feedback_h handle, feedback_pattern_e pattern)
+{
+       int ret = -1;
+       struct stat buf;
+
+       if (handle <= 0) {
+               FEEDBACK_ERROR("Please call _feedback_init() for sound init ");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (vibstatus == 0 && !__feedback_get_always_alert_case(pattern))  {
+               FEEDBACK_LOG("Vibration condition is OFF (vibstatus : %d)", vibstatus);
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (pattern == FEEDBACK_PATTERN_NONE) {
+               FEEDBACK_LOG("call _feedback_play_vibration passing FEEDBACK_PATTERN_NONE");
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (haptic_file[pattern] == NULL) {
+               FEEDBACK_LOG("This case(%d) does not play vibration", pattern);
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       if (stat(haptic_file[pattern], &buf)) {
+               FEEDBACK_ERROR("%s is not presents", haptic_file[pattern]);
+               ret = __feedback_restore_default_file(FEEDBACK_TYPE_VIBRATION, pattern);
+               if (FEEDBACK_FAILED(ret)) {
+                       FEEDBACK_ERROR("__feedback_restore_default_file(%d/%d) error", FEEDBACK_TYPE_VIBRATION, pattern);
+                       return FEEDBACK_ERROR_OPERATION_FAILED;
+               }
+               FEEDBACK_LOG("%s is restored", haptic_file[pattern]);
+       }
+
+       ret = haptic_vibrate_file_with_detail((haptic_device_h)handle, haptic_file[pattern], HAPTIC_ITERATION_ONCE, __feedback_get_haptic_level(pattern), __feedback_get_priority(pattern), NULL);
+       if (ret != HAPTIC_ERROR_NONE) {
+               FEEDBACK_ERROR("haptic_vibrate_file_with_detail(%s) is failed", haptic_file[pattern]);
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+int _feedback_set_path(feedback_type_e type, feedback_pattern_e pattern, char* path)
+{
+       const char* cur_path = NULL;
+       int ret = -1;
+
+       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+               FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+               FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (path == NULL) {
+               FEEDBACK_ERROR("Invalid parameter : path(NULL)");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (access(path, F_OK) != 0) {
+               FEEDBACK_ERROR("Invalid parameter : path does not exist");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (type == FEEDBACK_TYPE_SOUND) {
+               cur_path = snd_file[pattern];
+       } else {
+               cur_path = haptic_file[pattern];
+       }
+
+       if (cur_path == NULL) {
+               FEEDBACK_ERROR("This pattern(%d) in this type(%d) is not supported to play", pattern, type);
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       ret = __feedback_change_symlink(cur_path, path);
+       if (FEEDBACK_FAILED(ret)) {
+               FEEDBACK_ERROR("change_symlink is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+int _feedback_get_path(feedback_type_e type, feedback_pattern_e pattern, char* buf, unsigned int buflen)
+{
+       const char* cur_path = NULL;
+       int retry = FEEDBACK_RETRY_CNT;
+
+       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+               FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+               FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (buf == NULL || buflen <= 0) {
+               FEEDBACK_ERROR("Invalid parameter : buf(NULL) or bufLen(%d)", buflen);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (type == FEEDBACK_TYPE_SOUND) {
+               cur_path = snd_file[pattern];
+       } else {
+               cur_path = haptic_file[pattern];
+       }
+
+       if (cur_path == NULL) {
+               FEEDBACK_ERROR("This pattern(%d) in this type(%d) is not supported to play", pattern, type);
+               snprintf(buf, buflen, "NULL");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       do {
+               if(readlink(cur_path, buf, buflen) < 0) {
+                       FEEDBACK_ERROR("readlink is failed : %s", strerror(errno));
+                       return FEEDBACK_ERROR_OPERATION_FAILED;
+               }
+       } while(retry--);
+
+       return FEEDBACK_ERROR_NONE;
+}
diff --git a/src/feedback.c b/src/feedback.c
new file mode 100644 (file)
index 0000000..368fbb5
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include "feedback.h"
+#include "feedback-internal.h"
+#include "feedback-log.h"
+
+#define MAX_PATH_LENGTH      256
+#define NOT_ASSIGNED         NULL
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+static feedback_h _feedback_handle = NOT_ASSIGNED;
+
+API int feedback_initialize()
+{
+       int err = -1;
+
+       if (_feedback_handle != NOT_ASSIGNED) {
+               FEEDBACK_LOG("Already initialized");
+               return FEEDBACK_ERROR_NONE;
+       }
+
+       err = _feedback_init(&_feedback_handle);
+       if (FEEDBACK_FAILED(err)) {
+               FEEDBACK_ERROR("_feedback_init is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+API int feedback_deinitialize()
+{
+       int err = -1;
+
+       if (_feedback_handle == NOT_ASSIGNED) {
+               FEEDBACK_ERROR("Not initialized");
+               return FEEDBACK_ERROR_NOT_INITIALIZED;
+       }
+
+       err = _feedback_fini(_feedback_handle);
+       if (FEEDBACK_FAILED(err)) {
+               FEEDBACK_ERROR("_feedback_fini is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       _feedback_handle = NOT_ASSIGNED;
+       return FEEDBACK_ERROR_NONE;
+}
+
+API int feedback_play(feedback_pattern_e pattern)
+{
+       int err = -1;
+
+       if (_feedback_handle == NOT_ASSIGNED) {
+               FEEDBACK_ERROR("Not initialized");
+               return FEEDBACK_ERROR_NOT_INITIALIZED;
+       }
+
+       if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+               FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       err = _feedback_play_sound(_feedback_handle, pattern);
+       if (FEEDBACK_FAILED(err)) {
+               FEEDBACK_ERROR("_feedback_play_sound is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       err = _feedback_play_vibration(_feedback_handle, pattern);
+       if (FEEDBACK_FAILED(err)) {
+               FEEDBACK_ERROR("_feedback_play_vibration is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+API int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern)
+{
+       int err = -1;
+
+       if (_feedback_handle == NOT_ASSIGNED) {
+               FEEDBACK_ERROR("Not initialized");
+               return FEEDBACK_ERROR_NOT_INITIALIZED;
+       }
+
+       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+               FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+               FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       switch(type) {
+               case FEEDBACK_TYPE_SOUND:
+                       err = _feedback_play_sound(_feedback_handle, pattern);
+                       break;
+               case FEEDBACK_TYPE_VIBRATION:
+                       err = _feedback_play_vibration(_feedback_handle, pattern);
+                       break;
+               default:
+                       FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (FEEDBACK_FAILED(err)) {
+               FEEDBACK_ERROR("_feedback_play(type:%d) is failed", type);
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+API int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e pattern, char** path)
+{
+       int err = -1;
+       char buf[MAX_PATH_LENGTH] = {0,};
+
+       if (path == NULL) {
+               FEEDBACK_ERROR("Invalid parameter : path(NULL)");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+               FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+               FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
+
+       err = _feedback_get_path(type, pattern, buf, MAX_PATH_LENGTH);
+       if (FEEDBACK_FAILED(err)) {
+               FEEDBACK_ERROR("_feedback_get_path is failed");
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+       }
+
+       *path = strdup(buf);
+
+       return FEEDBACK_ERROR_NONE;
+}
diff --git a/src/svi.c b/src/svi.c
new file mode 100644 (file)
index 0000000..1f73ae6
--- /dev/null
+++ b/src/svi.c
@@ -0,0 +1,330 @@
+/*
+ * libfeedback
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+
+#include "svi.h"
+#include "feedback.h"
+#include "svi-log.h"
+
+#define SVI_TEMP_HANDLE                1
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+feedback_pattern_e feedback_sound[] = {
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       FEEDBACK_PATTERN_TAP,
+       FEEDBACK_PATTERN_TAP,
+       FEEDBACK_PATTERN_TAP,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       FEEDBACK_PATTERN_SIP,
+       FEEDBACK_PATTERN_SIP_BACKSPACE,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       FEEDBACK_PATTERN_KEY0,
+       FEEDBACK_PATTERN_KEY1,
+       FEEDBACK_PATTERN_KEY2,
+       FEEDBACK_PATTERN_KEY3,
+       FEEDBACK_PATTERN_KEY4,
+       FEEDBACK_PATTERN_KEY5,
+       FEEDBACK_PATTERN_KEY6,
+       FEEDBACK_PATTERN_KEY7,
+       FEEDBACK_PATTERN_KEY8,
+       FEEDBACK_PATTERN_KEY9,
+       FEEDBACK_PATTERN_KEY_STAR,
+       FEEDBACK_PATTERN_KEY_SHARP,
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       FEEDBACK_PATTERN_HOLD,
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       FEEDBACK_PATTERN_MULTI_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       FEEDBACK_PATTERN_HW_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       FEEDBACK_PATTERN_HW_HOLD,
+
+       /* OPERATION : POWER ON/OFF */
+       FEEDBACK_PATTERN_POWERON,
+       FEEDBACK_PATTERN_POWEROFF,
+       /* OPERATION : CHARGECONN */
+       FEEDBACK_PATTERN_CHARGERCONN,
+       /* OPERATION : FULLCHAREGED */
+       FEEDBACK_PATTERN_FULLCHARGED,
+       /* OPERATION : LOW BATTERY */
+       FEEDBACK_PATTERN_LOWBATT,
+       /* OPERATION : LOCK/UNLOCK */
+       FEEDBACK_PATTERN_LOCK,
+       FEEDBACK_PATTERN_UNLOCK,
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       FEEDBACK_PATTERN_CALLCONNECT,
+       FEEDBACK_PATTERN_DISCALLCONNECT,
+       /* OPERATION : MINUTE MINDER */
+       FEEDBACK_PATTERN_MINUTEMINDER,
+       /* OPERATION : VIBRATION */
+       FEEDBACK_PATTERN_VIBRATION,
+       /* OPERATION : BALLOON MESSAGE SEND/RECV */
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       /* OPERATION : ON/OFF SLIDER */
+       FEEDBACK_PATTERN_NONE,
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       FEEDBACK_PATTERN_SHUTTER,
+       /* OPERATION : LIST RE-ORDER */
+       FEEDBACK_PATTERN_LIST_REORDER,
+       /* OPERATION : LIST SLIDER */
+       FEEDBACK_PATTERN_SLIDER_SWEEP,
+};
+
+feedback_pattern_e feedback_vibration[] = {
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : GENERAL */
+       FEEDBACK_PATTERN_TAP,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : TEXT_NUMERIC_INPUT */
+       FEEDBACK_PATTERN_SIP,
+       FEEDBACK_PATTERN_SIP_BACKSPACE,
+       /* TOUCH : SCREEN TOUCH : TAP(TOUCH & RELEASE) : DAILER */
+       FEEDBACK_PATTERN_KEY0,
+       FEEDBACK_PATTERN_KEY1,
+       FEEDBACK_PATTERN_KEY2,
+       FEEDBACK_PATTERN_KEY3,
+       FEEDBACK_PATTERN_KEY4,
+       FEEDBACK_PATTERN_KEY5,
+       FEEDBACK_PATTERN_KEY6,
+       FEEDBACK_PATTERN_KEY7,
+       FEEDBACK_PATTERN_KEY8,
+       FEEDBACK_PATTERN_KEY9,
+       FEEDBACK_PATTERN_KEY_STAR,
+       FEEDBACK_PATTERN_KEY_SHARP,
+       /* TOUCH : H/W OR SOFT TOUCH : HOLD(TAP & HOLD) */
+       FEEDBACK_PATTERN_HOLD,
+       /* TOUCH : H/W OR SOFT TOUCH : MULTI TAP */
+       FEEDBACK_PATTERN_MULTI_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP */
+       FEEDBACK_PATTERN_HW_TAP,
+       /* TOUCH : H/W OR SOFT TOUCH : TAP & HOLD */
+       FEEDBACK_PATTERN_HW_HOLD,
+
+       /* NOTIFICATION : INCOMING : CALL */
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       /* NOTIFICATION : INCOMING : MESSAGE */
+       FEEDBACK_PATTERN_MESSAGE,
+       /* NOTIFICATION : INCOMING : EMAIL */
+       FEEDBACK_PATTERN_EMAIL,
+       /* NOTIFICATION : ALARM : WAKEUP */
+       FEEDBACK_PATTERN_WAKEUP,
+       /* NOTIFICATION : ALARM : SCHEDULE */
+       FEEDBACK_PATTERN_SCHEDULE,
+       /* NOTIFICATION : ALARM : TIMER */
+       FEEDBACK_PATTERN_TIMER,
+       /* NOTIFICATION : GENERAL(TICKER/IM/SMS ETC) */
+       FEEDBACK_PATTERN_GENERAL,
+
+       /* OPERATION : POWER ON/OFF */
+       FEEDBACK_PATTERN_POWERON,
+       FEEDBACK_PATTERN_POWEROFF,
+       /* OPERATION : CHARGECONN */
+       FEEDBACK_PATTERN_CHARGERCONN,
+       /* OPERATION : FULLCHAREGED */
+       FEEDBACK_PATTERN_FULLCHARGED,
+       /* OPERATION : LOW BATTERY */
+       FEEDBACK_PATTERN_LOWBATT,
+       /* OPERATION : LOCK/UNLOCK */
+       FEEDBACK_PATTERN_LOCK,
+       FEEDBACK_PATTERN_UNLOCK,
+       /* OPERATION : CALL CONNECT/ DISCONNECT */
+       FEEDBACK_PATTERN_CALLCONNECT,
+       FEEDBACK_PATTERN_DISCALLCONNECT,
+       /* OPERATION : MINUTE MINDER */
+       FEEDBACK_PATTERN_MINUTEMINDER,
+       /* OPERATION : VIBRATION */
+       FEEDBACK_PATTERN_VIBRATION,
+       /* OPERATION : BALLOON MESSAGE SEND/RECV */
+       FEEDBACK_PATTERN_NONE,
+       FEEDBACK_PATTERN_NONE,
+       /* OPERATION : ON/OFF SLIDER */
+       FEEDBACK_PATTERN_NONE,
+       /* OPERATION : CAMERA SHUTTER / SCREEN CAPTURE */
+       FEEDBACK_PATTERN_SHUTTER,
+       /* OPERATION : LIST RE-ORDER */
+       FEEDBACK_PATTERN_LIST_REORDER,
+       /* OPERATION : LIST SLIDER */
+       FEEDBACK_PATTERN_SLIDER_SWEEP,
+};
+
+API int svi_init(int *handle)
+{
+       int ret = -1;
+
+       if (handle == NULL) {
+               SVILOG("ERROR!! Invalid parameter : handle(NULL)");
+               return SVI_ERROR;
+       }
+
+       ret = feedback_initialize();
+       if (FEEDBACK_FAILED(ret)) {
+               SVILOG("ERROR!! feedback_initialize is failed");
+               return SVI_ERROR;
+       }
+
+       *handle = SVI_TEMP_HANDLE;
+       return SVI_SUCCESS;
+}
+
+API int svi_fini(int handle)
+{
+       int ret = -1;
+
+       if (handle != SVI_TEMP_HANDLE) {
+               SVILOG("ERROR!! Invalid parameter : handle(%d)", handle);
+               return SVI_ERROR;
+       }
+
+       ret = feedback_deinitialize();
+       if (FEEDBACK_FAILED(ret)) {
+               SVILOG("ERROR!! feedback_deinitialize is failed");
+               return SVI_ERROR;
+       }
+
+       return SVI_SUCCESS;
+}
+
+API int svi_play_sound(int handle, sound_type sound_key)
+{
+       int ret = -1;
+       feedback_pattern_e pattern = FEEDBACK_PATTERN_NONE;
+
+       if (handle != SVI_TEMP_HANDLE) {
+               SVILOG("ERROR!! Invalid parameter : handle(%d)", handle);
+               return SVI_ERROR;
+       }
+
+       if (sound_key < SVI_SND_NONE || sound_key >= SVI_SND_ENUM_END) {
+               SVILOG("ERROR!! Invalid parameter : sound_key(%d)", sound_key);
+               return SVI_ERROR;
+       }
+
+       if (sound_key == SVI_SND_NONE) {
+               pattern = FEEDBACK_PATTERN_NONE;
+               SVILOG("pattern is NONE");
+       } else {
+               pattern = feedback_sound[sound_key];
+               SVILOG("sound_key : %d, pattern : %d", sound_key, pattern);
+       }
+
+       ret = feedback_play_type(FEEDBACK_TYPE_SOUND, pattern);
+       if (FEEDBACK_FAILED(ret)) {
+               SVILOG("ERROR!! feedback_play_type is failed");
+               return SVI_ERROR;
+       }
+
+       return SVI_SUCCESS;
+}
+
+API int svi_play_vib(int handle, vibration_type vibration_key)
+{
+       int ret = -1;
+       feedback_pattern_e pattern = FEEDBACK_PATTERN_NONE;
+
+       if (handle != SVI_TEMP_HANDLE) {
+               SVILOG("ERROR!! Invalid parameter : handle(%d)", handle);
+               return SVI_ERROR;
+       }
+
+       if (vibration_key < SVI_VIB_NONE || vibration_key >= SVI_VIB_ENUM_END) {
+               SVILOG("ERROR!! Invalid parameter : sound_key(%d)", vibration_key);
+               return SVI_ERROR;
+       }
+
+       if (vibration_key == SVI_VIB_NONE) {
+               pattern = FEEDBACK_PATTERN_NONE;
+               SVILOG("pattern is NONE");
+       } else {
+               pattern = feedback_vibration[vibration_key];
+               SVILOG("vibration_key : %d, pattern : %d", vibration_key, pattern);
+       }
+
+       ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, pattern);
+       if (FEEDBACK_FAILED(ret)) {
+               SVILOG("ERROR!! feedback_play_type is failed");
+               return SVI_ERROR;
+       }
+
+       return SVI_SUCCESS;
+}
+
+API int svi_play(int handle, vibration_type vibration_key, sound_type sound_key)
+{
+       int ret_snd = svi_play_sound(handle, sound_key);
+       int ret_vib = svi_play_vib(handle, vibration_key);
+
+       if (ret_snd == SVI_ERROR || ret_vib == SVI_ERROR) {
+               return SVI_ERROR;
+       } else {
+               return SVI_SUCCESS;
+       }
+}
+
+API int svi_set_path(int svi_type, int svi_enum, char* path)
+{
+       SVILOG("This api is not supported");
+       return SVI_ERROR;
+}
+
+API int svi_get_path(int svi_type, int svi_enum, char* buf, unsigned int bufLen)
+{
+       int ret = -1;
+       feedback_pattern_e pattern = FEEDBACK_PATTERN_NONE;
+       char *path = NULL;
+
+       if (svi_type <= SVI_TYPE_NONE || svi_type >= SVI_TYPE_END) {
+               SVILOG("ERROR!! Invalid parameter : svi_type(%d).", svi_type);
+               return SVI_ERROR;
+       }
+
+       if (svi_type == SVI_TYPE_SND) {
+               if (svi_enum <= SVI_SND_NONE || svi_enum >= SVI_SND_ENUM_END) {
+                       SVILOG("ERROR! invalid svi_enum(%d)", svi_enum);
+                       return SVI_ERROR;
+               }
+
+               pattern = feedback_sound[svi_enum];
+               ret = feedback_get_resource_path(FEEDBACK_TYPE_SOUND, pattern, &path);
+       } else if (svi_type == SVI_TYPE_VIB) {
+               if (svi_enum <= SVI_VIB_NONE || svi_enum >= SVI_VIB_ENUM_END) {
+                       SVILOG("ERROR! invalid svi_enum(%d)", svi_enum);
+                       return SVI_ERROR;
+               }
+
+               pattern = feedback_vibration[svi_enum];
+               ret = feedback_get_resource_path(FEEDBACK_TYPE_VIBRATION, pattern, &path);
+       }
+
+       if (FEEDBACK_FAILED(ret)) {
+               SVILOG("ERROR!! feedback_play_type is failed");
+               return SVI_ERROR;
+       }
+
+       snprintf(buf, bufLen, "%s", path);
+       free(path);
+
+       return SVI_SUCCESS;
+}
old mode 100755 (executable)
new mode 100644 (file)
index 619e337..9ec1dcf
--- a/svi.pc.in
+++ b/svi.pc.in
@@ -1,11 +1,11 @@
 prefix=@PREFIX@
 exec_prefix=@EXEC_PREFIX@
 libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+includedir=/usr/include/svi
 
 Name: svi
 Description: configuration system library
 Version: @VERSION@
-Requires: vconf mm-keysound devman_haptic dlog
+Requires:
 Libs: -L${libdir} -lsvi
 Cflags: -I${includedir}