Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:44:35 +0000 (00:44 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:44:35 +0000 (00:44 +0900)
85 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
SLP_devman_PG.h [new file with mode: 0644]
TC/build.sh [new file with mode: 0755]
TC/execute.sh [new file with mode: 0755]
TC/tet_code [new file with mode: 0755]
TC/tet_scen [new file with mode: 0755]
TC/tetbuild.cfg [new file with mode: 0755]
TC/tetclean.cfg [new file with mode: 0755]
TC/tetexec.cfg [new file with mode: 0755]
TC/unit/Makefile [new file with mode: 0644]
TC/unit/tc_gen.sh [new file with mode: 0755]
TC/unit/tslist [new file with mode: 0644]
TC/unit/utc_MODULE_API_func.c.in [new file with mode: 0644]
TC/unit/utc_SystemFW_device_get_battery_pct_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_get_display_brt_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_get_display_gamma_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_get_max_brt_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_get_property_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_close_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_get_file_duration_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_get_pattern_duration_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_open_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_play_file_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_play_monotone_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_play_pattern_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_haptic_stop_play_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_is_battery_full_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_release_brt_ctrl_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_release_gamma_ctrl_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_set_display_brt_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_set_display_gamma_func.c [new file with mode: 0644]
TC/unit/utc_SystemFW_device_set_property_func.c [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/libdevman-0.install.in [new file with mode: 0644]
debian/libdevman-0.postinst.in [new file with mode: 0755]
debian/libdevman-0.postrm.in [new file with mode: 0755]
debian/libdevman-dev.install.in [new file with mode: 0644]
debian/libdevman-haptic-dev.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
device_engine.c [new file with mode: 0644]
device_engine.h [new file with mode: 0644]
device_generic.h [new file with mode: 0644]
device_haptic.c [new file with mode: 0644]
device_haptic.h [new file with mode: 0644]
device_haptic_tsp4000_pattern.h [new file with mode: 0644]
device_path.h [new file with mode: 0644]
devices/CMakeLists.txt [new file with mode: 0644]
devices/haptic.c [new file with mode: 0644]
devices/jack_35pi.c [new file with mode: 0644]
devices/jack_microusb.c [new file with mode: 0644]
devices/led.c [new file with mode: 0644]
devices/mmc.c [new file with mode: 0644]
devices/power_supply_battery.c [new file with mode: 0644]
devices/power_supply_pmic.c [new file with mode: 0644]
devices/uart.c [new file with mode: 0644]
devices/video.c [new file with mode: 0644]
devlog.h [new file with mode: 0644]
devman [new file with mode: 0755]
devman.h [new file with mode: 0644]
devman.pc.in [new file with mode: 0644]
devman_haptic.h [new file with mode: 0644]
devman_haptic.pc.in [new file with mode: 0644]
devman_haptic_ext.h [new file with mode: 0644]
devman_haptic_ext_core.h [new file with mode: 0644]
devman_internal.c [new file with mode: 0644]
devman_internal.h [new file with mode: 0644]
display_wd.c [new file with mode: 0644]
generic_haptic.c [new file with mode: 0644]
generic_jack.c [new file with mode: 0644]
generic_led.c [new file with mode: 0644]
generic_powersupply.c [new file with mode: 0644]
generic_video.c [new file with mode: 0644]
if_generic.c [new file with mode: 0644]
if_legacy.c [new file with mode: 0644]
image/SLP_devman_PG_architecture.png [new file with mode: 0755]
image/SLP_devman_PG_haptic_architecture.png [new file with mode: 0755]
packaging/devman.spec [new file with mode: 0644]
packaging/devman.yaml [new file with mode: 0644]
udev-files/91-devman.rules.in [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..67e6bd9
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Jinkun Jang <jinkun.jang@samsung.com>\r
+DongGi Jang <dg0402.jang@samsung.com>\r
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..45da93d
--- /dev/null
@@ -0,0 +1,88 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(devman C)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(rpkgs REQUIRED
+               vconf
+               sysman
+               dlog
+               heynoti)
+ADD_DEFINITIONS(${rpkgs_CFLAGS})
+
+SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRAINTS true)
+
+SET(SRCS
+       device_engine.c
+       device_haptic.c
+       generic_haptic.c
+       generic_jack.c
+       generic_powersupply.c 
+       generic_video.c
+       generic_led.c
+       if_legacy.c
+       if_generic.c
+       devman_internal.c)
+
+SET(HEADERS
+       devman.h
+       devman_haptic.h
+       devman_haptic_ext.h
+       devman_haptic_ext_core.h
+       SLP_devman_PG.h)
+
+INCLUDE(devices/CMakeLists.txt) 
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(DATADIR ${CMAKE_DATADIR})
+SET(VERSION 0.1)
+
+SET(UDEV_RULES_PATH ${CMAKE_DEVMAN_RSRC_PREFIX}/udev-rules)
+SET(UDEV_RULES udev-files/91-devman.rules)
+SET(RC_LOCAL_SCRIPT devman)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+
+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("-DENABLE_DLOG_OUT -DSLP_DEBUG")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${TARGET_SRCS})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpkgs_LDFLAGS} "-ldl")
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION})
+
+ADD_EXECUTABLE(display_wd display_wd.c)
+TARGET_LINK_LIBRARIES(display_wd ${pkgs_LDFLAGS} ${PROJECT_NAME})
+INSTALL(TARGETS display_wd DESTINATION bin)
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+CONFIGURE_FILE(devman_haptic.pc.in devman_haptic.pc @ONLY)
+CONFIGURE_FILE(${UDEV_RULES}.in ${UDEV_RULES} @ONLY)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_haptic.pc DESTINATION lib/pkgconfig)
+
+FOREACH(hfile ${HEADERS})
+       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME})
+ENDFOREACH(hfile)
+
+FOREACH(rfile ${UDEV_RULES})
+       INSTALL(FILES ${rfile} DESTINATION ${UDEV_RULES_PATH})
+ENDFOREACH(rfile)
+
+FOREACH(sfile ${PDP_FILES})
+       INSTALL(FILES ${sfile} DESTINATION sbin)
+ENDFOREACH(sfile)
+
+INSTALL(FILES ${UDEV_SMDEL} DESTINATION bin)
+INSTALL(FILES ${UDEV_USB} DESTINATION sbin)
+INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..9c13a9b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/SLP_devman_PG.h b/SLP_devman_PG.h
new file mode 100644 (file)
index 0000000..0c92c17
--- /dev/null
@@ -0,0 +1,353 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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 SLP_PG_DEVMAN Device Manager
+ * @{
+<h1 class="pg">Introduction</h1>
+
+<h2 class="pg">Purpose</h2>
+The purpose of this document is to describe how applications can use Device Manager APIs. This document gives programming guidelines to application engineers.
+
+<h2 class="pg">Scope</h2>
+The scope of this document is limited to Device Manager API usage.
+
+<br>
+<h1 class="pg">Device Manager Library Overview</h1>
+<h2 class="pg">General Device Manager</h2>
+Device Manager library is provided to control the device and to get data about several devices. You can get the data about battery, charger, display and so on.<br>
+Devman library uses sysfs for interfaces with device drivers and kernel. sysfs is a virtual file system provided by Linux 2.6 or above. Please refer to the web site, 
+http://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf for more information about sysfs.
+The following figure shows the basic architecture of devman library
+
+<h3 class="pg" align="center">Device Manager Architecture</h3>
+@image html SLP_devman_PG_architecture.png
+<br>
+<h2 class="pg">Haptic Device Manager</h2>
+<h3 class="pg" align="center">Haptic Vibration Functional Level Architecture</h3>
+@image html SLP_devman_PG_haptic_architecture.png
+
+The client side is available in the form of a shared library to all the processes, whereas the server is a daemon. 
+As shown in the diagram applications/middleware frameworks can have the haptic vibration client library in the process context.
+<br><br>
+The haptic vibration client is available in form of a shared library. This library has APIs which support various features. 
+These features are playing a rhythmical vibration pattern, playing a monotonous vibration pattern, etc. 
+Applications can call these APIs to give vibration feedback on any event. This could also be used to indicate any events or changes of a state to the user. 
+<br><br>
+The server interacts with the device driver interfaces and generates vibration feedback. 
+<br><br>
+<h3 class="pg">Haptic Vibration Features</h3>
+<b>Haptic client features</b>
+-#     Available in shared library form.<br>
+-#     Provides set of APIs to play haptic vibration patterns.<br>
+-#     Provide unique access control mechanism through client server architecture.<br>
+-#     Provision to play rhythmical vibration patterns.<br>
+-#     Provides functionality for application to play a different vibration pattern for a different event.<br>
+-#     Provides support for user defined duration for monotone playing or iteration for pattern playing.<br>
+-#     Provides immediate stop control over the vibrations played.<br><br>
+
+<b>Haptic server features</b>
+-#     The actual implementation of the functionality supported by haptic-vibration library has been implemented through haptic-server.<br>
+-#     Haptic-server processes the vibration pattern's play/stop requests sent by application through the haptic client library.<br>
+-#     There is an internal database maintained for different patterns and their specification.<br>
+-#     When application requests a particular pattern, haptic server checks this database for the specification of that pattern.<br>
+-#     After getting data from database, server sends these specific details to device driver which plays the pattern.<br>
+-#     Server can maintain multiple requests at a time on a priority basis.<br><br>
+
+<h1 class="pg">Device Manager Funtions</h1>
+
+<h2 class="pg">General Device Manager APIs</h2>
+<i><b>API : device_get_battery_pct</b></i><br>
+<b>Parameter :</b> void<br>
+<b>Return :</b> int<br>
+<b>Functionality :</b> This API is used to get the remaining battery percentage. On success, integer value(0~100) that indicate remaining battery percentage is returned. 
+Or a negative value (-1) is returned on failure.
+<br><br>
+<i><b>API : device_is_battery_full</b></i><br>
+<b>Parameter :</b> void<br>
+<b>Return :</b> int <br>
+<b>Functionality :</b> This API is used to get the fully charged status of battery. On fully charged, the integer value (1) is returned, 
+(0) is returned if battery is not fully charged, a negative value (-1) is returned on failure.
+<br><br>
+<i><b>API : device_get_display_brt</b></i>
+<br><b>Parameter In :</b> display_num_t num
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API is used to get the current brightness of the display from sysfs.
+The function returns the current brightness value on success and a negative value (-1) on failure.
+<br><br>
+<b>Enumerate values:</b>
+@code
+// Display number
+typedef enum {
+       DEV_DISPLAY_0,
+       DEV_DISPLAY_1,
+       DEV_MAIN_DISPLAY        = DEV_DISPLAY_0,
+} display_num_t;
+@endcode
+
+<i><b>API : device_set_display_brt</b></i>
+<br><b>Parameter In :</b> display_num_t num
+<br><b>Parameter In :</b> int val
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API is used to set the current brightness of the display using sysfs. 
+The parameter val should be set as a brightnesss value of your target.
+The function returns the current brightness value on success and a negative value (-1) on failure.
+<br><br>
+<i><b>API : device_get_display_gamma</b></i>
+<br></b>Parameter In :</b> display_num_t num
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API is used to get the current gamma value of the display from sysfs.
+The function returns the current brightness value on success and a negative value (-1) on failure.
+<br><br>
+<i><b>API : device_set_display_brt</b></i>
+<br><b>Parameter In :</b> display_num_t num
+<br><b>Parameter In :</b> int val
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API is used to set the current brightness of the display using sysfs. 
+The parameter val should be set as a brightnesss value of your target.
+The function returns the current brightness value on success and a negative value (-1) on failure.
+<br><br>
+<i><b>API : device_get_display_gamma</b></i>
+<br><b>Parameter In :</b> display_num_t num
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API is used to get the current gamma value of the display from sysfs.
+The function returns the current brightness value on success and a negative value (-1) on failure.
+<b>Enumerate values:</b>
+@code
+// LCD gamma values
+typedef enum {
+       LCD_GAMMA_22 = 1,            // 8500K , 2.2 GAMMA
+       LCD_GAMMA_19 = 2,            // 8500K , 1.9 GAMMA
+       LCD_GAMMA_17 = 3,            // 8500K , 1.7 GAMMA
+       LCD_GAMMA_NORMAL =      LCD_GAMMA_22, // Normal screen 
+       LCD_GAMMA_PLAY_RECORD = LCD_GAMMA_19, // Playing or recording cam 
+       LCD_GAMMA_PREVIEW =     LCD_GAMMA_17, // Preview 
+       LCD_GAMMA_MOVIE =       LCD_GAMMA_19, // Movie 
+       LCD_GAMMA_CAMERA =      11,               // Camera 
+} display_gamma_t;
+@endcode
+
+<i><b>API : device_power_suspend</b></i>
+<br><b>Parameter :</b> void
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API is used to make the phone go to a suspend (sleep) state. 
+The suspend state consumes little battery power. If the caller process does not have the permission which is root, it returns failure.
+The function returns 0 on success and a negative value (-1) on failure.
+<br><br>
+<i><b>API : device_get_property</b></i>
+<br><b>Parameter In :</b> devtype_t devtype
+<br><b>Parameter In :</b> int property 
+<br><b>Parameter Out :</b>  int *value
+<br><b>Return :</b> int 
+<br><b>Functionality :</b>This generic API is used to get the property values of supported devices. 
+If the caller process does not have permission, it returns failure.
+The function returns 0 on success and a negative value (-1) on failure.
+<br><br>
+<i><b>API : device_set_property</b></i>
+<br><b>Parameter In :</b> devtype_t devtype
+<br><b>Parameter In :</b> int property 
+<br><b>Parameter In :</b> int value
+<br><b>Return :</b> int 
+<br><b>Functionality :</b>This generic API is used to set the property values of supported devices. 
+If the caller process does not have permission, it returns failure.
+The function returns 0 on success and a negative value (-1) on failure.
+
+<h2 class="pg">Haptic Device Manager APIs</h2>
+<i><b>API : device_haptic_open</b></i>
+<br><b>Parameter In :</b> haptic_dev_idx dev_idx , unsigned int mode
+<br><b>Return :</b> int 
+<br><b>Functionality :</b> This API opens a Haptic-vibration device. On success it returns a dev_handle value. 
+In case of failure it returns a negative value. If the device is already open it returns (-1). <br>
+The first in parameter dev_idx should be from a predefined haptic-device-index which is available in the typedef enum haptic_dev_idx. 
+The DEV_IDX_0 means first haptic-device-index of target , the DEV_IDX_1 means second haptic-device-index of target and the DEV_IDX_ALL means both of them. 
+The availability of the dev_idx value is dependent on the real target. Normally, set a DEV_IDX_0 value to the first haptic-device.<br>
+The second in parameter mode is reserved for future so just set a 0 value<br>
+<b>Note:</b> The device_haptic_open() must be called before all other haptic APIs are called. 
+The device_haptic_open() should have a matching call to device_haptic_close(). 
+Applications call the device_haptic_open() only once if possible during application startup and call the device_haptic_close() during application shutdown.
+
+<b>Enumerate values:</b>
+@code
+//Haptic_dev_idx ;
+typedef enum haptic_dev_idx_t {
+       DEV_IDX_0               =       0x01,
+       DEV_IDX_1               =       0x02,
+       DEV_IDX_ALL            =        0x04,
+};
+@endcode
+
+<i><b>API : device_haptic_close</b></i>
+<br><b>Parameter In :</b> int dev_handle
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b> This API closes a Haptic-vibration device. On success it returns a zero value. 
+In case of failure it returns a negative value. If the device is already closed it returns (-1).  <br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().
+<br><br>
+<i><b>API : device_haptic_play_pattern</b></i>
+<br><b>Parameter In :</b> int dev_handle , int pattern , int iteration , int feedback_level
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b> This API plays a predefined rhythmic haptic-vibration pattern. <br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().<br>
+The second in parameter pattern should be from a predefined pattern list which is available in an enumeration (effectvibe_pattern_list). 
+These patterns are rhythmic vibration patterns. <br>
+The third in parameter iteration sets the number of iterations to be played. This should be less than the maximum iteration range set for the device (currently its 255).  <br>
+The fourth in parameter is the vibration feedback intensity level. This level is already predefined by enumeration type value from HAPTIC _FEEDBACK_LEVEL_1 
+to HAPTIC _FEEDBACK_LEVEL_5. If you want to use the value selected by the user in the Setting application menu, just set -1 value.<br>
+On success it returns a zero value. In case of failure it returns a negative value. <br>
+<b>Note:</b> The actual behavior of the feedback play pattern and the intensity depends on the target hardware. 
+
+<b>Enumerate values:</b>
+@code
+//Effectvibe_pattern_list
+enum effectvibe_pattern_list {
+       EFFCTVIBE_TOUCH = 0,
+       EFFCTVIBE_HW_TOUCH,
+       EFFCTVIBE_NOTIFICATION,
+       EFFCTVIBE_INCOMING_CALL01,
+       EFFCTVIBE_INCOMING_CALL02,
+       EFFCTVIBE_INCOMONG_CALL03,      
+       EFFCTVIBE_ALERTS_CALL,
+       EFFCTVIBE_OPERATION,
+       EFFCTVIBE_SILENT_MODE,
+       EFFCTVIBE_PATTERN_END 
+};
+
+//Feedback Level ;
+enum {
+       HAPTIC_FEEDBACK_LEVEL_AUTO = -1,
+       HAPTIC_FEEDBACK_LEVEL_1 = 1,
+       HAPTIC_FEEDBACK_LEVEL_2 = 2,
+       HAPTIC_FEEDBACK_LEVEL_3 = 3,
+       HAPTIC_FEEDBACK_LEVEL_4 = 4,
+       HAPTIC_FEEDBACK_LEVEL_5 = 5,
+};
+
+//definition for infinite iteration ;
+#define HAPTIC_INFINITE_ITERATION      256
+@endcode
+
+<i><b>API : device_haptic_play_file</b></i>
+<br><b>Parameter In :</b> int dev_handle , const char *file_name , int iteration , int feedback_level
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b>This API plays a predefined rhythmic haptic-vibration pattern file (only supports .ivt type file, Immersion VibeTonz).<br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().<br>
+The second in parameter file_name sets rhythmic vibration pattern file with path. It only supports .ivt type pattern file. <br>
+The third in parameter iteration sets the number of iterations to be played. This should be less than the maximum iteration range set for the device (currently its 255). 
+If you want to play indefinitely, use HAPTIC_INFINITE_ITERATION defined value. But it depends on the target hardware.<br>
+The fourth in parameter is the vibration feedback intensity level. This level is already predefined by enumeration type value from HAPTIC _FEEDBACK_LEVEL_1 
+to HAPTIC _FEEDBACK_LEVEL_5. If you want to use the value selected by the user in the Setting application menu, just set HAPTIC_FEEDBACK_LEVEL_AUTO value. 
+(But the application must have a main loop to use the HAPTIC_FEEDBACK_LEVEL_AUTO value ) <br>
+On success it returns a zero value. In case of failure it returns a negative value. <br>
+<b>Note:</b> The actual behavior of the feedback play pattern and the intensity depends on the target hardware.
+<br><br>
+<i><b>API : device_haptic_play_monotone</b></i>
+<br><b>Parameter In :</b> int dev_handle ,  int duration 
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b>This API plays a monotonous haptic-vibration pattern with a constant intensity. 
+In this monotone play, the intensity used is the value that the user has selected in the Setting application menu.<br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().<br>
+The second in parameter duration defines the length of time this vibration should be played. This duration is in milliseconds.  <br>
+On success it returns a zero value. In case of failure it returns a negative value. <br>
+<b>Note:</b> The actual behavior of the feedback played and the intensity depends on the target hardware.
+<br><br>
+<i><b>API : device_haptic_stop_play</b></i>
+<br><b>Parameter In :</b> int dev_handle
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b> This API stops the current vibration being played.<br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().<br>
+On success it returns a zero value. In case of failure it returns a negative value. 
+<br><br>
+<i><b>API : device_haptic_get_pattern_duration</b></i>
+<br><b>Parameter In :</b> int dev_handle ,  int pattern 
+<br><b>Parameter Out :</b> int *duration 
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b>This API gets a duration time value from a predefined rhythmic vibration pattern.<br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().<br>
+The second in parameter pattern should be from a predefined pattern list which is available in an enumeration (effectvibe_pattern_list).<br>
+The application can get a duration time value from the third out parameter duration when this API succeeds. The unit of duration is ms (millisecond)<br>
+On success it returns a zero value. In case of failure it returns a negative value. <br>
+<b>Note:</b> The actual behavior of the feedback played and the intensity depends on the target hardware.
+<br><br>
+<i><b>API : device_haptic_get_file_duration</b></i>
+<br><b>Parameter In :</b> int dev_handle ,  const char *file_name 
+<br><b>Parameter Out :</b> int *duration 
+<br><b>Parameter Return :</b> int 
+<br><b>Functionality :</b>This API gets a duration time value from a predefined rhythmic vibration pattern file (only supports .ivt type file).<br>
+The first in parameter dev_handle should be from the return value of device_haptic_open().<br>
+The second in parameter file_name sets rhythmic vibration pattern file with path. It only supports .ivt type pattern file.<br>
+The application can get a duration time value from the third out parameter duration when this API succeeds. The unit of duration is ms (millisecond)<br>
+On success it returns a zero value. In case of failure it returns a negative value. <br>
+<b>Note:</b>The actual behavior of the feedback played and the intensity depends on the target hardware.<br>
+
+<br><b>Sample Code <Simple program showing how to use haptic-vibration APIs></b>
+@code
+#include <stdio.h>
+#include <devman_haptic.h>
+#define HAPTIC_TEST_ITERATION 10
+
+int main()
+{
+       int ret_val=0;
+       int dev_handle;      
+
+       printf("\n Haptic vibration test : Start of the program \n");
+
+       //Open the haptic device
+       dev_handle = device_haptic_open(DEV_IDX_0,0);
+       if(dev_handle < 0)
+               return -1;
+
+       //Play a rhythmic pattern
+       ret_val = device_haptic_play_pattern(dev_handle, EFFCTVIBE_NOTIFICATION, 
+                       HAPTIC_TEST_ITERATION , HAPTIC_FEEDBACK_LEVEL_3); 
+       if(ret_val !=0)
+               return -1;
+
+       //Play a monotone pattern for 1s == 1000ms
+       ret_val = device_haptic_play_monotone(dev_handle, 1000);      
+       if(ret_val !=0)
+               return -1;
+
+       //Demo for a stop pattern API, playing a monotone for 10s
+       ret_val = device_haptic_play_monotone(dev_handle, 10000);      
+       if(ret_val !=0)
+               return -1;
+
+       sleep(1);
+
+       //Stop the pattern immediately 
+       ret_val = device_haptic_stop_play(dev_handle);
+       if(ret_val !=0)
+               return -1;
+
+       //Close the device
+       ret_val = device_haptic_close(dev_handle);
+       if(ret_val !=0)
+               return -1;
+}
+@endcode
+
+ @}
+**/
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..98ebeff
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+export TET_INSTALL_PATH=/scratchbox/tetware  # local tetware path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..6720da0
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+export TET_INSTALL_PATH=/mnt/nfs/tetware
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/tet_code b/TC/tet_code
new file mode 100755 (executable)
index 0000000..a2cf6c1
--- /dev/null
@@ -0,0 +1,12 @@
+# TET reserved codes
+0 "PASS"
+1 "FAIL"
+2 "UNRESOLVED"
+3 "NOTINUSE"
+4 "UNSUPPORTED"
+5 "UNTESTED"
+6 "UNINITIATED"
+7 "NORESULT"
+
+# Test suite additional codes
+33 "INSPECT"
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755 (executable)
index 0000000..43cbc9b
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/unit/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100755 (executable)
index 0000000..6192c78
--- /dev/null
@@ -0,0 +1,3 @@
+TET_OUTPUT_CAPTURE=False
+TET_BUILD_TOOL=make
+TET_PASS_TC_NAME=True
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100755 (executable)
index 0000000..c66eda4
--- /dev/null
@@ -0,0 +1,2 @@
+TET_OUTPUT_CAPTURE=False
+TET_CLEAN_TOOL=make clean
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100755 (executable)
index 0000000..0d9d39a
--- /dev/null
@@ -0,0 +1 @@
+TET_OUTPUT_CAPTURE=False
diff --git a/TC/unit/Makefile b/TC/unit/Makefile
new file mode 100644 (file)
index 0000000..7717ebf
--- /dev/null
@@ -0,0 +1,42 @@
+CC ?= gcc
+
+TARGETS = utc_SystemFW_device_get_battery_pct_func     \
+         utc_SystemFW_device_get_display_brt_func      \
+         utc_SystemFW_device_get_display_gamma_func    \
+         utc_SystemFW_device_get_max_brt_func          \
+         utc_SystemFW_device_get_property_func         \
+         utc_SystemFW_device_haptic_open_func          \
+         utc_SystemFW_device_haptic_close_func         \
+         utc_SystemFW_device_haptic_get_file_duration_func     \
+         utc_SystemFW_device_haptic_get_pattern_duration_func  \
+         utc_SystemFW_device_haptic_play_file_func             \
+         utc_SystemFW_device_haptic_play_monotone_func         \
+         utc_SystemFW_device_haptic_play_pattern_func          \
+         utc_SystemFW_device_haptic_stop_play_func             \
+         utc_SystemFW_device_is_battery_full_func              \
+         utc_SystemFW_device_release_brt_ctrl_func             \
+         utc_SystemFW_device_release_gamma_ctrl_func           \
+         utc_SystemFW_device_set_display_brt_func              \
+         utc_SystemFW_device_set_display_gamma_func            \
+         utc_SystemFW_device_set_property_func                 \
+
+
+
+PKGS = devman
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+all: $(TARGETS)
+
+$(TARGETS): %: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TARGETS)
diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh
new file mode 100755 (executable)
index 0000000..54f482d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+TMPSTR=$0
+SCRIPT=${TMPSTR##*/}
+
+if [ $# -lt 2 ]; then
+       echo "Usage) $SCRIPT module_name api_name"
+       exit 1
+fi
+
+MODULE=$1
+API=$2
+TEMPLATE=utc_MODULE_API_func.c.in
+TESTCASE=utc_${MODULE}_${API}_func
+
+sed -e '
+       s^@API@^'"$API"'^g
+       s^@MODULE@^'"$MODULE"'^g
+       ' $TEMPLATE > $TESTCASE.c
+
+if [ ! -e "$TESTCASE.c" ]; then
+       echo "Failed"
+       exit 1
+fi
+echo "Testcase file is $TESTCASE.c"
+echo "Done"
+echo "please put \"$TESTCASE\" as Target in Makefile"
+echo "please put \"/unit/$TESTCASE\" in tslist"
diff --git a/TC/unit/tslist b/TC/unit/tslist
new file mode 100644 (file)
index 0000000..eedb7cc
--- /dev/null
@@ -0,0 +1,19 @@
+/unit/utc_SystemFW_device_get_battery_pct_func
+/unit/utc_SystemFW_device_get_display_brt_func
+/unit/utc_SystemFW_device_get_display_gamma_func
+/unit/utc_SystemFW_device_get_max_brt_func
+/unit/utc_SystemFW_device_get_property_func
+/unit/utc_SystemFW_device_haptic_open_func
+/unit/utc_SystemFW_device_haptic_close_func
+/unit/utc_SystemFW_device_haptic_get_file_duration_func
+/unit/utc_SystemFW_device_haptic_get_pattern_duration_func
+/unit/utc_SystemFW_device_haptic_play_file_func
+/unit/utc_SystemFW_device_haptic_play_monotone_func
+/unit/utc_SystemFW_device_haptic_play_pattern_func
+/unit/utc_SystemFW_device_haptic_stop_play_func
+/unit/utc_SystemFW_device_is_battery_full_func
+/unit/utc_SystemFW_device_release_brt_ctrl_func
+/unit/utc_SystemFW_device_release_gamma_ctrl_func
+/unit/utc_SystemFW_device_set_display_brt_func
+/unit/utc_SystemFW_device_set_display_gamma_func
+/unit/utc_SystemFW_device_set_property_func
diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in
new file mode 100644 (file)
index 0000000..b235fa3
--- /dev/null
@@ -0,0 +1,64 @@
+#include <tet_api.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_@MODULE@_@API@_func_01(void);
+static void utc_@MODULE@_@API@_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX },
+       { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of @API@()
+ */
+static void utc_@MODULE@_@API@_func_01(void)
+{
+       int r = 0;
+
+/*
+       r = @API@(...);
+*/
+       if (r) {
+               tet_infoline("@API@() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init @API@()
+ */
+static void utc_@MODULE@_@API@_func_02(void)
+{
+       int r = 0;
+
+/*
+       r = @API@(...);
+*/
+       if (r) {
+               tet_infoline("@API@() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_get_battery_pct_func.c b/TC/unit/utc_SystemFW_device_get_battery_pct_func.c
new file mode 100644 (file)
index 0000000..7ad4398
--- /dev/null
@@ -0,0 +1,64 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_get_battery_pct_func_01(void);
+//static void utc_SystemFW_device_get_battery_pct_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_get_battery_pct_func_01, POSITIVE_TC_IDX },
+//     { utc_SystemFW_device_get_battery_pct_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_get_battery_pct()
+ */
+static void utc_SystemFW_device_get_battery_pct_func_01(void)
+{
+       int r = 0;
+
+       r = device_get_battery_pct();
+       if (r<0) {
+               tet_infoline("device_get_battery_pct() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_get_battery_pct()
+ */
+//static void utc_SystemFW_device_get_battery_pct_func_02(void)
+//{
+//     int r = 0;
+
+
+//     r = device_get_battery_pct();
+
+//     if (r>=0) {
+//             tet_infoline("device_get_battery_pct() failed in negative test case");
+//             tet_result(TET_FAIL);
+//             return;
+//     }
+//     tet_result(TET_PASS);
+//}
diff --git a/TC/unit/utc_SystemFW_device_get_display_brt_func.c b/TC/unit/utc_SystemFW_device_get_display_brt_func.c
new file mode 100644 (file)
index 0000000..fae099b
--- /dev/null
@@ -0,0 +1,66 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_get_display_brt_func_01(void);
+static void utc_SystemFW_device_get_display_brt_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_get_display_brt_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_get_display_brt_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_get_display_brt()
+ */
+static void utc_SystemFW_device_get_display_brt_func_01(void)
+{
+       int r = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+
+       r = device_get_display_brt(disp);
+       
+       if (r<0) {
+               tet_infoline("device_get_display_brt() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_get_display_brt()
+ */
+static void utc_SystemFW_device_get_display_brt_func_02(void)
+{
+       int r = 0;
+       display_num_t disp = -1;
+
+       r = device_get_display_brt(disp);
+
+       if (r>0) {
+               tet_infoline("device_get_display_brt() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_get_display_gamma_func.c b/TC/unit/utc_SystemFW_device_get_display_gamma_func.c
new file mode 100644 (file)
index 0000000..2cad3a6
--- /dev/null
@@ -0,0 +1,66 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_get_display_gamma_func_01(void);
+static void utc_SystemFW_device_get_display_gamma_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_get_display_gamma_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_get_display_gamma_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_get_display_gamma()
+ */
+static void utc_SystemFW_device_get_display_gamma_func_01(void)
+{
+       int r = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+
+       r = device_get_display_gamma(disp);
+
+       if (r<0) {
+               tet_infoline("device_get_display_gamma() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_get_display_gamma()
+ */
+static void utc_SystemFW_device_get_display_gamma_func_02(void)
+{
+       int r = 0;
+       display_num_t disp = -1;
+
+       r = device_get_display_gamma(disp);
+
+       if (r>=0) {
+               tet_infoline("device_get_display_gamma() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_get_max_brt_func.c b/TC/unit/utc_SystemFW_device_get_max_brt_func.c
new file mode 100644 (file)
index 0000000..ae5837d
--- /dev/null
@@ -0,0 +1,66 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_get_max_brt_func_01(void);
+static void utc_SystemFW_device_get_max_brt_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_get_max_brt_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_get_max_brt_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_get_max_brt()
+ */
+static void utc_SystemFW_device_get_max_brt_func_01(void)
+{
+       int r = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+
+       r = device_get_max_brt(disp);
+
+       if (r < 0) {
+               tet_infoline("device_get_max_brt() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_get_max_brt()
+ */
+static void utc_SystemFW_device_get_max_brt_func_02(void)
+{
+       int r = -1;
+       display_num_t disp = -1;
+
+       r = device_get_max_brt(disp);
+
+       if (r > 0) {
+               tet_infoline("device_get_max_brt() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_get_property_func.c b/TC/unit/utc_SystemFW_device_get_property_func.c
new file mode 100644 (file)
index 0000000..596e132
--- /dev/null
@@ -0,0 +1,69 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_get_property_func_01(void);
+static void utc_SystemFW_device_get_property_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_get_property_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_get_property_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_get_property()
+ */
+static void utc_SystemFW_device_get_property_func_01(void)
+{
+       int r = 0;
+       int value = -1;
+       int property = DISPLAY_PROP_BRIGHTNESS;
+       devtype_t devtype = DEVTYPE_DISPLAY0;
+
+       r = device_get_property(devtype,property,&value);
+
+       if (r < 0 || value == -1) {
+               tet_infoline("device_get_property() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_get_property()
+ */
+static void utc_SystemFW_device_get_property_func_02(void)
+{
+       int value = -1;
+       int ret_val = 0;
+       int property = DISPLAY_PROP_BRIGHTNESS;
+       devtype_t devtype = -1;
+
+       ret_val = device_get_property(devtype,property,&value);
+       if((ret_val >= 0) && (value!= -1)) {
+               tet_infoline("device_get_property() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_close_func.c b/TC/unit/utc_SystemFW_device_haptic_close_func.c
new file mode 100644 (file)
index 0000000..6f2e243
--- /dev/null
@@ -0,0 +1,78 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_close_func_01(void);
+static void utc_SystemFW_device_haptic_close_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_close_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_close_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_close()
+ */
+static void utc_SystemFW_device_haptic_close_func_01(void)
+{
+       int r = 0;
+       unsigned int mode =0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       int dev_handle;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_close() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = device_haptic_close(dev_handle);
+       if(r < 0)
+       {
+               tet_infoline("device_haptic_close() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_close()
+ */
+static void utc_SystemFW_device_haptic_close_func_02(void)
+{
+       int r = 0;
+       int invalid_handle = -1;
+
+       r = device_haptic_close(invalid_handle);
+
+       if (r >= 0) {
+               tet_infoline("device_haptic_close() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_get_file_duration_func.c b/TC/unit/utc_SystemFW_device_haptic_get_file_duration_func.c
new file mode 100644 (file)
index 0000000..a9089b4
--- /dev/null
@@ -0,0 +1,84 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_get_file_duration_func_01(void);
+static void utc_SystemFW_device_haptic_get_file_duration_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_get_file_duration_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_get_file_duration_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_get_file_duration()
+ */
+static void utc_SystemFW_device_haptic_get_file_duration_func_01(void)
+{
+       int duration = 0;
+       int ret_val = 0;
+       unsigned int mode =0;
+       char* haptic_file = "/usr/share/immersion/01_Touch/touch_20ms_sharp.ivt";
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       int dev_handle;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_get_file_duration() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ret_val = device_haptic_get_file_duration(dev_handle, haptic_file,&duration);
+       if((ret_val < 0) || (duration<0))
+       {
+               tet_infoline("device_haptic_get_file_duration() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       device_haptic_close(dev_handle);
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_get_file_duration()
+ */
+static void utc_SystemFW_device_haptic_get_file_duration_func_02(void)
+{
+       int duration = 0;
+       int invalid_handle = -1;
+       int ret_val = 0;
+       char* haptic_file = "test.ivt";
+
+       //Get duration from attern file 
+       ret_val = device_haptic_get_file_duration(invalid_handle, haptic_file, &duration);
+       if(ret_val >= 0)
+       {
+               tet_infoline("device_haptic_get_file_duration() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_get_pattern_duration_func.c b/TC/unit/utc_SystemFW_device_haptic_get_pattern_duration_func.c
new file mode 100644 (file)
index 0000000..40a63b2
--- /dev/null
@@ -0,0 +1,82 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+#define HAPTIC_TEST_PATTERN EFFCTVIBE_NOTIFICATION
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_get_pattern_duration_func_01(void);
+static void utc_SystemFW_device_haptic_get_pattern_duration_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_get_pattern_duration_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_get_pattern_duration_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_get_pattern_duration()
+ */
+static void utc_SystemFW_device_haptic_get_pattern_duration_func_01(void)
+{
+       int duration = 0;
+       int ret_val = 0;
+       unsigned int mode =0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       int dev_handle;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_get_file_duration() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ret_val = device_haptic_get_pattern_duration(dev_handle,HAPTIC_TEST_PATTERN, &duration);
+       if((ret_val < 0) || (duration < 0))
+       {
+               tet_infoline("device_haptic_get_file_duration() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       device_haptic_close(dev_handle);
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_get_pattern_duration()
+ */
+static void utc_SystemFW_device_haptic_get_pattern_duration_func_02(void)
+{
+       int ret_val = 0;
+        int duration = 0;
+        int invalid_handle = -1;
+
+       ret_val = device_haptic_get_pattern_duration(invalid_handle,HAPTIC_TEST_PATTERN, &duration);
+       if(ret_val >= 0)
+       {
+               tet_infoline("device_haptic_get_file_duration() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_open_func.c b/TC/unit/utc_SystemFW_device_haptic_open_func.c
new file mode 100644 (file)
index 0000000..c8776b1
--- /dev/null
@@ -0,0 +1,71 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_open_func_01(void);
+static void utc_SystemFW_device_haptic_open_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_open_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_open_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_open()
+ */
+static void utc_SystemFW_device_haptic_open_func_01(void)
+{
+       int r = 0;
+       unsigned int mode =0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+
+       r = device_haptic_open(dev_idx,mode);
+       
+       if (r < 0) {
+               tet_infoline("device_haptic_open() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+       device_haptic_close(r);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_open()
+ */
+static void utc_SystemFW_device_haptic_open_func_02(void)
+{
+       int r = 0;
+       unsigned int mode =0;
+       haptic_dev_idx dev_idx = 1000;
+       
+       r = device_haptic_open(dev_idx,mode);
+       
+       if (r >= 0) {
+               tet_infoline("device_haptic_open() failed in negative test case");
+               tet_result(TET_FAIL);
+               device_haptic_close(r);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_play_file_func.c b/TC/unit/utc_SystemFW_device_haptic_play_file_func.c
new file mode 100644 (file)
index 0000000..52f5659
--- /dev/null
@@ -0,0 +1,82 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_play_file_func_01(void);
+static void utc_SystemFW_device_haptic_play_file_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_play_file_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_play_file_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_play_file()
+ */
+static void utc_SystemFW_device_haptic_play_file_func_01(void)
+{
+       int ret_val = 0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       unsigned int mode =0;
+       char* haptic_file = "/usr/share/immersion/01_Touch/touch_20ms_sharp.ivt";
+       int dev_handle;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_play_file() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ret_val = device_haptic_play_file(dev_handle, haptic_file, 1, 1);
+       if(ret_val < 0)
+       {
+               tet_infoline("device_haptic_play_file() failed in positive test case");
+               tet_result(TET_FAIL);
+               device_haptic_close(dev_handle);
+               return;
+       }
+
+       device_haptic_close(dev_handle);
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_play_file()
+ */
+static void utc_SystemFW_device_haptic_play_file_func_02(void)
+{
+       int ret_val = 0;
+       int invalid_handle = -1;
+       char* haptic_file = "/usr/share/immersion/01_Touch/touch_20ms_sharp.ivt";
+
+       ret_val = device_haptic_play_file(invalid_handle, haptic_file, 1, 1);
+       if(ret_val >= 0)
+       {
+               tet_infoline("device_haptic_play_file() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_play_monotone_func.c b/TC/unit/utc_SystemFW_device_haptic_play_monotone_func.c
new file mode 100644 (file)
index 0000000..ded5a33
--- /dev/null
@@ -0,0 +1,79 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_play_monotone_func_01(void);
+static void utc_SystemFW_device_haptic_play_monotone_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_play_monotone_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_play_monotone_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_play_monotone()
+ */
+static void utc_SystemFW_device_haptic_play_monotone_func_01(void)
+{
+       int ret_val = 0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       unsigned int mode =0;
+       int dev_handle;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_play_monotone() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ret_val = device_haptic_play_monotone(dev_handle ,1); 
+       if(ret_val < 0)
+       {
+               tet_infoline("device_haptic_play_monotone() failed in positive test case");
+               tet_result(TET_FAIL);
+               device_haptic_close(dev_handle);
+               return;
+       }
+
+       device_haptic_close(dev_handle);
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_play_monotone()
+ */
+static void utc_SystemFW_device_haptic_play_monotone_func_02(void)
+{
+       int ret_val = 0;
+       int invalid_handle = -1;
+
+       ret_val = device_haptic_play_monotone(invalid_handle ,1);
+       if(ret_val >= 0) {
+               tet_infoline("device_haptic_play_monotone() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_play_pattern_func.c b/TC/unit/utc_SystemFW_device_haptic_play_pattern_func.c
new file mode 100644 (file)
index 0000000..3972a1f
--- /dev/null
@@ -0,0 +1,81 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+#define HAPTIC_TEST_PATTERN EFFCTVIBE_NOTIFICATION
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_play_pattern_func_01(void);
+static void utc_SystemFW_device_haptic_play_pattern_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_play_pattern_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_play_pattern_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_play_pattern()
+ */
+static void utc_SystemFW_device_haptic_play_pattern_func_01(void)
+{
+       int ret_val = 0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       unsigned int mode =0;
+       int dev_handle = 0;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_play_pattern() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ret_val = device_haptic_play_pattern(dev_handle, HAPTIC_TEST_PATTERN , 1, 1);
+       if(ret_val < 0)
+       {
+               tet_infoline("device_haptic_play_pattern() failed in positive test case");
+               tet_result(TET_FAIL);
+               device_haptic_close(dev_handle);
+               return;
+       }
+
+       device_haptic_close(dev_handle);
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_play_pattern()
+ */
+static void utc_SystemFW_device_haptic_play_pattern_func_02(void)
+{
+
+       int ret_val = 0;
+       int invalid_handle = -1;
+
+       ret_val = device_haptic_play_pattern(invalid_handle, HAPTIC_TEST_PATTERN , 1, 1);
+       if(ret_val >= 0) {
+               tet_infoline("device_haptic_play_pattern() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_haptic_stop_play_func.c b/TC/unit/utc_SystemFW_device_haptic_stop_play_func.c
new file mode 100644 (file)
index 0000000..aef795c
--- /dev/null
@@ -0,0 +1,101 @@
+#include <tet_api.h>
+#include <devman.h>
+#include <devman_haptic.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_haptic_stop_play_func_01(void);
+static void utc_SystemFW_device_haptic_stop_play_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_haptic_stop_play_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_haptic_stop_play_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_haptic_stop_play()
+ */
+static void utc_SystemFW_device_haptic_stop_play_func_01(void)
+{
+       int ret_val = 0;
+       haptic_dev_idx dev_idx = DEV_IDX_0;
+       unsigned int mode =0;
+       int dev_handle = 0;
+
+       dev_handle = device_haptic_open(dev_idx,mode);
+       if(dev_handle < 0)
+       {
+               tet_infoline("device_haptic_stop_play() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ret_val = device_haptic_play_monotone(dev_handle ,100);                    
+       if(ret_val < 0)
+       {
+               tet_infoline("device_haptic_stop_play() failed in positive test case");
+               tet_result(TET_FAIL);
+               device_haptic_close(dev_handle);
+               return;
+       }
+
+        ret_val = device_haptic_stop_play(dev_handle);
+        if(ret_val < 0)
+        {
+                tet_infoline("device_haptic_stop_play() failed in positive test case");
+                tet_result(TET_FAIL);
+                device_haptic_close(dev_handle);
+                return;
+        }
+                                        
+
+       device_haptic_close(dev_handle);
+       tet_result(TET_PASS);
+       int r = 0;
+
+/*
+       r = device_haptic_stop_play(...);
+*/
+       if (r) {
+               tet_infoline("device_haptic_stop_play() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_haptic_stop_play()
+ */
+static void utc_SystemFW_device_haptic_stop_play_func_02(void)
+{
+       int r = 0;
+
+
+       r = device_haptic_stop_play(-1);
+
+       if (r>=0) {
+               tet_infoline("device_haptic_stop_play() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_is_battery_full_func.c b/TC/unit/utc_SystemFW_device_is_battery_full_func.c
new file mode 100644 (file)
index 0000000..1df689c
--- /dev/null
@@ -0,0 +1,66 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_is_battery_full_func_01(void);
+//static void utc_SystemFW_device_is_battery_full_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_is_battery_full_func_01, POSITIVE_TC_IDX },
+//     { utc_SystemFW_device_is_battery_full_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_is_battery_full()
+ */
+static void utc_SystemFW_device_is_battery_full_func_01(void)
+{
+               
+       int r = 0;
+
+
+       r = device_is_battery_full();
+
+       if (r<0) {
+               tet_infoline("device_is_battery_full() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_is_battery_full()
+ */
+//static void utc_SystemFW_device_is_battery_full_func_02(void)
+//{
+//     int r = 0;
+//
+  //   r = device_is_battery_full();
+//
+//     if (r>=0) {
+//             tet_infoline("device_is_battery_full() failed in negative test case");
+//             tet_result(TET_FAIL);
+//             return;
+//     }
+//     tet_result(TET_PASS);
+//}
diff --git a/TC/unit/utc_SystemFW_device_release_brt_ctrl_func.c b/TC/unit/utc_SystemFW_device_release_brt_ctrl_func.c
new file mode 100644 (file)
index 0000000..8eb716e
--- /dev/null
@@ -0,0 +1,73 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_release_brt_ctrl_func_01(void);
+static void utc_SystemFW_device_release_brt_ctrl_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_release_brt_ctrl_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_release_brt_ctrl_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_release_brt_ctrl()
+ */
+static void utc_SystemFW_device_release_brt_ctrl_func_01(void)
+{
+       int org_brt = 0;
+       int ret_val = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+
+       org_brt = device_get_display_brt(disp);
+       if(org_brt < 0)
+               org_brt = 7;
+
+
+
+       ret_val = device_release_brt_ctrl(disp);
+       if(ret_val < 0) {
+               tet_infoline("device_release_brt_ctrl() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_release_brt_ctrl()
+ */
+static void utc_SystemFW_device_release_brt_ctrl_func_02(void)
+{
+       int ret_val = 0;
+       int org_brt = -1;
+
+       display_num_t disp = -1;
+
+       ret_val = device_release_brt_ctrl(disp);
+       if(ret_val >=0 ) {
+               tet_infoline("device_release_brt_ctrl() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_release_gamma_ctrl_func.c b/TC/unit/utc_SystemFW_device_release_gamma_ctrl_func.c
new file mode 100644 (file)
index 0000000..9203cf9
--- /dev/null
@@ -0,0 +1,67 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_release_gamma_ctrl_func_01(void);
+static void utc_SystemFW_device_release_gamma_ctrl_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_release_gamma_ctrl_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_release_gamma_ctrl_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_release_gamma_ctrl()
+ */
+static void utc_SystemFW_device_release_gamma_ctrl_func_01(void)
+{
+       int ret_val = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+       display_gamma_t org_val = 1;
+
+       ret_val = device_release_gamma_ctrl(disp,org_val);
+       if(ret_val < 0) {
+               tet_infoline("device_release_gamma_ctrl() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_release_gamma_ctrl()
+ */
+static void utc_SystemFW_device_release_gamma_ctrl_func_02(void)
+{
+       int ret_val = 0;
+       int org_brt = -1;
+
+       display_num_t disp = -1;
+
+       ret_val = device_release_gamma_ctrl(disp,org_brt);
+       if (ret_val >= 0) {
+               tet_infoline("device_release_gamma_ctrl() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_set_display_brt_func.c b/TC/unit/utc_SystemFW_device_set_display_brt_func.c
new file mode 100644 (file)
index 0000000..f3c9c06
--- /dev/null
@@ -0,0 +1,65 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_set_display_brt_func_01(void);
+static void utc_SystemFW_device_set_display_brt_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_set_display_brt_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_set_display_brt_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_set_display_brt()
+ */
+static void utc_SystemFW_device_set_display_brt_func_01(void)
+{
+       int ret_val = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+
+       ret_val = device_set_display_brt(disp,6);
+       if(ret_val > 0) {
+               tet_infoline("device_set_display_brt() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_set_display_brt()
+ */
+static void utc_SystemFW_device_set_display_brt_func_02(void)
+{
+       int ret_val = 0;
+
+       display_num_t disp = -1;
+
+       ret_val = device_set_display_brt(disp,6);
+       if(ret_val >= 0) {
+               tet_infoline("device_set_display_brt() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_set_display_gamma_func.c b/TC/unit/utc_SystemFW_device_set_display_gamma_func.c
new file mode 100644 (file)
index 0000000..a703ed8
--- /dev/null
@@ -0,0 +1,65 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_set_display_gamma_func_01(void);
+static void utc_SystemFW_device_set_display_gamma_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_set_display_gamma_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_set_display_gamma_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_set_display_gamma()
+ */
+static void utc_SystemFW_device_set_display_gamma_func_01(void)
+{
+       int r = 0;
+       display_num_t disp = DEV_DISPLAY_0;
+
+       r = device_set_display_gamma(disp,1);
+       if (r<0) {
+               tet_infoline("device_set_display_gamma() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_set_display_gamma()
+ */
+static void utc_SystemFW_device_set_display_gamma_func_02(void)
+{
+       int r = 0;
+       display_num_t disp = -1;
+
+       r = device_set_display_gamma(disp,-1);
+
+       if (r>=0) {
+               tet_infoline("device_set_display_gamma() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_SystemFW_device_set_property_func.c b/TC/unit/utc_SystemFW_device_set_property_func.c
new file mode 100644 (file)
index 0000000..9eb7c44
--- /dev/null
@@ -0,0 +1,68 @@
+#include <tet_api.h>
+#include <devman.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_SystemFW_device_set_property_func_01(void);
+static void utc_SystemFW_device_set_property_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_SystemFW_device_set_property_func_01, POSITIVE_TC_IDX },
+       { utc_SystemFW_device_set_property_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0 },
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of device_set_property()
+ */
+static void utc_SystemFW_device_set_property_func_01(void)
+{
+       int value = 6;
+       int ret_val = 0;
+       int property = DISPLAY_PROP_BRIGHTNESS;
+       devtype_t devtype = DEVTYPE_DISPLAY0;
+
+       //set brightness to 6
+       ret_val = device_set_property(devtype,property,value);
+       if((ret_val < 0) || (value == -1)) {
+               tet_infoline("device_set_property() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init device_set_property()
+ */
+static void utc_SystemFW_device_set_property_func_02(void)
+{
+       int ret_val = 0;
+       int property = DISPLAY_PROP_BRIGHTNESS; 
+       devtype_t devtype = -1;
+
+       ret_val = device_set_property(devtype,property,-1);                                                                  
+       if(ret_val >= 0) {
+               tet_infoline("device_set_property() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..868e09c
--- /dev/null
@@ -0,0 +1,23 @@
+devman (0.1.6-77) unstable; urgency=low
+
+  * Fix JIRA Issue
+  * Git: pkgs/d/devman
+  * Tag: devman_0.1.6-77
+
+ -- DongGi Jang <dg0402.jang@samsung.com>  Thu, 22 Dec 2011 17:52:51 +0900
+
+devman (0.1.6-76) unstable; urgency=low
+
+  * sync version
+  * Git: pkgs/d/devman
+  * Tag: devman_0.1.6-76
+  
+ -- Jinkun Jang <jinkun.jang@samsung.com>  Thu, 15 Dec 2011 10:50:49 +0900
+  
+devman (0.0.1-1) unstable; urgency=low
+
+  * initial release
+  * Git: pkgs/d/devman
+  * Tag: devman_0.0.1-1
+
+ -- Jinkun Jang <jinkun.jang@samsung.com>  Wed, 07 Dec 2011 12:50:49 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..f73558c
--- /dev/null
@@ -0,0 +1,34 @@
+Source: devman
+Section: devel
+Priority: extra
+Maintainer: Jonghoon Han <jonghoon.han@samsung.com> Jinkun Jang <jinkun.jang@samsung.com> DongGi Jang <dg0402.jang@samsung.com> TAESOO JUN <steve.jun@samsung.com>
+Uploaders: Jinkun Jang <jinkun.jang@samsung.com>
+Build-Depends: debhelper (>= 5), libslp-setting-dev, libslp-sysman-dev, dlog-dev, libheynoti-dev
+Standards-Version: 0.1.0
+
+Package: libdevman-dev
+Section: libs
+Architecture: any
+Depends: libdevman-0 (= ${Source-Version}), libdevman-haptic-dev
+XB-Generate-Docs: yes
+Description: device manager library for device control
+
+Package: libdevman-haptic-dev
+Section: libs
+Architecture: any
+Depends: libdevman-0 (= ${Source-Version}),
+XB-Generate-Docs: yes
+Description: device manager library for device_haptic
+
+Package: libdevman-0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, 
+Description: device manager library for device control
+
+Package: libdevman-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libdevman-0 (= ${Source-Version})
+Description: device manager library for device control (unstripped)
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..a0f0008
--- /dev/null
@@ -0,0 +1 @@
+CMakeLists.txt
diff --git a/debian/libdevman-0.install.in b/debian/libdevman-0.install.in
new file mode 100644 (file)
index 0000000..19e8cf6
--- /dev/null
@@ -0,0 +1,4 @@
+@PREFIX@/lib/*.so*
+@PREFIX@/share/*
+@PREFIX@/bin/*
+etc/*
diff --git a/debian/libdevman-0.postinst.in b/debian/libdevman-0.postinst.in
new file mode 100755 (executable)
index 0000000..02d4738
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+mkdir -p /etc/udev/rules.d
+if ! [ -L /etc/udev/rules.d/91-devman.rules ]; then
+       ln -s @PREFIX@/share/devman/udev-rules/91-devman.rules /etc/udev/rules.d/91-devman.rules
+fi
+
diff --git a/debian/libdevman-0.postrm.in b/debian/libdevman-0.postrm.in
new file mode 100755 (executable)
index 0000000..08f5048
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+rm -f /etc/udev/rules.d/91-X1.rules
diff --git a/debian/libdevman-dev.install.in b/debian/libdevman-dev.install.in
new file mode 100644 (file)
index 0000000..84457c6
--- /dev/null
@@ -0,0 +1,3 @@
+@PREFIX@/include/devman/devman.h
+@PREFIX@/include/devman/SLP_devman_PG.h
+@PREFIX@/lib/pkgconfig/devman.pc
diff --git a/debian/libdevman-haptic-dev.install.in b/debian/libdevman-haptic-dev.install.in
new file mode 100644 (file)
index 0000000..7dce113
--- /dev/null
@@ -0,0 +1,2 @@
+@PREFIX@/include/devman/devman_haptic*.h
+@PREFIX@/lib/pkgconfig/devman_haptic.pc
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..ab5ca11
--- /dev/null
@@ -0,0 +1,134 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?= 
+PREFIX ?= /usr
+DATADIR ?= /opt
+DEVMAN_RSRCDIR ?= share/devman
+MACHINE ?= aquila
+AP_KERN_VER ?= S5PC110_2_6_29
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       CFLAGS="$(CFLAGS) -D${AP_KERN_VER}" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DCMAKE_DEVMAN_RSRC_PREFIX=$(DEVMAN_RSRCDIR) -DCMAKE_MACHINE=${MACHINE} -DCMAKE_DATADIR=${DATADIR}
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       -$(MAKE) clean
+       rm -rf CMakeCache.txt
+       rm -rf CMakeFiles
+       rm -rf cmake_install.cmake
+       rm -rf Makefile
+       rm -rf install_manifest.txt
+       rm -rf test/CMakeFiles
+       rm -rf test/cmake_install.cmake
+       rm -rf test/Makefile
+       rm -rf test/install_manifest.txt
+
+       rm -rf *.so
+       rm -rf *.pc
+       rm -rf debian/*.install
+       rm -rf debian/*.postinst
+       rm -rf debian/*.postrm
+       rm -rf udev-files/*.rules
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+       mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/
+       mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/
+       ln -s ../init.d/devman $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S10devman
+       ln -s ../init.d/devman $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/S10devman
+
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+#      dh_strip
+       dh_strip --dbg-package=libdevman-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/device_engine.c b/device_engine.c
new file mode 100644 (file)
index 0000000..58870f0
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "devlog.h"
+#include "device_engine.h"
+
+struct device *dev_head = NULL;
+#define BUFF_MAX 255
+
+void add_dev(struct device *dev)
+{
+       dev->next = dev_head;
+       dev_head = dev;
+}
+
+void print_devices()
+{
+       struct device *dev;
+       dev = dev_head;
+
+       while (dev) {
+               DBG("%s - %d", dev->devname, dev->devtype);
+               dev = dev->next;
+       }
+}
+
+void reset_devtype()
+{
+       struct device *dev;
+       dev = dev_head;
+
+       while (dev) {
+               dev->devtype = -1;
+               dev = dev->next;
+       }
+}
+
+struct device *find_device(struct device *root_dev, devtype_t devtype)
+{
+       struct device *dev;
+
+       if (devtype == -1)
+               return NULL;
+
+       if (root_dev == NULL)
+               dev = dev_head;
+       else
+               dev = root_dev;
+
+       while (dev) {
+               DBG("devname = %s %d %d", dev->devname, dev->devtype, devtype);
+               if (dev->devtype == devtype)
+                       return dev;
+               dev = dev->next;
+       }
+
+       return NULL;
+}
+
+int find_sysfs_node(char *path, char *node_name)
+{
+       DIR *dp;
+       struct dirent *entry;
+
+       dp = opendir(path);
+       if (dp == NULL) {
+               DBG("path is not existed : %s", path);
+               return -1;
+       }
+
+       while ((entry = readdir(dp)) != NULL) {
+               if (strncmp(entry->d_name, ".", 1) == 0 ||
+                   strncmp(entry->d_name, "..", 2) == 0)
+                       continue;
+               else
+                       break;
+       }
+
+       /* copy node name */
+       if (entry != NULL) {
+               if (node_name != NULL)
+                       strncpy(node_name, entry->d_name,PATH_MAX);
+
+       } else {
+               DBG("sysfs node not existed");
+               if (closedir(dp) != 0)
+                       DBG("Unable to close directory");
+               return -1;
+       }
+
+       if (closedir(dp) != 0)
+               DBG("Unable to close directory");
+       return 0;
+}
+
+int set_devtype(char *devname, devtype_t devtype)
+{
+       int ret;
+       struct device *dev;
+       dev = dev_head;
+
+       while (dev) {
+               if (strstr(dev->devname, devname)) {
+                       if ((strstr(dev->devname, "auto") != NULL) &&
+                           (dev->probe != NULL)) {
+                               ret = dev->probe();
+                               if (ret < 0) {
+                                       DBG("auto probe failed");
+                                       return -1;
+                               }
+                       }
+
+                       dev->devtype = devtype;
+                       return 0;
+               }
+               dev = dev->next;
+       }
+
+       return -1;
+}
+
+static int sys_read_buf(char *file, char *buf)
+{
+       int fd;
+       int r;
+
+       fd = open(file, O_RDONLY);
+       if (fd == -1) {
+               ERR("%s open error: %s", file, strerror(errno));
+               return -1;
+       }
+
+       r = read(fd, buf, BUFF_MAX);
+       if ((r >= 0) && (r < BUFF_MAX))
+               buf[r] = '\0';
+       else {
+               ERR("%s read error: %s", file, strerror(errno));
+               return -1;
+       }
+
+       close(fd);
+       INFO("read %s, value= %s", file, buf);
+       return 0;
+}
+
+static int sys_write_buf(char *file, char *buf)
+{
+       int fd;
+       int r;
+
+       fd = open(file, O_WRONLY);
+       if (fd == -1) {
+               ERR("%s open error: %s", file, strerror(errno));
+               return -1;
+       }
+
+       r = write(fd, buf, strlen(buf));
+       close(fd);
+       if (r < 0) {
+               ERR("%s write error: %s", file, strerror(errno));
+               return -1;
+       }
+       INFO("write %s, value= %s", file, buf);
+       return 0;
+}
+
+int sys_get_int(char *fname, int *val)
+{
+       char buf[BUFF_MAX];
+
+       if (sys_read_buf(fname, buf) == 0) {
+               *val = atoi(buf);
+               return 0;
+       } else {
+               *val = -1;
+               return -1;
+       }
+}
+
+char *sys_get_str(char *fname)
+{
+       char buf[BUFF_MAX];
+       char *r = NULL;
+
+       if (sys_read_buf(fname, buf) == 0)
+               r = strdup((char *)buf);
+
+       return r;
+}
+
+int sys_set_int(char *fname, int val)
+{
+       char buf[BUFF_MAX];
+       int r = -1;
+       snprintf(buf, sizeof(buf), "%d", val);
+
+       if (sys_write_buf(fname, buf) == 0)
+               r = 0;
+
+       return r;
+}
+
+int sys_set_str(char *fname, char *val)
+{
+       int r = -1;
+
+       if (val != NULL) {
+               if (sys_write_buf(fname, val) == 0)
+                       r = 0;
+       }
+
+       return r;
+}
diff --git a/device_engine.h b/device_engine.h
new file mode 100644 (file)
index 0000000..f130704
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#include <stdio.h>
+#include "devman.h"
+
+struct device {
+       devtype_t devtype;
+       char *devname;
+       int (*set_int) (int property, int val);
+       int (*get_int) (int property, int *val);
+       int (*probe) (void);
+       struct device *next;
+};
+
+void add_dev(struct device *dev);
+struct device *find_device(struct device *root_dev, devtype_t devtype);
+int set_devtype(char *devname, devtype_t devtype);
+void reset_devtype();
+void print_devices();
+
+int find_sysfs_node(char *path, char *node_name);
+
+int sys_get_int(char *fname, int *val);
+int sys_set_int(char *fname, int val);
+char *sys_get_str(char *fname);
+int sys_set_str(char *fname, char *val);
diff --git a/device_generic.h b/device_generic.h
new file mode 100644 (file)
index 0000000..f914769
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVICE_GENERIC_H__
+#define __DEVICE_GENERIC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Jack */
+       int generic_jack_interface_get(char *nodename, int prop, int *val);
+       int generic_jack_interface_set(char *nodename, int prop, int val);
+
+/* Power Supply */
+       int generic_class_power_supply_get(char *nodename, int prop, int *val);
+
+/* Touch panel */
+       int generic_class_touchkey_get(char *nodename, int *val);
+       int generic_class_touchkey_set(char *nodename, int val);
+
+/* LCD */
+       int generic_class_lcd_get(char *nodename, int prop, int *val);
+       int generic_class_lcd_set(char *nodename, int prop, int val);
+
+/* Backlight */
+       int generic_class_backlight_get(char *nodename, int prop, int *val);
+       int generic_class_backlight_set(char *nodename, int prop, int val);
+
+/* LED */
+       int generic_class_led_get(char *nodename, int prop, int *val);
+       int generic_class_led_set(char *nodename, int prop, int val);
+
+/* Generic Motor */
+       int generic_class_haptic_get(char *nodename, int prop, int *val);
+       int generic_class_haptic_set(char *nodename, int prop, int val);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                         /* __DEVICE_GENERIC_H__ */
diff --git a/device_haptic.c b/device_haptic.c
new file mode 100644 (file)
index 0000000..5e8ceaf
--- /dev/null
@@ -0,0 +1,1852 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <vconf.h>
+#include <dlfcn.h>
+
+#include "devlog.h"
+#include "device_haptic.h"
+#include "devman.h"
+#include "devman_haptic.h"
+#include "devman_haptic_ext.h"
+/* START: Will be excluded by removing pattern */
+#include "device_haptic_tsp4000_pattern.h"
+/* END: Will be excluded */
+
+#ifndef EXTAPI
+#define EXTAPI __attribute__ ((visibility("default")))
+#endif /* EXTAPI */
+
+
+#define HAPTIC_DEVICE_NODE_PATH                "/dev/tspdrv"
+#define HAPTIC_MODULE_PATH             "/usr/lib/devman/libdevman_haptic.so"
+
+/* START: Will be removed by removing pattern */
+#define HAPTIC_PLAY_FILE_EXT           ".ivt"
+#define HAPTIC_BUILT_IN_FILE_PATH      "/usr/share/immersion"
+
+struct g_pivt_list_t
+{
+       char file_name[NAME_MAX];
+       unsigned char *ivt_pt;
+       int priority;
+};
+
+struct g_pivt_list_t g_haptic_internal_pattern_list[EFFCTVIBE_PATTERN_END] = {
+       /*for BeatUX*/
+       [EFFCTVIBE_TOUCH]                       = { "/01_Touch/touch_20ms_sharp", touch_ivt, 15},
+       [EFFCTVIBE_HW_TOUCH]                    = { "/01_Touch/HW_touch_30ms_sharp", hw_touch_ivt, 15},
+
+       [EFFCTVIBE_NOTIFICATION]                = { "/02_Notification/Notification", noti_ivt, 7},
+       [EFFCTVIBE_INCOMING_CALL01]             = { "/02_Notification/Incoming call_01", incomming_01_ivt, 7},
+       [EFFCTVIBE_INCOMING_CALL02]             = { "/02_Notification/Incoming call_02", incomming_02_ivt, 7},
+       [EFFCTVIBE_INCOMING_CALL03]             = { "/02_Notification/Incoming call_03", incomming_03_ivt, 7},
+
+       [EFFCTVIBE_ALERTS_CALL]                 = { "/03_Operation/Alerts on Call", alerts_call_ivt, 15},
+       [EFFCTVIBE_OPERATION]                   = { "/03_Operation/Operation", operation_ivt, 7},
+       [EFFCTVIBE_SILENT_MODE]                 = { "/03_Operation/Silent mode", silent_ivt, 7},
+};
+/* END: Will be removed */
+
+static int has_haptic_module = -1;
+static int master_callback_enable = 0;
+static int setting_fb_level = -1;
+static int device_handle_count = 0;
+static void *dlopen_handle;
+
+enum {
+       MODE_DEFAULT = 0x0000,
+       MODE_FEEDBACK_LEVEL_CHECK_DISABLE = 0x0001,
+};
+
+static void (*_haptic_internal_prepare_node) (void);
+static int (*_haptic_internal_play_buffer) (int, const unsigned char *, int, int, int);
+static int (*_haptic_internal_play_file) (int, const char *, int, int, int);
+static int (*_haptic_internal_play_monotone) (int, int, int, int);
+static int (*_haptic_internal_get_buffer_duration) (int, const unsigned char *, int *);
+static int (*_haptic_internal_get_file_duration) (int, const char *, int *);
+static int (*_haptic_internal_initialize) (void);
+static int (*_haptic_internal_terminate) (void);
+static int (*_haptic_internal_open_composite_device) (int *, int, int *);
+static int (*_haptic_internal_open_device) (int, int*);
+static int (*_haptic_internal_set_device_property_string) (int, int, const char *);
+static int (*_haptic_internal_set_device_property_int32) (int, int, int);
+static int (*_haptic_internal_set_device_property_bool) (int, int, unsigned char);
+static int (*_haptic_internal_get_device_property_string) (int, int, int, char *);
+static int (*_haptic_internal_get_device_property_int32) (int, int, int *);
+static int (*_haptic_internal_get_device_property_bool) (int, int, unsigned char *);
+static int (*_haptic_internal_play_IVT_effect) (int, const unsigned char *, int, int *);
+static int (*_haptic_internal_play_IVT_effect_repeat) (int, const unsigned char *, int, unsigned char, int *);
+static int (*_haptic_internal_close_device) (int);
+static int (*_haptic_internal_stop_all_playing_effects) (int);
+static int (*_haptic_internal_play_periodic_effect) (int, int, int, int, int, int, int, int, int, int *);
+static int (*_haptic_internal_get_device_count) (void);
+static int (*_haptic_internal_get_device_state) (int, int *);  
+static int (*_haptic_internal_get_device_capability_bool) (int, int, unsigned char *);
+static int (*_haptic_internal_get_device_capability_int32) (int, int, int *);
+static int (*_haptic_internal_get_device_capability_string) (int, int, int, char *);
+static int (*_haptic_internal_get_IVT_effect_count) (const unsigned char *);
+static int (*_haptic_internal_get_IVT_effect_name) (const unsigned char *, int, int, char *);
+static int (*_haptic_internal_get_IVT_effect_name_u) (const unsigned char *, int, int, unsigned short *);
+static int (*_haptic_internal_get_IVT_effect_index_from_name) (const unsigned char *, const char *, int *);
+static int (*_haptic_internal_get_IVT_effect_index_from_name_u) (const unsigned char *, const unsigned short *, int *);
+static int (*_haptic_internal_stop_playing_effect) (int, int);
+static int (*_haptic_internal_get_IVT_effect_type) (const unsigned char *, int, int *);
+static int (*_haptic_internal_get_IVT_magsweep_effect_definition) (const unsigned char *, int, int *, int *, int *, int *, int *, int *, int *);
+static int (*_haptic_internal_get_IVT_periodic_effect_definition) (const unsigned char *, int, int *, int *, int *, int *, int *, int *, int *, int *);
+static int (*_haptic_internal_get_IVT_effect_duration) (const unsigned char *, int, int *);
+static int (*_haptic_internal_play_magsweep_effect) (int, int, int, int, int, int, int, int, int *);
+static int (*_haptic_internal_play_periodic_effect) (int, int, int, int, int, int, int, int, int, int *);
+static int (*_haptic_internal_modify_playing_magsweep_effect) (int, int, int, int, int, int, int, int, int);
+static int (*_haptic_internal_modify_playing_periodic_effect) (int, int, int, int, int, int, int, int, int, int);
+static int (*_haptic_internal_create_streaming_effect) (int, int *);
+static int (*_haptic_internal_destroy_streaming_effect) (int, int);
+static int (*_haptic_internal_play_streaming_sample) (int, int, const unsigned char *, int);
+static int (*_haptic_internal_play_streaming_sample_with_offset) (int, int, const unsigned char *, int, int);
+static int (*_haptic_internal_save_IVT_file) (const unsigned char *, const char *);
+static int (*_haptic_internal_delete_IVT_file) (const char *);
+static int (*_haptic_internal_pause_playing_effect) (int, int);
+static int (*_haptic_internal_resume_paused_effect) (int, int);
+static int (*_haptic_internal_get_effect_state) (int, int, int *);
+static int (*_haptic_internal_get_IVT_size) (const unsigned char *, int);
+static int (*_haptic_internal_initialize_IVT_buffer) (unsigned char *, int);
+static int (*_haptic_internal_insert_IVT_element) (unsigned char *, int, int, const HapticElement *);
+static int (*_haptic_internal_insert_IVT_element2) (unsigned char *, int, int, const HapticElement2 *);
+static int (*_haptic_internal_insert_IVT_element3) (unsigned char *, int, int, const HapticElement3 *);
+static int (*_haptic_internal_read_IVT_element) (const unsigned char *, int, int, int, HapticElement *);
+static int (*_haptic_internal_read_IVT_element2) (const unsigned char *, int, int, int, HapticElement2 *);
+static int (*_haptic_internal_read_IVT_element3) (const unsigned char *, int, int, int, HapticElement3 *);
+static int (*_haptic_internal_remove_IVT_element) (unsigned char *, int, int, int);
+
+/* START of Static Function Section */
+static int __get_master_strength_value()
+{
+        int input_strength = 0;
+
+        switch (setting_fb_level) {
+        case SETTING_VIB_FEEDBACK_LEVEL0:
+                DBG("get setting value = 0 , so can not vibe");
+                return 0;
+                break;
+        case SETTING_VIB_FEEDBACK_LEVEL1:
+               input_strength = VIBE_FEEDBACK_LEVEL_1;
+                break;
+
+        case SETTING_VIB_FEEDBACK_LEVEL2:
+               input_strength = VIBE_FEEDBACK_LEVEL_2;
+                break;
+
+        case SETTING_VIB_FEEDBACK_LEVEL3:
+               input_strength = VIBE_FEEDBACK_LEVEL_3;
+                break;
+
+        case SETTING_VIB_FEEDBACK_LEVEL4:
+               input_strength = VIBE_FEEDBACK_LEVEL_4;
+                break;
+
+        case SETTING_VIB_FEEDBACK_LEVEL5:
+               input_strength = VIBE_FEEDBACK_LEVEL_5;
+                break;
+
+        default:
+                ERR("error get VCONF_SETAPPL_VIB_FEEDBACK_INT value (= %d) invalid", setting_fb_level);
+                return -2;
+                break;
+        }
+
+        return input_strength;
+}
+
+static int __convert_strength_level(int type, int base_level)
+{
+       int convert_strength = 0;
+
+       switch (base_level) {
+       case 0:
+               ERR("Input base_level == 0(:%d)\n", base_level);
+               break;
+
+       case HAPTIC_FEEDBACK_LEVEL_1:
+               convert_strength = VIBE_FEEDBACK_LEVEL_1;
+               break;
+
+       case HAPTIC_FEEDBACK_LEVEL_2:
+               convert_strength = VIBE_FEEDBACK_LEVEL_2;
+               break;
+
+       case HAPTIC_FEEDBACK_LEVEL_3:
+               convert_strength = VIBE_FEEDBACK_LEVEL_3;
+               break;
+
+       case HAPTIC_FEEDBACK_LEVEL_4:
+               convert_strength = VIBE_FEEDBACK_LEVEL_4;
+               break;
+
+       case HAPTIC_FEEDBACK_LEVEL_5:
+               convert_strength = VIBE_FEEDBACK_LEVEL_5;
+               break;
+
+       default:
+               ERR("error invalid convertable value (%d)", base_level);
+               return -2;
+       }
+
+       return convert_strength;
+}
+
+static void __haptic_changed_cb(keynode_t *node, void *data)
+{
+       int feedback_level;
+
+       DBG("[haptic_changed_cb] changed key = %s\n",
+           vconf_keynode_get_name(node));
+
+       if (vconf_keynode_get_type(node) == VCONF_TYPE_INT) {
+
+               feedback_level = vconf_keynode_get_int(node);
+
+               if (feedback_level == -1) {
+                       ERR(" [haptic_changed_cb] Err vconf_keynode_get_int fail from key in haptic_changed_cb : %s , fail state : %d ,so set default level", vconf_keynode_get_name(node), feedback_level);
+                       return;
+               }
+               DBG("[haptic_changed_cb] get value : %d , from key : %s",
+                   feedback_level, vconf_keynode_get_name(node));
+
+               setting_fb_level = feedback_level;
+       } else {
+               ERR("[haptic_changed_cb] Err changed key_type miss-match!!  read_type : %d", vconf_keynode_get_type(node));
+       }
+}
+/* END of Static Function Section */
+
+
+/* START: devman_haptic APIs */
+EXTAPI
+int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode)
+{
+       int status;
+       int device_index = dev_idx >> 1;
+       int device_handle;
+
+       if (device_handle_count == 0) {
+               if (has_haptic_module == 1) {
+                       _haptic_internal_prepare_node();
+
+                       if (_haptic_internal_initialize() < 0) {
+                               ERR("_haptic_internal_initialize() failed");
+                               return HAPTIC_FAIL;
+                       }
+               }
+
+               if (mode & MODE_FEEDBACK_LEVEL_CHECK_DISABLE) {
+                       pid_t cpid;
+                       cpid = getpid();
+                       DBG("NOT USE MAIN VIB_FEEDBACK_CHECK ROUTINE !!, at pid : %d", cpid);
+                       setting_fb_level = SETTING_VIB_FEEDBACK_LEVEL3;
+               } else if (master_callback_enable == 0) {
+                       status = vconf_get_int(VCONFKEY_SETAPPL_VIB_FEEDBACK_INT, &setting_fb_level);
+                       if (status < 0) {
+                               DBG(" vconf_get_int fail from key : %s , fail state : %d ,so set default level", VCONFKEY_SETAPPL_VIB_FEEDBACK_INT, status);
+                               setting_fb_level = SETTING_VIB_FEEDBACK_LEVEL3;
+                       }
+                       DBG("get value : %d , from key : %s", setting_fb_level, VCONFKEY_SETAPPL_VIB_FEEDBACK_INT);
+
+                       status = vconf_notify_key_changed (VCONFKEY_SETAPPL_VIB_FEEDBACK_INT, __haptic_changed_cb, NULL);
+                       if (status < 0) {
+                               ERR("Device_haptic_open vconf_notify_key_changed fail\n");
+                               return HAPTIC_FAIL;
+                       }
+
+                       master_callback_enable = 1;
+               }
+       }
+
+       if (has_haptic_module == 1) {
+               if (dev_idx == DEV_IDX_ALL) {
+                       status = _haptic_internal_open_composite_device(NULL, device_index, &device_handle);
+                       if(HAPTIC_FAILED(status)) {
+                               ERR("_haptic_internal_open_composite_device() Failed: %d", status);
+                               return HAPTIC_FAIL; 
+                       }
+               } else {
+                       status = _haptic_internal_open_device(device_index, &device_handle);
+                       if(HAPTIC_FAILED(status)) {
+                               ERR("_haptic_internal_open_device() Failed: %d", status);
+                               return HAPTIC_FAIL;
+                       }
+               }
+
+               ++device_handle_count;
+               return device_handle;
+       }
+
+       ++device_handle_count;
+       return DEFAULT_DEVICE_HANDLE;
+}
+
+EXTAPI
+int device_haptic_close(int device_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device already closed");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 1) {
+               status = _haptic_internal_close_device(device_handle);
+               if(HAPTIC_FAILED(status)) {
+                       ERR("_haptic_internal_close_device(0) fail: %d", status);
+                       return HAPTIC_FAIL;
+               }
+       }
+
+       --device_handle_count;
+       if (device_handle_count == 0) {
+               if (has_haptic_module == 1) {
+                       status = _haptic_internal_terminate();
+                       if(HAPTIC_FAILED(status)) {
+                               ERR("_haptic_internal_terminate(0) fail: %d", status);
+                               return HAPTIC_FAIL;
+                       }
+               }
+
+               if (master_callback_enable == 1) {
+                       status = vconf_ignore_key_changed(VCONFKEY_SETAPPL_VIB_FEEDBACK_INT, __haptic_changed_cb);
+                       if (status < 0) {
+                               ERR("Device_haptic_close vconf_ignore_key_changed fail\n");
+                               return HAPTIC_FAIL;
+                       }
+                       master_callback_enable = 0;
+               }
+       }
+
+       return HAPTIC_SUCCESS;
+}
+
+EXTAPI
+int device_haptic_play_buffer(int device_handle, const unsigned char *vibe_buffer, int iteration, int feedback_level)
+{
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_buffer(device_handle, vibe_buffer, iteration, feedback_level, HAPTIC_MIN_DEVICE_PRIORITY);
+}
+
+EXTAPI
+int device_haptic_play_file(int device_handle, const char *file_name, int iteration, int feedback_level)
+{
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_file(device_handle, file_name, iteration, feedback_level, HAPTIC_MIN_DEVICE_PRIORITY);
+}
+
+EXTAPI
+int device_haptic_play_pattern(int device_handle, int pattern, int iteration, int feedback_level)
+{
+       char file_name[NAME_MAX];
+       int priority = -1;
+       int input_feedback_level = feedback_level;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       if (feedback_level == HAPTIC_FEEDBACK_LEVEL_AUTO) {
+               input_feedback_level = -setting_fb_level;
+       }
+
+       /* Set Priority */
+       if (!g_haptic_internal_pattern_list[pattern].priority) {
+               priority = HAPTIC_MIN_DEVICE_PRIORITY;
+       } else {
+               priority = g_haptic_internal_pattern_list[pattern].priority;
+       }
+
+       if (!g_haptic_internal_pattern_list[pattern].ivt_pt) {
+               /* Pass filename insted of buffer pointer */
+               if (0 > snprintf(file_name, NAME_MAX, "%s%s%s", HAPTIC_BUILT_IN_FILE_PATH, g_haptic_internal_pattern_list[pattern].file_name, HAPTIC_PLAY_FILE_EXT))
+               {
+                       ERR("snprintf fail in EFFCTVIBE_SET_EFFECT_TYPE");
+                       return HAPTIC_FAIL;
+               }
+
+               return _haptic_internal_play_file(device_handle, file_name, iteration, input_feedback_level, HAPTIC_MIN_DEVICE_PRIORITY);
+       }
+
+       return _haptic_internal_play_buffer(device_handle, g_haptic_internal_pattern_list[pattern].ivt_pt, iteration, input_feedback_level, priority);
+}
+
+EXTAPI
+int device_haptic_stop_play(int device_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 1) {
+               status = _haptic_internal_stop_all_playing_effects(device_handle);
+               if(HAPTIC_FAILED(status)) {
+                       ERR("_haptic_internal_stop_all_playing_effects(0) fail: %d", status);
+                       return HAPTIC_FAIL;
+               }
+       } else {
+               status = device_set_property(DEVTYPE_HAPTIC, HAPTIC_PROP_ENABLE, 0);
+               if (status < 0) {
+                       ERR("Haptic device stop failed: %d", status);
+                       return HAPTIC_FAIL;
+               }
+       }
+
+       return HAPTIC_SUCCESS;
+}
+
+EXTAPI
+int device_haptic_play_monotone(int device_handle, int duration)
+{
+       int status;
+       int input_strength;
+       int effect_handle;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 1) {
+               status = _haptic_internal_play_monotone(device_handle, duration, -setting_fb_level, 0x05);
+               if(HAPTIC_FAILED(status)) {
+                       ERR("_haptic_internal_play_monotone(0) fail: %d", status);
+                       return HAPTIC_FAIL;
+               }
+       } else {
+               input_strength = __get_master_strength_value();
+               if (input_strength < 0) {
+                       ERR("convert_strength_level fail : %d", input_strength);
+                       return HAPTIC_FAIL;
+               }
+
+               status = device_set_property(DEVTYPE_HAPTIC, HAPTIC_PROP_LEVEL, input_strength);
+               if (status < 0) {
+                       ERR(" haptic_set_level for strength:%d (error:%d) \n", input_strength, status);
+                       return HAPTIC_FAIL;
+               }
+
+               status = device_set_property(DEVTYPE_HAPTIC, HAPTIC_PROP_ONESHOT, duration);
+               if (status < 0) {
+                       ERR(" haptic_oneshot for duration:%d (error:%d) \n", duration, status);
+                       return HAPTIC_FAIL;
+               }
+       }
+
+       return HAPTIC_SUCCESS;
+}
+
+EXTAPI
+int device_haptic_get_buffer_duration(int device_handle, const unsigned char *vibe_buffer, int *duration)
+{
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_buffer_duration(device_handle, vibe_buffer, duration); 
+}
+
+EXTAPI
+int device_haptic_get_file_duration(int device_handle, const char *file_name, int *duration)
+{
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_file_duration(device_handle, file_name, duration);
+}
+
+EXTAPI
+int device_haptic_get_pattern_duration(int device_handle, int pattern, int *duration)
+{
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+       int status;
+       char file_name[NAME_MAX];
+
+       if (!g_haptic_internal_pattern_list[pattern].ivt_pt) {
+               /* Pass filename insted of buffer pointer */
+               if (0 > snprintf(file_name, NAME_MAX, "%s%s%s", HAPTIC_BUILT_IN_FILE_PATH, g_haptic_internal_pattern_list[pattern].file_name, HAPTIC_PLAY_FILE_EXT))
+               {
+                       ERR("snprintf fail in EFFCTVIBE_SET_EFFECT_TYPE");
+                       return HAPTIC_FAIL;
+               }
+
+               return _haptic_internal_get_file_duration(device_handle, file_name, duration);
+       }
+
+       return _haptic_internal_get_buffer_duration(device_handle, g_haptic_internal_pattern_list[pattern].ivt_pt, duration);
+}
+
+EXTAPI
+int device_haptic_get_device_count()
+{
+       int status;
+       int device_count = -1;
+
+       if (has_haptic_module == 0) {
+               return DEFAULT_MOTOR_COUNT;
+       }
+
+       if (device_handle_count == 0) {
+               _haptic_internal_prepare_node();
+
+               status = _haptic_internal_initialize();
+               if (status < 0) {
+                       return HAPTIC_FAIL;
+               }
+               /* Get device count */
+               device_count = _haptic_internal_get_device_count();
+               if(HAPTIC_FAILED(device_count)) {
+                       ERR("_haptic_internal_get_device_count(0) fail: %d",status);
+                       return HAPTIC_FAIL;
+               }
+
+               status = _haptic_internal_terminate();
+               if (status < 0) {
+                       return HAPTIC_FAIL;
+               }
+       } else {
+               device_count = _haptic_internal_get_device_count();
+               if(HAPTIC_FAILED(device_count)) {
+                       ERR("_haptic_internal_get_device_count(0) fail: %d",status);
+                       return HAPTIC_FAIL;
+               }
+       }
+
+       return device_count;
+}
+/* END: devman_haptic APIs */
+
+
+/* START: devman_haptic_ext APIs */
+EXTAPI
+int device_haptic_get_device_state(int device_index, int *state)
+{
+       int status;
+       int index = device_index >> 1;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_state(index, state);
+}
+
+EXTAPI
+int device_haptic_get_device_capability_bool(int device_index, int device_cap_type, unsigned char *device_cap_value)
+{
+       int status;
+       int index = device_index >> 1;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_capability_bool(index, device_cap_type, device_cap_value);
+}
+
+EXTAPI
+int device_haptic_get_device_capability_int32(int device_index, int device_cap_type, int *device_cap_value)
+{
+       int status;
+       int index = device_index >> 1;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_capability_int32(index, device_cap_type, device_cap_value);
+}
+
+EXTAPI
+int device_haptic_get_device_capability_string(int device_index, int device_cap_type, int size, char *device_cap_value)
+{
+       int status;
+       int index = device_index >> 1;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_capability_string(index, device_cap_type, size, device_cap_value);
+}
+
+EXTAPI
+int device_haptic_get_device_property_bool(int device_handle, int device_prop_type, unsigned char *device_prop_value)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_property_bool(device_handle, device_prop_type, device_prop_value);
+}
+
+EXTAPI
+int device_haptic_set_device_property_bool(int device_handle, int device_prop_type, unsigned char device_prop_value)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_set_device_property_bool(device_handle, device_prop_type, device_prop_value);
+}
+
+EXTAPI
+int device_haptic_get_device_property_int32(int device_handle, int device_prop_type, int *device_prop_value)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_property_int32(device_handle, device_prop_type, device_prop_value);
+}
+
+EXTAPI
+int device_haptic_set_device_property_int32(int device_handle, int device_prop_type, int device_prop_value)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_set_device_property_int32(device_handle, device_prop_type, device_prop_value);
+}
+
+EXTAPI
+int device_haptic_get_device_property_string(int device_handle, int device_prop_type, int size, char *device_prop_value)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_device_property_string(device_handle, device_prop_type, size, device_prop_value);
+}
+
+EXTAPI
+int device_haptic_set_device_property_string(int device_handle, int device_prop_type, const char *device_prop_value)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_set_device_property_string(device_handle, device_prop_type, device_prop_value);
+}
+
+EXTAPI
+int device_haptic_get_effect_count(const unsigned char *haptic_buffer)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_count(haptic_buffer);
+}
+
+EXTAPI
+int device_haptic_get_effect_name(const unsigned char *haptic_buffer, int effect_index, int size, char *effect_name)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_name(haptic_buffer, effect_index, size, effect_name);
+}
+
+EXTAPI
+int device_haptic_get_effect_name_u(const unsigned char *haptic_buffer, int effect_index, int size, unsigned short *effect_name)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_name_u(haptic_buffer, effect_index, size, effect_name);
+}
+
+EXTAPI
+int device_haptic_get_effect_index_from_name(const unsigned char *haptic_buffer, char const *effect_name, int *effect_index)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_index_from_name(haptic_buffer, effect_name, effect_index);
+}
+
+EXTAPI
+int device_haptic_get_effect_index_from_name_u(const unsigned char *haptic_buffer, const unsigned short *effect_name, int *effect_index)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_index_from_name_u(haptic_buffer, effect_name, effect_index);
+}
+
+EXTAPI
+int device_haptic_play_effect(int device_handle, const unsigned char *haptic_buffer, int effect_index, int *effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_IVT_effect(device_handle, haptic_buffer, effect_index, effect_handle);
+}
+
+EXTAPI
+int device_haptic_play_effect_repeat(int device_handle, const unsigned char *haptic_buffer, int effect_index, unsigned char repeat, int *effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_IVT_effect_repeat(device_handle, haptic_buffer, effect_index, repeat, effect_handle);
+}
+
+EXTAPI
+int device_haptic_stop_playing_effect(int device_handle, int effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_stop_playing_effect(device_handle, effect_handle);
+}
+
+EXTAPI
+int device_haptic_get_effect_type(const unsigned char *haptic_buffer, int effect_index, int *effect_type)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_type(haptic_buffer, effect_index, effect_type);
+}
+
+EXTAPI
+int device_haptic_get_magsweep_effect_definition(const unsigned char *haptic_buffer, int effect_index,
+       int *duration, int *magnitude, int *style, int *attacktime, int *attacklevel,
+       int *fadetime, int *fadelevel)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_magsweep_effect_definition(haptic_buffer, effect_index, duration, magnitude, style, attacktime, attacklevel, fadetime, fadelevel);
+}
+
+EXTAPI
+int device_haptic_get_periodic_effect_definition(const unsigned char *haptic_buffer, int effect_index,
+       int *duration, int *magnitude, int *period, int *style_and_wave_type, int *attacktime, int *attacklevel,
+       int *fadetime, int *fadelevel)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_periodic_effect_definition(haptic_buffer, effect_index, duration, magnitude, period, style_and_wave_type, attacktime, attacklevel, fadetime, fadelevel);
+}
+
+EXTAPI
+int device_haptic_get_effect_duration(const unsigned char *haptic_buffer, int effect_index, int *effect_duration)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_effect_duration(haptic_buffer, effect_index, effect_duration);
+}
+
+EXTAPI
+int device_haptic_play_magsweep_effect(int device_handle,
+       int duration, int magnitude, int style, int attacktime, int attacklevel,
+       int fadetime, int fadelevel, int *effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_magsweep_effect(device_handle, duration, magnitude, style, attacktime, attacklevel, fadetime, fadelevel, effect_handle);
+}
+
+EXTAPI
+int device_haptic_play_periodic_effect(int device_handle,
+       int duration, int magnitude, int period, int style_and_wave_type, int attacktime, int attacklevel,
+       int fadetime, int fadelevel, int *effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_periodic_effect(device_handle, duration, magnitude, period, style_and_wave_type, attacktime, attacklevel, fadetime, fadelevel, effect_handle);
+}
+
+EXTAPI
+int device_haptic_modify_playing_magsweep_effect(int device_handle, int effect_handle,
+        int duration, int magnitude, int style, int attacktime, int attacklevel, int fadetime, int fadelevel)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_modify_playing_magsweep_effect(device_handle, effect_handle, duration, magnitude, style, attacktime, attacklevel, fadetime, fadelevel);
+}
+
+EXTAPI
+int device_haptic_modify_playing_periodic_effect(int device_handle, int effect_handle,
+        int duration, int magnitude, int period, int style_and_wave_type, int attacktime, int attacklevel, int fadetime, int fadelevel)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_modify_playing_periodic_effect(device_handle, effect_handle, duration, magnitude, period, style_and_wave_type, attacktime, attacklevel, fadetime, fadelevel);
+}
+
+EXTAPI
+int device_haptic_create_streaming_effect(int device_handle, int *effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+       }
+
+       return _haptic_internal_create_streaming_effect(device_handle, effect_handle);
+}
+
+EXTAPI
+int device_haptic_destroy_streaming_effect(int device_handle, int effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_destroy_streaming_effect(device_handle, effect_handle);
+}
+
+EXTAPI
+int device_haptic_play_streaming_sample(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_streaming_sample(device_handle, effect_handle, streaming_sample, size);
+}
+
+EXTAPI
+int device_haptic_play_streaming_sample_with_offset(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size, int offset_time)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_play_streaming_sample_with_offset(device_handle, effect_handle, streaming_sample, size, offset_time);
+}
+
+EXTAPI
+int device_haptic_stop_all_playing_effects(int device_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_stop_all_playing_effects(device_handle);
+}
+
+EXTAPI
+int device_haptic_save_file(const unsigned char *haptic_buffer, const char *path_name)
+{
+       ERR("%s() is not supported without specific haptic module", __func__);
+       return -2;
+
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return -1;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return -2;
+       }
+
+       return _haptic_internal_save_IVT_file(haptic_buffer, path_name);
+}
+
+EXTAPI
+int device_haptic_delete_file(const char *path_name)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_delete_IVT_file(path_name);
+}
+
+EXTAPI
+int device_haptic_pause_playing_effect(int device_handle, int effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_pause_playing_effect(device_handle, effect_handle);
+}
+
+EXTAPI
+int device_haptic_resume_paused_effect(int device_handle, int effect_handle)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_resume_paused_effect(device_handle, effect_handle);
+}
+
+EXTAPI
+int device_haptic_get_effect_state(int device_handle, int effect_handle, int *effect_state)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_effect_state(device_handle, effect_handle, effect_state);
+}
+
+EXTAPI
+int device_haptic_get_size(const unsigned char *haptic_buffer, int size)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_get_IVT_size(haptic_buffer, size);
+}
+
+EXTAPI
+int device_haptic_initialize_buffer(unsigned char *haptic_buffer, int size)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_initialize_IVT_buffer(haptic_buffer, size);
+}
+
+EXTAPI
+int device_haptic_insert_element(unsigned char *haptic_buffer, int size, int timeline_index, const HapticElement *element)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_insert_IVT_element(haptic_buffer, size, timeline_index, element);
+}
+
+EXTAPI
+int device_haptic_insert_element2(unsigned char *haptic_buffer, int size, int timeline_index, const HapticElement2 *element)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_insert_IVT_element2(haptic_buffer, size, timeline_index, element);
+}
+
+EXTAPI
+int device_haptic_insert_element3(unsigned char *haptic_buffer, int size, int timeline_index, const HapticElement3 *element)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_insert_IVT_element3(haptic_buffer, size, timeline_index, element);
+}
+
+EXTAPI
+int device_haptic_read_element(const unsigned char *haptic_buffer, int size, int timeline_index, int element_index, HapticElement *element)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_read_IVT_element(haptic_buffer, size, timeline_index, element_index, element);
+}
+
+EXTAPI
+int device_haptic_read_element2(const unsigned char *haptic_buffer, int size, int timeline_index, int element_index, HapticElement2 *element)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_read_IVT_element2(haptic_buffer, size, timeline_index, element_index, element);
+}
+
+EXTAPI
+int device_haptic_read_element3(const unsigned char *haptic_buffer, int size, int timeline_index, int element_index, HapticElement3 *element)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_read_IVT_element3(haptic_buffer, size, timeline_index, element_index, element);
+}
+
+EXTAPI
+int device_haptic_remove_element(unsigned char *haptic_buffer, int size, int timeline_index, int element_index)
+{
+       int status;
+
+       if (device_handle_count == 0) {
+               ERR("Haptic device is not opened yet");
+               return HAPTIC_NOT_OPENED;
+       }
+
+       if (has_haptic_module == 0) {
+               ERR("%s() is not supported without specific haptic module", __func__);
+               return HAPTIC_NOT_SUPPORTED;
+       }
+
+       return _haptic_internal_remove_IVT_element(haptic_buffer, size, timeline_index, element_index);
+}
+/* END: devman_haptic_ext APIs */
+
+static void __attribute__ ((constructor)) module_init()
+{
+       char *error;
+
+       if (access(HAPTIC_DEVICE_NODE_PATH, F_OK) < 0) {
+               has_haptic_module = 0;
+               return;
+       } else {
+               has_haptic_module = 1;
+       }
+
+       dlopen_handle = dlopen(HAPTIC_MODULE_PATH, RTLD_LAZY);
+       if (!dlopen_handle) {
+               ERR("dlopen failed: %s", dlerror());
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_buffer = dlsym(dlopen_handle, "_haptic_internal_play_buffer");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_file = dlsym(dlopen_handle, "_haptic_internal_play_file");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_monotone = dlsym(dlopen_handle, "_haptic_internal_play_monotone");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_buffer_duration = dlsym(dlopen_handle, "_haptic_internal_get_buffer_duration");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_file_duration = dlsym(dlopen_handle, "_haptic_internal_get_file_duration");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_prepare_node = dlsym(dlopen_handle, "_haptic_internal_prepare_node");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_initialize = dlsym(dlopen_handle, "_haptic_internal_initialize");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_open_composite_device = dlsym(dlopen_handle, "_haptic_internal_open_composite_device");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_open_device = dlsym(dlopen_handle, "_haptic_internal_open_device");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_close_device = dlsym(dlopen_handle, "_haptic_internal_close_device");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_terminate = dlsym(dlopen_handle, "_haptic_internal_terminate");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_set_device_property_string = dlsym(dlopen_handle, "_haptic_internal_set_device_property_string");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_set_device_property_int32 = dlsym(dlopen_handle, "_haptic_internal_set_device_property_int32");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+
+       _haptic_internal_play_IVT_effect = dlsym(dlopen_handle, "_haptic_internal_play_IVT_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_IVT_effect_repeat = dlsym(dlopen_handle, "_haptic_internal_play_IVT_effect_repeat");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_stop_all_playing_effects = dlsym(dlopen_handle, "_haptic_internal_stop_all_playing_effects");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+
+       _haptic_internal_play_periodic_effect = dlsym(dlopen_handle, "_haptic_internal_play_periodic_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_count = dlsym(dlopen_handle, "_haptic_internal_get_device_count");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_duration = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_duration");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_magsweep_effect = dlsym(dlopen_handle, "_haptic_internal_play_magsweep_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_state = dlsym(dlopen_handle, "_haptic_internal_get_device_state");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_property_bool = dlsym(dlopen_handle, "_haptic_internal_get_device_property_bool");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_property_string = dlsym(dlopen_handle, "_haptic_internal_get_device_property_string");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_property_int32 = dlsym(dlopen_handle, "_haptic_internal_get_device_property_int32");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_set_device_property_bool = dlsym(dlopen_handle, "_haptic_internal_set_device_property_bool");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_capability_bool = dlsym(dlopen_handle, "_haptic_internal_get_device_capability_bool");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_capability_int32 = dlsym(dlopen_handle, "_haptic_internal_get_device_capability_int32");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_device_capability_string = dlsym(dlopen_handle, "_haptic_internal_get_device_capability_string");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_count = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_count");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_name = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_name");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_name_u = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_name_u");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_index_from_name = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_index_from_name");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_index_from_name_u = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_index_from_name_u");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_effect_type = dlsym(dlopen_handle, "_haptic_internal_get_IVT_effect_type");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_size = dlsym(dlopen_handle, "_haptic_internal_get_IVT_size");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_magsweep_effect_definition = dlsym(dlopen_handle, "_haptic_internal_get_IVT_magsweep_effect_definition");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_IVT_periodic_effect_definition = dlsym(dlopen_handle, "_haptic_internal_get_IVT_periodic_effect_definition");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_modify_playing_magsweep_effect = dlsym(dlopen_handle, "_haptic_internal_modify_playing_magsweep_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_modify_playing_periodic_effect = dlsym(dlopen_handle, "_haptic_internal_modify_playing_periodic_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_create_streaming_effect = dlsym(dlopen_handle, "_haptic_internal_create_streaming_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_destroy_streaming_effect = dlsym(dlopen_handle, "_haptic_internal_destroy_streaming_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_streaming_sample = dlsym(dlopen_handle, "_haptic_internal_play_streaming_sample");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_play_streaming_sample_with_offset = dlsym(dlopen_handle, "_haptic_internal_play_streaming_sample_with_offset");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_save_IVT_file = dlsym(dlopen_handle, "_haptic_internal_save_IVT_file");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_delete_IVT_file = dlsym(dlopen_handle, "_haptic_internal_delete_IVT_file");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_stop_playing_effect = dlsym(dlopen_handle, "_haptic_internal_stop_playing_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_pause_playing_effect = dlsym(dlopen_handle, "_haptic_internal_pause_playing_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_resume_paused_effect = dlsym(dlopen_handle, "_haptic_internal_resume_paused_effect");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_get_effect_state = dlsym(dlopen_handle, "_haptic_internal_get_effect_state");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_initialize_IVT_buffer = dlsym(dlopen_handle, "_haptic_internal_initialize_IVT_buffer");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_insert_IVT_element = dlsym(dlopen_handle, "_haptic_internal_insert_IVT_element");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_insert_IVT_element2 = dlsym(dlopen_handle, "_haptic_internal_insert_IVT_element2");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_insert_IVT_element3 = dlsym(dlopen_handle, "_haptic_internal_insert_IVT_element3");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_read_IVT_element = dlsym(dlopen_handle, "_haptic_internal_read_IVT_element");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_read_IVT_element2 = dlsym(dlopen_handle, "_haptic_internal_read_IVT_element2");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_read_IVT_element3 = dlsym(dlopen_handle, "_haptic_internal_read_IVT_element3");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+
+       _haptic_internal_remove_IVT_element = dlsym(dlopen_handle, "_haptic_internal_remove_IVT_element");
+       if ((error = dlerror()) != NULL) {
+               ERR("dlsym failed : %s", error);
+               has_haptic_module = 0;
+               return;
+       }
+}
+
+static void __attribute__ ((destructor)) module_fini()
+{
+       if (dlopen_handle) {
+               dlclose(dlopen_handle);
+       }
+}
+
diff --git a/device_haptic.h b/device_haptic.h
new file mode 100644 (file)
index 0000000..f399421
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVICE_HAPTIC_H__
+#define __DEVICE_HAPTIC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Default capability value
+ */
+#define DEFAULT_MOTOR_COUNT            1
+
+/*
+ * Default device handle
+ */
+#define DEFAULT_DEVICE_HANDLE          1
+
+/*
+ * Motor property for generic APIs
+ */
+       enum {
+               HAPTIC_PROP_ENABLE,
+               HAPTIC_PROP_LEVEL,
+               HAPTIC_PROP_LEVEL_MAX,
+               HAPTIC_PROP_VALUE,
+               HAPTIC_PROP_ONESHOT,
+       };
+
+/*
+ * Feedback level for generic APIs
+ */
+       enum {
+               VIBE_FEEDBACK_LEVEL_1 = 55,     /* HAPTIC_FEEDBACK_LEVEL_1 */
+               VIBE_FEEDBACK_LEVEL_2 = 60,     /* HAPTIC_FEEDBACK_LEVEL_2 */
+               VIBE_FEEDBACK_LEVEL_3 = 65,     /* HAPTIC_FEEDBACK_LEVEL_3 */
+               VIBE_FEEDBACK_LEVEL_4 = 70,     /* HAPTIC_FEEDBACK_LEVEL_4 */
+               VIBE_FEEDBACK_LEVEL_5 = 80,     /* HAPTIC_FEEDBACK_LEVEL_5 */
+       };
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/device_haptic_tsp4000_pattern.h b/device_haptic_tsp4000_pattern.h
new file mode 100644 (file)
index 0000000..7a7f253
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVICE_HAPTIC_TSP4000_PATTERN_H__
+#define __DEVICE_HAPTIC_TSP4000_PATTERN_H__
+
+#include "devman_haptic_ext.h"
+
+/////////////////
+// for Beat UX //
+
+unsigned char touch_ivt[] =
+{
+       0x01, 0x00, 0x01, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x7F, 0x00,
+       0x00, 0x42, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00,
+       0x65, 0x00, 0x70, 0x00, 0x00, 0x00
+
+};
+
+unsigned char hw_touch_ivt[] =
+{
+       0x01, 0x00, 0x01, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x7F, 0x00,
+       0x00, 0xE2, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00,
+       0x65, 0x00, 0x70, 0x00, 0x00, 0x00
+
+};
+
+unsigned char noti_ivt[] =
+{
+       0x01, 0x00, 0x02, 0x00, 0x1E, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x12, 0x00, 0xF1, 0xE0, 0x01, 0xE2,
+       0x00, 0x00, 0xF1, 0xE0, 0x01, 0xE2, 0x05, 0xDC, 0xD0, 0x07, 0xD0, 0xD1, 0x00, 0xFF, 0x20, 0x5D,
+       0x00, 0x00, 0x7F, 0x00, 0x00, 0xC1, 0x00, 0x00, 0x12, 0x00, 0x54, 0x00, 0x69, 0x00, 0x6D, 0x00,
+       0x65, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00,
+       0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00, 0x65, 0x00, 0x70, 0x00, 0x20, 0x00, 0x23, 0x00,
+       0x32, 0x00, 0x00, 0x00
+
+};
+
+unsigned char incomming_01_ivt[] =
+{
+       0x01, 0x00, 0x02, 0x00, 0x34, 0x00, 0x34, 0x00, 0x00, 0x00, 0x27, 0x00, 0xF1, 0xE0, 0x01, 0xE2,
+       0x00, 0x00, 0xD0, 0x01, 0x2C, 0xF1, 0xE0, 0x01, 0xE2, 0x01, 0x66, 0xD0, 0x07, 0xD0, 0xF1, 0xE0,
+       0x01, 0xE2, 0x09, 0x84, 0xD0, 0x01, 0x2C, 0xF1, 0xE0, 0x01, 0xE2, 0x09, 0xC4, 0xD0, 0x01, 0xF4,
+       0xD1, 0x00, 0xFF, 0x20, 0x7D, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00,
+       0x4D, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x72, 0x00, 0x4D, 0x00, 0x6F, 0x00,
+       0x64, 0x00, 0x65, 0x00, 0x36, 0x00, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00,
+       0x77, 0x00, 0x65, 0x00, 0x65, 0x00, 0x70, 0x00, 0x20, 0x00, 0x23, 0x00, 0x32, 0x00, 0x00, 0x00
+
+};
+
+unsigned char incomming_02_ivt[] =
+{
+       0x01, 0x00, 0x03, 0x00, 0x72, 0x00, 0x42, 0x00, 0x00, 0x00, 0x54, 0x00, 0x64, 0x00, 0xF1, 0xE0,
+       0x02, 0xE2, 0x00, 0x00, 0xF1, 0xE0, 0x01, 0xE2, 0x00, 0x00, 0xF1, 0xE0, 0x02, 0xE2, 0x01, 0xAE,
+       0xF1, 0xE0, 0x02, 0xE2, 0x02, 0xCC, 0xF1, 0xE0, 0x02, 0xE2, 0x03, 0xAA, 0xF1, 0xE0, 0x02, 0xE2,
+       0x04, 0x5B, 0xF1, 0xE0, 0x02, 0xE2, 0x04, 0xFE, 0xF1, 0xE0, 0x02, 0xE2, 0x05, 0x8C, 0xF1, 0xE0,
+       0x02, 0xE2, 0x06, 0x0C, 0xF1, 0xE0, 0x02, 0xE2, 0x06, 0x8C, 0xF1, 0xE0, 0x02, 0xE2, 0x07, 0x05,
+       0xF1, 0xE0, 0x02, 0xE2, 0x07, 0x6A, 0xF1, 0xE0, 0x02, 0xE2, 0x0A, 0xF0, 0xD0, 0x00, 0xC8, 0xD1,
+       0x00, 0xFF, 0x30, 0xB3, 0x09, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x20, 0xB5, 0x00, 0x00, 0x7F, 0x00,
+       0x00, 0x40, 0x20, 0x06, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x42, 0x00, 0x00, 0x12, 0x00, 0x24, 0x00,
+       0x54, 0x00, 0x69, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00,
+       0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00, 0x65, 0x00,
+       0x70, 0x00, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00,
+       0x65, 0x00, 0x70, 0x00, 0x20, 0x00, 0x23, 0x00, 0x31, 0x00, 0x00, 0x00
+
+};
+
+unsigned char incomming_03_ivt[] =
+{
+       0x01, 0x00, 0x03, 0x00, 0x34, 0x00, 0x42, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x26, 0x00, 0xF1, 0xE0,
+       0x02, 0xE2, 0x00, 0x00, 0xD0, 0x03, 0x31, 0xF1, 0xE0, 0x01, 0xE2, 0x03, 0x76, 0xD0, 0x05, 0xAE,
+       0xF1, 0xE0, 0x01, 0xE2, 0x0A, 0xF0, 0xD0, 0x00, 0xC8, 0xD1, 0x00, 0xFF, 0x20, 0x06, 0x00, 0x00,
+       0x7F, 0x00, 0x00, 0x41, 0x20, 0x3E, 0x00, 0x00, 0x7F, 0x81, 0x3E, 0x82, 0x00, 0x00, 0x18, 0x00,
+       0x2A, 0x00, 0x54, 0x00, 0x69, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x6E, 0x00,
+       0x65, 0x00, 0x20, 0x00, 0x23, 0x00, 0x32, 0x00, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00,
+       0x53, 0x00, 0x77, 0x00, 0x65, 0x00, 0x65, 0x00, 0x70, 0x00, 0x00, 0x00, 0x50, 0x00, 0x65, 0x00,
+       0x72, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x69, 0x00, 0x63, 0x00, 0x00, 0x00
+
+};
+
+unsigned char alerts_call_ivt[] =
+{
+       0x01, 0x00, 0x01, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x06, 0x00, 0x00, 0x19, 0x00,
+       0x00, 0x40, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00,
+       0x65, 0x00, 0x70, 0x00, 0x00, 0x00
+
+};
+
+unsigned char operation_ivt[] =
+{
+       0x01, 0x00, 0x01, 0x00, 0x0A, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x20, 0x06, 0x00, 0x00, 0x7F, 0x00,
+       0x00, 0x41, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00,
+       0x65, 0x00, 0x70, 0x00, 0x20, 0x00, 0x23, 0x00, 0x32, 0x00, 0x00, 0x00
+
+};
+
+unsigned char silent_ivt[] =
+{
+       0x01, 0x00, 0x01, 0x00, 0x12, 0x00, 0x14, 0x00, 0x00, 0x00, 0x30, 0x96, 0x00, 0x96, 0x00, 0x00,
+       0x00, 0x00, 0x20, 0x1F, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x41, 0x00, 0x00, 0x4D, 0x00, 0x61, 0x00,
+       0x67, 0x00, 0x53, 0x00, 0x77, 0x00, 0x65, 0x00, 0x65, 0x00, 0x70, 0x00, 0x00, 0x00
+
+};
+
+
+#endif /* __DEVICE_HAPTIC_TSP4000_PATTERN_H__ */
diff --git a/device_path.h b/device_path.h
new file mode 100644 (file)
index 0000000..8f7502d
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef _DEVICE_PATH_H_
+#define _DEVICE_PATH_H_
+
+/* DEVICE SYSFS PATH */
+#define CLASS_HAPTIC           "/sys/class/haptic"
+#define SYS_DEVICE_JACK                "/sys/devices/platform/jack"
+#define CLASS_POWERSUPPLY      "/sys/class/power_supply"
+#define CLASS_BACKLIGHT                "/sys/class/backlight"
+#define CLASS_LCD              "/sys/class/lcd"
+#define CLASS_LED              "/sys/class/leds"
+#define CLASS_TOUCHKEY         "/sys/class/input/event3"
+
+/* Device reference path */
+#define REF_FILE_HAPTIC                "/tmp/haptic"
+#define REF_FILE_POWERSUPPLY   "/tmp/powersupply"
+#define REF_FILE_LCD           "/tmp/lcd"
+#define REF_FILE_BACKLIGHT     "/tmp/backlight"
+#define REF_FILE_TOUCHKEY      "/tmp/touchkey"
+
+#endif
diff --git a/devices/CMakeLists.txt b/devices/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6c041f9
--- /dev/null
@@ -0,0 +1,12 @@
+SET(TARGET_SRCS        
+       devices/haptic.c
+       devices/jack_35pi.c
+       devices/jack_microusb.c
+       devices/mmc.c
+       devices/power_supply_battery.c
+       devices/power_supply_pmic.c     
+       devices/uart.c
+       devices/video.c
+       devices/led.c
+)
+
diff --git a/devices/haptic.c b/devices/haptic.c
new file mode 100644 (file)
index 0000000..e1c072f
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_generic.h"
+#include "device_haptic.h"
+
+#define NODE_NAME "vibetones"
+
+static int get_haptic(int prop, int *val)
+{
+       switch (prop) {
+       case HAPTIC_PROP_LEVEL:
+       case HAPTIC_PROP_LEVEL_MAX:
+       case HAPTIC_PROP_VALUE:
+               return generic_class_haptic_get(NODE_NAME, prop, val);
+       }
+
+       return -1;
+}
+
+static int set_haptic(int prop, int val)
+{
+       switch (prop) {
+       case HAPTIC_PROP_ENABLE:
+       case HAPTIC_PROP_LEVEL:
+       case HAPTIC_PROP_ONESHOT:
+               return generic_class_haptic_set(NODE_NAME, prop, val);
+       }
+
+       return -1;
+}
+
+static struct device haptic = {
+       .devname = "haptic",
+       .set_int = set_haptic,
+       .get_int = get_haptic,
+       .devtype = DEVTYPE_HAPTIC
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&haptic);
+}
diff --git a/devices/jack_35pi.c b/devices/jack_35pi.c
new file mode 100644 (file)
index 0000000..11af66f
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_path.h"
+#include "device_generic.h"
+
+enum snd_jack_types {
+       SND_JACK_HEADPHONE = 0x0001,
+       SND_JACK_MICROPHONE = 0x0002,
+       SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
+       SND_JACK_LINEOUT = 0x0004,
+       SND_JACK_MECHANICAL = 0x0008,
+       SND_JACK_VIDEOOUT = 0x0010,
+       SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
+};
+
+static int get_35pi(int prop, int *val)
+{
+
+       switch (prop) {
+       case JACK_PROP_MIC_ONLINE:
+               return -1;
+       case JACK_PROP_EARKEY_PRESS:
+               return sys_get_int(SYS_DEVICE_JACK "/earkey_online", val);
+
+       case JACK_PROP_EARJACK_ONLINE:
+       case JACK_PROP_TVOUT_ONLINE:
+               generic_jack_interface_get(NULL, JACK_PROP_EARJACK_ONLINE, val);
+
+               printf("val : %d\n", *val);
+
+               if (prop == JACK_PROP_EARJACK_ONLINE) {
+                       if ((*val | ~SND_JACK_HEADPHONE) == 0xFFFFFFFF ||
+                           ((*val | ~SND_JACK_HEADSET) == 0xFFFFFFFF))
+                               *val = 1;
+                       else
+                               *val = 0;
+
+                       return 0;
+               } else {
+                       if (*val == SND_JACK_MECHANICAL
+                           || *val == SND_JACK_AVOUT)
+                               *val = 1;
+                       else
+                               *val = 0;
+
+                       return 0;
+               }
+       }
+
+       return -1;
+}
+
+static struct device microusb = {
+       .devname = "35pi",
+       .get_int = get_35pi,
+       .devtype = DEVTYPE_JACK,
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&microusb);
+}
diff --git a/devices/jack_microusb.c b/devices/jack_microusb.c
new file mode 100644 (file)
index 0000000..77109f7
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "device_engine.h"
+#include "device_generic.h"
+
+#define USB_PATH_SYSFS                 "/sys/devices/platform/usb-switch/path"
+#define MODEM_REGULATOR_SYSFS  "/sys/class/regulator/regulator.29/state"
+
+enum {
+       PATH_TO_MODEM = 0,
+       PATH_TO_PDA,
+};
+
+static const char *usb_path_string[3] = { "CP\0", "AP\0" };
+
+static int get_microusb_status(int prop, int *val)
+{
+       char *tmp_buff = NULL;
+       switch (prop) {
+       case JACK_PROP_USB_ONLINE:
+       case JACK_PROP_TA_ONLINE:
+               return generic_jack_interface_get(NULL, prop, val);
+
+       case JACK_PROP_HDMI_ONLINE:
+               tmp_buff =
+                   sys_get_str("/sys/class/i2c-adapter/i2c-5/5-0072/status");
+               if (tmp_buff && (strstr(tmp_buff, "MHL connected:yes") != 0)) {
+                       free(tmp_buff);
+                       *val = 1;
+               } else {
+                       if(tmp_buff)
+                               free(tmp_buff);
+                       *val = 0;
+               }
+               return 0;
+       case JACK_PROP_USB_PATH:
+               tmp_buff = sys_get_str(USB_PATH_SYSFS);
+               if (tmp_buff == NULL)
+                       return -1;
+               if (strncmp(tmp_buff, usb_path_string[PATH_TO_MODEM], 2) == 0)
+                       *val = PATH_TO_MODEM;
+               else
+                       *val = PATH_TO_PDA;
+
+               free(tmp_buff);
+               return 0;
+       }
+
+       free(tmp_buff);
+       return -1;
+}
+
+static int set_microusb_path(int prop, int val)
+{
+       char *cur_path;
+       int conn;
+
+       switch (prop) {
+       case JACK_PROP_USB_PATH:
+               break;
+       default:
+               return -1;
+       }
+       cur_path = sys_get_str(USB_PATH_SYSFS);
+       if (cur_path == NULL)
+               return -1;
+
+       switch (val) {
+       case PATH_TO_MODEM:
+       case PATH_TO_PDA:
+               if (strncmp(cur_path, usb_path_string[val], 2) == 0) {
+                       free(cur_path);
+                       return 0;
+               }
+               free(cur_path);
+               if (generic_jack_interface_get
+                   (NULL, JACK_PROP_USB_ONLINE, &conn) != 0) {
+                       /*failed to get the connection status */
+                       return -1;
+               }
+               if (sys_set_str(USB_PATH_SYSFS, (char *)usb_path_string[val]) !=
+                   0)
+                       return -1;
+               if (val == PATH_TO_MODEM) {
+                       system("/usr/bin/save_blenv usbpath CP");
+               } else {
+                       system("/usr/bin/save_blenv usbpath AP");
+               }
+               break;
+
+       default:
+               free(cur_path);
+               return -1;
+       }
+
+       return 0;
+}
+
+static struct device microusb = {
+       .devname = "microusb",
+       .set_int = set_microusb_path,
+       .get_int = get_microusb_status,
+       .devtype = DEVTYPE_JACK,
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&microusb);
+}
diff --git a/devices/led.c b/devices/led.c
new file mode 100644 (file)
index 0000000..061e906
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdbool.h>
+#include <string.h>
+#include <dirent.h>
+
+#include "devlog.h"
+#include "device_engine.h"
+#include "device_generic.h"
+#include "device_path.h"
+
+#define SYSFS_LED                      "/sys/class/led"
+#define NODE_NAME "leds-torch"
+
+static char node_name[PATH_MAX];
+static char bl_node_name[PATH_MAX];
+
+static int get_led_prop(int prop, int *val)
+{
+       char *gamma;
+       switch (prop) {
+       case LED_PROP_BRIGHTNESS:
+       case LED_PROP_MAX_BRIGHTNESS:
+               return generic_class_led_get(NODE_NAME, prop, val);
+       }
+       return -1;
+}
+
+static int set_led_prop(int prop, int val)
+{
+       switch (prop) {
+       case LED_PROP_BRIGHTNESS:
+               return generic_class_led_set(NODE_NAME, prop, val);
+       }
+       return -1;
+}
+
+static struct device led_prop = {
+       .devname = "led",
+       .set_int = set_led_prop,
+       .get_int = get_led_prop,
+       .devtype = DEVTYPE_LED
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&led_prop);
+}
diff --git a/devices/mmc.c b/devices/mmc.c
new file mode 100644 (file)
index 0000000..0ae517d
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include "devlog.h"
+#include "device_engine.h"
+#include "device_path.h"
+#include <sysman.h>
+#include <heynoti.h>
+
+#define MMC_DEV                "/dev/mmcblk"
+#define MMC_MOUNT_PATH "/opt/storage/sdcard"
+
+
+static int exec_process(char *name, const char *arg1)
+{
+       int ret, pid;
+       int i;
+
+       if (name[0] == '\0')
+               return 0;
+
+       pid = fork();
+       switch (pid) {
+       case -1:
+               ERR("Fork error");
+               ret = -1;
+               break;
+       case 0:
+               for (i = 0; i < _NSIG; i++)
+                       signal(i, SIG_DFL);
+               execl(name, name, arg1, NULL);
+               ERR("execlp() error : %s\n", strerror(errno));
+               exit(-1);
+               break;
+       default:
+               ret = pid;
+               break;
+       }
+       return ret;
+}
+
+static int get_mmcblk_num()
+{
+       int i;
+       char buf[255];
+
+       /* mmcblk0 and mmcblk1 is reserved for movinand */
+       for (i = 9; i > 0; i--) {
+               snprintf(buf, 255, "%s%d", MMC_DEV, i);
+               if (access(buf, R_OK) == 0)
+                       return i;
+       }
+       ERR("Failed to find mmc block number\n");
+       return -1;
+}
+
+int format_mmc(int blknum)
+{
+       int fd;
+       struct stat parent_stat, mount_stat;
+
+       /* check MMC_MOUNT_FULL_PATH length */
+       char parent_path[PATH_MAX], mount_path[PATH_MAX];
+       int ret_f = 0, ret_s = 0;
+       char buf[512];
+       char dev_mmcblk[NAME_MAX];
+       int mkfs_pid = 0;
+
+       if (blknum < 0) {
+               vconf_set_int("memory/mmc/format", 2);
+               vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT,
+                             VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
+               return -1;
+       } else
+               snprintf(dev_mmcblk, NAME_MAX, "%s%d", MMC_DEV, blknum);
+
+       snprintf(parent_path, sizeof(parent_path), "%s/%s", MMC_MOUNT_PATH, "..");
+       snprintf(mount_path, sizeof(mount_path), "%s", MMC_MOUNT_PATH);
+
+       if (stat(mount_path, &mount_stat) != 0) {
+               ERR("get stat error : %s\n", mount_path);
+               ret_f = -1;
+       } else if (stat(parent_path, &parent_stat) != 0) {
+               ERR("get stat error : %s\n", parent_path);
+               ret_f = -1;
+       }
+
+       else if (mount_stat.st_dev == parent_stat.st_dev) {
+               ERR("Does not mounted, same st_dev\n");
+               ret_f = -2;
+       } else {
+               ERR("MMC mounted, diff st_dev\n");
+       }
+
+       if (ret_f == 0) {
+               if (umount2(MMC_MOUNT_PATH, MNT_FORCE) == -1) {
+                       ERR("devman mmc_format umount fail\n");
+                       if (umount2(MMC_MOUNT_PATH, MNT_FORCE) == -1) {
+                               vconf_set_int("memory/mmc/format", 2);
+                               vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT,
+                                             VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
+                               ERR("devman mmc_format umount retry fail\n");
+                               return -1;
+                       }
+               }
+       }
+
+       fd = open(dev_mmcblk, O_RDWR);
+       if (fd < 0) {
+               ERR("%s open fail", dev_mmcblk);
+               ret_s = -1;
+       } else {
+
+               memset(buf, 0, sizeof(buf));
+               if (write(fd, buf, sizeof(buf)) < 0) {
+                       ERR("%s write fail to erase partition\n", dev_mmcblk);
+                       close(fd);
+                       ret_s = -2;
+               } else {
+                       sync();
+                       usleep(200000);
+
+                       if (ioctl(fd, BLKRRPART, NULL) < 0) {
+                               ERR("%s ioctl fail\n", dev_mmcblk);
+                               close(fd);
+                               ret_s = -3;
+                       } else {
+                               close(fd);
+                               sync();
+
+                               mkfs_pid =
+                                   exec_process("/sbin/mkfs.vfat", dev_mmcblk);
+                               if (mkfs_pid == -1) {
+                                       ERR("devman mmc_format mkfs.vfat fail\n");
+                                       ret_s = -4;
+                               }
+                       }
+               }
+       }
+       int i = 0;
+       snprintf(buf, sizeof(buf), "%s%d", "/proc/", mkfs_pid);
+       while (1) {
+               sleep(1);
+               if (access(buf, R_OK) != 0)
+                       break;
+       }
+       sync();
+
+       if (ret_f == 0 && ret_s == 0) {
+               if (mount
+                   (dev_mmcblk, MMC_MOUNT_PATH, "vfat", 0,
+                    "uid=0,gid=0,dmask=0000,fmask=0111,iocharset=iso8859-1,utf8,shortname=mixed")
+                   != 0) {
+                       ERR("Failed to mount mmc card, %s,%s\n", dev_mmcblk,
+                           MMC_MOUNT_PATH);
+                       vconf_set_int("memory/mmc/format", 2);
+                       vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT,
+                                     VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
+                       heynoti_publish("mmcblk_remove");
+                       return -1;
+               } else
+                   if (heynoti_publish("mmcblk_add") == -1
+                       && ret_s == 0)
+                       ERR("notification failed for new MMC\n");
+       } else {
+               vconf_set_int("memory/mmc/format", 2);
+               vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT,
+                             VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
+               ERR("result format process fail\n");
+               heynoti_publish("mmcblk_remove");
+               return -1;
+       }
+
+       vconf_set_int("memory/mmc/format", 0);
+       vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT,
+                     VCONFKEY_SYSMAN_MMC_FORMAT_COMPLETED);
+       return 0;
+}
+
+static int set_mmc_int(int prop, int val)
+{
+       int ret = -1;
+       switch (prop) {
+       case MMC_PROP_FORMAT:
+               ret = format_mmc(get_mmcblk_num());
+               return ret;
+       }
+
+       return -1;
+
+}
+
+static struct device mmc = {
+       .devname = "mmc",
+       .set_int = set_mmc_int,
+       .devtype = DEVTYPE_MMC,
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&mmc);
+}
diff --git a/devices/power_supply_battery.c b/devices/power_supply_battery.c
new file mode 100644 (file)
index 0000000..0d80b33
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_generic.h"
+
+#define NODE_NAME "battery"
+
+static int get_battery(int prop, int *val)
+{
+       switch (prop) {
+       case POWER_SUPPLY_PROP_CAPACITY:
+               return generic_class_power_supply_get(NODE_NAME, prop, val);
+       }
+
+       return -1;
+}
+
+static struct device powersupply = {
+       .devname = "power_supply_battery",
+       .set_int = NULL,
+       .get_int = get_battery,
+       .devtype = DEVTYPE_POWERSUPPLY,
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&powersupply);
+}
diff --git a/devices/power_supply_pmic.c b/devices/power_supply_pmic.c
new file mode 100644 (file)
index 0000000..845b627
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_generic.h"
+
+#define NODE_NAME "battery"
+
+static int get_pmic(int prop, int *val)
+{
+       switch (prop) {
+       case POWER_SUPPLY_PROP_CHARGE_NOW:
+       case POWER_SUPPLY_PROP_CHARGE_FULL:
+               return generic_class_power_supply_get(NODE_NAME, prop, val);
+       }
+
+       return -1;
+}
+
+static struct device powersupply = {
+       .devname = "power_supply_pmic",
+       .set_int = NULL,
+       .get_int = get_pmic,
+       .devtype = DEVTYPE_POWERSUPPLY,
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&powersupply);
+}
diff --git a/devices/uart.c b/devices/uart.c
new file mode 100644 (file)
index 0000000..16ad7a2
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include "devlog.h"
+#include "device_engine.h"
+#include "device_path.h"
+
+#define SYS_DEVICE_UART_PATH   "/sys/devices/platform/uart-select/path"
+
+enum {
+       PATH_TO_MODEM = 0,
+       PATH_TO_PDA,
+};
+
+static int uart_get(int prop, int *val)
+{
+       char *tmp_buff;
+       switch (prop) {
+       case UART_PROP_SELECT_PATH:
+               tmp_buff = sys_get_str(SYS_DEVICE_UART_PATH);
+               if (tmp_buff == NULL)
+                       return -1;
+
+               if (strncmp(tmp_buff, "AP", 2) == 0) {
+                       *val = PATH_TO_PDA;
+               } else if (strncmp(tmp_buff, "CP", 2) == 0) {
+                       *val = PATH_TO_MODEM;
+               } else {
+                       free(tmp_buff);
+                       return -1;
+               }
+               free(tmp_buff);
+               break;
+       }
+
+       return 0;
+}
+
+static int uart_set(int prop, int val)
+{
+       int ret = -1;
+
+       switch (prop) {
+       case UART_PROP_SELECT_PATH:
+               if (val < PATH_TO_MODEM || val > PATH_TO_PDA) {
+                       return -1;
+               }
+               ret =
+                   sys_set_str(SYS_DEVICE_UART_PATH,
+                               (val == PATH_TO_MODEM) ? "CP" : "AP");
+               if(ret == 0) {
+                       if (val == PATH_TO_MODEM) {
+                               system("/usr/bin/save_blenv uartpath CP");
+                       } else {
+                               system("/usr/bin/save_blenv uartpath AP");
+                       }
+               }
+               return ret;
+       }
+
+       return -1;
+}
+
+static struct device uart = {
+       .devname = "uart",
+       .set_int = uart_set,
+       .get_int = uart_get,
+       .devtype = DEVTYPE_UART,
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&uart);
+}
diff --git a/devices/video.c b/devices/video.c
new file mode 100644 (file)
index 0000000..7ddf2ad
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdbool.h>
+#include <string.h>
+#include <dirent.h>
+
+#include "devlog.h"
+#include "device_engine.h"
+#include "device_generic.h"
+#include "device_path.h"
+
+#define SYSFS_LCD                      "/sys/class/lcd"
+#define SYSFS_GAMMA                    "/sys/bus/spi/devices/spi2.0/gamma_mode"
+#define SYSFS_mDNIe_PATH               "/sys/devices/platform/s3cfb/mdnie_path"
+
+static char node_name[PATH_MAX];
+static char bl_node_name[PATH_MAX];
+
+static int get_display_count(int *val)
+{
+       DIR *root_dir;
+       struct dirent *entry;
+
+       int r, count = 0;
+
+       root_dir = opendir(SYSFS_LCD);
+
+       if (root_dir == NULL) {
+               ERR("Failed to open directory: %s", SYSFS_LCD);
+               return -1;
+       }
+
+       if (val == NULL) {
+               ERR("Argument is null pointer");
+               closedir(root_dir);
+               return -1;
+       }
+
+       while ((entry = readdir(root_dir)) != NULL) {
+               if (strncmp(entry->d_name, ".", 1) == 0
+                   || strncmp(entry->d_name, "..", 2) == 0)
+                       continue;
+               ++count;
+       }
+
+       if (count <= 0) {
+               ERR("Failed to get number of display nodes");
+               r = closedir(root_dir);
+               if (r < 0)
+                       ERR("Failed to close directory");
+               return -1;
+       }
+       *val = count;
+
+       r = closedir(root_dir);
+       if (r < 0)
+               ERR("Failed to close directory");
+
+       return 0;
+}
+
+static bool is_enable_mDNIe(void)
+{
+       char *mdnie_path;
+       mdnie_path = sys_get_str(SYSFS_mDNIe_PATH);
+
+       if (mdnie_path == NULL)
+               return false;
+
+       if (strncmp("mDNIe", mdnie_path, 5) == 0) {
+               free(mdnie_path);
+               return true;
+       }
+
+       free(mdnie_path);
+       return false;
+}
+
+static int search_node(void)
+{
+       int ret;
+       ret = find_sysfs_node(CLASS_LCD, node_name);
+       if (ret < 0) {
+               DBG("lcd node not found");
+               return -1;
+       }
+
+       ret = find_sysfs_node(CLASS_BACKLIGHT, bl_node_name);
+       if (ret < 0) {
+               DBG("backlight node not found");
+               return -1;
+       }
+
+       DBG("*** %s, %s ***", node_name, bl_node_name);
+       return 0;
+}
+
+static int get_video_prop(int prop, int *val)
+{
+       int ret = search_node();
+       if (ret != 0) {
+               DBG("find node fail");
+               return -1;
+       }
+
+       char *gamma;
+       switch (prop) {
+       case DISPLAY_PROP_BRIGHTNESS:
+       case DISPLAY_PROP_MAX_BRIGHTNESS:
+               return generic_class_backlight_get(bl_node_name, prop, val);
+       case DISPLAY_PROP_ONOFF:
+               if (generic_class_lcd_get(node_name, prop, val) != 0)
+                       return -1;
+               *val = !(*val);
+               return 0;
+       case DISPLAY_PROP_GAMMA:
+               /* not supported yet */
+               return 0;
+       case DISPLAY_PROP_DISPLAY_COUNT:
+               if (get_display_count(val) < 0)
+                       return -1;
+               return 0;
+       }
+       return -1;
+}
+
+static int set_video_prop(int prop, int val)
+{
+       int ret = search_node();
+       if (ret != 0) {
+               DBG("find node fail");
+               return -1;
+       }
+       switch (prop) {
+       case DISPLAY_PROP_BRIGHTNESS:
+               return generic_class_backlight_set(bl_node_name, prop, val);
+       case DISPLAY_PROP_ONOFF:
+               if (val == 0)
+                       val = 4;
+               else
+                       val = 0;
+               return generic_class_lcd_set(node_name, prop, val);
+       case DISPLAY_PROP_GAMMA:
+               /* not supported yet */
+               return 0;
+       }
+       return -1;
+}
+
+static struct device video_prop = {
+       .devname = "video",
+       .set_int = set_video_prop,
+       .get_int = get_video_prop,
+       .devtype = DEVTYPE_DISPLAY0
+};
+
+static void __attribute__ ((constructor)) module_init()
+{
+       add_dev(&video_prop);
+}
diff --git a/devlog.h b/devlog.h
new file mode 100644 (file)
index 0000000..a96779c
--- /dev/null
+++ b/devlog.h
@@ -0,0 +1,177 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVLOG_H__
+#define __DEVLOG_H__
+
+/*
+ * SYSLOG_INFO(), SYSLOG_ERR(), SYSLOG_DBG() are syslog() wrappers.
+ * PRT_INFO(), PRT_ERR(), PRT_DBG() are fprintf() wrappers.
+ *
+ * If SLP_DEBUG is not defined, SYSLOG_DBG() and PRT_DBG() is ignored.
+ *
+ * IF SLP_SYSLOG_OUT is defined, 
+ *   INFO(), ERR(), DBG() are SYSLOG_XXX()
+ * IF ENABLE_DLOG_OUT is defined,
+ *   INFO(), ERR(), DBG() are SLOGI(), SLOGE(), SLOGD()
+ * Otherwise,
+ *   They are PRT_XXX()
+ *
+ *
+ * warn_if(exrp, fmt, ...)
+ *   If expr is true, The fmt string is printed using ERR().
+ * 
+ * ret_if(), retv_if(), retm_if(), retvm_if() 
+ *   If expr is true, current function return. 
+ *   Postfix 'v' means that it has a return value and 'm' means that it has output message.
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined(ENABLE_DLOG_OUT)
+#  define LOG_TAG              "DEVMAN"
+#  include <dlog.h>
+#else
+#  include <syslog.h>
+#  define __LOG(prio, fmt, arg...) \
+               do { syslog(prio, fmt, ##arg); } while (0)
+#  define __LOGD(prio, fmt, arg...) \
+               do { \
+                       if (getenv("SLP_DEBUG")) { \
+                               syslog(prio, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \
+                       } \
+               } while (0)
+#endif
+
+#define __PRTI(fmt, arg...) \
+       do { fprintf(stdout, fmt"\n", ##arg); } while (0)
+#define __PRTE(fmt, arg...) \
+       do { fprintf(stderr, fmt"\n", ##arg); } while (0)
+#define __PRTD(fmt, arg...) \
+       do { \
+               if (getenv("SLP_DEBUG")) { \
+                       fprintf(stdout, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \
+               } \
+       } while(0)
+#define _NOUT(arg...) do { } while (0)
+
+#ifdef SLP_DEBUG
+#  define _LOGD __LOGD
+#  define _LOG  __LOG
+#  define _PRTD __PRTD
+#  define _PRTI __PRTI
+#  define _PRTE __PRTE
+#else
+#  define _LOGD _NOUT
+#  define _LOG  __LOG
+#  define _PRTD _NOUT
+#  define _PRTI __PRTI
+#  define _PRTE __PRTE
+#endif
+
+#define PRT_INFO(fmt, arg...) _PRTI(fmt, ##arg)
+#define PRT_ERR(fmt, arg...) _PRTE(fmt, ##arg)
+#define PRT_DBG(fmt, arg...) _PRTD(fmt, ##arg)
+
+#if defined(SLP_SYSLOG_OUT)
+#  define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg)
+#  define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg)
+#  define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg)
+#  define INFO SYSLOG_INFO
+#  define ERR SYSLOG_ERR
+#  define DBG SYSLOG_DBG
+#elif defined(ENABLE_DLOG_OUT)
+#  define INFO SLOGI
+#  define ERR SLOGE
+#  define DBG SLOGD
+#else
+#  define INFO PRT_INFO
+#  define ERR PRT_ERR
+#  define DBG PRT_DBG
+#endif
+
+#ifdef SLP_DEBUG
+#  define warn_if(expr, fmt, arg...) do { \
+               if (expr) { \
+                       DBG("(%s) -> "fmt, #expr, ##arg); \
+               } \
+       } while (0)
+#  define ret_if(expr) do { \
+               if (expr) { \
+                       DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
+                       return; \
+               } \
+       } while (0)
+#  define retv_if(expr, val) do { \
+               if (expr) { \
+                       DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
+                       return (val); \
+               } \
+       } while (0)
+#  define retm_if(expr, fmt, arg...) do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
+                       return; \
+               } \
+       } while (0)
+#  define retvm_if(expr, val, fmt, arg...) do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
+                       return (val); \
+               } \
+       } while (0)
+
+#else
+#  define warn_if(expr, fmt, arg...) do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+               } \
+       } while (0)
+#  define ret_if(expr) do { \
+               if (expr) { \
+                       return; \
+               } \
+       } while (0)
+#  define retv_if(expr, val) do { \
+               if (expr) { \
+                       return (val); \
+               } \
+       } while (0)
+#  define retm_if(expr, fmt, arg...) do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       return; \
+               } \
+       } while (0)
+#  define retvm_if(expr, val, fmt, arg...) do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       return (val); \
+               } \
+       } while (0)
+
+#endif
+
+#endif                         /* __DEVLOG_H__ */
diff --git a/devman b/devman
new file mode 100755 (executable)
index 0000000..74d324b
--- /dev/null
+++ b/devman
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+do_start () {
+       # If setting for device is needed, do here
+}
+
+## for setting default brightness
+set_display () {
+       BL_BRT=
+       for file in /sys/class/backlight/*; do
+       #       echo $file
+               if [ -e $file ]; then
+                       BL_BRT=$file/brightness
+                       break
+               fi
+       done
+       /bin/echo `/usr/bin/vconftool get db/setting/Brightness | /usr/bin/awk '{print $4}'` > $BL_BRT
+       /bin/echo 0 > /sys/class/leds/leds-torch/brightness
+}
+
+case "$1" in
+       start)
+               do_start
+               ;;
+       display)
+               set_display
+               ;;
+       *)
+               echo "Usage: $0 start | display"
+               exit 1
+
+esac
+
+exit 0
+
diff --git a/devman.h b/devman.h
new file mode 100644 (file)
index 0000000..9e2fbed
--- /dev/null
+++ b/devman.h
@@ -0,0 +1,474 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVMAN_H__
+#define __DEVMAN_H__
+
+#ifndef DEPRECATED
+#define DEPRECATED __attribute__((deprecated))
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** 
+ * @file        devman.h
+ * @ingroup     DEVICE_MANAGER
+ * @brief       This file contains the API for the status of devices
+ * @author      SLP2.0
+ * @date        2010-01-24
+ * @version     0.1
+ */
+
+/**
+ * @defgroup DEVICE_MANAGER            Device Manager
+ * @ingroup SYSTEM_FRAMEWORK
+ * @brief Device Manager library
+ *
+ * Device manager provides APIs to control devices or to get the status of devices.
+ * <br> Use devman.pc and include devman.h and devman_haptic.h files
+ *
+ * @addtogroup DEVICE_MANAGER
+ * @{
+ */
+
+/**
+ * @par Description:
+ *     device type enum
+ */
+       typedef enum devtype_list {
+               DEVTYPE_POWERSUPPLY,    /**< battery, PMIC, etc about power */
+               DEVTYPE_DISPLAY0,               /**< main screen */
+               DEVTYPE_DISPLAY1,               /**< sub screen */
+               DEVTYPE_HAPTIC,                 /**< motor */
+               DEVTYPE_LED,                    /**< LED */
+               DEVTYPE_JACK,                   /**< jack - Micro USB, 3.5 pi jack etc */
+               DEVTYPE_TOUCHSCREEN,    /**< main touch screen */
+               DEVTYPE_TOUCHKEY,               /**< touchkey */
+               DEVTYPE_GPS,
+               DEVTYPE_UART,
+               DEVTYPE_MMC,                    /**< MMC card(Micro SD) */
+               DEVTYPE_EFFECT_HAPTIC,  /**< extended touchsense */
+
+               DEVTYPE_MAX
+       } devtype_t;
+
+/** 
+ * @par Description:
+ *     DEVTYPE_POWERSUPPLY property for generic APIs
+ */
+       enum {
+               POWER_SUPPLY_PROP_CHARGE_FULL,
+                                       /**< Battery is full-charged.*/
+               POWER_SUPPLY_PROP_CHARGE_NOW,
+                                       /**< Battery is being charged now */
+               POWER_SUPPLY_PROP_CAPACITY,     /**< Current remaining battery */
+       };
+
+/**
+ * @par Description:
+ *     DEVTYPE_DISPLAY0 and DEVTYPE_DISPLAY1 property for generic APIs
+ */
+       enum {
+               DISPLAY_PROP_ONOFF,
+               DISPLAY_PROP_BRIGHTNESS,
+               DISPLAY_PROP_MAX_BRIGHTNESS,
+               DISPLAY_PROP_GAMMA,
+               DISPLAY_PROP_DISPLAY_COUNT,
+       };
+
+/**
+ * @par Description:
+ *  DEVTYPE_LED property for generic APIs
+ */
+       enum {
+               LED_PROP_BRIGHTNESS,
+               LED_PROP_MAX_BRIGHTNESS,
+       };
+
+/**
+ * @par Description:
+ *     DEVTYPE_JACK property for generic APIs
+ */
+       enum {
+               JACK_PROP_EARJACK_ONLINE,
+                                       /**< Earjack */
+               JACK_PROP_MIC_ONLINE,   /**< Microphone */
+               JACK_PROP_TVOUT_ONLINE, /**< analog tvout */
+               JACK_PROP_USB_ONLINE,   /**< USB connection */
+               JACK_PROP_TA_ONLINE,    /**< Travel Adapter(Charger) */
+               JACK_PROP_HDMI_ONLINE,  /**< Digital tvout */
+               JACK_PROP_USB_PATH,             /**< */
+               JACK_PROP_EARKEY_PRESS, /**< */
+               JACK_PROP_CRADLE_ONLINE,/**< Cradle connection */
+       };
+
+/**
+ * @par Description:
+ *     DEVTYPE_TOUCHKEY property for generic APIs
+ */
+       enum {
+               TCKEY_PROP_FIRST,
+                               /**< */
+               TCKEY_PROP_SECOND,
+                               /**< */
+               TCKEY_PROP_THIRD,
+                               /**< */
+       };
+
+/**
+ * @par Description:
+ *     DEVTYPE_UART property for generic APIs
+ */
+       enum {
+               UART_PROP_SELECT_PATH,
+       };
+
+/**
+ * @par Description:
+ *     DEVTYPE_MMC property for generic APIs
+ */
+       enum {
+               MMC_PROP_FORMAT,
+       };
+
+/**
+ * @fn int device_get_property(devtype_t devtype, int property, int *value)
+ * @par Description:
+ *     This generic API is used to get the property values of supported devices.\n
+ *     If the caller process does not have permission, it returns failure.
+ * @param[in] devtype device type that you want to get the value 
+ * @param[in] property value property that you want to get the value
+ * @param[out] *value current value of device property
+ * @return 0 on success, -1 if failed
+ * @see device_set_property()
+ * @par Example:
+ * @code
+ *     ...
+ *     if( device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &val) < 0 )
+ *             printf("Fail to get property\n");
+ *     else 
+ *             printf("Property is %d\n", val);
+ *     ...
+ * @endcode
+ */
+       int device_get_property(devtype_t devtype, int property, int *value);
+
+/**
+ * @fn int device_set_property(devtype_t devtype, int property, int value)
+ * @par Description:
+ *     This generic API is used to set the property values of supported devices.\n 
+ *     If the caller process does not have permission, it returns failure.
+ * @param[in] devtype device type that you want to set the value
+ * @param[in] property value property that you want to set the value
+ * @param[in] value value that you want to set
+ * @return 0 on success, -1 if failed
+ * @see device_get_property()
+ * @par Example
+ * @code
+ *     ...
+ *     if( device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_BRIGHTNESS, val) < 0 )
+ *             printf("Fail to set property\n");
+ *     else
+ *             printf("Property is set %d\n", val);
+ *     ...
+ * @endcode
+ */
+       int device_set_property(devtype_t devtype, int property, int value);
+
+/* Application level interfaces */
+
+/**
+ * @par Description:
+ *     This API is used to get the remaining battery percentage.\n
+ *     It gets the Battery percentage by calling device_get_property() function.\n
+ *     It returns integer value(0~100) that indicate remaining batterty percentage on success.\n
+ *     Or a negative value(-1) is returned on failure.
+ * @return On success, integer value(0~100) is returned. 
+ *             Or a negative value(-1) is returned on failure.
+ * @see device_is_battery_full()
+ * @par Example
+ * @code
+ *     ...
+ *     int battery;
+ *     battery = device_get_battery_pct();
+ *     if( battery < 0 )
+ *             printf("Fail to get the remaining battery percentage.\n");
+ *     else
+ *             printf("remaining battery percentage : %d\n", battery);
+ *     ...         
+ * @endcode
+ */
+       int device_get_battery_pct(void);
+
+/**
+ * @par Description:
+ *     This API is used to get the fully charged status of battery.\n
+ *     It gets the fully charged status of Battery by calling device_get_property() function.\n
+ *     If the status of battery is full, it returns 1.\n
+ *     Or a negative value(-1) is returned, if the status of battery is not full.
+ * @return 1 with battery full, or 0 on not full-charged, -1 if failed
+ * @see device_get_battery_pct()
+ * @par Example
+ * @code
+ *     ...
+ *     if ( device_is_battery_full() > 0 )
+ *             printf("battery fully chared\n");
+ *     ...         
+ * @endcode
+ */
+       int device_is_battery_full(void);
+
+/**
+ * @par Description:
+ *     Display number
+ */
+       typedef enum {
+               DEV_DISPLAY_0,  /**< */
+               DEV_DISPLAY_1,  /**< */
+               DEV_MAIN_DISPLAY = DEV_DISPLAY_0,       /**< */
+       } display_num_t;
+
+/**
+ * @par Description:
+ *     This API is used to get the current brightness of the display.\n
+ *     It gets the current brightness of the display by calling device_get_property() function.\n
+ *     It returns integer value which is the current brightness on success.\n
+ *     Or a negative value(-1) is returned on failure.
+ * @param[in] num display number that you want to get the brightness value
+ * @return current brightness value on success, -1 if failed
+ * @see device_set_diplay_brt()
+ * @par Example
+ * @code
+ *     ...
+ *     int cur_brt;
+ *     cur_brt = device_get_display_brt(0);
+ *     if( cur_brt < 0 )
+ *             printf("Fail to get the current brightness of the display.\n");
+ *     else
+ *             printf("Current brightness of the display is %d\n", cur_brt);
+ *     ...
+ * @endcode
+ */
+       int device_get_display_brt(display_num_t num);
+
+/**
+ * @par Description:
+ *     This API is used to set the current brightness of the display.\n 
+ *     It sets the current brightness of the display by calling device_set_property() function.\n
+ *     MUST use this API very carefully. \n
+ *     you MUST set original brightness by device_release_brt_ctrl(), 
+ *     after you finish your job using this API. 
+ * @param[in] num display number that you want to set the brightness value
+ * @param[in] val brightness value that you want to set
+ * @return 0 on success, -1 if failed
+ * @see device_get_diplay_brt(), device_release_brt_ctrl()
+ * @par Example
+ * @code
+ *     ...
+ *     if( device_set_display_brt(0,6) < 0 )
+ *                     printf("Fail to set the current brightness of the display0\n");
+ *     else
+ *                     printf("The current brightness of the display0 is set 6\n");
+ *     ...
+ * @endcode
+ */
+       int device_set_display_brt(display_num_t num, int val);
+
+/**
+ * @par Description:
+ *     This API is used to release brightness control.\n
+ *     It sets the current brightness of the display by calling device_set_property() function.\n
+ *     MUST call this API after you finished the job which need to change the brightness.
+ * @param[in] num display number
+ * @return 0 on success, -1 if failed
+ * @see device_set_display_brt()
+ * @par Example
+ * @code
+ *     ...
+ *     org_val = device_get_display_brt(0);
+ *     device_set_display_brt(0,1);
+ *     ...
+ *     ret = device_release_brt_ctrl(0);
+ *     if( ret < 0 )
+ *             printf("Fail to release brightness control\n");
+ *     ...
+ * @endcode
+ */
+       int device_release_brt_ctrl(display_num_t num);
+
+/**
+ * @par Description:
+ *      This API is used to get the max brightness of the display.\n
+ *      It gets the current brightness of the display by calling device_get_property() function.\n
+ *      It returns integer value which is the max brightness on success.\n
+ *      Or a negative value(-1) is returned on failure
+ * @param[in] num display number
+ * @return max brightness value on success, -1 if failed
+ * @par Example
+ * @code
+ *      ...
+ *      int max_brt;
+ *      max_brt = device_get_max_brt(0);
+ *      if( max_brt < 0 )
+ *              printf("Fail to get the max brightness of the display.\n");
+ *      else
+ *              printf("Max brightness of the display is %d\n", max_brt);
+ *      ...
+ * @endcode
+ */
+       int device_get_max_brt(display_num_t num);
+
+/** 
+ * @par Description:
+ *     LCD gamma values
+ */
+       typedef enum {
+               LCD_GAMMA_22 = 1,                       /**< 8500K , 2.2 GAMMA*/
+               LCD_GAMMA_19 = 2,                       /**< 8500K , 1.9 GAMMA*/
+               LCD_GAMMA_17 = 3,                       /**< 8500K , 1.7 GAMMA*/
+               LCD_GAMMA_NORMAL = LCD_GAMMA_22,                        /**< Normal screen */
+               LCD_GAMMA_PLAY_RECORD = LCD_GAMMA_19,           /**< Playing or recording cam */
+               LCD_GAMMA_PREVIEW = LCD_GAMMA_17,                       /**< Preview */
+               LCD_GAMMA_MOVIE = LCD_GAMMA_19,                         /**< Movie */
+               LCD_GAMMA_CAMERA = 11,                                                  /**< Camera */
+       } display_gamma_t;
+
+/**
+ * @par Description:
+ *     This API is used to get the current gamma of the display.\n
+ *      It gets the current gamma of the display by calling device_get_property() function.\n
+ *      It returns enum value which is the current gamma on success.\n
+ *      Or a negative value(-1) is returned on failure.
+ * @param[in] num display number that you want to get the gamma value
+ * @return current gamma enum value on success, -1 if failed
+ * @see device_set_diplay_gamma()
+ * @par Example
+ * @code
+ *      ...
+ *      int cur_brt;
+ *      cur_brt = device_get_display_gamma(0);
+ *      if( cur_brt < 0 )
+ *              printf("Fail to get the current gamma of the display.\n");
+ *      else
+ *              printf("Current gamma of the display is %d\n", cer_brt);
+ *      ...
+ * @endcode
+ */
+       int device_get_display_gamma(display_num_t num);
+
+/**
+ * @par Description:
+ *     This API is used to set the specific gamma value of the display .\n 
+ *      It sets the specific gamma value of the display by calling device_set_property() function.\n
+ *      MUST use this API very carefully. \n
+ *      you MUST set original gamma by device_release_gamma_ctrl(), 
+ *      after you finish your job using this API. 
+ * @param[in] num display number that you want to set the gamma value
+ * @param[in] new_val lcd gamma enum value that you want to set
+ * @return 0 on success, -1 if failed
+ * @see device_get_diplay_gammat(), device_release_gamma_ctrl()
+ * @par Example
+ * @code
+ *      ...
+ *      if( device_set_display_gamma(0,1) < 0 )
+ *                      printf("Fail to set the specific gamma of the display0\n");
+ *      else
+ *                      printf("The gamma of the display0 is set 1(LCD_GAMMA_22)\n");
+ *      ...
+ * @endcode
+ */
+       int device_set_display_gamma(display_num_t num,
+                                    display_gamma_t new_val);
+
+/**
+ * @par Description:
+ *     This API is used to release gamma control.\n
+ *      It sets the gamma of the display by calling device_set_property() function.\n
+ *      MUST call this API after you finished the job which need to change the gamma.
+ * @param[in] num display number
+ * @param[in] org_val original gamma enums value before you control the gamma
+ * @return 0 on success, -1 if failed
+ * @see device_set_display_gamma()
+ * @par Example
+ * @code
+ *      ...
+ *      org_val = device_get_display_gamma(0);
+ *      device_set_display_gamma(0,2);
+ *      ...
+ *      ret = device_release_gamma_ctrl(0, org_val);
+ *      if( ret < 0 )
+ *              printf("Fail to release gamma control\n");
+ *      ...
+ * @endcode
+ */
+       int device_release_gamma_ctrl(display_num_t num,
+                                     display_gamma_t org_val);
+
+/**
+ * @par Description:
+ *     This API is used to get number of displays on the phone.\n
+ *      It gets the current number of displays by calling device_get_display_count() function.\n
+ *      It returns enum value which is the current number on success.\n
+ *      Or a negative value(-1) is returned on failure.
+ * @return 0 on success, -1 if failed
+ * @par Example
+ * @code
+ *     ...
+ *     ret = device_get_display_count();
+ *     if( ret < 0 )
+ *              printf("Fail to get number of displays\n");
+ *      ...
+ * @endcode
+ */
+       int device_get_display_count(void);
+
+/**
+ * @par Description:
+ *     This API is used to make the phone go to a suspend (sleep) state. \n
+ *     The suspend state consumes little battery power. \n
+ *     If the caller process does not have permission, it returns failure.
+ * @return 0 on success, -1 if failed
+ * @par Example
+ * @code
+ *     ...
+ *     ret = device_power_suspend();
+ *     if( ret < 0 )
+ *              printf("Fail to make the phone go to a suspend (sleep) state\n");
+ *      ...
+ * @endcode
+ */
+       int device_power_suspend(void);
+
+       int device_get_led_brt(void);
+       int device_set_led_brt(int val);
+       int device_get_max_led(void);
+
+/**
+ * @} // end of internal APIs
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/devman.pc.in b/devman.pc.in
new file mode 100644 (file)
index 0000000..fa263eb
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: device manager
+Description: SLP device control library
+Version: @VERSION@
+Requires: 
+Libs: -L${libdir} -ldevman -ldl
+Cflags: -I${includedir}
diff --git a/devman_haptic.h b/devman_haptic.h
new file mode 100644 (file)
index 0000000..d41d9f8
--- /dev/null
@@ -0,0 +1,391 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVMAN_HAPTIC_H__
+#define __DEVMAN_HAPTIC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** 
+ * @file        devman_haptic.h
+ * @ingroup     DEVICE_MANAGER
+ * @brief       This file contains the prototypes of the haptic API
+ * @author      SLP2.0
+ * @date        2010-01-24
+ * @version     0.1
+ */
+
+/**
+ * @addtogroup DEVICE_MANAGER
+ * @{
+ */
+
+
+/**
+ * @par Description:
+ *     The pattern list for haptic.\n
+ *     Note: The patterns will be removed except the patterns which are used for BEAT UX after 9. Dec. 2011.
+ */
+       enum effectvibe_pattern_list {
+               EFFCTVIBE_TOUCH = 0,            /**< for BeatUX */
+               EFFCTVIBE_HW_TOUCH,             /**< for BeatUX */
+               EFFCTVIBE_NOTIFICATION,         /**< for BeatUX */
+               EFFCTVIBE_INCOMING_CALL01,      /**< for BeatUX */
+               EFFCTVIBE_INCOMING_CALL02,      /**< for BeatUX */
+               EFFCTVIBE_INCOMING_CALL03,      /**< for BeatUX */
+               EFFCTVIBE_ALERTS_CALL,          /**< for BeatUX */
+               EFFCTVIBE_OPERATION,            /**< for BeatUX */
+               EFFCTVIBE_SILENT_MODE,          /**< for BeatUX */
+
+               EFFCTVIBE_PATTERN_END
+       };
+
+/**
+ * @par Description:
+ *      feedback level for haptic.
+ */
+       enum haptic_feedback_level {
+               HAPTIC_FEEDBACK_LEVEL_AUTO = -1,                /**< auto feedback level */
+               HAPTIC_FEEDBACK_LEVEL_1 = 1,                    /**< feedback level 1 */
+               HAPTIC_FEEDBACK_LEVEL_2 = 2,                    /**< feedback level 2 */
+               HAPTIC_FEEDBACK_LEVEL_3 = 3,                    /**< feedback level 3 */
+               HAPTIC_FEEDBACK_LEVEL_4 = 4,                    /**< feedback level 4 */
+               HAPTIC_FEEDBACK_LEVEL_5 = 5,                    /**< feedback level 5 */
+       };
+
+/**
+ * @par Description:
+ *     infinite iteration count
+ */
+#define HAPTIC_INFINITE_ITERATION      256
+
+/**
+ * @par Description:
+ *     Return Values
+ */
+#define HAPTIC_SUCCESS                 0
+#define HAPTIC_NOT_OPENED              -2
+#define HAPTIC_FAIL                    -4
+#define HAPTIC_NOT_SUPPORTED           -13
+
+/**
+ * @par Description:
+ * Motor device index. We support two motors now.
+ */
+       typedef enum haptic_dev_idx_t {
+               DEV_IDX_0 = 0x01,               /**< 1st motor */
+               DEV_IDX_1 = 0x02,               /**< 2nd motor */
+               DEV_IDX_ALL = 0x04,             /**< both of them */
+       } haptic_dev_idx;
+
+/**
+ * @fn int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode)
+ * @par Description:
+ *     This API opens a Haptic-vibration device. \n
+ *     On success it returns a dev_handle value. In case of failure it returns a negative value. \n
+ *     If the device is already open it returns (-1).\n
+ *     The first in parameter dev_idx should be from a predefined haptic-device-index which is available in the typedef enum haptic_dev_idx.\n
+ *     The DEV_IDX_0 means first haptic-device-index of target , the DEV_IDX_1 means second haptic-device-index of target \n
+ *     and the DEV_IDX_ALL means both of them. \n
+ *     The availability of the dev_idx value is dependent on the real target. Normally, set a DEV_IDX_0 value to the first haptic-device.\n
+ *     The second in parameter mode is reserved for future so just set a 0 value\n
+ *     Note: The device_haptic_open() must be called before all other haptic APIs are called. \n
+ *     The device_haptic_open() should have a matching call to device_haptic_close().\n 
+ *     Applications call the device_haptic_open() only once if possible during application startup and call the device_haptic_close() during application shutdown.
+ * @param[in] dev_idx set a device index (predefined enum value by haptic_dev_idx)
+ * @param[in] mode just set a "0" value (not support current , reserved for future)
+ * @return if it succeed, it return dev_handle value , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int ret_val=0;
+ *      int dev_handle;      
+ *
+ *     //Open the haptic device
+ *     dev_handle = device_haptic_open(DEV_IDX_0,0);
+ *     if(dev_handle < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode);
+
+/**
+ * @fn int device_haptic_close(int dev_handle)
+ * @par Description:
+ *     This API closes a Haptic-vibration device. \n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     If the device is already closed it returns (-1).  \n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().
+ * hatic device close
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_open()
+ * @par Example:
+ * @code
+ *      ...
+ *     //Close the device
+ *     ret_val = device_haptic_close(dev_handle);
+ *     if(ret_val != 0)
+ *              return -1
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_close(int dev_handle);
+
+/**
+ * @fn int device_haptic_play_pattern(int dev_handle, int pattern , int iteration , int feedback_level )
+ * @par Description:
+ *     This API plays a predefined rhythmic haptic-vibration pattern. \n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     The second in parameter pattern should be from a predefined pattern list which is available in an enumeration (effectvibe_pattern_list). 
+ *     These patterns are rhythmic vibration patterns. \n
+ *     The third in parameter iteration sets the number of iterations to be played. 
+ *     This should be less than the maximum iteration range set for the device (currently its 255).  \n
+ *     The fourth in parameter is the vibration feedback intensity level. 
+ *     This level is already predefined by enumeration type value from HAPTIC_FEEDBACK_LEVEL_1 to HAPTIC_FEEDBACK_LEVEL_5. 
+ *     If you want to use the value selected by the user in the Setting application menu, just set -1 value.\n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback play pattern and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @param[in] pattern set predefined pattern enum value from effectvibe_pattern_list
+ * @param[in] iteration set iteration count
+ * @param[in] feedback_level set feed_back level value ( it is dependent on target's hardware )
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_play_file(), device_haptic_play_monoton(), device_haptic_stop_play()
+ * @par Example
+ * @code
+ *     ...
+ *     //Play a rhythmic pattern
+ *     ret_val = device_haptic_play_pattern(dev_handle, EFFCTVIBE_POPUP, HAPTIC_TEST_ITERATION , HAPTIC_FEEDBACK_LEVEL_3); 
+ *     if(ret_val !=0)
+ *             return -1;
+ *     ...
+ * @endcode              
+ */
+
+       int device_haptic_play_pattern(int dev_handle, int pattern,
+                                      int iteration, int feedback_level);
+
+/**
+ * @fn int device_haptic_play_file(int dev_handle, const char *file_name , int iteration , int feedback_level  )
+ * @par Description:
+ *     This API plays a predefined rhythmic haptic-vibration pattern file (only supports .ivt type file, Immersion VibeTonz).\n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     The second in parameter file_name sets rhythmic vibration pattern file with path. 
+ *     It only supports *.ivt type pattern file. \n
+ *     The third in parameter iteration sets the number of iterations to be played. 
+ *     This should be less than the maximum iteration range set for the device (currently its 255). 
+ *     If you want to play indefinitely, use HAPTIC_INFINITE_ITERATION defined value. But it depends on the target hardware.\n
+ *     The fourth in parameter is the vibration feedback intensity level. 
+ *     This level is already predefined by enumeration type value from HAPTIC _FEEDBACK_LEVEL_1 to HAPTIC _FEEDBACK_LEVEL_5. 
+ *     If you want to use the value selected by the user in the Setting application menu, just set HAPTIC_FEEDBACK_LEVEL_AUTO value. 
+ *     (But the application must have a main loop to use the HAPTIC_FEEDBACK_LEVEL_AUTO value ) \n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback play pattern and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @param[in] file_name set file name with path
+ * @param[in] iteration set iteration count
+ * @param[in] feedback_level set feed_back level value ( it is dependent on target's hardware )
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_play_pattern(), device_haptic_play_monotone(), device_haptic_stop_play()
+ * @par Example
+ * @code
+ *      ...
+ *      ret_val = device_haptic_play_file(dev_handle, "test.ivt", HAPTIC_TEST_ITERATION , HAPTIC_FEEDBACK_LEVEL_3); 
+ *      if(ret_val !=0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_file(int dev_handle, const char *file_name,
+                                   int iteration, int feedback_level);
+
+/**
+ * @fn int device_haptic_play_buffer(int dev_handle, const unsigned char *vibe_buffer, int iteration , int feedback_level  )
+ * @par Description:
+ *     This API plays a predefined rhythmic haptic-vibration pattern file (only supports .ivt type file, Immersion VibeTonz).\n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     The second in parameter vibe_buffer sets rhythmic vibration pattern buffer.
+ *     The third in parameter iteration sets the number of iterations to be played.
+ *     This should be less than the maximum iteration range set for the device (currently its 255).
+ *     If you want to play indefinitely, use HAPTIC_INFINITE_ITERATION defined value. But it depends on the target hardware.\n
+ *     The fourth in parameter is the vibration feedback intensity level. 
+ *     This level is already predefined by enumeration type value from HAPTIC _FEEDBACK_LEVEL_1 to HAPTIC _FEEDBACK_LEVEL_5.
+ *     If you want to use the value selected by the user in the Setting application menu, just set HAPTIC_FEEDBACK_LEVEL_AUTO value.
+ *     (But the application must have a main loop to use the HAPTIC_FEEDBACK_LEVEL_AUTO value ) \n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback play pattern and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived dev_handle value from device_haptic_open()
+ * @param[in] buffer set buffer to be played
+ * @param[in] iteration set iteration count
+ * @param[in] feedback_level set feed_back level value ( it is dependent on target's hardware )
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_play_pattern(), device_haptic_play_monotone(), device_haptic_stop_play()
+ * @par Example
+ * @code
+ *      ...
+ *      ret_val = device_haptic_play_buffer(dev_handle, buffer, HAPTIC_TEST_ITERATION , HAPTIC_FEEDBACK_LEVEL_3);
+ *      if(ret_val !=0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_buffer(int dev_handle, const unsigned char *vibe_buffer,
+                                   int iteration, int feedback_level);
+
+/**
+ * @fn int device_haptic_play_monotone(int dev_handle, int duration)
+ * @par Description:
+ *     This API plays a monotonous haptic-vibration pattern with a constant intensity. \n
+ *     In this monotone play, the intensity used is the value that the user has selected in the Setting application menu.\n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     The second in parameter duration defines the length of time this vibration should be played. 
+ *     This duration is in milliseconds.  \n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback played and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @param[in] duration set duration times (ms)
+ * @return if it succeed, it return zero value, otherwise negative value return
+ * @see device_haptic_play_pattern(), device_haptic_play_file(), device_haptic_stop_play()
+ * @par Example
+ * @code
+ *      ...
+ *      //Play a monotone pattern for 1s == 1000ms
+ *      ret_val = device_haptic_play_monotone(dev_handle, 1000);
+ *      if(ret_val !=0)
+ *              return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_monotone(int dev_handle, int duration);
+
+/**
+ * @fn int device_haptic_stop_play(int dev_handle)
+ * @par Description:
+ *     This API stops the current vibration being played.\n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     On success it returns a zero value. In case of failure it returns a negative value.
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_play_pattern(), device_haptic_play_file(), device_haptic_play_monotone()
+ * @par Example
+ * @code
+ *      ...
+ *      //Stop the pattern immediately 
+ *      ret_val = device_haptic_stop_play(dev_handle);
+ *      if(ret_val !=0)
+ *             return -1;
+ *      ...              
+ * @endcode
+ */
+
+       int device_haptic_stop_play(int dev_handle);
+
+/**
+ * @fn int device_haptic_get_buffer_duration(int dev_handle, const unsigned char* vibe_buffer , int* duration)
+ * @par Description:
+ *     This API gets a duration time value from a predefined rhythmic vibration pattern.\n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     The second in parameter vibe_buffer sets rhythmic vibration pattern buffer.
+ *     The application can get a duration time value from the third out parameter duration when this API succeeds.
+ *     The unit of duration is ms (millisecond) \n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback played and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived dev_handle value from device_haptic_open()
+ * @param[in] vibe_buffer set vibe pattern buffer to get duration
+ * @param[out] duration get duration times (ms)
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_get_file_duration()
+ */
+
+       int device_haptic_get_buffer_duration(int dev_handle, const unsigned char *vibe_buffer,
+                                              int *duration);
+
+/**
+ * @fn int device_haptic_get_pattern_duration(int dev_handle, int pattern , int* duration)
+ * @par Description:
+ *     This API gets a duration time value from a predefined rhythmic vibration pattern.\n
+ *     The first in parameter dev_handle should be from the return value of device_haptic_open().\n
+ *     The second in parameter pattern should be from a predefined pattern list
+ *     which is available in an enumeration (effectvibe_pattern_list). \n
+ *     The application can get a duration time value from the third out parameter duration when this API succeeds.
+ *     The unit of duration is ms (millisecond) \n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback played and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @param[in] pattern set predefined pattern enum value from <effectvibe_pattern_list>
+ * @param[out] duration get duration times (ms)
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_get_file_duration()
+ */
+
+       int device_haptic_get_pattern_duration(int dev_handle, int pattern,
+                                              int *duration);
+
+/**
+ * @fn int device_haptic_get_file_duration(int dev_handle, const char *file_name , int* duration)
+ * @par Description:
+ *     This API gets a duration time value from a predefined rhythmic vibration pattern file (only supports .ivt type file).\n
+ *     The first in parameter ?dev_handle? should be from the return value of device_haptic_open().\n
+ *     The second in parameter ?file_name? sets rhythmic vibration pattern file with path. It only supports *.ivt type pattern file.\n
+ *     The application can get a duration time value from the third out parameter duration when this API succeeds. 
+ *     The unit of duration is ms (millisecond)\n
+ *     On success it returns a zero value. In case of failure it returns a negative value. \n
+ *     Note: The actual behavior of the feedback played and the intensity depends on the target hardware.
+ * @param[in] dev_handle set recived  dev_handle value from device_haptic_open()
+ * @param[in] file_name set file name with path
+ * @param[out] duration get duration times (ms)
+ * @return if it succeed, it return zero value , otherwise negative value return
+ * @see device_haptic_get_pattern_duration()
+ */
+
+       int device_haptic_get_file_duration(int dev_handle,
+                                           const char *file_name,
+                                           int *duration);
+
+/**
+ * @fn int device_haptic_get_device_count(void)
+ * @par Description:
+ *     This API gets a numer of devices.\n
+ *     The application can get a number of devices from the return value this API succeeds. 
+ *     On success it returns a number of devices. In case of failure it returns a negative value. \n
+ * @return if it succeed, it return number of devices, otherwise negative value return
+ */
+       int device_haptic_get_device_count(void);
+
+/**
+ * @} 
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/devman_haptic.pc.in b/devman_haptic.pc.in
new file mode 100644 (file)
index 0000000..5cb1018
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: devman_haptic
+Description: SLP devman haptic library
+Version: @VERSION@
+Requires: 
+Libs: -L${libdir} -ldevman
+Cflags: -I${includedir}
diff --git a/devman_haptic_ext.h b/devman_haptic_ext.h
new file mode 100644 (file)
index 0000000..669bfa0
--- /dev/null
@@ -0,0 +1,1303 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef __DEVMAN_HAPTIC_EXT_H__
+#define __DEVMAN_HAPTIC_EXT_H__
+
+#include "devman_haptic_ext_core.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file        devman_haptic_ext.h
+ * @ingroup     DEVICE_MANAGER
+ * @brief       This file contains the prototypes of the haptic extended API
+ * @author      SLP2.0
+ * @date        2010-01-24
+ * @version     0.1
+ */
+
+/**
+ * @addtogroup DEVICE_MANAGER
+ * @{
+ */
+
+/**
+ * @fn int device_haptic_get_device_state(int device_index, int *state)
+ * @par Description:
+ *     This API gets the status bits of an available device that is supported by the TouchSense Player API.\n
+ * @param[in] dev_idx set a device index (predefined enum value by haptic_dev_idx)
+ * @param[out] state is a pointer to the variable that will receive the status bits of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int state
+ *
+ *     //Get the haptic device state
+ *     status = device_haptic_get_device_state(DEV_IDX_0, &state);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_state(int device_index, int *state);
+
+/**
+ * @fn int device_haptic_get_device_capability_bool(int device_index, int device_cap_type, unsigned char *device_cap_value)
+ * @par Description:
+ *     This API gets a Boolean capability of an available device that is supported by the TouchSense Player API.\n
+ * @param[in] device_index set a device index (predefined enum value by haptic_dev_idx)
+ * @param[in] device_cap_type set capability type of the Boolean capability to get
+ * @param[out] device_cap_value is a pointer to the variable that will receive the requested Boolean capability value of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char device_cap_value;
+ *
+ *     //Get haptic device capability
+ *     status = device_haptic_get_device_capability_bool(DEV_IDX_0, NOT_AVAILABLE_CAPABILITY, &device_cap_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_capability_bool(int device_index, int device_cap_type, unsigned char *device_cap_value);
+
+/**
+ * @fn int device_haptic_get_device_capability_int32(int device_index, int device_cap_type, int *device_cap_value)
+ * @par Description:
+ *     This API gets a 32-bit integer capability of an available device that is supported by the TouchSense Player API.\n
+ * @param[in] device_index set a device index (predefined enum value by haptic_dev_idx)
+ * @param[in] device_cap_type set Capability type of the Boolean capability to get
+ * @param[out] device_cap_value is a pointer to the variable that will receive the requested 32-bit integer capability value of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_cap_value;
+ *
+ *     //Get haptic device capability
+ *     status = device_haptic_get_device_capability_int32(DEV_IDX_0, HAPTIC_DEVCAPTYPE_ACTUATOR_TYPE, &device_cap_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_capability_int32(int device_index, int device_cap_type, int *device_cap_value);
+
+/**
+ * @fn int device_haptic_get_device_capability_string(int device_index, int device_cap_type, int size, char *device_cap_value)
+ * @par Description:
+ *     This API gets a string capability of an available device that is supported by the TouchSense Player API.\n
+ * @param[in] device_index set a device index (predefined enum value by haptic_dev_idx)
+ * @param[in] device_cap_type set Capability type of the Boolean capability to get
+ * @param[out] device_cap_value is a pointer to the variable that will receive the requested 32-bit integer capability value of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int size = 1024;
+ *      char device_cap_value[size];
+ *
+ *     //Get haptic device capability
+ *     status = device_haptic_get_device_capability_string(DEV_IDX_0, HAPTIC_DEVCAPTYPE_DEVICE_NAME, size, device_cap_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_capability_string(int device_index, int device_cap_type, int size, char *device_cap_value);
+
+/**
+ * @fn int device_haptic_get_device_property_bool(int device_handle, int device_prop_type, unsigned char *device_prop_value)
+ * @par Description:
+ *     This API gets a Boolean property of an open device.\n
+ * @param[in] device_handle is a handle to the device for which to get a Boolean property
+ * @param[in] device_prop_type set property type of the Boolean property to get
+ * @param[out] device_prop_value is a pointer to the variable that will receive the requested Boolean property value of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_handle;
+ *      unsigned char device_prop_value;
+ *
+ *     device_handle = device_haptic_open_device(DEV_IDX0, 0);
+ *      ...
+ *
+ *     //Get haptic device property
+ *     status = device_haptic_get_device_property_bool(device_handle, HAPTIC_DEVPROPTYPE_DISABLE_EFFECTS, &device_prop_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_property_bool(int device_handle, int device_prop_type, unsigned char *device_prop_value);
+
+/**
+ * @fn int device_haptic_set_device_property_bool(int device_handle, int device_prop_type, unsigned char device_prop_value)
+ * @par Description:
+ *     This API sets a Boolean property of an open device.\n
+ * @param[in] device_handle is a handle to the device for which to set a Boolean property
+ * @param[in] device_prop_type set property type of the Boolean property to set
+ * @param[in] device_prop_value is a value of the Boolean property to set
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_handle;
+ *      unsigned char device_prop_value = HAPTIC_FALSE;
+ *
+ *     device_handle = device_haptic_open_device(DEV_IDX0, 0);
+ *      ...
+ *
+ *     //Get haptic device property
+ *     status = device_haptic_set_device_property_bool(device_handle, HAPTIC_DEVPROPTYPE_DISABLE_EFFECTS, device_prop_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_set_device_property_bool(int device_handle, int device_prop_type, unsigned char device_prop_value);
+
+/**
+ * @fn int device_haptic_get_device_property_int32(int device_handle, int device_prop_type, int *device_prop_value)
+ * @par Description:
+ *     This API gets a 32-bit integer property of an open device.\n
+ * @param[in] device_handle is a handle to the device for which to get a 32-bit integer property
+ * @param[in] device_prop_type set property type of the Boolean property to get
+ * @param[in] device_prop_value is a pointer to the variable that will receive the requested 32-bit integer property value of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_handle;
+ *      int device_prop_value;
+ *
+ *     device_handle = device_haptic_open_device(DEV_IDX0, 0);
+ *      ...
+ *
+ *     //Get haptic device property
+ *     status = device_haptic_get_device_property_int32(device_handle, HAPTIC_DEVPROPTYPE_STRENGTH, &device_prop_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_property_int32(int device_handle, int device_prop_type, int *device_prop_value);
+
+/**
+ * @fn int device_haptic_set_device_property_int32(int device_handle, int device_prop_type, int device_prop_value)
+ * @par Description:
+ *     This API sets a 32-bit integer property of an open device.\n
+ * @param[in] device_handle is a handle to the device for which to set a 32-bit integer property
+ * @param[in] device_prop_type set property type of the Boolean property to set
+ * @param[in] device_prop_value is a value of the 32-bit integer property to set.
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_handle;
+ *      int device_prop_value = 5000;
+ *
+ *     device_handle = device_haptic_open_device(DEV_IDX0, 0);
+ *      ...
+ *
+ *     //Get haptic device property
+ *     status = device_haptic_get_device_property_int32(device_handle, HAPTIC_DEVPROPTYPE_STRENGTH, device_prop_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_set_device_property_int32(int device_handle, int device_prop_type, int device_prop_value);
+
+/**
+ * @fn int device_haptic_get_device_property_string(int device_handle, int device_prop_type, int size, char *device_prop_value)
+ * @par Description:
+ *     This API gets a string property of an open device.\n
+ * @param[in] device_handle is a handle to the device for which to get a string property
+ * @param[in] device_prop_type set property type of the string property to get
+ * @param[in] size is a size of the buffer, in bytes, pointed to by the device_prop_value parameter.
+ * @param[out] device_prop_value is a pointer to the variable that will receive the requested string property value of the device
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_handle;
+ *      int size = 1024;
+ *      char device_prop_value[size];
+ *
+ *     device_handle = device_haptic_open_device(DEV_IDX0, 0);
+ *      ...
+ *
+ *     //Get haptic device property
+ *     status = device_haptic_get_device_property_string(device_handle, HAPTIC_DEVPROPTYPE_STRENGTH, size, device_prop_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_device_property_string(int device_handle, int device_prop_type, int size, char *device_prop_value);
+
+/**
+ * @fn int device_haptic_set_device_property_string(int device_handle, int device_prop_type, char *device_prop_value)
+ * @par Description:
+ *     This API sets a string property of an open device.\n
+ * @param[in] device_handle is a handle to the device for which to get a string property
+ * @param[in] device_prop_type set property type of the string property to set
+ * @param[in] device_prop_value pointer to the character buffer containing the string property value to set.
+ * @return if it succeed, it return HAPTIC_S_SUCCESS , otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int device_handle;
+ *      char *device_prop_value = "DMZI13021KAIA112123";
+ *
+ *     device_handle = device_haptic_open_device(DEV_IDX0, 0);
+ *      ...
+ *
+ *     //Get haptic device property
+ *     status = device_haptic_set_device_property_string(device_handle, HAPTIC_DEVPROPTYPE_LICENSE_KEY, device_prop_value);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_set_device_property_string(int device_handle, int device_prop_type, const char *device_prop_value);
+
+/**
+ * @fn int device_haptic_get_effect_count(const unsigned char *ivt_buffer)
+ * @par Description:
+ *     This API gets number of effects defined in IVT data.\n
+ * @param[in] ivt_buffer is a pointer to IVT data
+ * @return if it succeed, it returns number of effects defined in the specified IVT data, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int effect_count;
+ *      unsigned char ivt_buffer = { .... };
+ *
+ *     //Open the haptic device
+ *     effect_count = device_haptic_get_effect_count(ivt_buffer);
+ *     if(effect_count < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_count(const unsigned char *ivt_buffer);
+
+/**
+ * @fn int device_haptic_get_effect_name(const unsigned char *ivt_buffer, int effect_index, int size, char *effect_name)
+ * @par Description:
+ *     This API Gets the name of an effect defined in IVT data.\n
+ * @param[in] ivt_buffer is a pointer to IVT data containing the effect for which to get the name
+ * @param[in] effect_index is index of the effect for which to get the name
+ * @param[in] size is a size of the buffer, in bytes, pointed by the effect_name parameter
+ * @param[out] effect_name is a pointer to the character buffer that will receive the name of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int size = 1024;
+ *     char effect_name[size];
+ *
+ *     //Get IVT effect duration
+ *     status = device_haptic_get_effect_name(ivt_buffer, 0, size, effect_name);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_name(const unsigned char *ivt_buffer, int effect_index, int size, char *effect_name);
+
+/**
+ * @fn int device_haptic_get_effect_name_u(const unsigned char *ivt_buffer, int effect_index, int size, unsigned short *effect_name)
+ * @par Description:
+ *     This API gets the name of an effect defined in IVT data as a string of VibeWChar in UCS-2 format.\n
+ * @param[in] ivt_buffer is a pointer to IVT data containing the effect for which to get the name
+ * @param[in] effect_index is index of the effect for which to get the name
+ * @param[in] size is a size of the buffer, in bytes, pointed by the effect_name parameter
+ * @param[out] effect_name is a pointer to the unsigned short buffer that will receive the name of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int size = 1024;
+ *     unsigned short effect_name[size];
+ *
+ *     //Get IVT effect duration
+ *     status = device_haptic_get_effect_name_u(ivt_buffer, 0, size, effect_name);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_name_u(const unsigned char *ivt_buffer, int effect_index, int size, unsigned short *effect_name);
+
+/**
+ * @fn int device_haptic_get_effect_index_from_name(const unsigned char *ivt_buffer, const char *effect_name, int *effect_index)
+ * @par Description:
+ *     This API gets the index of an effect defined in IVT data given the name of the effect.\n
+ * @param[in] ivt_buffer is a pointer to IVT data
+ * @param[in] effect_name is pointer to the character buffer containing the name of the effect for which to get the index
+ * @param[out] effect_index is a pointer to the variable that will receive the index of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int effect_index;
+ *     char *effect_name = "PERIODIC_EFFECT";
+ *
+ *     //Get IVT effect duration
+ *     status = device_haptic_get_effect_index_from_name(ivt_buffer, effect_name, &effect_index);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_index_from_name(const unsigned char *ivt_buffer, const char *effect_name, int *effect_index);
+
+/**
+ * @fn int device_haptic_get_effect_index_from_name_u(const unsigned char *ivt_buffer, const unsigned short *effect_name, int *effect_index)
+ * @par Description:
+ *     This API Gets the index of an effect defined in IVT data given the name of the effect as a string of VibeWChar in UCS-2 format.\n
+ * @param[in] ivt_buffer is a pointer to IVT data
+ * @param[in] effect_name is a pointer to the unsigned short buffer containing the UCS-2 formatted name of the effect for which to get the index
+ * @param[out] effect_index is a pointer to the variable that will receive the index of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int effect_index;
+ *     unsigned short *effect_name = "PERIODIC_EFFECT";
+ *
+ *     //Get IVT effect duration
+ *     status = device_haptic_get_effect_index_from_name_u(ivt_buffer, effect_name, &effect_index);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_index_from_name_u(const unsigned char *ivt_buffer, const unsigned short *effect_name, int *effect_index);
+
+/**
+ * @fn int device_haptic_play_effect(int device_handle, const unsigned char *ivt_buffer, int effect_index, int *effect_handle)
+ * @par Description:
+ *     This API Pauses a playing effect.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @param[in] ivt_buffer is a pointer to IVT data containing the definition of the effect to play
+ * @param[in] effect_index is an index of the effect to play
+ * @param[out] effect_handle is a pointer to the handle to the variable that will receive a handle to the playing effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int effect_handle;
+ *
+ *      status = device_haptic_play_effect(device_handle, ivt_buffer, 0, &effect_handle);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_effect(int device_handle, const unsigned char *ivt_buffer, int effect_index, int *effect_handle);
+
+/**
+ * @fn int device_haptic_play_effect_repeat(int device_handle, const unsigned char *ivt_buffer, int effect_index, unsigned char repeat, int *effect_handle)
+ * @par Description:
+ *     This API Pauses a playing effect.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @param[in] ivt_buffer is a pointer to IVT data containing the definition of the effect to play
+ * @param[in] effect_index is an index of the effect to play
+ * @param[in] repeat is a number of time to repeat the effect
+ * @param[out] effect_handle is a pointer to the handle to the variable that will receive a handle to the playing effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @see device_haptic_close()
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int effect_handle;
+ *
+ *      status = device_haptic_play_effect_repeat(device_handle, ivt_buffer, 0, 3, &effect_handle);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_effect_repeat(int device_handle, const unsigned char *ivt_buffer, int effect_index, unsigned char repeat, int *effect_handle);
+
+/**
+ * @fn int device_haptic_stop_playing_effects(int device_handle, int effect_handle)
+ * @par Description:
+ *     This API stops playing effect.\n
+ * @param[in] device_handle is a handle to the device on which to stop the playing effect
+ * @param[in] effect_handle is a handle to the playing effect to stop
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *     status = device_haptic_stop_playing_effects(device_handle, effect_handle);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_stop_playing_effect(int device_handle, int effect_handle);
+
+/**
+ * @fn int device_haptic_get_effect_type(const unsigned char *ivt_buffer, int effect_index, int *effect_type)
+ * @par Description:
+ *     This API gets the type of an effect defined in IVT data.\n
+ * @param[in] ivt_buffer is a pointer to IVT data containing the effect for which to get the type
+ * @param[in] effect_index is index of the effect for which to get the type
+ * @param[out] effect_type is a pointer to the variable that will receive the type of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int effect_type;
+ *
+ *     //Get IVT effect type
+ *     status = device_haptic_get_effect_type(ivt_buffer, 0, &effect_type);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_type(const unsigned char *ivt_buffer, int effect_index, int *effect_type);
+
+/**
+ * @fn int device_haptic_get_magsweep_effect_definition(const unsigned char *ivt_buffer, int effect_index, int *duration, int *magnitude, int *style, int *attacktime, int *attacklevel, int *fadetime, int *fadelevel);
+ * @par Description:
+ *     This API gets the parameters of a MagSweep effect defined in IVT data.\n
+ * @param[in] ivt_buffer is a pointer to IVT data containing the effect for which to get the type
+ * @param[in] effect_index is index of the effect for which to get the type
+ * @param[out] duration is a pointer to the variable that will receive the duration of the effect in milliseconds
+ * @param[out] magnitude is a pointer to the variable that will receive the magnitude of the effect
+ * @param[out] style is a pointer to the variable that will receive the style of the effect
+ * @param[out] attacktime is a pointer to the variable that will receive the attack time of the effect in milliseconds
+ * @param[out] attacklevel is a pointer to the variable that will receive the attack level of the effect
+ * @param[out] fadetime is a pointer to the variable that will receive the fade time of the effect in milliseconds
+ * @param[out] fadelevel is a pointer to the variable that will receive the fade level of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int duration;
+ *      int magnitude;
+ *      int style;
+ *      int attacktime;
+ *      int attacklevel;
+ *      int fadetime;
+ *      int fadelevel;
+ *
+ *      status = device_haptic_get_magsweep_effect_definition(ivt_buffer, 1,
+ *              &duration, &magnitude, &style, &attacktime, &attacklevel, &fadetime, &fadelevel);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_magsweep_effect_definition(const unsigned char *ivt_buffer, int effect_index, int *duration, int *magnitude, int *style, int *attacktime, int *attacklevel, int *fadetime, int *fadelevel);
+
+/**
+ * @fn int device_haptic_get_periodic_effect_definition(const unsigned char *ivt_buffer, int effect_index, int *duration, int *magnitude, int *period, int *style_and_wave_type, int *attacktime, int *attacklevel, int *fadetime, int *fadelevel);
+ * @par Description:
+ *     This API gets the parameters of a Periodic effect defined in IVT data.\n
+ * @param[in] ivt_buffer is a pointer to IVT data containing the effect for which to get the type
+ * @param[in] effect_index is index of the effect for which to get the type
+ * @param[out] duration is a pointer to the variable that will receive the duration of the effect in milliseconds
+ * @param[out] magnitude is a pointer to the variable that will receive the magnitude of the effect
+ * @param[out] period is a pointer to the variable that will receive the period of the effect in milliseconds
+ * @param[out] style_and_wave_type is a pointer to the variable that will receive the style and wave type of the effect
+ * @param[out] attacktime is a pointer to the variable that will receive the attack time of the effect in milliseconds
+ * @param[out] attacklevel is a pointer to the variable that will receive the attack level of the effect
+ * @param[out] fadetime is a pointer to the variable that will receive the fade time of the effect in milliseconds
+ * @param[out] fadelevel is a pointer to the variable that will receive the fade level of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int duration;
+ *      int magnitude;
+ *      int period;
+ *      int style;
+ *      int attacktime;
+ *      int attacklevel;
+ *      int fadetime;
+ *      int fadelevel;
+ *
+ *      status = device_haptic_get_periodic_effect_definition(ivt_buffer, 1,
+ *              &duration, &magnitude, &period, &style, &attacktime, &attacklevel, &fadetime, &fadelevel);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_periodic_effect_definition(const unsigned char *ivt_buffer, int effect_index, int *duration, int *magnitude, int *period, int *style_and_wave_type, int *attacktime, int *attacklevel, int *fadetime, int *fadelevel);
+
+/**
+ * @fn int device_haptic_get_effect_duration(const unsigned char *ivt_buffer, int effect_index, int *effect_duration)
+ * @par Description:
+ *     This API gets the duration of an effect defined in IVT data.\n
+ * @param[in] ivt_buffer is a pointer to IVT data containing the effect for which to get the Duration
+ * @param[in] effect_index is a index of the effect for which to get the Duration
+ * @param[out] effect_duration is a pointer to the variable that will receive the Duration of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int effect_duration
+ *
+ *     //Get IVT effect duration
+ *     status = device_haptic_get_effect_duration(ivt_buffer, 0, &effect_duration);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_duration(const unsigned char *ivt_buffer, int effect_index, int *effect_duration);
+
+/**
+ * @fn int device_haptic_play_magsweep_effect(int device_handle, int duration, int magnitude, int style, int attacktime, int attacklevel, int fadetime, int fadelevel, int *effect_handle);
+ * @par Description:
+ *     This API play Mag Sweep effect.\n
+ * @param[in] device_handle is a handle to the device on which to modify the playing effect
+ * @param[in] duration is a duration of the effect in milliseconds
+ * @param[in] magnitude is a magnitude of the effect
+ * @param[in] style is a style of the effect
+ * @param[in] attacktime is a attack time of the effect in milliseconds
+ * @param[in] attacklevel is a attack level of the effect
+ * @param[in] fadetime is a fade time of the effect in milliseconds
+ * @param[in] fadelevel is a fade level of the effect
+ * @param[out] effect_handle is a pointer to the variable that will receive a handle to the playing effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int duration       = 2900;
+ *      int magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      int style          = HAPTIC_STYLE_SMOOTH;
+ *      int attackTime     = 2483;
+ *      int attackLevel    = 0;
+ *      int fadeTime       = 0;
+ *      int fadeLevel      = HAPTIC_MAX_MAGNITUDE;
+ *      int effect_handle;
+ *
+ *      status = device_haptic_play_magsweep_effect(device_handle,
+ *              duration, magnitude, style, attacktime, attacklevel, fadetime, fadelevel, &effect_handle);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_magsweep_effect(int device_handle, int duration, int magnitude, int style, int attacktime, int attacklevel, int fadetime, int fadelevel, int *effect_handle);
+
+/**
+ * @fn int device_haptic_play_periodic_effect(int device_handle, int duration, int magnitude, int period, int style_and_wave_type, int attacktime, int attacklevel, int fadetime, int fadelevel, int *effect_handle);
+ * @par Description:
+ *     This API play Periodic effect.\n
+ * @param[in] device_handle is a handle to the device on which to modify the playing effect
+ * @param[in] duration is a duration of the effect in milliseconds
+ * @param[in] magnitude is a magnitude of the effect
+ * @param[in] style is a style of the effect
+ * @param[in] attacktime is a attack time of the effect in milliseconds
+ * @param[in] attacklevel is a attack level of the effect
+ * @param[in] fadetime is a fade time of the effect in milliseconds
+ * @param[in] fadelevel is a fade level of the effect
+ * @param[out] effect_handle is a pointer to the variable that will receive a handle to the playing effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int duration       = 2900;
+ *      int magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      int period         = 100;
+ *      int style          = HAPTIC_STYLE_SMOOTH;
+ *      int attackTime     = 2483;
+ *      int attackLevel    = 0;
+ *      int fadeTime       = 0;
+ *      int fadeLevel      = HAPTIC_MAX_MAGNITUDE;
+ *      int effect_handle;
+ *
+ *      status = device_haptic_play_periodic_effect(device_handle,
+ *              duration, magnitude, period, style, attacktime, attacklevel, fadetime, fadelevel, &effect_handle);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_periodic_effect(int device_handle, int duration, int magnitude, int period, int style_and_wave_type, int attacktime, int attacklevel, int fadetime, int fadelevel, int *effect_handle);
+
+/**
+ * @fn int device_haptic_modify_playing_magsweep_effect(int device_handle, int effect_handle,  int duration, int magnitude, int style, int attacktime, int attacklevel, int fadetime, int fadelevel);
+ * @par Description:
+ *     This API Modifies a playing Mag Sweep effect.\n
+ * @param[in] device_handle is a handle to the device on which to modify the playing effect
+ * @param[in] effect_handle is a handle to the playing MagSweep effect to modify
+ * @param[in] duration is a duration of the effect in milliseconds
+ * @param[in] magnitude is a magnitude of the effect
+ * @param[in] style is a style of the effect
+ * @param[in] attacktime is a attack time of the effect in milliseconds
+ * @param[in] attacklevel is a attack level of the effect
+ * @param[in] fadetime is a fade time of the effect in milliseconds
+ * @param[in] fadelevel is a fade level of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int duration       = 2900;
+ *      int magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      int style          = HAPTIC_STYLE_SMOOTH;
+ *      int attackTime     = 2483;
+ *      int attackLevel    = 0;
+ *      int fadeTime       = 0;
+ *      int fadeLevel      = HAPTIC_MAX_MAGNITUDE;
+ *
+ *      status = device_haptic_modify_playing_magsweep_effect(device_handle, effect_handle,
+ *              duration, magnitude, style, attacktime, attacklevel, fadetime, fadelevel);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_modify_playing_magsweep_effect(int device_handle, int effect_handle,  int duration, int magnitude, int style, int attacktime, int attacklevel, int fadetime, int fadelevel);
+
+/**
+ * @fn int device_haptic_modify_playing_periodic_effect(int device_handle, int effect_handle, int duration, int magnitude, int period, int style_and_wave_type, int attacktime, int attacklevel, int fadetime, int fadelevel);
+ * @par Description:
+ *     This API modifies a playing Periodic effect.\n
+ * @param[in] device_handle is a handle to the device on which to modify the playing effect
+ * @param[in] effect_handle is a handle to the playing MagSweep effect to modify
+ * @param[in] duration is a duration of the effect in milliseconds
+ * @param[in] magnitude is a magnitude of the effect
+ * @param[in] period is a period of the effect
+ * @param[in] style is a style of the effect
+ * @param[in] attacktime is a attack time of the effect in milliseconds
+ * @param[in] attacklevel is a attack level of the effect
+ * @param[in] fadetime is a fade time of the effect in milliseconds
+ * @param[in] fadelevel is a fade level of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int duration       = 2900;
+ *      int magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      int period        = 100;
+ *      int style          = HAPTIC_STYLE_SMOOTH;
+ *      int attackTime     = 2483;
+ *      int attackLevel    = 0;
+ *      int fadeTime       = 0;
+ *      int fadeLevel      = HAPTIC_MAX_MAGNITUDE;
+ *
+ *      status = device_haptic_modify_playing_periodic_effect(device_handle, effect_handle,
+ *              duration, magnitude, period, style, attacktime, attacklevel, fadetime, fadelevel);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_modify_playing_periodic_effect(int device_handle, int effect_handle, int duration, int magnitude, int period, int style_and_wave_type, int attacktime, int attacklevel, int fadetime, int fadelevel);
+
+/**
+ * @fn int device_haptic_create_streaming_effect(int device_handle, int *effect_handle)
+ * @par Description:
+ *     This API creates a Streaming effect.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @param[out] effect_handle is a pointer to the variable that will receive a handle to the Streaming effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int effect_handle;
+ *
+ *     status = device_haptic_create_streaming_effect(device_handle, &effect_handle);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_create_streaming_effect(int device_handle, int *effect_handle);
+
+/**
+ * @fn int device_haptic_destroy_streaming_effect(int device_handle, int effect_handle)
+ * @par Description:
+ *     This API creates a Streaming effect.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @param[in] effect_handle is a handle to the Streaming effect to destroy
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int effect_handle;
+ *
+ *     status = device_haptic_create_streaming_effect(device_handle, &effect_handle);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_destroy_streaming_effect(int device_handle, int effect_handle);
+
+/**
+ * @fn int device_haptic_play_streaming_sample(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size)
+ * @par Description:
+ *     This API plays a Streaming Sample given the parameters defining the effect.\n
+ * @param[in] device_handle is a handle to the device on which to play the effect
+ * @param[in] effect_handle is a hndle to the Streaming effect to play
+ * @param[in] streaming_sameple is a pointer to Streaming Sample data containing the definition of the effect to play
+ * @param[in] size is a size of the buffer, in bytes, pointed to by streaming_sample parameter
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *     status = device_haptic_play_streaming_sample(device_handle, effect_handle, *streaming_sample, size);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_streaming_sample(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size);
+
+/**
+ * @fn int device_haptic_play_streaming_sample_with_offset(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size, int offset_time)
+ * @par Description:
+ *     This API plays a Streaming Sample with a time offset given the parameters defining the effect.\n
+ * @param[in] device_handle is a handle to the device on which to play the effect
+ * @param[in] effect_handle is a hndle to the Streaming effect to play
+ * @param[in] streaming_sameple is a pointer to Streaming Sample data containing the definition of the effect to play
+ * @param[in] size is a size of the buffer, in bytes, pointed to by streaming_sample parameter
+ * @param[in] offset_time is set offet time to play the sample
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *     status = device_haptic_play_streaming_sample_with_offset(device_handle, effect_handle, *streaming_sample, size, 100);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_play_streaming_sample_with_offset(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size, int offset_time);
+
+
+
+/**
+ * @fn int device_haptic_stop_all_playing_effects(int device_handle)
+ * @par Description:
+ *     This API stops all playing and paused effects on a device.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *     status = device_haptic_stop_all_playing_effects(device_handle);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_stop_all_playing_effects(int device_handle);
+
+/**
+ * @fn int device_haptic_save_file(const unsigned char *ivt_buffer, const char *path_name)
+ * @par Description:
+ *     This API saves an IVT file to persistent storage.\n
+ * @param[in] ivt_buffer is a pointer to IVT data
+ * @param[in] path_name is a pointer to the character buffer containing the path name of the file to save
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      char *path_name = "test.ivt";
+ *
+ *     status = device_haptic_save_file(ivt_buffer, path_name);
+ *     if(staus < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_save_file(const unsigned char *ivt_buffer, const char *path_name);
+
+/**
+ * @fn int device_haptic_delete_file(const char *path_name)
+ * @par Description:
+ *     This API removes an IVT file from persistent storage.\n
+ * @param[in] path_name is a pointer to the character buffer containing the path name of the file to remove.\n
+ * @return if it succeed, it return HAPTIC_S_SUCCESSe , otherwise negative value return
+ * @see device_haptic_save_file()
+ * @par Example:
+ * @code
+ *      ...
+ *      char *path_name = "test.ivt";
+ *      int = status;
+ *
+ *     //Remove an IVT file
+ *     status = device_haptic_delete_file(path_name);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_delete_file(const char *path_name);
+
+/**
+ * @fn int device_haptic_pause_playing_effect(int device_handle, int effect_handle)
+ * @par Description:
+ *     This API Pauses a playing effect.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @param[in] effect_handle is a handle to the playing effect to pause
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *      status = device_haptic_pause_playing_effect(handle, effect_handle);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_pause_playing_effect(int device_handle, int effect_handle);
+
+/**
+ * @fn int device_haptic_resume_paused_effect(int device_handle, int effect_handle)
+ * @par Description:
+ *     This API resumes a paused effect from the point where the effect was paused.\n
+ * @param[in] device_handle is a handle to the device associated to the effect
+ * @param[in] effect_handle is a handle to the playing effect to pause
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *      status = device_haptic_resume_paused_effect(handle, effect_handle);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_resume_paused_effect(int device_handle, int effect_handle);
+
+/**
+ * @fn int device_haptic_get_effect_state(int device_handle, int effect_handle, int *effect_state)
+ * @par Description:
+ *     This API retrieves the status of an effect (playing, not playing, paused).\n
+ * @param[in] device_handle ia a handle to the device associated to the effect
+ * @param[in] effect_handle ia a handle to the effect which must have been obtained by calling playing APIs
+ * @param[out] state ia a pointer to the variable that will receive the status bits of the effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *
+ *     //Open the haptic device
+ *     status = device_haptic_get_effect_state(device_handle, device_effect, &state);
+ *     if(status < 0)
+ *             return -1;
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_effect_state(int device_handle, int effect_handle, int *effect_state);
+
+/**
+ * @fn int device_haptic_get_size(const unsigned char *ivt_buffer, int size)
+ * @par Description:
+ *     This API sets the size of IVT data.\n
+ * @param[in] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @return if it succeed, it return the size of the IVT data, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      unsigned char *ivt_buffer = { ... };
+ *      int IVT_size;
+ *
+ *      IVT_size = device_haptic_get_size(ivt_buffer, sizeof(ivt_buffer));
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_get_size(const unsigned char *ivt_buffer, int size);
+
+/**
+ * @fn int device_haptic_initialize_buffer(unsigned char *ivt_buffer, int size)
+ * @par Description:
+ *     This API initializes an IVT buffer. Any data currently in the buffer will be destroyed.\n
+ * @param[in/out] ivt_buffer is a pointer to a buffer to initialize
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      int size = 1024;
+ *      unsigned char ivt_buffer[size];
+ *
+ *      status = device_haptic_initialize_buffer(ivt_buffer, size);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_initialize_buffer(unsigned char *ivt_buffer, int size);
+
+/**
+ * @fn int device_haptic_insert_element(unsigned char *ivt_buffer, int size, int timeline_index, const HapticElement *element)
+ * @par Description:
+ *     This API inserts an element into a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect in which to insert the element
+ * @param[in] element is a pointer to an HapticElement structure containing the parameters of a Periodic effect, MagSweep effect, or Repeat event to insert into the Timeline effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement elem1;
+ *      elem1.elementtype    = HAPTIC_ELEMTYPE_MAGSWEEP;
+ *      elem1.time           = 0;
+ *      elem1.TypeSpecific.magsweep.duration       = 2900;
+ *      elem1.TypeSpecific.magsweep.magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      elem1.TypeSpecific.magsweep.style          = HAPTIC_STYLE_SMOOTH;
+ *      elem1.TypeSpecific.magsweep.attacktime     = 2483;
+ *      elem1.TypeSpecific.magsweep.attacklevel    = 0;
+ *      elem1.TypeSpecific.magsweep.fadetime       = 0;
+ *      elem1.TypeSpecific.magsweep.fadelevel      = HAPTIC_MAX_MAGNITUDE;
+ *
+ *      status = device_haptic_insert_element(temp_buffer, temp_size, timeline_index, &elem1);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_insert_element(unsigned char *ivt_buffer, int size, int timeline_index, const HapticElement *element);
+
+/**
+ * @fn int device_haptic_insert_element2(unsigned char *ivt_buffer, int size, int timeline_index, const HapticElement2 *element)
+ * @par Description:
+ *     This API inserts an element into a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect in which to insert the element
+ * @param[in] element is a pointer to an HapticElement2 structure containing the parameters of a Periodic effect, MagSweep effect, or Repeat event to insert into the Timeline effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement2 elem1;
+ *      elem1.elementtype    = HAPTIC_ELEMTYPE_MAGSWEEP;
+ *      elem1.time           = 0;
+ *      elem1.TypeSpecific.magsweep.duration       = 2900;
+ *      elem1.TypeSpecific.magsweep.magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      elem1.TypeSpecific.magsweep.style          = HAPTIC_STYLE_SMOOTH;
+ *      elem1.TypeSpecific.magsweep.attacktime     = 2483;
+ *      elem1.TypeSpecific.magsweep.attacklevel    = 0;
+ *      elem1.TypeSpecific.magsweep.fadetime       = 0;
+ *      elem1.TypeSpecific.magsweep.fadelevel      = HAPTIC_MAX_MAGNITUDE;
+ *
+ *      status = device_haptic_insert_element2(temp_buffer, temp_size, timeline_index, &elem1);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_insert_element2(unsigned char *ivt_buffer, int size, int timeline_index, const HapticElement2 *element);
+
+/**
+ * @fn int device_haptic_insert_element3(unsigned char *ivt_buffer, int size, int timeline_index, const HapticElement3 *element)
+ * @par Description:
+ *     This API inserts an element into a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect in which to insert the element
+ * @param[in] element is a pointer to an HapticElement3 structure containing the parameters of a Periodic effect, MagSweep effect, or Repeat event to insert into the Timeline effect
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement3 elem1;
+ *      elem1.elementtype    = HAPTIC_ELEMTYPE_MAGSWEEP;
+ *      elem1.time           = 0;
+ *      elem1.TypeSpecific.magsweep.duration       = 2900;
+ *      elem1.TypeSpecific.magsweep.magnitude      = HAPTIC_MAX_MAGNITUDE;
+ *      elem1.TypeSpecific.magsweep.style          = HAPTIC_STYLE_SMOOTH;
+ *      elem1.TypeSpecific.magsweep.attacktime     = 2483;
+ *      elem1.TypeSpecific.magsweep.attacklevel    = 0;
+ *      elem1.TypeSpecific.magsweep.fadetime       = 0;
+ *      elem1.TypeSpecific.magsweep.fadelevel      = HAPTIC_MAX_MAGNITUDE;
+ *
+ *      status = device_haptic_insert_element3(temp_buffer, temp_size, 0, &elem1);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_insert_element3(unsigned char *ivt_buffer, int size, int timeline_index, const HapticElement3 *element);
+
+/**
+ * @fn int device_haptic_read_element(const unsigned char *ivt_buffer, int size, int timeline_index, int element_index, HapticElement *element);
+ * @par Description:
+ *     This API retrieves the parameters of an element of a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect in which to read the element
+ * @param[in] element_index is an index of the element to retrieve
+ * @param[out] element is a pointer to an HapticElement structure to receive the parameters of a Periodic effect, MagSweepeffect, or Repeat event
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement elem1;
+ *
+ *      status = device_haptic_insert_element(ivt_buffer, size, 0, 0, &elem1);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+
+       int device_haptic_read_element(const unsigned char *ivt_buffer, int size, int timeline_index, int element_index, HapticElement *element);
+
+/**
+ * @fn int device_haptic_read_element2(const unsigned char *ivt_buffer, int size, int timeline_index, int element_index, HapticElement2 *element);
+ * @par Description:
+ *     This API retrieves the parameters of an element of a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect in which to read the element
+ * @param[in] element_index is an index of the element to retrieve
+ * @param[out] element is a pointer to an HapticElement2 structure to receive the parameters of a Periodic effect, MagSweepeffect, or Repeat event
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement2 elem1;
+ *
+ *      status = device_haptic_insert_element2(ivt_buffer, size, 0, 0, &elem1);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_read_element2(const unsigned char *ivt_buffer, int size, int timeline_index, int element_index, HapticElement2 *element);
+
+/**
+ * @fn int device_haptic_read_element3(const unsigned char *ivt_buffer, int size, int timeline_index, int element_index, HapticElement3 *element);
+ * @par Description:
+ *     This API retrieves the parameters of an element of a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect in which to read the element
+ * @param[in] element_index is an index of the element to retrieve
+ * @param[out] element is a pointer to an HapticElement3 structure to receive the parameters of a Periodic effect, MagSweepeffect, or Repeat event
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement3 elem1;
+ *
+ *      status = device_haptic_insert_element3(ivt_buffer, size, 0, 0, &elem1);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_read_element3(const unsigned char *ivt_buffer, int size, int timeline_index, int element_index, HapticElement3 *element);
+
+/**
+ * @fn int device_haptic_remove_element(unsigned char *ivt_buffer, int size, int timeline_index, int element_index);
+ * @par Description:
+ *     This API removes the element at the specified index from a Timeline effect in an IVT buffer.\n
+ * @param[in/out] ivt_buffer is a pointer to an IVT buffer
+ * @param[in] size is a size of the buffer pointed to by ivt_buffer
+ * @param[in] timeline_index is an index of a Timeline effect to remove the element from
+ * @param[in] element_index is an index of the element to remove
+ * @return if it succeed, it return HAPTIC_S_SUCCESS, otherwise negative value return
+ * @par Example:
+ * @code
+ *      ...
+ *      int status;
+ *      HapticElement3 elem1;
+ *
+ *      status = device_haptic_remove_element(ivt_buffer, size, 0, 0);
+ *      if (status < 0) {
+ *              return status;
+ *      }
+
+ *      ...
+ * @endcode
+ */
+
+       int device_haptic_remove_element(unsigned char *ivt_buffer, int size, int timeline_index, int element_index);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __DEVMAN_HAPTIC_EXT_H__ */
diff --git a/devman_haptic_ext_core.h b/devman_haptic_ext_core.h
new file mode 100644 (file)
index 0000000..6659d54
--- /dev/null
@@ -0,0 +1,377 @@
+/*\r
+ *  devman\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: DongGi Jang <dg0402.jang@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+*/ \r
+\r
+\r
+#ifndef __DEVMAN_HAPTIC_EXT_CORE_H__\r
+#define __DEVMAN_HAPTIC_EXT_CORE_H__\r
+\r
+#include <sys/types.h>\r
+#include <limits.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/** \r
+ * @file        devman_haptic_ext_core.h\r
+ * @ingroup     DEVICE_MANAGER\r
+ * @brief       This file contains the data type, structure and definitions of the haptic extra API\r
+ * @author      SLP2.0\r
+ * @date        2010-01-24\r
+ * @version     0.1\r
+ */\r
+\r
+/**\r
+ * @addtogroup DEVICE_MANAGER\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * @par Description:\r
+ *      Data types level for haptic extra functions.\r
+ */\r
+#define HAPTIC_MAX_MAGNITUDE                          10000 /*!< Maximum Force Magnitude */\r
+#define HAPTIC_MIN_MAGNITUDE                          0     /*!< Minimum Force Magnitude */\r
+\r
+/**\r
+ * @par Description:\r
+ *      Data types level for haptic extra functions.\r
+ */\r
+#define HAPTIC_MAX_EFFECT_NAME_LENGTH                 128   /*!< Maximum effect name length */\r
+#define HAPTIC_INVALID_INDEX                          -1    /*!< Invalid Index */\r
+\r
+/* DevicePropertyType */\r
+#define HAPTIC_DEVPROPTYPE_PRIORITY                   1 /*!< Property type constant to set device priority */\r
+#define HAPTIC_DEVPROPTYPE_DISABLE_EFFECTS            2 /*!< Property type constant to enable/disable effects on a device */\r
+#define HAPTIC_DEVPROPTYPE_STRENGTH                   3 /*!< Property type constant to set the strength (volume) on a device */\r
+#define HAPTIC_DEVPROPTYPE_MASTERSTRENGTH             4 /*!< Property type constant to set the strength (volume) on ALL devices */\r
+\r
+/* Device type returned by device_haptic_get_device_capability_int32 in 'xxxx' field of\r
+   'yyyy' struct for 'deviceCapabilityType' equal to\r
+   HAPTIC_DEVCAPTYPE_DEVICE_CATEGORY */\r
+#define HAPTIC_DEVICECATEGORY_IFC                     0 /*!< Device category constant for IFC Devices */\r
+#define HAPTIC_DEVICECATEGORY_IMPULSE                 1 /*!< Device category constant for Impulse Devices */\r
+#define HAPTIC_DEVICECATEGORY_VIRTUAL                 2 /*!< Device category constant for Virtual Devices */\r
+#define HAPTIC_DEVICECATEGORY_EMBEDDED                3 /*!< Device category constant for Embedded Devices */\r
+#define HAPTIC_DEVICECATEGORY_TETHERED                4 /*!< Device category constant for Tethered Devices */\r
+#define HAPTIC_DEVICECATEGORY_IMMERSION_USB           5 /*!< Device category constant for Immersion USB Devices */\r
+#define HAPTIC_DEVICECATEGORY_COMPOSITE               6 /*!< Device category constant for Composite Devices */\r
+\r
+/* Effect type returned by device_haptic_get_IVT_effect_type */\r
+#define HAPTIC_EFFECT_TYPE_PERIODIC                   0 /*!< Periodic Effect type constant */\r
+#define HAPTIC_EFFECT_TYPE_MAGSWEEP                   1 /*!< Magsweep Effect type constant */\r
+#define HAPTIC_EFFECT_TYPE_TIMELINE                   2 /*!< Timeline Effect type constant */\r
+#define HAPTIC_EFFECT_TYPE_STREAMING                  3 /*!< Streaming Effect type constant */\r
+#define HAPTIC_EFFECT_TYPE_WAVEFORM                   4 /*!< Waveform Effect type constant */\r
+\r
+/* Device capability type passed as input 'deviceCapabilityType' argument to device_haptic_get_device_capability_... */\r
+#define HAPTIC_DEVCAPTYPE_DEVICE_CATEGORY             0        /*!< Use device_haptic_get_device_capability_int32 >*/\r
+#define HAPTIC_DEVCAPTYPE_MAX_NESTED_REPEATS          1        /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_NUM_ACTUATORS               2        /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_ACTUATOR_TYPE               3        /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_NUM_EFFECT_SLOTS            4        /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES            5        /*!< Use device_haptic_get_device_capability_int32 */\r
+/* HAPTIC_DEVCAPTYPE_SUPPORTED_CONTROL_MODES is deprecated and will not be an available constant\r
+** in future versions of this software.  Please use HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES instead. */\r
+#define HAPTIC_DEVCAPTYPE_SUPPORTED_CONTROL_MODES     HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES\r
+#define HAPTIC_DEVCAPTYPE_MIN_PERIOD                  6  /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_MAX_PERIOD                  7  /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_MAX_EFFECT_DURATION         8  /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_SUPPORTED_EFFECTS           9  /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_DEVICE_NAME                 10 /*!< Use device_haptic_get_device_capability_string */\r
+#define HAPTIC_DEVCAPTYPE_MAX_ENVELOPE_TIME           11 /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_APIVERSIONNUMBER            12 /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_MAX_IVT_SIZE_TETHERED       13 /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_MAX_IVT_SIZE                14 /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_EDITION_LEVEL               15 /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_SUPPORTED_WAVE_TYPES        16 /*!< Use device_haptic_get_device_capability_int32 */\r
+#define HAPTIC_DEVCAPTYPE_HANDSET_INDEX               17 /*!< Use device_haptic_get_device_capability_int32 */\r
+\r
+/* Handles */\r
+#define HAPTIC_INVALID_EFFECT_HANDLE_VALUE            -1 /*!< Invalid Effect Handle */\r
+#define HAPTIC_INVALID_DEVICE_HANDLE_VALUE            -1 /*!< Invalid Device Handle */\r
+\r
+/* Periodic, MagSweep effect Styles are only 4 bits and may be combined with other flags */\r
+#define HAPTIC_STYLE_MASK                             0x0F    /*!< Style mask */\r
+\r
+/* Periodic, MagSweep effect Styles */\r
+#define HAPTIC_STYLE_SMOOTH                           0   /*!< "Smooth" style */\r
+#define HAPTIC_STYLE_STRONG                           1   /*!< "Strong" style */\r
+#define HAPTIC_STYLE_SHARP                            2   /*!< "Sharp" style  */\r
+\r
+#define HAPTIC_DEFAULT_STYLE                          HAPTIC_STYLE_STRONG\r
+\r
+/* HAPTIC_CONTROLMODE_ constants are deprecated and will not be available\r
+** in future versions of this software.  Please use the HAPTIC_STYLE_ constants instead. */\r
+#define HAPTIC_CONTROLMODE_SMOOTH                     HAPTIC_STYLE_SMOOTH\r
+#define HAPTIC_CONTROLMODE_STRONG                     HAPTIC_STYLE_STRONG\r
+#define HAPTIC_CONTROLMODE_SHARP                      HAPTIC_STYLE_SHARP\r
+\r
+#define HAPTIC_DEFAULT_CONTROLMODE                    HAPTIC_DEFAULT_STYLE\r
+\r
+/* Effect period resolution */\r
+#define HAPTIC_PERIOD_RESOLUTION_MICROSECOND          0x80000000\r
+\r
+/* Periodic effect Wave Types are only 4 bits and may be combined with other flags */\r
+#define HAPTIC_WAVETYPE_SHIFT                         4       /*!< Wave type shift */\r
+#define HAPTIC_WAVETYPE_MASK                          0xF0    /*!< Wave type mask */\r
+\r
+/* Periodic effect Wave Types */\r
+#define HAPTIC_WAVETYPE_SQUARE                        (1 << HAPTIC_WAVETYPE_SHIFT)  /*!< "Square" wave type */\r
+#define HAPTIC_WAVETYPE_TRIANGLE                      (2 << HAPTIC_WAVETYPE_SHIFT)  /*!< "Triangle" wave type */\r
+#define HAPTIC_WAVETYPE_SINE                          (3 << HAPTIC_WAVETYPE_SHIFT)  /*!< "Sine" wave type */\r
+#define HAPTIC_WAVETYPE_SAWTOOTHUP                    (4 << HAPTIC_WAVETYPE_SHIFT)  /*!< "Sawtooth Up" wave type */\r
+#define HAPTIC_WAVETYPE_SAWTOOTHDOWN                  (5 << HAPTIC_WAVETYPE_SHIFT)  /*!< "Sawtooth Down" wave type */\r
+\r
+#define HAPTIC_DEFAULT_WAVETYPE                       HAPTIC_WAVETYPE_SQUARE\r
+\r
+/* String length constants */\r
+#define HAPTIC_MAX_DEVICE_NAME_LENGTH                 64 /*!<Maximum device name length */\r
+#define HAPTIC_MAX_CAPABILITY_STRING_LENGTH           64 /*!<Maximum string length use by device_haptic_get_device_capability_string/ device_haptic_set_device_capability_string*/\r
+#define HAPTIC_MAX_PROPERTY_STRING_LENGTH             64 /*!<Maximum string length use by device_haptic_get_device_property_string/ device_haptic_set_device_property_string */\r
+\r
+/* Effect type support bit masks */\r
+#define HAPTIC_PERIODIC_EFFECT_SUPPORT                (1 << HAPTIC_EFFECT_TYPE_PERIODIC)  /*!< Bitmask for Periodic effect support */\r
+#define HAPTIC_MAGSWEEP_EFFECT_SUPPORT                (1 << HAPTIC_EFFECT_TYPE_MAGSWEEP)  /*!< Bitmask for Magsweep effect support */\r
+#define HAPTIC_TIMELINE_EFFECT_SUPPORT                (1 << HAPTIC_EFFECT_TYPE_TIMELINE)  /*!< Bitmask for Timeline effect support */\r
+#define HAPTIC_STREAMING_EFFECT_SUPPORT               (1 << HAPTIC_EFFECT_TYPE_STREAMING) /*!< Bitmask for Streaming effect support */\r
+#define HAPTIC_WAVEFORM_EFFECT_SUPPORT                (1 << HAPTIC_EFFECT_TYPE_WAVEFORM)  /*!< Bitmask for Waveform effect support */\r
+\r
+/* Effect Style support bit masks */\r
+#define HAPTIC_STYLE_SUPPORT_MASK                     0x0000FFFF              /*!< Effect style support mask */\r
+#define HAPTIC_STYLE_SMOOTH_SUPPORT                   (1 << HAPTIC_STYLE_SMOOTH) /*!< Bitmask for "Smooth" style support */\r
+#define HAPTIC_STYLE_STRONG_SUPPORT                   (1 << HAPTIC_STYLE_STRONG) /*!< Bitmask for "Strong" style support */\r
+#define HAPTIC_STYLE_SHARP_SUPPORT                    (1 << HAPTIC_STYLE_SHARP)  /*!< Bitmask for "Sharp" style support  */\r
+\r
+/* Wave type support bit masks */\r
+/* Starts at 0x10000 to allow combining the flag with the supported style (nControlMode) 32 bits flag */\r
+#define HAPTIC_WAVETYPE_SUPPORT_MASK                  0xFFFF0000                                                       /*!< Wave type support mask */\r
+#define HAPTIC_WAVETYPE_SQUARE_SUPPORT                (0x10000 << (HAPTIC_WAVETYPE_SQUARE >> HAPTIC_WAVETYPE_SHIFT))       /*!< Bitmask for "Square" wave type support */\r
+#define HAPTIC_WAVETYPE_TRIANGLE_SUPPORT              (0x10000 << (HAPTIC_WAVETYPE_TRIANGLE >> HAPTIC_WAVETYPE_SHIFT))     /*!< Bitmask for "Triangle" wave type support */\r
+#define HAPTIC_WAVETYPE_SINE_SUPPORT                  (0x10000 << (HAPTIC_WAVETYPE_SINE >> HAPTIC_WAVETYPE_SHIFT))         /*!< Bitmask for "Sine" wave type support  */\r
+#define HAPTIC_WAVETYPE_SAWTOOTHUP_SUPPORT            (0x10000 << (HAPTIC_WAVETYPE_SAWTOOTHUP >> HAPTIC_WAVETYPE_SHIFT))   /*!< Bitmask for "Saw tooth up" wave type support  */\r
+#define HAPTIC_WAVETYPE_SAWTOOTHDOWN_SUPPORT          (0x10000 << (HAPTIC_WAVETYPE_SAWTOOTHDOWN >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Saw tooth down" wave type support  */\r
+\r
+/* HAPTIC_CONTROLMODE_*_SUPPORT constants are deprecated and will not be available\r
+** in future versions of this software.  Please use the HAPTIC_STYLE_*_SUPPORT constants instead. */\r
+#define HAPTIC_CONTROLMODE_SMOOTH_SUPPORT             HAPTIC_STYLE_SMOOTH_SUPPORT\r
+#define HAPTIC_CONTROLMODE_STRONG_SUPPORT             HAPTIC_STYLE_STRONG_SUPPORT\r
+#define HAPTIC_CONTROLMODE_SHARP_SUPPORT              HAPTIC_STYLE_SHARP_SUPPORT\r
+\r
+/* Device State constants */\r
+#define HAPTIC_DEVICESTATE_ATTACHED                   (1 << 0) /*!< Device is attached to the system */\r
+#define HAPTIC_DEVICESTATE_BUSY                       (1 << 1) /*!< Device is busy (playing effects) */\r
+\r
+/* Time in milliseconds */\r
+#define HAPTIC_TIME_INFINITE                          HAPTIC_INT32_MAX /*!< Infinite time */\r
+\r
+/* Effect priority */\r
+#define HAPTIC_MIN_DEVICE_PRIORITY                    0x0 /*!< Minimum Effect priority */\r
+#define HAPTIC_MAX_DEV_DEVICE_PRIORITY                0x7 /*!< Maximum Effect priority for developers */\r
+#define HAPTIC_MAX_OEM_DEVICE_PRIORITY                0xF /*!< Maximum Effect priority for OEMs */\r
+#define HAPTIC_MAX_DEVICE_PRIORITY                    HAPTIC_MAX_OEM_DEVICE_PRIORITY    /*!< FOR BACKWARD COMPATIBILITY ONLY;\r
+                                                                                         new applications should use HAPTIC_MAX_DEV_DEVICE_PRIORITY\r
+                                                                                         or HAPTIC_MAX_OEM_DEVICE_PRIORITY */\r
+\r
+\r
+/* Device Actuator Type constants */\r
+#define HAPTIC_DEVACTUATORTYPE_ERM                    0\r
+#define HAPTIC_DEVACTUATORTYPE_BLDC                   1\r
+#define HAPTIC_DEVACTUATORTYPE_LRA                    2\r
+#define HAPTIC_DEVACTUATORTYPE_PIEZO                  4\r
+#define HAPTIC_DEVACTUATORTYPE_PIEZO_WAVE             4\r
+\r
+/* Device Default priority value */\r
+#define HAPTIC_DEVPRIORITY_DEFAULT                    0\r
+\r
+/* Repeat count */\r
+#define HAPTIC_REPEAT_COUNT_INFINITE                  255 /*!< Infinite repeat count */\r
+\r
+/* Streaming Sample */\r
+#define HAPTIC_MAX_STREAMING_SAMPLE_SIZE              255 /*!< Maximum size for streaming sample */\r
+\r
+/* Effect state returned by ImmVibeGetEffectState */\r
+#define HAPTIC_EFFECT_STATE_NOT_PLAYING               0 /*!< Not Playing and not paused */\r
+#define HAPTIC_EFFECT_STATE_PLAYING                   1 /*!< Playing */\r
+#define HAPTIC_EFFECT_STATE_PAUSED                    2 /*!< Paused */\r
+\r
+/* Edition levels */\r
+#define HAPTIC_EDITION_3000                           3000\r
+#define HAPTIC_EDITION_4000                           4000\r
+#define HAPTIC_EDITION_5000                           5000\r
+\r
+/* Element type for IVTElement structure that is used by ImmVibeInsertIVTElement, ImmVibeReadIVTElement and ImmVibeRemoveIVTElement */\r
+#define HAPTIC_ELEMTYPE_PERIODIC                      0\r
+#define HAPTIC_ELEMTYPE_MAGSWEEP                      1\r
+#define HAPTIC_ELEMTYPE_REPEAT                        2\r
+/* New in API v3.4 */\r
+#define HAPTIC_ELEMTYPE_WAVEFORM                      3\r
+\r
+/* Composite device */\r
+#define HAPTIC_MAX_LOGICAL_DEVICE_COUNT               16 /*!< Maximum number of device indices that can be passed to ImmVibeOpenCompositeDevice */\r
+\r
+/****************************************************************************\r
+ *\r
+ *  General macros\r
+ *\r
+ ****************************************************************************/\r
+#define HAPTIC_SUCCEEDED(n)                           ((n) >= 0)\r
+#define HAPTIC_FAILED(n)                              ((n) < 0)\r
+#define HAPTIC_IS_INVALID_DEVICE_HANDLE(n)            (((n) == 0) || ((n) == HAPTIC_INVALID_DEVICE_HANDLE_VALUE))\r
+#define HAPTIC_IS_INVALID_EFFECT_HANDLE(n)            (((n) == 0) || ((n) == HAPTIC_INVALID_EFFECT_HANDLE_VALUE))\r
+#define HAPTIC_IS_VALID_DEVICE_HANDLE(n)              (((n) != 0) && ((n) != HAPTIC_INVALID_DEVICE_HANDLE_VALUE))\r
+#define HAPTIC_IS_VALID_EFFECT_HANDLE(n)              (((n) != 0) && ((n) != HAPTIC_INVALID_EFFECT_HANDLE_VALUE))\r
+\r
+/****************************************************************************\r
+ *\r
+ *  Error and Return value codes.\r
+ *\r
+ ****************************************************************************/\r
+#define HAPTIC_S_SUCCESS                               0  /*!< Success */\r
+#define HAPTIC_S_FALSE                                 0  /*!< False */\r
+#define HAPTIC_S_TRUE                                  1  /*!< True */\r
+#define HAPTIC_W_NOT_PLAYING                           1  /*!< Effect is not playing */\r
+#define HAPTIC_W_INSUFFICIENT_PRIORITY                 2  /*!< Effect doesn't have enough priority to play: higher priority effect is playing on the device */\r
+#define HAPTIC_W_EFFECTS_DISABLED                      3  /*!< Effects are disabled on the device */\r
+#define HAPTIC_W_NOT_PAUSED                            4  /*!< The ImmVibeResumePausedEffect function cannot resume an effect that is not paused */\r
+#define HAPTIC_E_NOT_INITIALIZED                      -2  /*!< The API is already is not initialized */\r
+#define HAPTIC_E_INVALID_ARGUMENT                     -3  /*!< Invalid argument was used in a API function call */\r
+#define HAPTIC_E_FAIL                                 -4  /*!< Generic error */\r
+#define HAPTIC_E_INCOMPATIBLE_EFFECT_TYPE             -5  /*!< Incompatible Effect type has been passed into  API function call */\r
+#define HAPTIC_E_INCOMPATIBLE_CAPABILITY_TYPE         -6  /*!< Incompatible Capability type was used into one of the following functions */\r
+#define HAPTIC_E_INCOMPATIBLE_PROPERTY_TYPE           -7  /*!< Incompatible Property type was used into one of the following functions */\r
+#define HAPTIC_E_DEVICE_NEEDS_LICENSE                 -8  /*!< Access to the instance of the device is locked until a valid license key is provided. */\r
+#define HAPTIC_E_NOT_ENOUGH_MEMORY                    -9  /*!< The API function cannot allocate memory to complete the process */\r
+#define HAPTIC_E_SERVICE_NOT_RUNNING                  -10 /*!< ImmVibeService is not running */\r
+#define HAPTIC_E_INSUFFICIENT_PRIORITY                -11 /*!< Not enough priority to achieve the request (insufficient license key priority) */\r
+#define HAPTIC_E_SERVICE_BUSY                         -12 /*!< ImmVibeService is busy and failed to complete the request */\r
+#define HAPTIC_E_NOT_SUPPORTED                        -13 /*!< The API function is not supported by this version of the API */\r
+\r
+/****************************************************************************\r
+ *\r
+ *  Stuctures\r
+ *\r
+ ****************************************************************************/\r
+typedef struct\r
+{\r
+       int duration;\r
+       int magnitude;\r
+       int period;\r
+       int style;\r
+       int attacktime;\r
+       int attacklevel;\r
+       int fadetime;\r
+       int fadelevel;\r
+} HapticPeriodic;\r
+\r
+typedef struct\r
+{\r
+       int duration;\r
+       int magnitude;\r
+       int period;\r
+       int style;\r
+       int attacktime;\r
+       int attacklevel;\r
+       int fadetime;\r
+       int fadelevel;\r
+       int actuatorindex;\r
+} HapticPeriodic2;\r
+\r
+typedef struct\r
+{\r
+       int duration;\r
+       int magnitude;\r
+       int style;\r
+       int attacktime;\r
+       int attacklevel;\r
+       int fadetime;\r
+       int fadelevel;\r
+} HapticMagSweep;\r
+\r
+typedef struct\r
+{\r
+       int duration;\r
+       int magnitude;\r
+       int style;\r
+       int attacktime;\r
+       int attacklevel;\r
+       int fadetime;\r
+       int fadelevel;\r
+       int actuatorindex;\r
+} HapticMagSweep2;\r
+\r
+typedef struct\r
+{\r
+       int count;\r
+       int duration;\r
+} HapticRepeat;\r
+\r
+typedef struct\r
+{\r
+    const unsigned char *data;\r
+    int datasize;\r
+    int samplingrate;\r
+    int bitdepth;\r
+    int magnitude;\r
+    int actuatorindex;\r
+} HapticWaveform;\r
+\r
+typedef struct\r
+{\r
+    int elementtype;\r
+    int time;\r
+    union\r
+    {\r
+        HapticPeriodic periodic;\r
+        HapticMagSweep magsweep;\r
+        HapticRepeat   repeat;\r
+    } TypeSpecific;\r
+} HapticElement;\r
+\r
+typedef struct\r
+{\r
+    int elementtype;\r
+    int time;\r
+    union\r
+    {\r
+        HapticPeriodic2        periodic;\r
+        HapticMagSweep2        magsweep;\r
+        HapticRepeat   repeat;\r
+    } TypeSpecific;\r
+} HapticElement2;\r
+\r
+typedef struct\r
+{\r
+    int elementtype;\r
+    int time;\r
+    union\r
+    {\r
+        HapticPeriodic2        periodic;\r
+        HapticMagSweep2        magsweep;\r
+        HapticRepeat   repeat;\r
+        HapticWaveform waveform;\r
+    } TypeSpecific;\r
+} HapticElement3;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* __DEVMAN_HAPTIC_EXT_CORE_H__ */\r
diff --git a/devman_internal.c b/devman_internal.c
new file mode 100644 (file)
index 0000000..94f484b
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <dirent.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <poll.h>
+
+#include "devlog.h"
+#include "devman_internal.h"
+
+#define WD_RESPONSE_TIMEOUT     100 /* 0.1 seconds */
+#define DISPLAY_WD_PATH                        "/usr/bin/display_wd"
+
+static int fifo_fd;
+
+API int display_register_postjob(void)
+{
+       int ret, i;
+       long open_max;
+       pid_t pid;
+       char buf[PATH_MAX];
+       char fifo_path[NAME_MAX];
+       struct pollfd fifo_pollfd;
+
+       snprintf(fifo_path, NAME_MAX, "%s.%d", DISPLAY_WD_FIFO, getpid());
+       if (access(fifo_path, F_OK) == 0) {
+               ERR("Already registered!");
+               return -1;
+       }
+       mkfifo(fifo_path, 0700);
+
+       pid = fork();
+       if(pid < 0) {
+               ERR("Failed to fork child process for LCD On/Off");
+               unlink(fifo_path);
+               return -1;
+       }
+       if (pid == 0) {
+               open_max = sysconf(_SC_OPEN_MAX);
+               for (i = 0; i < open_max; i++) {
+                       close(i);
+               }
+
+               execl(DISPLAY_WD_PATH, DISPLAY_WD_PATH, NULL);
+       }
+
+       fifo_pollfd.fd = open(fifo_path, O_RDWR | O_NONBLOCK);
+       if (fifo_pollfd.fd < 0) {
+               ERR("Cannot open fifo file");
+               unlink(fifo_path);
+               return -1;
+       }
+
+       /* get the watch dog ready message. */
+       fifo_pollfd.events = POLLIN;
+       if (poll(&fifo_pollfd, 1, WD_RESPONSE_TIMEOUT) < 0) {
+               ERR("Cannot poll the fifo file");
+               DBG("fifo file path is %s", fifo_path);
+               close(fifo_pollfd.fd);
+               unlink(fifo_path);
+               return -1;
+       }
+       read(fifo_pollfd.fd, buf, sizeof(buf));
+
+       fifo_fd = fifo_pollfd.fd;
+
+       return 0;
+}
+
+API int display_cancel_postjob(void)
+{
+       char buf[PATH_MAX];
+       int ret;
+
+       snprintf(buf, PATH_MAX, "%s.%d", DISPLAY_WD_FIFO, getpid());
+       if (access(buf, F_OK) != 0) {
+               ERR("No registered the post job!");
+               return -1;
+       }
+
+       if (fifo_fd < 0)
+               fifo_fd = open(buf, O_WRONLY);
+       if (fifo_fd < 0) {
+               ERR("Cannot open the fifo file");
+               DBG("fifo file path is %s", buf);
+               return -1;
+       }
+       ret = DISPLAY_WD_CANCEL;       
+       write(fifo_fd, &ret, sizeof(int));
+       close(fifo_fd);
+       unlink(buf);
+       fifo_fd = -1;
+
+       return 0;
+}
+
diff --git a/devman_internal.h b/devman_internal.h
new file mode 100644 (file)
index 0000000..b197bee
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#define DISPLAY_WD_FIFO     "/tmp/.display_wd"
+#define DISPLAY_WD_CANCEL      226235
+
+int display_register_postjob(void);
+int display_cancel_postjob(void);
+
diff --git a/display_wd.c b/display_wd.c
new file mode 100644 (file)
index 0000000..1ba191e
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <strings.h>
+#include <string.h>
+#include <fcntl.h>
+#include <linux/limits.h>
+#include <poll.h>
+#include <errno.h>
+#include <signal.h>
+#include "device_engine.h"
+#include "devman_internal.h"
+#include <vconf.h>
+#include <vconf-keys.h>
+
+char fifo_path[NAME_MAX];
+struct pollfd fifo_pollfd;
+
+static void sig_quit(int signo)
+{
+       fprintf(stderr, "[DISPLAY_WD] display_wd will be exit for signal %d\n", signo);
+       if(fifo_pollfd.fd >= 0)
+               close(fifo_pollfd.fd);
+       if (access(fifo_path, F_OK) == 0) 
+               unlink(fifo_path);
+}
+
+int main(void)
+{
+       int fd, ret, val = -1;
+       fifo_pollfd.fd = -1;
+       setsid();
+
+       signal(SIGPIPE, sig_quit);
+
+       snprintf(fifo_path, NAME_MAX, "%s.%d", DISPLAY_WD_FIFO, getppid());
+       fifo_pollfd.fd = open(fifo_path, O_WRONLY);
+       if (fifo_pollfd.fd < 0) {
+               fprintf(stderr, "[DISPLAY_WD] Cannot open the fifo file - %s.\n",
+                       fifo_path);
+               return -1;
+       }
+
+       /* waitting for parent process ready */
+       usleep(10000);
+       ret = write(fifo_pollfd.fd, "ack", strlen("ack") + 1);
+
+       close(fifo_pollfd.fd);
+
+       fifo_pollfd.fd = open(fifo_path, O_RDONLY);
+       if (fifo_pollfd.fd < 0) {
+               fprintf(stderr, "[DISPLAY_WD] Cannot open the fifo file - %s.\n",
+                       fifo_path);
+               return -1;
+       }
+
+       fifo_pollfd.events = (POLLIN | POLLHUP);
+       ret = 0;
+       while (ret != DISPLAY_WD_CANCEL) {
+               if (poll(&fifo_pollfd, 1, -1) < 0) {
+                       fprintf(stderr,
+                               "[DISPLAY_WD] Cannot poll the fifo file - %s\n",
+                               fifo_path);
+                       close(fifo_pollfd.fd);
+                       return -1;
+               }
+               if (fifo_pollfd.revents & POLLIN) {
+                       read(fifo_pollfd.fd, &ret, sizeof(int));
+                       if (ret == DISPLAY_WD_CANCEL) {
+                               fprintf(stderr,
+                                       "[DISPLAY_WD] Canceled. - %s, %d\n",
+                                       fifo_path, ret);
+                               close(fifo_pollfd.fd);
+                               return -1;
+                       }
+               }
+               if (fifo_pollfd.revents & POLLHUP)
+                       break;
+       }
+       close(fifo_pollfd.fd);
+       unlink(fifo_path);
+
+       ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &val);
+
+       if (ret == 0 && val > 0) {
+               device_set_property(DEVTYPE_DISPLAY0, DISPLAY_PROP_BRIGHTNESS, val);
+               device_set_property(DEVTYPE_LED, LED_PROP_BRIGHTNESS, 0);
+       }
+
+       return 0;
+}
diff --git a/generic_haptic.c b/generic_haptic.c
new file mode 100644 (file)
index 0000000..19534fc
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_path.h"
+#include "device_haptic.h"
+
+#define MAX_BUFF 255
+
+int generic_class_haptic_get(char *nodename, int prop, int *val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case HAPTIC_PROP_LEVEL:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_HAPTIC, nodename,
+                        "level");
+               return sys_get_int(tmp, val);
+       case HAPTIC_PROP_LEVEL_MAX:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_HAPTIC, nodename,
+                        "level_max");
+               return sys_get_int(tmp, val);
+       case HAPTIC_PROP_VALUE:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_HAPTIC, nodename,
+                        "value");
+               return sys_get_int(tmp, val);
+       default:
+               return -1;
+       }
+       return 0;
+}
+
+int generic_class_haptic_set(char *nodename, int prop, int val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case HAPTIC_PROP_ENABLE:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_HAPTIC, nodename,
+                        "enable");
+               return sys_set_int(tmp, val);
+       case HAPTIC_PROP_LEVEL:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_HAPTIC, nodename,
+                        "level");
+               return sys_set_int(tmp, val);
+       case HAPTIC_PROP_ONESHOT:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_HAPTIC, nodename,
+                        "oneshot");
+               return sys_set_int(tmp, val);
+       default:
+               return -1;
+       }
+       return 0;
+}
diff --git a/generic_jack.c b/generic_jack.c
new file mode 100644 (file)
index 0000000..10b9216
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_path.h"
+
+#define MAX_BUFF 255
+
+int generic_jack_interface_get(char *nodename, int prop, int *val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case JACK_PROP_USB_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "usb_online");
+               break;
+       case JACK_PROP_TA_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "charger_online");
+               break;
+       case JACK_PROP_HDMI_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "hdmi_online");
+               break;
+       case JACK_PROP_EARJACK_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "earjack_online");
+               break;
+       case JACK_PROP_TVOUT_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "tvout_online");
+               break;
+       case JACK_PROP_CRADLE_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "cradle_online");
+               break;
+       default:
+               return -1;
+       }
+
+       return sys_get_int(tmp, val);
+}
+
+int generic_jack_interface_set(char *nodename, int prop, int val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case JACK_PROP_TVOUT_ONLINE:
+               snprintf(tmp, MAX_BUFF, "%s/%s", SYS_DEVICE_JACK, "tvout_online");
+               break;
+       default:
+               return -1;
+       }
+
+       return sys_set_int(tmp, val);
+}
diff --git a/generic_led.c b/generic_led.c
new file mode 100644 (file)
index 0000000..49308ef
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_path.h"
+
+#define MAX_BUFF 255
+
+int generic_class_led_get(char *nodename, int prop, int *val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case LED_PROP_BRIGHTNESS:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_LED, nodename,
+                        "brightness");
+
+               return sys_get_int(tmp, val);
+       case LED_PROP_MAX_BRIGHTNESS:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_LED, nodename,
+                        "max_brightness");
+
+               return sys_get_int(tmp, val);
+       }
+       return -1;
+}
+
+int generic_class_led_set(char *nodename, int prop, int val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case LED_PROP_BRIGHTNESS:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_LED, nodename,
+                        "brightness");
+
+               return sys_set_int(tmp, val);
+       }
+       return -1;
+}
diff --git a/generic_powersupply.c b/generic_powersupply.c
new file mode 100644 (file)
index 0000000..1cbe6e0
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_path.h"
+
+#define MAX_BUFF 255
+
+int generic_class_power_supply_get(char *nodename, int prop, int *val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case POWER_SUPPLY_PROP_CAPACITY:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_POWERSUPPLY, nodename,
+                        "capacity");
+               return sys_get_int(tmp, val);
+       case POWER_SUPPLY_PROP_CHARGE_NOW:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_POWERSUPPLY, nodename,
+                        "charge_now");
+               return sys_get_int(tmp, val);
+       case POWER_SUPPLY_PROP_CHARGE_FULL:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_POWERSUPPLY, nodename,
+                        "charge_full");
+               return sys_get_int(tmp, val);
+       default:
+               return -1;
+       }
+       return 0;
+}
diff --git a/generic_video.c b/generic_video.c
new file mode 100644 (file)
index 0000000..0c470b4
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include "device_engine.h"
+#include "device_path.h"
+
+#define MAX_BUFF 255
+
+int generic_class_lcd_get(char *nodename, int prop, int *val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case DISPLAY_PROP_ONOFF:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_LCD, nodename,
+                        "lcd_power");
+               return sys_get_int(tmp, val);
+       case DISPLAY_PROP_GAMMA:
+               snprintf(tmp, MAX_BUFF, "%s/%s/gamma", CLASS_LCD, nodename);
+               return sys_get_int(tmp, val);
+       default:
+               return -1;
+       }
+       return 0;
+}
+
+int generic_class_lcd_set(char *nodename, int prop, int val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case DISPLAY_PROP_ONOFF:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_LCD, nodename,
+                        "lcd_power");
+               return sys_set_int(tmp, val);
+       case DISPLAY_PROP_GAMMA:
+               snprintf(tmp, MAX_BUFF, "%s/%s/gamma", CLASS_LCD, nodename);
+               return sys_set_int(tmp, val);
+       default:
+               return -1;
+       }
+       return 0;
+}
+
+int generic_class_backlight_get(char *nodename, int prop, int *val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case DISPLAY_PROP_BRIGHTNESS:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_BACKLIGHT, nodename,
+                        "brightness");
+
+               return sys_get_int(tmp, val);
+       case DISPLAY_PROP_MAX_BRIGHTNESS:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_BACKLIGHT, nodename,
+                        "max_brightness");
+
+               return sys_get_int(tmp, val);
+       }
+       return -1;
+}
+
+int generic_class_backlight_set(char *nodename, int prop, int val)
+{
+       char tmp[MAX_BUFF];
+       switch (prop) {
+       case DISPLAY_PROP_BRIGHTNESS:
+               snprintf(tmp, MAX_BUFF, "%s/%s/%s", CLASS_BACKLIGHT, nodename,
+                        "brightness");
+
+               return sys_set_int(tmp, val);
+       }
+       return -1;
+}
diff --git a/if_generic.c b/if_generic.c
new file mode 100644 (file)
index 0000000..82f6106
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <string.h>
+#include <errno.h>
+#include "devlog.h"
+#include "device_engine.h"
+
+API int device_get_property(devtype_t devtype, int property, int *value)
+{
+       struct device *dev = NULL;
+ retry:
+       if (dev != NULL) {
+               dev = dev->next;
+               if (dev == NULL) {
+                       errno = ENODEV;
+                       return -1;
+               }
+       }
+
+       dev = find_device(dev, devtype);
+       if (dev == NULL) {
+               DBG("devtype cannot find");
+               errno = ENODEV;
+               return -1;
+       }
+       if (dev->get_int == NULL) {
+               DBG("get_int of %s is null", dev->devname);
+               goto retry;
+       }
+
+       if (dev->get_int(property, value) == -1) {
+               DBG("get_int of %s return fails", dev->devname);
+               goto retry;
+       }
+
+       errno = 0;
+       return 0;
+}
+
+API int device_set_property(devtype_t devtype, int property, int value)
+{
+       struct device *dev = NULL;
+ retry:
+       if (dev != NULL) {
+               dev = dev->next;
+               if (dev == NULL) {
+                       return -1;
+               }
+       }
+
+       dev = find_device(dev, devtype);
+       if (dev == NULL) {
+               DBG("devtype cannot find");
+               errno = ENODEV;
+               return -1;
+       }
+       if (dev->set_int == NULL) {
+               errno = EPERM;
+               goto retry;
+       }
+
+       if (dev->set_int(property, value) == -1) {
+               errno = EACCES;
+               goto retry;
+       }
+
+       errno = 0;
+       return 0;
+}
diff --git a/if_legacy.c b/if_legacy.c
new file mode 100644 (file)
index 0000000..06d8559
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ *  devman
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: DongGi Jang <dg0402.jang@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.
+ *
+*/ 
+
+
+#include <vconf.h>
+
+#include "devman_internal.h"
+#include "device_engine.h"
+#include "device_path.h"
+#include "devlog.h"
+
+#define SET_FLAG(var, bit)             (var |= (1<<bit))
+#define UNSET_FLAG(var, bit)   (var &= (~(1<<bit)))
+#define BRT_BIT                        1
+#define GAMMA_BIT              2
+#define LED_BIT                        4
+static unsigned int disp_flag = 0x0;
+
+API int device_get_battery_pct(void)
+{
+       int val;
+       if (device_get_property
+           (DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &val) < 0)
+               return -1;
+       if (val < 0 || val > 100) {
+               ERR("capacity value is wrong");
+               return -1;
+       }
+
+       return val;
+}
+
+API int device_is_battery_full(void)
+{
+       int capacity = 0, charge_state = 0;
+       if(device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CAPACITY, &capacity) < 0)
+               return -1;
+
+       /* If the capacity is 100 and charge state is 1, battery is not full */
+       device_get_property(DEVTYPE_POWERSUPPLY, POWER_SUPPLY_PROP_CHARGE_NOW, &charge_state);
+       if(capacity < 0 || capacity > 100) {
+               ERR("capacity value is wrong");
+               return -1;
+       } else if(capacity == 100 && charge_state < 1) {
+               return 1;
+       } else {
+               return 0;
+       }
+}
+
+API int device_get_display_brt(display_num_t lcdnum)
+{
+       int val;
+
+       switch (lcdnum) {
+       case 0:
+               /* Fall through */
+       case 1:
+               /* check lcd power on/off */
+               if (device_get_property
+                   ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_ONOFF, &val) < 0)
+                       return -1;
+               if (val == 0)
+                       /* lcd is off */
+                       return 0;
+               if (device_get_property
+                   ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_BRIGHTNESS,
+                    &val) < 0)
+                       return -1;
+               break;
+       default:
+               return -1;
+       }
+
+       return val;
+}
+
+API int device_set_display_brt(display_num_t lcdnum, int val)
+{
+       int bat_state = -1, ret = -1;
+       switch (lcdnum) {
+       case 0:
+               /* Fall through */
+       case 1:
+               if(vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) != 0 || bat_state >= VCONFKEY_SYSMAN_BAT_WARNING_LOW ) {
+                       if (device_set_property
+                                       ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_BRIGHTNESS,
+                                        val) < 0)
+                               return -1;
+                       break;
+               } else {
+                       ERR("can not set brightness for low battery");
+                       return -1;
+               }
+       default:
+               return -1;
+       }
+
+       if (!disp_flag)
+               ret = display_register_postjob();
+       if (ret == 0)
+               SET_FLAG(disp_flag, BRT_BIT);
+       return 0;
+}
+
+API int device_release_brt_ctrl(display_num_t lcdnum)
+{
+       int setting_val=0;
+       int bat_state=-1;
+
+       switch (lcdnum) {
+       case 0:
+       case 1:
+               if(vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) != 0 || bat_state >= VCONFKEY_SYSMAN_BAT_WARNING_LOW ) {
+                       if(vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &setting_val) != 0){
+                               if (device_get_property
+                                               ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_MAX_BRIGHTNESS,
+                                                &setting_val) < 0)
+                                       return -1;
+                               setting_val=setting_val*0.7;
+                       }
+
+                       if (device_set_property
+                                       ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_BRIGHTNESS,
+                                        setting_val) < 0)
+                               return -1;
+                       break;
+               } else {
+                       ERR("can not set brightness for low battery");
+                       return -1;
+               }
+       default:
+               return -1;
+       }
+       UNSET_FLAG(disp_flag, BRT_BIT);
+       if (!disp_flag)     
+               display_cancel_postjob();
+       return 0;
+}
+
+API int device_get_max_brt(display_num_t lcdnum)
+{
+       int val = -1;
+
+       switch (lcdnum) {
+       case 0:
+               /* Fall through */
+       case 1:
+               /* check lcd power on/off */
+               if (device_get_property
+                   ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_MAX_BRIGHTNESS,
+                    &val) < 0)
+                       return -1;
+               break;
+       default:
+               return -1;
+       }
+
+       return val;
+}
+
+API int device_get_display_gamma(display_num_t lcdnum)
+{
+       int val = -1;
+
+       switch (lcdnum) {
+       case 0:
+               /* Fall through */
+       case 1:
+               /* check lcd power on/off */
+               if (device_get_property
+                   ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_GAMMA, &val) < 0)
+                       return -1;
+               break;
+       default:
+               return -1;
+       }
+
+       return val;
+}
+
+API int device_set_display_gamma(display_num_t lcdnum, display_gamma_t val)
+{
+       int ret = -1;
+       switch (lcdnum) {
+       case 0:
+               /* Fall through */
+       case 1:
+               if (device_set_property
+                   ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_GAMMA, val) < 0)
+                       return -1;
+               break;
+       default:
+               return -1;
+       }
+
+       if (!disp_flag)
+               ret = display_register_postjob();
+       if (ret == 0)
+               SET_FLAG(disp_flag, GAMMA_BIT);
+       return 0;
+}
+
+API int device_release_gamma_ctrl(display_num_t lcdnum, display_gamma_t org_val)
+{
+       switch (lcdnum) {
+       case 0:
+               /* Fall through */
+       case 1:
+               if (device_set_property
+                   ((DEVTYPE_DISPLAY0 + lcdnum), DISPLAY_PROP_GAMMA,
+                    org_val) < 0)
+                       return -1;
+               break;
+       default:
+               return -1;
+       }
+       UNSET_FLAG(disp_flag, GAMMA_BIT);
+       if (!disp_flag)
+               display_cancel_postjob();
+       return 0;
+}
+
+API int device_get_display_count(void)
+{
+       int val = -1;
+
+       if (device_get_property
+           (DEVTYPE_DISPLAY0, DISPLAY_PROP_DISPLAY_COUNT, &val) < 0)
+               return -1;
+
+       return val;
+}
+
+API int device_power_suspend(void)
+{
+       return sys_set_str("/sys/power/state", "mem");
+}
+
+API int device_get_led_brt(void)
+{
+       int val;
+
+       if (device_get_property(DEVTYPE_LED, LED_PROP_BRIGHTNESS, &val) < 0)
+               return -1;
+
+       return val;
+}
+
+API int device_set_led_brt(int val)
+{
+       int ret=-1;
+       if (device_set_property(DEVTYPE_LED, LED_PROP_BRIGHTNESS, val) < 0) 
+               return -1;
+
+       if (val == 0) {
+               UNSET_FLAG(disp_flag, LED_BIT);
+               if (!disp_flag)
+                       display_cancel_postjob();
+       } else {
+               if (!disp_flag)
+                       ret = display_register_postjob();
+               if (ret == 0)
+                       SET_FLAG(disp_flag, LED_BIT);
+       }
+       return 0;
+}
+
+API int device_get_max_led(void)
+{
+       int val = -1;
+
+       if (device_get_property(DEVTYPE_LED, LED_PROP_MAX_BRIGHTNESS, &val) < 0)
+               return -1;
+
+       return val;
+}
+
diff --git a/image/SLP_devman_PG_architecture.png b/image/SLP_devman_PG_architecture.png
new file mode 100755 (executable)
index 0000000..1ff6c03
Binary files /dev/null and b/image/SLP_devman_PG_architecture.png differ
diff --git a/image/SLP_devman_PG_haptic_architecture.png b/image/SLP_devman_PG_haptic_architecture.png
new file mode 100755 (executable)
index 0000000..2d4c3f7
Binary files /dev/null and b/image/SLP_devman_PG_haptic_architecture.png differ
diff --git a/packaging/devman.spec b/packaging/devman.spec
new file mode 100644 (file)
index 0000000..32fb34c
--- /dev/null
@@ -0,0 +1,86 @@
+#sbs-git:slp/pkgs/d/devman devman_0.1.6-66 62dc621fa0c0ae0ec4855a0e8381978a072304af
+Name:       devman
+Summary:    Device manager library
+Version:    0.1.6
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    LGPL 2.1
+Source0:    %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires:  cmake
+BuildRequires:  vconf-keys-devel
+BuildRequires:  sysman-devel
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(sysman)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(heynoti)
+
+%description
+Device manager library for device control
+
+%package devel
+Summary:    Device manager library for (devel)
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Device manager library for device control (devel)
+
+%package haptic-devel
+Summary:    Haptic Device manager library for (devel)
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+Requires:   %{name}-devel = %{version}-%{release}
+
+%description haptic-devel
+Haptic Device manager library for device control (devel)
+
+%prep
+%setup -q
+
+%build
+CFLAGS="$CFLAGS -DS5PC110_2_6_29" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_DEVMAN_RSRC_PREFIX=share/devman -DCMAKE_MACHINE=aquila -DCMAKE_DATADIR=/opt
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc4.d
+ln -s %{_sysconfdir}/init.d/devman %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S10devman
+ln -s %{_sysconfdir}/init.d/devman %{buildroot}%{_sysconfdir}/rc.d/rc4.d/S10devman
+
+%post
+/sbin/ldconfig
+mkdir -p /etc/udev/rules.d
+if ! [ -L /etc/udev/rules.d/91-devman.rules ]; then
+ln -s /usr/share/devman/udev-rules/91-devman.rules /etc/udev/rules.d/91-devman.rules
+fi
+
+%postun
+/sbin/ldconfig
+rm -f /etc/udev/rules.d/91-X1.rules
+
+%files
+/etc/rc.d/init.d/devman
+%{_bindir}/delete.sm
+%{_sbindir}/pdp*.sh
+%{_libdir}/libdevman.so.*
+%{_datadir}/devman/udev-rules/91-devman.rules
+%{_sysconfdir}/rc.d/rc3.d/S10devman
+%{_sysconfdir}/rc.d/rc4.d/S10devman
+
+%files devel
+%{_includedir}/devman/devman.h
+%{_includedir}/devman/SLP_devman_PG.h
+%{_libdir}/pkgconfig/devman.pc
+%{_libdir}/libdevman.so
+
+%files haptic-devel
+%{_includedir}/devman/devman_haptic.h
+%{_includedir}/devman/devman_haptic_ext.h
+%{_includedir}/devman/devman_haptic_ext_core.h
+%{_libdir}/pkgconfig/devman_haptic.pc
diff --git a/packaging/devman.yaml b/packaging/devman.yaml
new file mode 100644 (file)
index 0000000..6823284
--- /dev/null
@@ -0,0 +1,48 @@
+Name       : devman
+Version    : 0.1.6
+Release    : 1
+Group      : TO_BE/FILLED_IN
+Summary    : Device manager library
+Description: |
+    Device manager library for device control
+Sources    : 
+    - devman-%{version}.tar.gz
+Patches :
+    - devman-0.1.6-open-fix.patch
+
+PkgBR:
+    - cmake
+    - vconf-keys-devel
+    - sysman-devel
+    - pkgconfig(vconf)
+    - pkgconfig(sysman)
+    - pkgconfig(dlog)
+    
+Configure  : none
+License: TO BE FILLED IN
+Files:
+    - "%doc COPYING"
+    - /etc/rc.d/init.d/devman
+    - "%{_libdir}/libdevman.so.*"
+    - "%{_datadir}/devman/udev-rules/91-devman.rules"
+
+SubPackages :
+    - Name: devel
+      Summary: Device manager library for (devel)
+      Description: Device manager library for device control (devel)
+      Group: Development/Libraries
+      Files:
+        - "%{_includedir}/devman/devman.h"
+        - "%{_includedir}/devman/SLP_devman_PG.h"
+        - "%{_libdir}/pkgconfig/devman.pc"
+        - "%{_libdir}/libdevman.so"
+
+    - Name: haptic-devel
+      Summary: Haptic Device manager library for (devel)
+      Description: Haptic Device manager library for device control (devel)
+      Group: Development/Libraries
+      Files:
+        - "%{_includedir}/devman/devman_haptic.h"
+        - "%{_includedir}/devman/devman_haptic_ext.h"
+        - "%{_includedir}/devman/devman_haptic_ext_core.h"
+        - "%{_libdir}/pkgconfig/devman_haptic.pc"
diff --git a/udev-files/91-devman.rules.in b/udev-files/91-devman.rules.in
new file mode 100755 (executable)
index 0000000..c7afed5
--- /dev/null
@@ -0,0 +1,3 @@
+#pdp0
+ACTION=="add", KERNEL=="pdp0", RUN+="@PREFIX@/sbin/pdp0_up.sh"
+ACTION=="remove", KERNEL=="pdp0", RUN+="@PREFIX@/sbin/pdp0_down.sh"