diff options
author | Taeyoung Kim <ty317.kim@samsung.com> | 2016-03-08 12:25:51 +0900 |
---|---|---|
committer | Taeyoung Kim <ty317.kim@samsung.com> | 2016-03-08 12:25:51 +0900 |
commit | 99c8910acae257af45a4c8b685005f5b93a94895 (patch) | |
tree | 987dcf226f57de2ca631eff1003cf594d7a695ad | |
parent | f063602bfb5dbf818f590fc8e9bb300cb8c504ed (diff) | |
download | deviced-99c8910acae257af45a4c8b685005f5b93a94895.tar.gz deviced-99c8910acae257af45a4c8b685005f5b93a94895.tar.bz2 deviced-99c8910acae257af45a4c8b685005f5b93a94895.zip |
common; remove sysman, devman, libslp-pm, and libhapticsubmit/tizen_common/20160311.185532submit/tizen/20160308.051626submit/tizen/20160305.131859accepted/tizen/wearable/20160310.052612accepted/tizen/wearable/20160308.102023accepted/tizen/tv/20160310.052556accepted/tizen/tv/20160308.101657accepted/tizen/mobile/20160310.052529accepted/tizen/mobile/20160308.101640accepted/tizen/ivi/20160310.052639accepted/tizen/ivi/20160308.101740accepted/tizen/common/20160314.065521
They are deprecated libraries. Thus they are removed from deviced
Change-Id: Ib85572e8aa0e2b1728f574506e63db7190631842
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
49 files changed, 0 insertions, 8801 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ba5a6a83..bc834d15 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,7 +275,3 @@ IF(BLOCK_MODULE STREQUAL on) ADD_SUBDIRECTORY(src/fsck-msdos) ADD_SUBDIRECTORY(src/newfs-msdos) ENDIF() -ADD_SUBDIRECTORY(src/libsysman) -ADD_SUBDIRECTORY(src/libslp-pm) -ADD_SUBDIRECTORY(src/libhaptic) -ADD_SUBDIRECTORY(src/libdevman) diff --git a/packaging/deviced.spec b/packaging/deviced.spec index 9cb0026f..51379fb0 100644 --- a/packaging/deviced.spec +++ b/packaging/deviced.spec @@ -56,10 +56,6 @@ License: Apache-2.0 and BSD-2-Clause and BSD-4-Clause Source0: %{name}-%{version}.tar.gz Source1: deviced.manifest Source2: libdeviced.manifest -Source3: sysman.manifest -Source4: libslp-pm.manifest -Source5: haptic.manifest -Source6: devman.manifest BuildRequires: cmake BuildRequires: libattr-devel @@ -134,96 +130,6 @@ Requires: libdeviced = %{version}-%{release} %description -n libdeviced-devel Deviced library for device control (devel) -%package -n sysman -Summary: Sysman library -License: Apache-2.0 -Group: System/Libraries -Requires: libdeviced = %{version}-%{release} - -%description -n sysman -sysman library. - -%package -n sysman-devel -Summary: Sysman devel library -License: Apache-2.0 -Group: System/Development -Requires: sysman = %{version}-%{release} - -%description -n sysman-devel -sysman devel library. - -%package -n sysman-internal-devel -Summary: Sysman internal devel library -License: Apache-2.0 -Group: System/Development -Requires: sysman = %{version}-%{release} - -%description -n sysman-internal-devel -sysman internal devel library. - -%package -n libslp-pm -Summary: Power manager client -Group: System/Libraries -Requires: libdeviced = %{version}-%{release} - -%description -n libslp-pm -power-manager library. - -%package -n libslp-pm-devel -Summary: Power manager client (devel) -Group: System/Development -Requires: libslp-pm = %{version}-%{release} - -%description -n libslp-pm-devel -power-manager devel library. - -%package -n libhaptic -Summary: Haptic library -Group: Development/Libraries - -%description -n libhaptic -Haptic library for device control - -%package -n libhaptic-devel -Summary: Haptic library for (devel) -Group: Development/Libraries -Requires: libhaptic = %{version}-%{release} - -%description -n libhaptic-devel -Haptic library for device control (devel) - -%package -n libhaptic-plugin-devel -Summary: Haptic plugin library for (devel) -Group: Development/Libraries -Requires: libhaptic = %{version}-%{release} - -%description -n libhaptic-plugin-devel -Haptic plugin library for device control (devel) - -%package -n libdevman -Summary: Device manager library -Group: Development/Libraries -Requires: libdeviced = %{version}-%{release} - -%description -n libdevman -Device manager library for device control - -%package -n libdevman-devel -Summary: Device manager library for (devel) -Group: Development/Libraries -Requires: libdevman = %{version}-%{release} - -%description -n libdevman-devel -Device manager library for device control (devel) - -%package -n libdevman-haptic-devel -Summary: Haptic Device manager library for (devel) -Group: Development/Libraries -Requires: libdevman-devel = %{version}-%{release} - -%description -n libdevman-haptic-devel -Haptic Device manager library for device control (devel) - %prep %setup -q %if %{with emulator} @@ -276,10 +182,6 @@ Haptic Device manager library for device control (devel) %build cp %{SOURCE1} . cp %{SOURCE2} . -cp %{SOURCE3} . -cp %{SOURCE4} . -cp %{SOURCE5} . -cp %{SOURCE6} . make %{?jobs:-j%jobs} %install @@ -316,22 +218,6 @@ systemctl daemon-reload %postun -n libdeviced -p /sbin/ldconfig -%post -n sysman -p /sbin/ldconfig - -%postun -n sysman -p /sbin/ldconfig - -%post -n libslp-pm -p /sbin/ldconfig - -%postun -n libslp-pm -p /sbin/ldconfig - -%post -n libhaptic -p /sbin/ldconfig - -%postun -n libhaptic -p /sbin/ldconfig - -%post -n libdevman -p /sbin/ldconfig - -%postun -n libdevman -p /sbin/ldconfig - %files -n deviced %manifest %{name}.manifest %license LICENSE @@ -392,70 +278,3 @@ systemctl daemon-reload %{_includedir}/deviced/*.h %{_libdir}/libdeviced.so %{_libdir}/pkgconfig/deviced.pc - -%files -n sysman -%manifest sysman.manifest -%defattr(-,root,root,-) -%{_libdir}/libsysman.so.* - -%files -n sysman-devel -%defattr(-,root,root,-) -%{_includedir}/sysman/sysman.h -%{_includedir}/sysman/sysman_managed.h -%{_includedir}/sysman/SLP_sysman_PG.h -%{_libdir}/pkgconfig/sysman.pc -%{_libdir}/libsysman.so - -%files -n sysman-internal-devel -%defattr(-,root,root,-) -%{_includedir}/sysman/sysman-internal.h - -%files -n libslp-pm -%defattr(-,root,root,-) -%manifest libslp-pm.manifest -%{_libdir}/libpmapi.so.* - -%files -n libslp-pm-devel -%defattr(-,root,root,-) -%{_includedir}/pmapi/pmapi.h -%{_includedir}/pmapi/pmapi_managed.h -%{_includedir}/pmapi/SLP_pm_PG.h -%{_libdir}/pkgconfig/pmapi.pc -%{_libdir}/libpmapi.so - -%files -n libhaptic -%defattr(-,root,root,-) -%{_libdir}/libhaptic.so.* -%manifest haptic.manifest - -%files -n libhaptic-devel -%defattr(-,root,root,-) -%{_includedir}/haptic/haptic.h -%{_libdir}/libhaptic.so -%{_libdir}/pkgconfig/haptic.pc - -%files -n libhaptic-plugin-devel -%defattr(-,root,root,-) -%{_includedir}/haptic/haptic_module.h -%{_includedir}/haptic/haptic_plugin_intf.h -%{_includedir}/haptic/SLP_haptic_PG.h -%{_libdir}/pkgconfig/haptic-plugin.pc - -%files -n libdevman -%{_bindir}/display_wd -%{_libdir}/libdevman.so.* -%manifest devman.manifest - -%files -n libdevman-devel -%{_includedir}/devman/devman.h -%{_includedir}/devman/devman_image.h -%{_includedir}/devman/devman_managed.h -%{_includedir}/devman/devman_haptic.h -%{_includedir}/devman/SLP_devman_PG.h -%{_libdir}/pkgconfig/devman.pc -%{_libdir}/libdevman.so - -%files -n libdevman-haptic-devel -%{_includedir}/devman/devman_haptic_ext.h -%{_includedir}/devman/devman_haptic_ext_core.h -%{_libdir}/pkgconfig/devman_haptic.pc diff --git a/packaging/devman.manifest b/packaging/devman.manifest deleted file mode 100644 index 97e8c313..00000000 --- a/packaging/devman.manifest +++ /dev/null @@ -1,5 +0,0 @@ -<manifest> - <request> - <domain name="_"/> - </request> -</manifest> diff --git a/packaging/haptic.manifest b/packaging/haptic.manifest deleted file mode 100644 index 3256181b..00000000 --- a/packaging/haptic.manifest +++ /dev/null @@ -1,5 +0,0 @@ -<manifest> -<request> - <domain name="_"/> -</request> -</manifest> diff --git a/packaging/libslp-pm.manifest b/packaging/libslp-pm.manifest deleted file mode 100644 index 81ace0cb..00000000 --- a/packaging/libslp-pm.manifest +++ /dev/null @@ -1,6 +0,0 @@ -<manifest> - <request> - <domain name="_"/> - </request> -</manifest> - diff --git a/packaging/sysman.manifest b/packaging/sysman.manifest deleted file mode 100644 index 97e8c313..00000000 --- a/packaging/sysman.manifest +++ /dev/null @@ -1,5 +0,0 @@ -<manifest> - <request> - <domain name="_"/> - </request> -</manifest> diff --git a/src/libdevman/CMakeLists.txt b/src/libdevman/CMakeLists.txt deleted file mode 100644 index faaed8ae..00000000 --- a/src/libdevman/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(devman C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(rpkgs REQUIRED - vconf - dlog - device-node) -ADD_DEFINITIONS(${rpkgs_CFLAGS}) - -SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRAINTS true) - -SET(SRCS - src/device_haptic.c - src/if_legacy.c - src/devman_internal.c) - -SET(HEADERS - include/SLP_devman_PG.h - include/devman.h - include/devman_managed.h - include/devman_image.h - include/devman_haptic.h - include/devman_haptic_ext.h - include/devman_haptic_ext_core.h) - -SET(INC_DIR include) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}) - -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "${PREFIX}/bin") -SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}") -SET(DATADIR "${PREFIX}/share/devman") -SET(VERSION 0.1) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g") - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${TARGET_SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpkgs_LDFLAGS} libdeviced) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION}) - -ADD_EXECUTABLE(display_wd src/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(${PROJECT_NAME}_haptic.pc.in ${PROJECT_NAME}_haptic.pc @ONLY) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_haptic.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) - -FOREACH(hfile ${HEADERS}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) -ENDFOREACH(hfile) diff --git a/src/libdevman/devman.pc.in b/src/libdevman/devman.pc.in deleted file mode 100644 index 7ffae14d..00000000 --- a/src/libdevman/devman.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDEDIR@ - -Name: device manager -Description: SAMSUNG Linux platform device control library -Version: @VERSION@ -Requires: -Libs: -L${libdir} -ldevman -ldl -Cflags: -I${includedir} diff --git a/src/libdevman/devman_haptic.pc.in b/src/libdevman/devman_haptic.pc.in deleted file mode 100644 index 334dc655..00000000 --- a/src/libdevman/devman_haptic.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDEDIR@ - -Name: devman_haptic -Description: SAMSUNG Linux platform motor devman_haptic library -Version: @VERSION@ -Requires: -Libs: -L${libdir} -ldevman -Cflags: -I${includedir} diff --git a/src/libdevman/include/SLP_devman_PG.h b/src/libdevman/include/SLP_devman_PG.h deleted file mode 100644 index 5adff01b..00000000 --- a/src/libdevman/include/SLP_devman_PG.h +++ /dev/null @@ -1,349 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/** - * - * @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/src/libdevman/include/devlog.h b/src/libdevman/include/devlog.h deleted file mode 100644 index 346b71a3..00000000 --- a/src/libdevman/include/devlog.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DEVLOG_H__ -#define __DEVLOG_H__ - -#define FEATURE_DEVMAN_DLOG - -#ifdef FEATURE_DEVMAN_DLOG - #define LOG_TAG "DEVMAN" - #include <dlog.h> - #define DEVLOG(fmt, args...) SLOGD(fmt, ##args) - #define DEVERR(fmt, args...) SLOGE(fmt, ##args) -#else - #define DEVLOG(x, ...) - #define DEVERR(x, ...) -#endif - -#endif // __DEVLOG_H__ diff --git a/src/libdevman/include/devman.h b/src/libdevman/include/devman.h deleted file mode 100644 index 6cb6dd94..00000000 --- a/src/libdevman/include/devman.h +++ /dev/null @@ -1,846 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DEVMAN_H__ -#define __DEVMAN_H__ - -#ifndef DEPRECATED -#define DEPRECATED __attribute__((deprecated)) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** START: This code related to the opensource api will be removed */ -#include "devman_managed.h" -/** END: Will be remved */ - -/** - * @file devman.h - * @ingroup DEVICE_MANAGER - * @brief This file contains the API for the status of devices - * @author Tizen2.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 - * @{ - */ - -/** - * @brief Enumerations of error code for Devman - */ -typedef enum { - DEVMAN_ERROR_NONE = 0, /**< Successful */ - DEVMAN_ERROR_OPERATION_FAILED = -1, /**< Operation failed */ - DEVMAN_ERROR_NOT_SUPPORTED = -2, /**< Not supported in this device */ -} devman_error_e; - -/** - * @par Description: - * device type enum - */ - typedef enum devtype_list { - DEVTYPE_DISPLAY0, /**< main screen */ - DEVTYPE_DISPLAY1 = DEVTYPE_DISPLAY0, /**< sub screen */ - DEVTYPE_HAPTIC, /**< motor */ - DEVTYPE_JACK, /**< jack - Micro USB, 3.5 pi jack etc */ - DEVTYPE_LED, /**< LED */ - DEVTYPE_POWERSUPPLY, /**< battery, PMIC, etc about power */ - DEVTYPE_MAX, - DEVTYPE_TOUCHSCREEN = -1, - DEVTYPE_TOUCHKEY = -1, - DEVTYPE_GPS = -1, - DEVTYPE_UART = -1, - DEVTYPE_MMC = -1, - DEVTYPE_EFFECT_HAPTIC = -1, - } devtype_t; - -/** - * @par Description: - * DEVTYPE_POWERSUPPLY property for generic APIs - */ - enum { - /**< Current remaining battery */ - POWER_SUPPLY_PROP_CAPACITY, - /**< Current remaining battery expressed 1/10000 */ - POWER_SUPPLY_PROP_CAPACITY_RAW, - /**< Battery is full-charged.*/ - POWER_SUPPLY_PROP_CHARGE_FULL, - /**< Battery is being charged now */ - POWER_SUPPLY_PROP_CHARGE_NOW, - /**< iBattery status about cahrge */ - POWER_SUPPLY_PROP_BATTERY_HEALTH = 9, - }; - -/** - * @par Description: - * DEVTYPE_DISPLAY0 and DEVTYPE_DISPLAY1 property for generic APIs - */ - enum { - DISPLAY_PROP_DISPLAY_COUNT, - DISPLAY_PROP_BRIGHTNESS, - DISPLAY_PROP_ACL_CONTROL, - DISPLAY_PROP_ONOFF, - DISPLAY_PROP_IMAGE_ENHANCE_MODE = 8, - DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO, - DISPLAY_PROP_IMAGE_ENHANCE_TONE, - DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR, - DISPLAY_PROP_IMAGE_ENHANCE_INFO = 13, - DISPLAY_PROP_MIN_BRIGHTNESS = -1, - DISPLAY_PROP_MAX_BRIGHTNESS = -1, - DISPLAY_PROP_GAMMA = -1, - }; - -/** - * @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_TA_ONLINE, /**< Travel Adapter(Charger) */ - JACK_PROP_EARJACK_ONLINE, /**< Earjack */ - JACK_PROP_EARKEY_PRESS, /**< */ - JACK_PROP_HDMI_ONLINE, /**< Digital tvout */ - JACK_PROP_USB_ONLINE, /**< USB connection */ - JACK_PROP_CRADLE_ONLINE, /**< Cradle connection */ - JACK_PROP_TVOUT_ONLINE, /**< analog tvout */ - JACK_PROP_MIC_ONLINE = -1, - JACK_PROP_USB_PATH = -1, - }; - -/** - * @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, - }; - -/** - * @par Description: - * Motor property for generic APIs - */ - enum { - HAPTIC_PROP_LEVEL_MAX, - HAPTIC_PROP_LEVEL, - HAPTIC_PROP_ENABLE, - HAPTIC_PROP_ONESHOT, - }; - -/* 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(), device_get_battery_pct_raw() - * @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 remaining battery percentage expressed 1/10000.\n - * It gets the Battery percentage by calling device_get_property() function.\n - * It returns integer value(0~10000) that indicate remaining batterty percentage on success.\n - * Or a negative value(-1) is returned on failure. - * @return On success, integer value(0~10000) is returned. - * Or a negative value(-1) is returned on failure. - * @see device_is_battery_full(), device_get_battery_pct() - * @par Example - * @code - * ... - * int battery; - * battery = device_get_battery_pct_raw(); - * if( battery < 0 ) - * printf("Fail to get the remaining battery percentage.\n"); - * else - * printf("remaining battery percentage expressed 1/10000 : %d\n", battery); - * ... - * @endcode - */ - int device_get_battery_pct_raw(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); - -#ifndef __DD_BATTERY_H__ -/** - * @par Description: - * Battery health status - */ - enum { - BAT_UNKNOWN = 0, /**< */ - BAT_GOOD, /**< */ - BAT_OVERHEAT, /**< */ - BAT_DEAD, /**< */ - BAT_OVERVOLTAGE, /**< */ - BAT_UNSPECIFIED, /**< */ - BAT_COLD, /**< */ - BAT_HEALTH_MAX, /**< */ - }; -#endif - -/** - * @par Description: - * This API is used to get the battery health status.\n - * It gets the battery health status by calling device_get_property() function.\n - * It returns integer value(0~6) that indicate battery health status on success.\n - * Or a negative value(-1) is returned, if the status of battery is not full. - * @return interger value, -1 if failed\n - * (0 BATTERY_UNKNOWN, 1 GOOD, 2 OVERHEAT, 3 DEAD, 4 OVERVOLTAGE, 5 UNSPECIFIED, 6 COLD) - * @par Example - * @code - * ... - * int bat_health; - * bat_health =device_get_battery_health(); - * if(bat_health != BAT_GOOD) - * printf("battery health is not good\n"); - * ... - * @endcode - */ - int device_get_battery_health(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 and system brightness value in settings.\n - * It sets the current brightness of the display by calling device_set_property() function.\n - * MUST use this API very carefully. \n - * This api is different from device_set_display_brt api.\n - * device_set_display_brt api will change only device brightness value.\n - * but this api will change device brightness as well as system brightness value.\n - * @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_set_display_brt() - * @par Example - * @code - * ... - * if( device_set_display_brt_with_settings(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_with_settings(display_num_t lcdnum, int val); - -/** - * @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 min 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 min brightness on success.\n - * Or a negative value(-1) is returned on failure - * @param[in] num display number - * @return min brightness value on success, -1 if failed - * @par Example - * @code - * ... - * int min_brt; - * min_brt = device_get_min_brt(0); - * if( min_brt < 0 ) - * printf("Fail to get the min brightness of the display.\n"); - * else - * printf("Min brightness of the display is %d\n", min_brt); - * ... - * @endcode - */ - int device_get_min_brt(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: - * mode - dynamic, standard, natural, movie - */ - enum image_enhance_mode { - MODE_DYNAMIC = 0, - MODE_STANDARD, - MODE_NATURAL, - MODE_MOVIE, - }; - -/** - * @par Description: - * This API is used to get image enhance mode.\n - * It returns enum value which is the current mode on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current mode on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_mode(); - * if( ret < 0 ) - * printf("Fail to get current image enhance mode\n"); - * ... - * @endcode - */ - int device_get_image_enhance_mode(void); - -/** - * @par Description: - * This API is used to set image enhance mode.\n - * @param[in] val mode enum vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_mode(MODE_DYNAMIC) < 0 ) - * printf("Fail to set the image enhance mode\n"); - * ... - * @endcode - */ - int device_set_image_enhance_mode(int val); - -/** - * @par Description: - * scenario - ui, gallery, video, vtcall, camera, browser, negative, bypass - */ - enum image_enhance_scenario { - SCENARIO_UI = 0, - SCENARIO_GALLERY, - SCENARIO_VIDEO, - SCENARIO_VTCALL, - SCENARIO_CAMERA, - SCENARIO_BROWSER, - SCENARIO_NEGATIVE, - SCENARIO_BYPASS, - }; - -/** - * @par Description: - * This API is used to get image enhance scenario.\n - * It returns enum value which is the current scenario on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current wcenario on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_scenario(); - * if( ret < 0 ) - * printf("Fail to get current image enhance scenarioe\n"); - * ... - * @endcode - */ - int device_get_image_enhance_scenario(void); - -/** - * @par Description: - * This API is used to set image enhance scenario.\n - * @param[in] val scenario enum vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_scenario(SCENARIO_UI) < 0 ) - * printf("Fail to set the image enhance scenario\n"); - * ... - * @endcode - */ - int device_set_image_enhance_scenario(int val); - -/** - * @par Description: - * tone - normal, warm, cold - */ - enum image_enhance_tone { - TONE_NORMAL = 0, - TONE_WARM, - TONE_COLD, - }; - -/** - * @par Description: - * This API is used to get image enhance tone.\n - * It returns enum value which is the current mode on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current tone on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_tone(); - * if( ret < 0 ) - * printf("Fail to get current image enhance tone\n"); - * ... - * @endcode - */ - int device_get_image_enhance_tone(void); - -/** - * @par Description: - * This API is used to set image enhance tone.\n - * @param[in] val tone vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_tone(TONE_NORMAL) < 0 ) - * printf("Fail to set the image enhance tone\n"); - * ... - * @endcode - */ - int device_set_image_enhance_tone(int val); - -/** - * @par Description: - * outdoor - off, on - */ - enum image_enhance_outdoor { - OUTDOOR_OFF = 0, - OUTDOOR_ON, - }; - -/** - * @par Description: - * This API is used to get image enhance outdoor.\n - * It returns enum value which is the current outdoor on success.\n - * Or a negative value(-1) is returned on failure. - * @return enum value for current outdoor on success, -1 if failed - * @par Example - * @code - * ... - * ret = device_get_image_enhance_ourdoor(); - * if( ret < 0 ) - * printf("Fail to get current image enhance outdoor\n"); - * ... - * @endcode - */ - int device_get_image_enhance_outdoor(void); - -/** - * @par Description: - * This API is used to set image enhance outdoor.\n - * @param[in] val outdoor vlaue - * @return 0 on success, -1 if failed - * @par Example - * @code - * ... - * if( device_set_image_enhance_outdoor(TONE_NORMAL) < 0 ) - * printf("Fail to set the image enhance outdoor\n"); - * ... - * @endcode - */ - int device_set_image_enhance_outdoor(int val); - -/** - * @par Description: - * This API is used to get information about image enhance function.\n - * It returns 1, this device can use enhance mode.\n - * Or a negative value(-1) is returned, it doesn't support enhance mode. - * @return 1 is returned on support for enhance mode, -1 if not. - * @par Example - * @code - * ... - * ret = device_get_image_enhance_info(); - * if( ret < 0 ) - * printf("Not support image enhance mode on this device\n"); - * ... - * @endcode - */ - int device_get_image_enhance_info(void); - -/** - * @par Description: - * This API is used to get the current brightness of the led.\n - * It gets the current brightness of the led 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. - * @return current brightness value on success, -1 if failed - * @see device_set_led_brt() - * @par Example - * @code - * ... - * int cur_brt; - * cur_brt = device_get_led_brt(); - * if( cur_brt < 0 ) - * printf("Fail to get the current brightness of the led.\n"); - * else - * printf("Current brightness of the led is %d\n", cur_brt); - * ... - * @endcode - */ - int device_get_led_brt(void); - -/** - * @par Description: - * This API is used to set the current brightness of the led.\n - * It sets the current brightness of the led by calling device_set_property() function.\n - * @param[in] val brightness value that you want to set - * @return 0 on success, -1 if failed - * @see device_get_led_brt() - * @par Example - * @code - * ... - * if( device_set_led_brt(1) < 0 ) - * printf("Fail to set the brightness of the led\n"); - * @endcode - */ - int device_set_led_brt(int val); - -/** - * @par Description: - * This API is used to set the current brightness of the led without noti.\n - * It sets the current brightness of the led by calling device_set_property() function.\n - * @param[in] val brightness value that you want to set - * @return 0 on success, -1 if failed - * @see device_get_led_brt() - * @par Example - * @code - * ... - * if( device_set_led_brt_without_noti(1) < 0 ) - * printf("Fail to set the brightness of the led\n"); - * @endcode - */ - int device_set_led_brt_without_noti(int val); - -/** - * @par Description: - * This API is used to get the max brightness of the led.\n - * It gets the current brightness of the led 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 - * @return max brightness value on success, -1 if failed - * @par Example - * @code - * ... - * int max_brt; - * max_brt = device_get_max_led(0); - * if( max_brt < 0 ) - * printf("Fail to get the max brightness of the led.\n"); - * ... - * @endcode - */ - int device_get_max_led(void); - -/** - * @par Description: - * This API is used to get the current state for acl.\n - * It gets the current state for acl by calling device_get_property() function.\n - * @param[in] num display number that you want to set the gamma value - * @return current status for acl(1 on, 0 off) on success, -1 if failed - * @see device_set_acl_control_status() - * @par Example - * @code - * ... - * int acl_stat; - * acl_stat = device_get_acl_control_status(0); - * if( acl_stat < 0 ) - * printf("Fail to get the current status for acl.\n"); - * else - * printf("Current status for acl is %d\n", cur_brt); - * ... - * @endcode - */ - int device_get_acl_control_status(display_num_t num); - -/** - * @par Description: - * This API is used to set the current status for acl.\n - * It sets the current status for acl by calling device_set_property() function.\n - * @param[in] num display number that you want to set the brightness value - * @param[in] val status for acl(1 on, 0 off) that you want to set - * @return 0 on success, -1 if failed - * @see device_get_acl_control_status() - * @par Example - * @code - * ... - * if( device_set_acl_control_status(0, 1) < 0 ) - * printf("Fail to set the current status for acl\n"); - * else - * printf("The current status for acl is set 6\n"); - * ... - * @endcode - */ - int device_set_acl_control_status(display_num_t num, int val); - -/** - * @} // end of internal APIs - */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/libdevman/include/devman_haptic.h b/src/libdevman/include/devman_haptic.h deleted file mode 100644 index d8b05c1b..00000000 --- a/src/libdevman/include/devman_haptic.h +++ /dev/null @@ -1,516 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __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: - * priority level for haptic. - */ - enum haptic_priority_level { - HAPTIC_PRIORITY_LEVEL_MIN = 0, /**< Minimum effect priority for developers */ - HAPTIC_PRIORITY_LEVEL_MAX_DEV, /**< Maximum effect priority for developers */ - HAPTIC_PRIORITY_LEVEL_MAX_OEM, /**< Maximum effect priority for OEMs */ - }; - -/** - * @par Description: - * feedback level for haptic. - */ - enum haptic_feedback_level { - HAPTIC_FEEDBACK_LEVEL_AUTO = -1, /**< auto feedback level */ - HAPTIC_FEEDBACK_LEVEL_0, /**< feedback level 0 */ - HAPTIC_FEEDBACK_LEVEL_1, /**< feedback level 1 */ - HAPTIC_FEEDBACK_LEVEL_2, /**< feedback level 2 */ - HAPTIC_FEEDBACK_LEVEL_3, /**< feedback level 3 */ - HAPTIC_FEEDBACK_LEVEL_4, /**< feedback level 4 */ - HAPTIC_FEEDBACK_LEVEL_5, /**< feedback level 5 */ - - HAPTIC_FEEDBACK_LEVEL_END, - }; - -/** - * @par Description: - * infinite iteration count - */ -#define HAPTIC_INFINITE_ITERATION 256 - -/** - * @par Description: - * Return Values - */ -#define HAPTIC_SUCCESS 0 -#define HAPTIC_ALREADY_INITIALIZED -1 -#define HAPTIC_NOT_OPENED -2 -#define HAPTIC_INVALID_ARGUMENT -3 -#define HAPTIC_FAIL -4 -#define HAPTIC_NOT_SUPPORTED -13 -#define HAPTIC_ALREADY_EXIST -14 - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @fn int device_haptic_play_file_with_priority(int device_handle, const char *file_name, int priority_level, int iteration, int feedback_level) - * @par Description: - * This API plays a predefined rhythmic haptic-vibration pattern file with priority(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 prioritizes between the different effect. \n - * This level is already predefined by enumeration type value from hantpic_priority_level. - * This value must be between HAPTIC_PRIORITY_LEVEL_MIN and HAPTIC_PRIORITY_LEVEL_MAX_OEM. - * The fourth 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 fifth 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 received dev_handle value from device_haptic_open() - * @param[in] file_name set file name with path - * @param[in] priority_level set priority value - * @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_monotone(), device_haptic_stop_play() - * @par Example - * @code - * ... - * ret_val = device_haptic_play_file_with_priority(dev_handle, "test.ivt", HAPTIC_PRIORITY_LEVEL_MAX_DEV, HAPTIC_TEST_ITERATION , HAPTIC_FEEDBACK_LEVEL_3); - * if(ret_val !=0) - * return -1; - * ... - * @endcode - */ - - int device_haptic_play_file_with_priority(int device_handle, const char *file_name, - int priority, int iteration, int feedback_level) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @fn int device_haptic_play_monotone_with_feedback_level(int dev_handle, int duration, int feedback_level) - * @par Description: - * This API plays a monotonous haptic-vibration pattern with a given feedback intensity. \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 - * 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 - * The third in paramater feedback_level defines the strenth of vibration. - * 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) - * @param[in] feedback_level set feedback level - * @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_with_feedback_level(dev_handle, 1000, HAPTIC_FEEDBACK_LEVEL_3); - * if(ret_val !=0) - * return -1; - * ... - * @endcode - */ - - int device_haptic_play_monotone_with_feedback_level(int dev_handle, int duration, int feedback_level) __attribute__ ((deprecated)); - -/** - * @fn int device_haptic_play_monotone_with_detail_feedback_level(int dev_handle, int duration, int detail_feedback_level) - * @par Description: - * This API plays a monotonous haptic-vibration pattern with a given feedback intensity. \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 - * The fourth in parameter is the vibration feedback intensity level. - * This level is integer type value from 0 to 100. - * If you want to use the value selected by the user in the Setting application menu, just set 0 value. - * 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) - * @param[in] detail_feedback_level set feedback level (0 - 100) - * @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_with_detail_feedback_level(dev_handle, 1000, 100); - * if(ret_val !=0) - * return -1; - * ... - * @endcode - */ - - int device_haptic_play_monotone_with_detail_feedback_level(int dev_handle, int duration, int detail_feedback_level) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @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) __attribute__ ((deprecated)); - -/** - * @fn int device_haptic_convert_to_binary(const char *haptic_name) - * @par Description: - * This API convert ivt file to binary file.\n - * If the haptic file is not located predefined position, this api can't work and returns a negative value.\n - * And also binary file is located predefined position and name according to rules.\n - * The first in parameter sets source file name which should be ".ivt" file.\n - * On success it returns 0. In case of failure it returns a negative value.\n - * @return if it succeed, it return 0, otherwise negative value return - */ - int device_haptic_convert_to_binary(const char *haptic_name) __attribute__ ((deprecated)); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif /* __DEVMAN_HAPTIC_H__ */ diff --git a/src/libdevman/include/devman_haptic_ext.h b/src/libdevman/include/devman_haptic_ext.h deleted file mode 100644 index 077c2d31..00000000 --- a/src/libdevman/include/devman_haptic_ext.h +++ /dev/null @@ -1,1301 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __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, int max_bufsize, 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] max_bufsize is a max size of ivt_buffer - * @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"; - * int size = MAX_IVT_SIZE; - * - * status = device_haptic_save_file(ivt_buffer, size, path_name); - * if(staus < 0) - * return -1; - * ... - * @endcode - */ - - int device_haptic_save_file(const unsigned char *ivt_buffer, int max_bufsize, 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/src/libdevman/include/devman_haptic_ext_core.h b/src/libdevman/include/devman_haptic_ext_core.h deleted file mode 100644 index b6d86c3b..00000000 --- a/src/libdevman/include/devman_haptic_ext_core.h +++ /dev/null @@ -1,373 +0,0 @@ -/*
- * devman
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DEVMAN_HAPTIC_EXT_CORE_H__
-#define __DEVMAN_HAPTIC_EXT_CORE_H__
-
-#include <sys/types.h>
-#include <limits.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file devman_haptic_ext_core.h
- * @ingroup DEVICE_MANAGER
- * @brief This file contains the data type, structure and definitions of the haptic extra API
- * @author SLP2.0
- * @date 2010-01-24
- * @version 0.1
- */
-
-/**
- * @addtogroup DEVICE_MANAGER
- * @{
- */
-
-/**
- * @par Description:
- * Data types level for haptic extra functions.
- */
-#define HAPTIC_MAX_MAGNITUDE 10000 /*!< Maximum Force Magnitude */
-#define HAPTIC_MIN_MAGNITUDE 0 /*!< Minimum Force Magnitude */
-
-/**
- * @par Description:
- * Data types level for haptic extra functions.
- */
-#define HAPTIC_MAX_EFFECT_NAME_LENGTH 128 /*!< Maximum effect name length */
-#define HAPTIC_INVALID_INDEX -1 /*!< Invalid Index */
-
-/* DevicePropertyType */
-#define HAPTIC_DEVPROPTYPE_PRIORITY 1 /*!< Property type constant to set device priority */
-#define HAPTIC_DEVPROPTYPE_DISABLE_EFFECTS 2 /*!< Property type constant to enable/disable effects on a device */
-#define HAPTIC_DEVPROPTYPE_STRENGTH 3 /*!< Property type constant to set the strength (volume) on a device */
-#define HAPTIC_DEVPROPTYPE_MASTERSTRENGTH 4 /*!< Property type constant to set the strength (volume) on ALL devices */
-
-/* Device type returned by device_haptic_get_device_capability_int32 in 'xxxx' field of
- 'yyyy' struct for 'deviceCapabilityType' equal to
- HAPTIC_DEVCAPTYPE_DEVICE_CATEGORY */
-#define HAPTIC_DEVICECATEGORY_IFC 0 /*!< Device category constant for IFC Devices */
-#define HAPTIC_DEVICECATEGORY_IMPULSE 1 /*!< Device category constant for Impulse Devices */
-#define HAPTIC_DEVICECATEGORY_VIRTUAL 2 /*!< Device category constant for Virtual Devices */
-#define HAPTIC_DEVICECATEGORY_EMBEDDED 3 /*!< Device category constant for Embedded Devices */
-#define HAPTIC_DEVICECATEGORY_TETHERED 4 /*!< Device category constant for Tethered Devices */
-#define HAPTIC_DEVICECATEGORY_IMMERSION_USB 5 /*!< Device category constant for Immersion USB Devices */
-#define HAPTIC_DEVICECATEGORY_COMPOSITE 6 /*!< Device category constant for Composite Devices */
-
-/* Effect type returned by device_haptic_get_IVT_effect_type */
-#define HAPTIC_EFFECT_TYPE_PERIODIC 0 /*!< Periodic Effect type constant */
-#define HAPTIC_EFFECT_TYPE_MAGSWEEP 1 /*!< Magsweep Effect type constant */
-#define HAPTIC_EFFECT_TYPE_TIMELINE 2 /*!< Timeline Effect type constant */
-#define HAPTIC_EFFECT_TYPE_STREAMING 3 /*!< Streaming Effect type constant */
-#define HAPTIC_EFFECT_TYPE_WAVEFORM 4 /*!< Waveform Effect type constant */
-
-/* Device capability type passed as input 'deviceCapabilityType' argument to device_haptic_get_device_capability_... */
-#define HAPTIC_DEVCAPTYPE_DEVICE_CATEGORY 0 /*!< Use device_haptic_get_device_capability_int32 >*/
-#define HAPTIC_DEVCAPTYPE_MAX_NESTED_REPEATS 1 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_NUM_ACTUATORS 2 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_ACTUATOR_TYPE 3 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_NUM_EFFECT_SLOTS 4 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES 5 /*!< Use device_haptic_get_device_capability_int32 */
-/* HAPTIC_DEVCAPTYPE_SUPPORTED_CONTROL_MODES is deprecated and will not be an available constant
-** in future versions of this software. Please use HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES instead. */
-#define HAPTIC_DEVCAPTYPE_SUPPORTED_CONTROL_MODES HAPTIC_DEVCAPTYPE_SUPPORTED_STYLES
-#define HAPTIC_DEVCAPTYPE_MIN_PERIOD 6 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_MAX_PERIOD 7 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_MAX_EFFECT_DURATION 8 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_SUPPORTED_EFFECTS 9 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_DEVICE_NAME 10 /*!< Use device_haptic_get_device_capability_string */
-#define HAPTIC_DEVCAPTYPE_MAX_ENVELOPE_TIME 11 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_APIVERSIONNUMBER 12 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_MAX_IVT_SIZE_TETHERED 13 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_MAX_IVT_SIZE 14 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_EDITION_LEVEL 15 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_SUPPORTED_WAVE_TYPES 16 /*!< Use device_haptic_get_device_capability_int32 */
-#define HAPTIC_DEVCAPTYPE_HANDSET_INDEX 17 /*!< Use device_haptic_get_device_capability_int32 */
-
-/* Handles */
-#define HAPTIC_INVALID_EFFECT_HANDLE_VALUE -1 /*!< Invalid Effect Handle */
-#define HAPTIC_INVALID_DEVICE_HANDLE_VALUE -1 /*!< Invalid Device Handle */
-
-/* Periodic, MagSweep effect Styles are only 4 bits and may be combined with other flags */
-#define HAPTIC_STYLE_MASK 0x0F /*!< Style mask */
-
-/* Periodic, MagSweep effect Styles */
-#define HAPTIC_STYLE_SMOOTH 0 /*!< "Smooth" style */
-#define HAPTIC_STYLE_STRONG 1 /*!< "Strong" style */
-#define HAPTIC_STYLE_SHARP 2 /*!< "Sharp" style */
-
-#define HAPTIC_DEFAULT_STYLE HAPTIC_STYLE_STRONG
-
-/* HAPTIC_CONTROLMODE_ constants are deprecated and will not be available
-** in future versions of this software. Please use the HAPTIC_STYLE_ constants instead. */
-#define HAPTIC_CONTROLMODE_SMOOTH HAPTIC_STYLE_SMOOTH
-#define HAPTIC_CONTROLMODE_STRONG HAPTIC_STYLE_STRONG
-#define HAPTIC_CONTROLMODE_SHARP HAPTIC_STYLE_SHARP
-
-#define HAPTIC_DEFAULT_CONTROLMODE HAPTIC_DEFAULT_STYLE
-
-/* Effect period resolution */
-#define HAPTIC_PERIOD_RESOLUTION_MICROSECOND 0x80000000
-
-/* Periodic effect Wave Types are only 4 bits and may be combined with other flags */
-#define HAPTIC_WAVETYPE_SHIFT 4 /*!< Wave type shift */
-#define HAPTIC_WAVETYPE_MASK 0xF0 /*!< Wave type mask */
-
-/* Periodic effect Wave Types */
-#define HAPTIC_WAVETYPE_SQUARE (1 << HAPTIC_WAVETYPE_SHIFT) /*!< "Square" wave type */
-#define HAPTIC_WAVETYPE_TRIANGLE (2 << HAPTIC_WAVETYPE_SHIFT) /*!< "Triangle" wave type */
-#define HAPTIC_WAVETYPE_SINE (3 << HAPTIC_WAVETYPE_SHIFT) /*!< "Sine" wave type */
-#define HAPTIC_WAVETYPE_SAWTOOTHUP (4 << HAPTIC_WAVETYPE_SHIFT) /*!< "Sawtooth Up" wave type */
-#define HAPTIC_WAVETYPE_SAWTOOTHDOWN (5 << HAPTIC_WAVETYPE_SHIFT) /*!< "Sawtooth Down" wave type */
-
-#define HAPTIC_DEFAULT_WAVETYPE HAPTIC_WAVETYPE_SQUARE
-
-/* String length constants */
-#define HAPTIC_MAX_DEVICE_NAME_LENGTH 64 /*!<Maximum device name length */
-#define HAPTIC_MAX_CAPABILITY_STRING_LENGTH 64 /*!<Maximum string length use by device_haptic_get_device_capability_string/ device_haptic_set_device_capability_string*/
-#define HAPTIC_MAX_PROPERTY_STRING_LENGTH 64 /*!<Maximum string length use by device_haptic_get_device_property_string/ device_haptic_set_device_property_string */
-
-/* Effect type support bit masks */
-#define HAPTIC_PERIODIC_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_PERIODIC) /*!< Bitmask for Periodic effect support */
-#define HAPTIC_MAGSWEEP_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_MAGSWEEP) /*!< Bitmask for Magsweep effect support */
-#define HAPTIC_TIMELINE_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_TIMELINE) /*!< Bitmask for Timeline effect support */
-#define HAPTIC_STREAMING_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_STREAMING) /*!< Bitmask for Streaming effect support */
-#define HAPTIC_WAVEFORM_EFFECT_SUPPORT (1 << HAPTIC_EFFECT_TYPE_WAVEFORM) /*!< Bitmask for Waveform effect support */
-
-/* Effect Style support bit masks */
-#define HAPTIC_STYLE_SUPPORT_MASK 0x0000FFFF /*!< Effect style support mask */
-#define HAPTIC_STYLE_SMOOTH_SUPPORT (1 << HAPTIC_STYLE_SMOOTH) /*!< Bitmask for "Smooth" style support */
-#define HAPTIC_STYLE_STRONG_SUPPORT (1 << HAPTIC_STYLE_STRONG) /*!< Bitmask for "Strong" style support */
-#define HAPTIC_STYLE_SHARP_SUPPORT (1 << HAPTIC_STYLE_SHARP) /*!< Bitmask for "Sharp" style support */
-
-/* Wave type support bit masks */
-/* Starts at 0x10000 to allow combining the flag with the supported style (nControlMode) 32 bits flag */
-#define HAPTIC_WAVETYPE_SUPPORT_MASK 0xFFFF0000 /*!< Wave type support mask */
-#define HAPTIC_WAVETYPE_SQUARE_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SQUARE >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Square" wave type support */
-#define HAPTIC_WAVETYPE_TRIANGLE_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_TRIANGLE >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Triangle" wave type support */
-#define HAPTIC_WAVETYPE_SINE_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SINE >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Sine" wave type support */
-#define HAPTIC_WAVETYPE_SAWTOOTHUP_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SAWTOOTHUP >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Saw tooth up" wave type support */
-#define HAPTIC_WAVETYPE_SAWTOOTHDOWN_SUPPORT (0x10000 << (HAPTIC_WAVETYPE_SAWTOOTHDOWN >> HAPTIC_WAVETYPE_SHIFT)) /*!< Bitmask for "Saw tooth down" wave type support */
-
-/* HAPTIC_CONTROLMODE_*_SUPPORT constants are deprecated and will not be available
-** in future versions of this software. Please use the HAPTIC_STYLE_*_SUPPORT constants instead. */
-#define HAPTIC_CONTROLMODE_SMOOTH_SUPPORT HAPTIC_STYLE_SMOOTH_SUPPORT
-#define HAPTIC_CONTROLMODE_STRONG_SUPPORT HAPTIC_STYLE_STRONG_SUPPORT
-#define HAPTIC_CONTROLMODE_SHARP_SUPPORT HAPTIC_STYLE_SHARP_SUPPORT
-
-/* Device State constants */
-#define HAPTIC_DEVICESTATE_ATTACHED (1 << 0) /*!< Device is attached to the system */
-#define HAPTIC_DEVICESTATE_BUSY (1 << 1) /*!< Device is busy (playing effects) */
-
-/* Time in milliseconds */
-#define HAPTIC_TIME_INFINITE LONG_MAX /*!< Infinite time */
-
-/* Effect priority */
-#define HAPTIC_MIN_DEVICE_PRIORITY 0x0 /*!< Minimum Effect priority */
-#define HAPTIC_MAX_DEV_DEVICE_PRIORITY 0x7 /*!< Maximum Effect priority for developers */
-#define HAPTIC_MAX_OEM_DEVICE_PRIORITY 0xF /*!< Maximum Effect priority for OEMs */
-#define HAPTIC_MAX_DEVICE_PRIORITY HAPTIC_MAX_OEM_DEVICE_PRIORITY /*!< FOR BACKWARD COMPATIBILITY ONLY;
- new applications should use HAPTIC_MAX_DEV_DEVICE_PRIORITY
- or HAPTIC_MAX_OEM_DEVICE_PRIORITY */
-
-
-/* Device Actuator Type constants */
-#define HAPTIC_DEVACTUATORTYPE_ERM 0
-#define HAPTIC_DEVACTUATORTYPE_BLDC 1
-#define HAPTIC_DEVACTUATORTYPE_LRA 2
-#define HAPTIC_DEVACTUATORTYPE_PIEZO 4
-#define HAPTIC_DEVACTUATORTYPE_PIEZO_WAVE 4
-
-/* Device Default priority value */
-#define HAPTIC_DEVPRIORITY_DEFAULT 0
-
-/* Repeat count */
-#define HAPTIC_REPEAT_COUNT_INFINITE 255 /*!< Infinite repeat count */
-
-/* Streaming Sample */
-#define HAPTIC_MAX_STREAMING_SAMPLE_SIZE 255 /*!< Maximum size for streaming sample */
-
-/* Effect state returned by ImmVibeGetEffectState */
-#define HAPTIC_EFFECT_STATE_NOT_PLAYING 0 /*!< Not Playing and not paused */
-#define HAPTIC_EFFECT_STATE_PLAYING 1 /*!< Playing */
-#define HAPTIC_EFFECT_STATE_PAUSED 2 /*!< Paused */
-
-/* Edition levels */
-#define HAPTIC_EDITION_3000 3000
-#define HAPTIC_EDITION_4000 4000
-#define HAPTIC_EDITION_5000 5000
-
-/* Element type for IVTElement structure that is used by ImmVibeInsertIVTElement, ImmVibeReadIVTElement and ImmVibeRemoveIVTElement */
-#define HAPTIC_ELEMTYPE_PERIODIC 0
-#define HAPTIC_ELEMTYPE_MAGSWEEP 1
-#define HAPTIC_ELEMTYPE_REPEAT 2
-/* New in API v3.4 */
-#define HAPTIC_ELEMTYPE_WAVEFORM 3
-
-/* Composite device */
-#define HAPTIC_MAX_LOGICAL_DEVICE_COUNT 16 /*!< Maximum number of device indices that can be passed to ImmVibeOpenCompositeDevice */
-
-/****************************************************************************
- *
- * General macros
- *
- ****************************************************************************/
-#define HAPTIC_SUCCEEDED(n) ((n) >= 0)
-#define HAPTIC_FAILED(n) ((n) < 0)
-#define HAPTIC_IS_INVALID_DEVICE_HANDLE(n) (((n) == 0) || ((n) == HAPTIC_INVALID_DEVICE_HANDLE_VALUE))
-#define HAPTIC_IS_INVALID_EFFECT_HANDLE(n) (((n) == 0) || ((n) == HAPTIC_INVALID_EFFECT_HANDLE_VALUE))
-#define HAPTIC_IS_VALID_DEVICE_HANDLE(n) (((n) != 0) && ((n) != HAPTIC_INVALID_DEVICE_HANDLE_VALUE))
-#define HAPTIC_IS_VALID_EFFECT_HANDLE(n) (((n) != 0) && ((n) != HAPTIC_INVALID_EFFECT_HANDLE_VALUE))
-
-/****************************************************************************
- *
- * Error and Return value codes.
- *
- ****************************************************************************/
-#define HAPTIC_S_SUCCESS 0 /*!< Success */
-#define HAPTIC_S_FALSE 0 /*!< False */
-#define HAPTIC_S_TRUE 1 /*!< True */
-#define HAPTIC_W_NOT_PLAYING 1 /*!< Effect is not playing */
-#define HAPTIC_W_INSUFFICIENT_PRIORITY 2 /*!< Effect doesn't have enough priority to play: higher priority effect is playing on the device */
-#define HAPTIC_W_EFFECTS_DISABLED 3 /*!< Effects are disabled on the device */
-#define HAPTIC_W_NOT_PAUSED 4 /*!< The ImmVibeResumePausedEffect function cannot resume an effect that is not paused */
-#define HAPTIC_E_NOT_INITIALIZED -2 /*!< The API is already is not initialized */
-#define HAPTIC_E_INVALID_ARGUMENT -3 /*!< Invalid argument was used in a API function call */
-#define HAPTIC_E_FAIL -4 /*!< Generic error */
-#define HAPTIC_E_INCOMPATIBLE_EFFECT_TYPE -5 /*!< Incompatible Effect type has been passed into API function call */
-#define HAPTIC_E_INCOMPATIBLE_CAPABILITY_TYPE -6 /*!< Incompatible Capability type was used into one of the following functions */
-#define HAPTIC_E_INCOMPATIBLE_PROPERTY_TYPE -7 /*!< Incompatible Property type was used into one of the following functions */
-#define HAPTIC_E_DEVICE_NEEDS_LICENSE -8 /*!< Access to the instance of the device is locked until a valid license key is provided. */
-#define HAPTIC_E_NOT_ENOUGH_MEMORY -9 /*!< The API function cannot allocate memory to complete the process */
-#define HAPTIC_E_SERVICE_NOT_RUNNING -10 /*!< ImmVibeService is not running */
-#define HAPTIC_E_INSUFFICIENT_PRIORITY -11 /*!< Not enough priority to achieve the request (insufficient license key priority) */
-#define HAPTIC_E_SERVICE_BUSY -12 /*!< ImmVibeService is busy and failed to complete the request */
-#define HAPTIC_E_NOT_SUPPORTED -13 /*!< The API function is not supported by this version of the API */
-
-/****************************************************************************
- *
- * Stuctures
- *
- ****************************************************************************/
-typedef struct
-{
- int duration;
- int magnitude;
- int period;
- int style;
- int attacktime;
- int attacklevel;
- int fadetime;
- int fadelevel;
-} HapticPeriodic;
-
-typedef struct
-{
- int duration;
- int magnitude;
- int period;
- int style;
- int attacktime;
- int attacklevel;
- int fadetime;
- int fadelevel;
- int actuatorindex;
-} HapticPeriodic2;
-
-typedef struct
-{
- int duration;
- int magnitude;
- int style;
- int attacktime;
- int attacklevel;
- int fadetime;
- int fadelevel;
-} HapticMagSweep;
-
-typedef struct
-{
- int duration;
- int magnitude;
- int style;
- int attacktime;
- int attacklevel;
- int fadetime;
- int fadelevel;
- int actuatorindex;
-} HapticMagSweep2;
-
-typedef struct
-{
- int count;
- int duration;
-} HapticRepeat;
-
-typedef struct
-{
- const unsigned char *data;
- int datasize;
- int samplingrate;
- int bitdepth;
- int magnitude;
- int actuatorindex;
-} HapticWaveform;
-
-typedef struct
-{
- int elementtype;
- int time;
- union
- {
- HapticPeriodic periodic;
- HapticMagSweep magsweep;
- HapticRepeat repeat;
- } TypeSpecific;
-} HapticElement;
-
-typedef struct
-{
- int elementtype;
- int time;
- union
- {
- HapticPeriodic2 periodic;
- HapticMagSweep2 magsweep;
- HapticRepeat repeat;
- } TypeSpecific;
-} HapticElement2;
-
-typedef struct
-{
- int elementtype;
- int time;
- union
- {
- HapticPeriodic2 periodic;
- HapticMagSweep2 magsweep;
- HapticRepeat repeat;
- HapticWaveform waveform;
- } TypeSpecific;
-} HapticElement3;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DEVMAN_HAPTIC_EXT_CORE_H__ */
diff --git a/src/libdevman/include/devman_image.h b/src/libdevman/include/devman_image.h deleted file mode 100644 index f964450f..00000000 --- a/src/libdevman/include/devman_image.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DEVMAN_IMAGE_H__ -#define __DEVMAN_IMAGE_H__ - -/** - * @file devman_image.h - * @defgroup devman_image Definitions of managed api set - * @ingroup DEVICE_MANAGER_MANAGED - * @brief This file contains the definitions of managed API for devices - * @details define functions that control enhance mode and haptic device - * @author Tizen2.0 - * @date 2010-06-26 - * @version 0.1 - */ - -// This file will be deprecated -#include "devman.h" - -#endif /* __DEVMAN_IMAGE_H__ */ diff --git a/src/libdevman/include/devman_internal.h b/src/libdevman/include/devman_internal.h deleted file mode 100644 index 39b6cf59..00000000 --- a/src/libdevman/include/devman_internal.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef 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/src/libdevman/include/devman_managed.h b/src/libdevman/include/devman_managed.h deleted file mode 100644 index 3fd9cab6..00000000 --- a/src/libdevman/include/devman_managed.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DEVMAN_MANAGED_H__ -#define __DEVMAN_MANAGED_H__ - -/** - * @file devman_managed.h - * @defgroup devman_managed Definitions of managed api set - * @ingroup DEVICE_MANAGER_MANAGED - * @brief This file contains the definitions of managed API for devices - * @details define functions that control enhance mode and haptic device - * @author Tizen2.0 - * @date 2010-06-26 - * @version 0.1 - */ - -// This file will be deprecated -#include "devman.h" - -#endif /* __DEVMAN_MANAGED_H__ */ diff --git a/src/libdevman/src/device_haptic.c b/src/libdevman/src/device_haptic.c deleted file mode 100644 index 30a0481a..00000000 --- a/src/libdevman/src/device_haptic.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <vconf.h> - -#include "devlog.h" -#include "devman_haptic.h" -#include "devman_haptic_ext_core.h" - -#ifndef EXTAPI -#define EXTAPI __attribute__ ((visibility("default"))) -#endif /* EXTAPI */ - -/* START: devman_haptic APIs */ -EXTAPI -int device_haptic_open(haptic_dev_idx dev_idx, unsigned int mode) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_close(int device_handle) -{ - - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_buffer(int device_handle, const unsigned char *vibe_buffer, int iteration, int feedback_level) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_file(int device_handle, const char *file_name, int iteration, int feedback_level) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_file_with_priority(int device_handle, const char *file_name, int priority_level, int iteration, int feedback_level) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_pattern(int device_handle, int pattern, int iteration, int feedback_level) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_stop_play(int device_handle) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_monotone(int device_handle, int duration) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_monotone_with_feedback_level(int device_handle, int duration, int feedback_level) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_play_monotone_with_detail_feedback_level(int device_handle, int duration, int detail_feedback_level) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_get_buffer_duration(int device_handle, const unsigned char *vibe_buffer, int *duration) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_get_file_duration(int device_handle, const char *file_name, int *duration) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_get__duration(int device_handle, int pattern, int *duration) -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} - -EXTAPI -int device_haptic_get_device_count() -{ - DEVERR("This api was deprecated, you have to use libhaptic."); - return HAPTIC_FAIL; -} -/* END: devman_haptic APIs */ - - -/* START: devman_haptic_ext APIs */ -EXTAPI -int device_haptic_get_device_state(int device_index, int *state) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_device_capability_bool(int device_index, int device_cap_type, unsigned char *device_cap_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_device_capability_int32(int device_index, int device_cap_type, int *device_cap_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_device_capability_string(int device_index, int device_cap_type, int size, char *device_cap_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_device_property_bool(int device_handle, int device_prop_type, unsigned char *device_prop_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_set_device_property_bool(int device_handle, int device_prop_type, unsigned char device_prop_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_device_property_int32(int device_handle, int device_prop_type, int *device_prop_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_set_device_property_int32(int device_handle, int device_prop_type, int device_prop_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_device_property_string(int device_handle, int device_prop_type, int size, char *device_prop_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_set_device_property_string(int device_handle, int device_prop_type, const char *device_prop_value) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_count(const unsigned char *haptic_buffer) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_name(const unsigned char *haptic_buffer, int effect_index, int size, char *effect_name) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_name_u(const unsigned char *haptic_buffer, int effect_index, int size, unsigned short *effect_name) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_index_from_name(const unsigned char *haptic_buffer, char const *effect_name, int *effect_index) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_index_from_name_u(const unsigned char *haptic_buffer, const unsigned short *effect_name, int *effect_index) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_play_effect(int device_handle, const unsigned char *haptic_buffer, int effect_index, int *effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_play_effect_repeat(int device_handle, const unsigned char *haptic_buffer, int effect_index, unsigned char repeat, int *effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_stop_playing_effect(int device_handle, int effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_type(const unsigned char *haptic_buffer, int effect_index, int *effect_type) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_duration(const unsigned char *haptic_buffer, int effect_index, int *effect_duration) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_create_streaming_effect(int device_handle, int *effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_destroy_streaming_effect(int device_handle, int effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_play_streaming_sample(int device_handle, int effect_handle, const unsigned char *streaming_sample, int size) -{ - return HAPTIC_SUCCESS; -} - -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) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_stop_all_playing_effects(int device_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_save_file(const unsigned char *ivt_buffer, int max_bufsize, const char *path_name) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_delete_file(const char *path_name) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_pause_playing_effect(int device_handle, int effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_resume_paused_effect(int device_handle, int effect_handle) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_effect_state(int device_handle, int effect_handle, int *effect_state) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_get_size(const unsigned char *haptic_buffer, int size) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_initialize_buffer(unsigned char *haptic_buffer, int size) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_insert_element(unsigned char *haptic_buffer, int size, int timeline_index, const HapticElement *element) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_insert_element2(unsigned char *haptic_buffer, int size, int timeline_index, const HapticElement2 *element) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_insert_element3(unsigned char *haptic_buffer, int size, int timeline_index, const HapticElement3 *element) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_read_element(const unsigned char *haptic_buffer, int size, int timeline_index, int element_index, HapticElement *element) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_read_element2(const unsigned char *haptic_buffer, int size, int timeline_index, int element_index, HapticElement2 *element) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_read_element3(const unsigned char *haptic_buffer, int size, int timeline_index, int element_index, HapticElement3 *element) -{ - return HAPTIC_SUCCESS; -} - -EXTAPI -int device_haptic_remove_element(unsigned char *haptic_buffer, int size, int timeline_index, int element_index) -{ - return HAPTIC_SUCCESS; -} -/* END: devman_haptic_ext APIs */ diff --git a/src/libdevman/src/devman_internal.c b/src/libdevman/src/devman_internal.c deleted file mode 100644 index b2a53dc2..00000000 --- a/src/libdevman/src/devman_internal.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <stdio.h> -#include <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 <sys/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) { - DEVERR("Already registered!"); - return -1; - } - - if (mkfifo(fifo_path, 0700) != 0) { - DEVERR("mkfifo error : %s", strerror(errno)); - return -1; - } - - pid = fork(); - if(pid < 0) { - DEVERR("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) { - DEVERR("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) { - DEVERR("Cannot poll the fifo file"); - DEVLOG("fifo file path is %s", fifo_path); - close(fifo_pollfd.fd); - unlink(fifo_path); - return -1; - } - ret = read(fifo_pollfd.fd, buf, sizeof(buf)); - if (ret < 0) - DEVERR("read() failed (%d)", ret); - - fifo_fd = fifo_pollfd.fd; - - return 0; -} - -API int display_cancel_postjob(void) -{ - char buf[PATH_MAX]; - int ret, disp; - - snprintf(buf, PATH_MAX, "%s.%d", DISPLAY_WD_FIFO, getpid()); - if (access(buf, F_OK) != 0) { - DEVERR("No registered the post job!"); - return -1; - } - - if (fifo_fd < 0) - fifo_fd = open(buf, O_WRONLY); - if (fifo_fd < 0) { - DEVERR("Cannot open the fifo file"); - DEVLOG("fifo file path is %s", buf); - return -1; - } - disp = DISPLAY_WD_CANCEL; - ret = write(fifo_fd, &disp, sizeof(int)); - if (ret <= 0) - DEVERR("write() failed (%d)", ret); - close(fifo_fd); - unlink(buf); - fifo_fd = -1; - - return 0; -} - diff --git a/src/libdevman/src/display_wd.c b/src/libdevman/src/display_wd.c deleted file mode 100644 index e1e10e87..00000000 --- a/src/libdevman/src/display_wd.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <stdbool.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <linux/limits.h> -#include <sys/poll.h> -#include <errno.h> -#include <signal.h> -#include <vconf.h> -#include <vconf-keys.h> -#include <device-node.h> - -#include "devlog.h" -#include "devman_internal.h" - -char fifo_path[NAME_MAX]; -struct pollfd fifo_pollfd; - -static void sig_quit(int signo) -{ - DEVERR("[DISPLAY_WD] display_wd will be exit for signal %d", signo); - if(fifo_pollfd.fd >= 0) - close(fifo_pollfd.fd); - if (access(fifo_path, F_OK) == 0) - unlink(fifo_path); -} - -int main(void) -{ - int r = -1; - int ret = -1; - int val = -1; - int auto_brightness_state = -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) { - DEVERR("[DISPLAY_WD] Cannot open the fifo file - %s.", - 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) { - DEVERR("[DISPLAY_WD] Cannot open the fifo file - %s.", - fifo_path); - return -1; - } - - fifo_pollfd.events = (POLLIN | POLLHUP); - ret = 0; - while (ret != DISPLAY_WD_CANCEL) { - DEVLOG("[DISPLAY_WD] wait...."); - if (poll(&fifo_pollfd, 1, -1) < 0) { - DEVERR("[DISPLAY_WD] Cannot poll the fifo file - %s", fifo_path); - close(fifo_pollfd.fd); - return -1; - } - if (fifo_pollfd.revents & POLLIN) { - r = read(fifo_pollfd.fd, &ret, sizeof(int)); - if (r < 0) - DEVERR("read() failed(%d)", r); - if (ret == DISPLAY_WD_CANCEL) { - DEVERR("[DISPLAY_WD] Canceled. - %s, %d", fifo_path, ret); - close(fifo_pollfd.fd); - return -1; - } - } - if (fifo_pollfd.revents & POLLHUP) - break; - } - close(fifo_pollfd.fd); - unlink(fifo_path); - - DEVLOG("[DISPLAY_WD] occurs POLLHUP"); - - vconf_set_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, VCONFKEY_PM_CUSTOM_BRIGHTNESS_OFF); - if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brightness_state) == 0) { - if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_OFF) { - ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &val); - if (ret == 0 && val > 0) { - device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_BRIGHTNESS, val); - } - } else if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) { - DEVLOG("Auto brightness is enable"); - vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON); - } - } - - return 0; -} diff --git a/src/libdevman/src/if_legacy.c b/src/libdevman/src/if_legacy.c deleted file mode 100644 index c356659e..00000000 --- a/src/libdevman/src/if_legacy.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * devman - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <dd-display.h> -#include <dd-battery.h> -#include <dd-led.h> - -#include "devman.h" -#include "devlog.h" - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif - -API int device_get_battery_pct(void) -{ - return battery_get_percent(); -} - -API int device_is_battery_full(void) -{ - return battery_is_full(); -} - -API int device_get_battery_health(void) -{ - return battery_get_health(); -} - -API int device_get_battery_pct_raw(void) -{ - return battery_get_percent_raw(); -} - -API int device_get_display_brt(display_num_t lcdnum) -{ - return display_get_brightness(); -} - -API int device_set_display_brt_with_settings(display_num_t lcdnum, int val) -{ - return display_set_brightness_with_setting(val); -} - -API int device_set_display_brt(display_num_t lcdnum, int val) -{ - return display_set_brightness(val); -} - -API int device_release_brt_ctrl(display_num_t lcdnum) -{ - return display_release_brightness(); -} - -API int device_get_max_brt(display_num_t lcdnum) -{ - return display_get_max_brightness(); -} - -API int device_get_min_brt(display_num_t lcdnum) -{ - return display_get_min_brightness(); -} - -API int device_get_display_gamma(display_num_t lcdnum) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_set_display_gamma(display_num_t lcdnum, display_gamma_t val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_release_gamma_ctrl(display_num_t lcdnum, display_gamma_t org_val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_get_display_count(void) -{ - return display_get_count(); -} - -API int device_get_image_enhance_mode(void) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_set_image_enhance_mode(int val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_get_image_enhance_scenario(void) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_set_image_enhance_scenario(int val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_get_image_enhance_tone(void) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_set_image_enhance_tone(int val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_get_image_enhance_outdoor(void) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_set_image_enhance_outdoor(int val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_get_image_enhance_info(void) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_get_led_brt(void) -{ - return led_get_brightness(); -} - -API int device_set_led_brt(int val) -{ - DEVERR("Not support this api"); - return DEVMAN_ERROR_NOT_SUPPORTED; -} - -API int device_set_led_brt_without_noti(int val) -{ - return led_set_brightness(val); -} - -API int device_get_max_led(void) -{ - return led_get_max_brightness(); -} - -API int device_get_acl_control_status(display_num_t num) -{ - return display_get_acl_status(); -} - -API int device_set_acl_control_status(display_num_t num, int val) -{ - return display_set_acl_status(val); -} diff --git a/src/libhaptic/CMakeLists.txt b/src/libhaptic/CMakeLists.txt deleted file mode 100644 index 6bed5293..00000000 --- a/src/libhaptic/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(haptic C) - -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") -SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") -SET(VERSION 0.1) - -SET(SRCS - src/haptic.c) - -SET(HEADERS - SLP_haptic_PG.h - include/haptic.h - include/haptic_module.h - include/haptic_plugin_intf.h) - -SET(DEPENDENTS "dlog vconf") -SET(PC_DEPENDENTS "capi-base-common") - -SET(PC_NAME ${PROJECT_NAME}) -SET(PC_REQUIRED ${PC_DEPENDENTS}) -SET(PC_LDFLAGS -l${PROJECT_NAME}) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED ${DEPENDENTS}) - -FOREACH(flag ${pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g") - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION}) - -CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) -CONFIGURE_FILE(${PROJECT_NAME}-plugin.pc.in ${PROJECT_NAME}-plugin.pc @ONLY) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-plugin.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) - -FOREACH(hfile ${HEADERS}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) -ENDFOREACH(hfile) diff --git a/src/libhaptic/SLP_haptic_PG.h b/src/libhaptic/SLP_haptic_PG.h deleted file mode 100644 index 02d20b43..00000000 --- a/src/libhaptic/SLP_haptic_PG.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * haptic - * - * 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_HAPTIC_PG Haptic Library - * @{ - -<h1 class="pg">Introduction</h1> - -<h2 class="pg">Purpose</h2> -The purpose of this document is to describe how applications can use Haptic Library APIs. This document gives programming guidelines to application engineers. - -<h2 class="pg">Scope</h2> -The scope of this document is limited to Haptic Library API usage. - -<br> -<h1 class="pg">Device Manager Library Overview</h1> -<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">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/src/libhaptic/haptic-plugin.pc.in b/src/libhaptic/haptic-plugin.pc.in deleted file mode 100644 index e90fc895..00000000 --- a/src/libhaptic/haptic-plugin.pc.in +++ /dev/null @@ -1,13 +0,0 @@ - -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDEDIR@ - -Name: @PC_NAME@ -Description: @PACKAGE_DESCRIPTION@ -Version: @VERSION@ -Requires: -Cflags: -I${includedir} diff --git a/src/libhaptic/haptic.pc.in b/src/libhaptic/haptic.pc.in deleted file mode 100644 index 477601d6..00000000 --- a/src/libhaptic/haptic.pc.in +++ /dev/null @@ -1,14 +0,0 @@ - -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDEDIR@ - -Name: @PC_NAME@ -Description: @PACKAGE_DESCRIPTION@ -Version: @VERSION@ -Requires: @PC_REQUIRED@ -Libs: -L${libdir} @PC_LDFLAGS@ -Cflags: -I${includedir} diff --git a/src/libhaptic/include/haptic.h b/src/libhaptic/include/haptic.h deleted file mode 100644 index dba0254e..00000000 --- a/src/libhaptic/include/haptic.h +++ /dev/null @@ -1,704 +0,0 @@ -/* - * haptic - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jiyoung Yun <jy910.yun@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 __HAPTIC_H__ -#define __HAPTIC_H__ - -#include <tizen_error.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file haptic.h - * @brief This file contains the prototypes of the haptic API - */ - -/** - * @addtogroup CAPI_SYSTEM_HAPTIC_MODULE - * @{ - */ - -/** - * @brief The handle of haptic device - */ -typedef void* haptic_device_h; - -/** - * @brief The handle of haptic effect - */ -typedef void* haptic_effect_h; - -/** - * @brief Enumerations of device id for the Haptic API. - * @details We support two motors now. - */ -typedef enum { - HAPTIC_DEVICE_0 = 0x0, /**< 1st motor */ - HAPTIC_DEVICE_1 = 0x1, /**< 2nd motor */ - HAPTIC_DEVICE_ALL = 0x4, /**< both of them */ -} haptic_device_e; - -/** - * @brief Enumerations of priority level for the Haptic API. - */ -typedef enum -{ - HAPTIC_PRIORITY_MIN = 0, /**< Minimum effect priority for developers (default) */ - HAPTIC_PRIORITY_MIDDLE, /**< Maximum effect priority for developers */ - HAPTIC_PRIORITY_HIGH, /**< Maximum effect priority for OEMs */ -} haptic_priority_e; - -/** - * @brief Enumerations of feedback level for the Haptic API. - * @details Haptic level means vibration power (intensity). - */ -typedef enum -{ - HAPTIC_FEEDBACK_0 = 0, /**< feedback level 0 */ - HAPTIC_FEEDBACK_1 = 20, /**< feedback level 1 */ - HAPTIC_FEEDBACK_2 = 40, /**< feedback level 2 */ - HAPTIC_FEEDBACK_3 = 60, /**< feedback level 3 */ - HAPTIC_FEEDBACK_4 = 80, /**< feedback level 4 */ - HAPTIC_FEEDBACK_5 = 100, /**< feedback level 5 */ - HAPTIC_FEEDBACK_AUTO, /**< feedback level auto */ -} haptic_feedback_e; - -/** - * @brief Enumerations of iteration count for the Haptic API. - */ -typedef enum -{ - HAPTIC_ITERATION_ONCE = 1, - HAPTIC_ITERATION_INFINITE = 256, -} haptic_iteration_e; - -/** - * @brief Enumerations of effect or device state for the Haptic API. - */ -typedef enum -{ - HAPTIC_STATE_STOP = 0, - HAPTIC_STATE_PLAYING, -} haptic_state_e; - -/** - * @brief Enumerations of error codes for the Haptic API. - */ -typedef enum -{ - HAPTIC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - HAPTIC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - HAPTIC_ERROR_FILE_EXISTS = TIZEN_ERROR_FILE_EXISTS, /**< File exists */ - HAPTIC_ERROR_NOT_INITIALIZED = TIZEN_ERROR_SYSTEM_CLASS | 0x26, /**< Not initialized */ - HAPTIC_ERROR_OPERATION_FAILED = TIZEN_ERROR_SYSTEM_CLASS | 0x28, /**< Operation failed */ - HAPTIC_ERROR_NOT_SUPPORTED_DEVICE = TIZEN_ERROR_SYSTEM_CLASS | 0x30, /**< Not supported device */ -} haptic_error_e; - -/** - * @brief Gets the number of the vibrators. - * - * @remarks The index HAPTIC_DEVICE_ALL is reserved meaning for all vibrators at a time. - * - * @param[out] vibrator_number A number of vibrators - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - */ -int haptic_get_count(int *device_number); - -/** - * @brief Opens a haptic-vibration device. - * - * @details Internally, it makes a connection to the vibrator. - * - * @remarks If this function is not called in advance, other functions will return #HAPTIC_ERROR_NOT_INITIALIZED. - * @remarks Haptic API must be closed by haptic_close(). - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_close() - */ -int haptic_open(haptic_device_e device, haptic_device_h *device_handle); - -/** - * @brief Closes a haptic-vibration device. - * - * @details Internally, it disconnects the connection to vibrator. - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_open() - */ -int haptic_close(haptic_device_h device_handle); - -/** - * @brief Vibrates during the specified time with a constant intensity. - * @details - * This function can be used to start monotonous vibration for specified time. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n - * And default value of feedback and priority is used.\n - * feedback level is reserved for auto chaning to save variable in the settings.\n - * priority level uses HAPTIC_PRIORITY_MIN. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] duration The play duration in milliseconds - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_monotone_with_detail() - * @see haptic_vibrate_file() - * @see haptic_vibrate_buffer() - * @see haptic_get_count() - */ -int haptic_vibrate_monotone(haptic_device_h device_handle, int duration, haptic_effect_h *effect_handle); - -/** - * @brief Vibrates during the specified time with a constant intensity. - * @details - * This function can be used to start monotonous vibration for specified time. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] duration The play duration in milliseconds - * @param[in] feedback The amount of the intensity variation - * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file_with_detail() - * @see haptic_vibrate_buffer_with_detail() - * @see haptic_get_count() - */ -int haptic_vibrate_monotone_with_detail(haptic_device_h device_handle, - int duration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern file. - * @details - * This function can be used to play a haptic-vibration pattern file. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n - * And default value of feedback and priority is used.\n - * feedback level is reserved for auto chaning to save variable in the settings.\n - * priority level uses HAPTIC_PRIORITY_MIN. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] file_path Vibration pattern file with path - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_file_with_detail() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_buffer() - * @see haptic_get_count() - */ -int haptic_vibrate_file(haptic_device_h device_handle, const char *file_path, haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern file. - * @details - * This function can be used to play a haptic-vibration pattern file. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] file_path Vibration pattern file with path - * @param[in] iteration The number of times to repeat the effect - * @param[in] feedback The amount of the intensity variation - * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_file() - * @see haptic_vibrate_monotone_with_detail() - * @see haptic_vibrate_buffer_with_detail() - * @see haptic_get_count() - */ -int haptic_vibrate_file_with_detail(haptic_device_h device_handle, - const char *file_path, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer. - * @details - * This function can be used to play a haptic-vibration pattern buffer. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n - * And default value of feedback and priority is used.\n - * feedback level is reserved for auto chaning to save variable in the settings.\n - * priority level uses HAPTIC_PRIORITY_MIN. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer_with_detail() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file() - * @see haptic_get_count() - */ -int haptic_vibrate_buffer(haptic_device_h device_handle, const unsigned char *vibe_buffer, haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer. - * @details - * This function can be used to play a haptic-vibration pattern buffer. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[in] iteration The number of times to repeat the effect - * @param[in] feedback The amount of the intensity variation - * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer() - * @see haptic_vibrate_monotone_with_detail() - * @see haptic_vibrate_file_with_detail() - * @see haptic_get_count() - */ -int haptic_vibrate_buffer_with_detail(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer. - * @details - * This function can be used to play a haptic-vibration pattern buffer. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter.\n - * And default value of feedback and priority is used.\n - * feedback level is reserved for auto chaning to save variable in the settings.\n - * priority level uses HAPTIC_PRIORITY_MIN. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[in] size Size to the vibration pattern - * @param[out] effect_handle [DEPRECATED] Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer_with_detail() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file() - * @see haptic_get_count() - */ -int haptic_vibrate_buffers(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - int size, - haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer. - * @details - * This function can be used to play a haptic-vibration pattern buffer. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[in] size Size to the vibration pattern - * @param[in] iteration The number of times to repeat the effect - * @param[in] feedback The amount of the intensity variation - * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH - * @param[out] effect_handle [DEPRECATED] Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer() - * @see haptic_vibrate_monotone_with_detail() - * @see haptic_vibrate_file_with_detail() - * @see haptic_get_count() - */ -int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - int size, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle); - -/** - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer_with_detail() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file() - * @see haptic_get_count() - */ -int haptic_vibrate_buffers(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - int size, - haptic_effect_h *effect_handle); - -/** - * @brief Vibrates a predefined rhythmic haptic-vibration pattern buffer. - * @details - * This function can be used to play a haptic-vibration pattern buffer. - * - * @remark - * If you don't use th api regarding effect_handle, you can pass in a NULL value to last parameter. - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[in] size Size to the vibration pattern - * @param[in] iteration The number of times to repeat the effect - * @param[in] feedback The amount of the intensity variation - * @param[in] priority The priority from HAPTIC_PRIORITY_MIN to HAPTIC_PRIORITY_HIGH - * @param[out] effect_handle Pointer to the variable that will receive a handle to the playing effect - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer() - * @see haptic_vibrate_monotone_with_detail() - * @see haptic_vibrate_file_with_detail() - * @see haptic_get_count() - */ -int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - int size, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle); - -/** - * @brief Stops the current vibration effect which is being played. - * @details This function can be used to stop each effect started by haptic_vibrate_xxx(). - * - * @remark - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] effect_handle The effect handle from haptic_vibrate_xxx() - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file() - * @see haptic_get_count() - * @see haptic_stop_all_effects() - */ -int haptic_stop_effect(haptic_device_h device_handle, haptic_effect_h effect_handle); - -/** - * @brief Stops all vibration effects which are being played. - * @details This function can be used to stop all effects started by haptic_vibrate_xxx(). - * - * @remark - * - * @param[in] device_handle The device handle from haptic_open() - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file() - * @see haptic_get_count() - * @see haptic_stop_effect() - */ -int haptic_stop_all_effects(haptic_device_h device_handle); - -/** - * @brief Gets the status of the effect. - * @details This function can be used to get the status of the effect wheter the effect are playing or not. - * - * @remark - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] effect_handle The effect handle from haptic_vibrate_xxx() - * @param[out] state The pointer to variable that will receive the status of the effect. - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_vibrate_buffer() - * @see haptic_vibrate_monotone() - * @see haptic_vibrate_file() - * @see haptic_get_count() - * @see haptic_stop_effect() - * @see haptic_stop_all_effects() - */ -int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h effect_handle, haptic_state_e *state); - -/** - * @par Description: - * effect element for haptic. - */ -typedef struct { - int haptic_duration; /**< Duration of the effect element in millisecond */ - haptic_feedback_e haptic_level; /**< Level of the effect element (0 ~ 100) */ -} haptic_effect_element_s; - -/** - * @brief Creates an effect buffer. - * @details This function can be used to create an effect buffer using effeclt_element variable. - * - * @remark - * - * @param[out] vibe_buffer Pointer to the vibration pattern - * @param[in] max_bufsize The size of the buffer pointed to by vibe_buffer - * @param[in] elem_arr Pointer to an haptic_effect_element_s structure - * @param[in] max_elemcnt The size fo the buffer pointed to by elem_arr - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_save_effect() - */ -int haptic_create_effect(unsigned char *vibe_buffer, - int max_bufsize, - haptic_effect_element_s *elem_arr, - int max_elemcnt); - -/** - * @brief Save an effect buffer to the file. - * @details This function can be used to save an effect buffer to the file using third parameter. - * - * @remark - * - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[in] max_bufsize The size of the buffer pointed to by vibe_buffer - * @param[in] file_path The pointer to the character buffer containing the path to save - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_FILE_EXISTS File exists - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_create_effect() - */ -int haptic_save_effect(const unsigned char *vibe_buffer, - int max_bufsize, - const char *file_path); - -/** - * @brief Gets a duration time value from file. - * @details This function can be used to get a duration time value from the file using second parameter. - * - * @remark - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] file_path The pointer to the character buffer containing the path to save - * @param[out] duration The pointer to the duration time value - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_get_buffer_duration() - */ -int haptic_get_file_duration(haptic_device_h device_handle, const char *file_path, int *duration); - -/** - * @brief Gets a duration time value from buffer. - * @details This function can be used to get a duration time value from the buffer using second parameter. - * - * @remark - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern buffer - * @param[out] duration The pointer to the duration time value - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_get_file_duration() - */ -int haptic_get_buffer_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int *duration); - -/** - * @brief Gets a duration time value from buffer. - * @details This function can be used to get a duration time value from the buffer using second parameter. - * - * @remark - * - * @param[in] device_handle The device handle from haptic_open() - * @param[in] vibe_buffer Pointer to the vibration pattern buffer - * @param[in] size Size to the vibration pattern buffer - * @param[out] duration The pointer to the duration time value - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_get_file_duration() - */ -int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int size, int *buffer_duration); - -/** - * @brief Save an effect buffer to the led file. - * @details This function can be used to save an effect buffer to the led file which name is third parameter. - * - * @remark - * Third parameter should be compatible with ledplayer file. - * - * @param[in] vibe_buffer Pointer to the vibration pattern - * @param[in] max_bufsize The size of the buffer pointed to by vibe_buffer - * @param[in] file_path The pointer to the character buffer containing the path to save - * - * @return 0 on success, otherwise a negative error value. - * @retval #HAPTIC_ERROR_NONE Successful - * @retval #HAPTIC_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #HAPTIC_ERROR_NOT_INITIALIZED Not initialized - * @retval #HAPTIC_ERROR_FILE_EXISTS File exists - * @retval #HAPTIC_ERROR_OPERATION_FAILED Operation failed - * @retval #HAPTIC_ERROR_NOT_SUPPORTED_DEVICE Not supported device - * - * @see haptic_save_effect() - */ -int haptic_save_led(const unsigned char *vibe_buffer, int max_bufsize, const char *file_path); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif /* __HAPTIC_H__ */ diff --git a/src/libhaptic/include/haptic_log.h b/src/libhaptic/include/haptic_log.h deleted file mode 100644 index 1cee54b2..00000000 --- a/src/libhaptic/include/haptic_log.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * haptic - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jiyoung Yun <jy910.yun@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 __HAPTIC_LOG_H__ -#define __HAPTIC_LOG_H__ - -#define FEATURE_HAPTIC_DLOG - -#ifdef FEATURE_HAPTIC_DLOG - #define LOG_TAG "HAPTIC" - #include <dlog.h> - #define HAPTIC_LOG(fmt, args...) SLOGD(fmt, ##args) - #define HAPTIC_ERROR(fmt, args...) SLOGE(fmt, ##args) -#else - #define HAPTIC_LOG(x, ...) - #define HAPTIC_ERROR(x, ...) -#endif - -#endif //__HAPTIC_LOG_H__ diff --git a/src/libhaptic/include/haptic_module.h b/src/libhaptic/include/haptic_module.h deleted file mode 100644 index 3a86354b..00000000 --- a/src/libhaptic/include/haptic_module.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * haptic - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jiyoung Yun <jy910.yun@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 __HAPTIC_MODULE_H__ -#define __HAPTIC_MODULE_H__ - - -/** - * @brief Enumerations of device id for the Haptic Module API. - * @details We support two motors now. - */ -typedef enum { - HAPTIC_MODULE_DEVICE_0 = 0x0, /**< 1st motor */ - HAPTIC_MODULE_DEVICE_1 = 0x1, /**< 2nd motor */ - HAPTIC_MODULE_DEVICE_ALL = 0x4, /**< both of them */ -} haptic_module_device; - -/** - * @brief Enumerations of priority level for the Haptic Module API. - */ -typedef enum -{ - HAPTIC_MODULE_PRIORITY_MIN = 0, /**< Minimum effect priority for developers (default) */ - HAPTIC_MODULE_PRIORITY_MIDDLE, /**< Maximum effect priority for developers */ - HAPTIC_MODULE_PRIORITY_HIGH, /**< Maximum effect priority for OEMs */ -} haptic_module_priority; - -/** - * @brief Enumerations of feedback level for the Haptic Module API. - * @details Haptic level means vibration power (intensity). - */ -typedef enum -{ - HAPTIC_MODULE_FEEDBACK_MIN = 0, - HAPTIC_MODULE_FEEDBACK_MAX = 100, -} haptic_module_feedback; - -/** - * @brief Enumerations of iteration count for the Haptic Module API. - */ -typedef enum -{ - HAPTIC_MODULE_ITERATION_ONCE = 1, - HAPTIC_MODULE_ITERATION_INFINITE = 256, -} haptic_module_iteration; - -/** - * @brief Enumerations of effect or device state for the Haptic Module API. - */ -typedef enum -{ - HAPTIC_MODULE_STATE_PLAYING = 0, - HAPTIC_MODULE_STATE_STOP, -} haptic_module_state; - -/* Error and Return value codes */ -#define HAPTIC_MODULE_ERROR_NONE 0 -#define HAPTIC_MODULE_NOT_INITIALIZED -1 -#define HAPTIC_MODULE_ALREADY_INITIALIZED -2 -#define HAPTIC_MODULE_INVALID_ARGUMENT -3 -#define HAPTIC_MODULE_OPERATION_FAILED -4 -#define HAPTIC_MODULE_NOT_SUPPORTED -5 - -/** - * @par Description: - * effect element for haptic module. - */ -typedef struct { - int haptic_duration; /**< Duration of the effect element in millisecond */ - int haptic_level; /**< Level of the effect element (0 ~ 100) */ -} haptic_module_effect_element; - -#endif /* __HAPTIC_MODULE_H__ */ diff --git a/src/libhaptic/include/haptic_plugin_intf.h b/src/libhaptic/include/haptic_plugin_intf.h deleted file mode 100644 index f2338def..00000000 --- a/src/libhaptic/include/haptic_plugin_intf.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * haptic - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jiyoung Yun <jy910.yun@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 __HAPTIC_PLUGIN_INTF_H__ -#define __HAPTIC_PLUGIN_INTF_H__ - -#include "haptic_module.h" - -typedef struct { - int (*haptic_internal_get_device_count) (int*); - int (*haptic_internal_open_device) (int, int*); - int (*haptic_internal_close_device) (int); - int (*haptic_internal_vibrate_monotone) (int, int, int, int, int*); - int (*haptic_internal_vibrate_file) (int, const char*, int, int, int, int*); - int (*haptic_internal_vibrate_buffer) (int, const unsigned char*, int, int, int, int*); - int (*haptic_internal_stop_effect) (int, int); - int (*haptic_internal_stop_all_effects) (int); - int (*haptic_internal_pause_effect) (int, int); - int (*haptic_internal_resume_effect) (int, int); - int (*haptic_internal_get_effect_state) (int, int, int*); - int (*haptic_internal_create_effect) (unsigned char*, int, haptic_module_effect_element*, int); - int (*haptic_internal_save_effect) (const unsigned char*, int, const char*); - int (*haptic_internal_get_file_duration) (int, const char*, int*); - int (*haptic_internal_get_buffer_duration) (int, const unsigned char*, int*); - int (*haptic_internal_convert_binary) (const unsigned char*, int, const char*); -} haptic_plugin_interface; - -const haptic_plugin_interface *get_haptic_plugin_interface(); - -#endif /* __HAPTIC_PLUGIN_INTF_H__ */ diff --git a/src/libhaptic/src/device_convert.c b/src/libhaptic/src/device_convert.c deleted file mode 100644 index c527ea76..00000000 --- a/src/libhaptic/src/device_convert.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - * devman - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jiyoung Yun <jy910.yun@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 <string.h> -#include <dirent.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "devlog.h" -#include <devman_haptic.h> -#include <devman_haptic_ext.h> -#include <devman_haptic_ext_core.h> - -#ifndef EXTAPI -#define EXTAPI __attribute__ ((visibility("default"))) -#endif /* EXTAPI */ - -#ifdef PERFORM_CHECK -static long long ms = 0; - -#define MICROSECONDS(tv) ((tv.tv_sec * 1000000ll) + tv.tv_usec) - -#define ESTIMATE_PERFORMANCE() \ - do { \ - struct timeval tv; \ - if (ms == 0) { \ - gettimeofday(&tv, NULL); \ - ms = MICROSECONDS(tv); \ - fDBG(stderr, "%s start time : %lld\n", __func__, ms); \ - } else { \ - gettimeofday(&tv, NULL); \ - fDBG(stderr, "%s elapsed time : %lld\n", __func__, MICROSECONDS(tv) - ms); \ - ms = 0; \ - } \ - } while(0) -#else -#define ESTIMATE_PERFORMANCE() -#endif - -#define MAX_FILE_PATH 256 /* Maximum file path length */ -#define SAMPLE_INTERVAL 10.0 /* Sample calculation interval in milliseconds */ -#define IVT_BUFFER_SIZE 4096 /* IVT buffer size */ -#define BASE 5 -#define FOLDER_MASK 664 - -typedef enum { - WAVETYPE_SQUARE = 1, - WAVETYPE_TRIANGLE, - WAVETYPE_SINE, - WAVETYPE_SAWTOOTHUP, - WAVETYPE_SAWTOOTHDOWN -} effect_wave_type; - -/* This functions loads the IVT file into memory */ -static unsigned char *_load_ivt_file(const char *filepath) -{ - FILE *pFile; - long cbyFileSize; - unsigned char *p_ivt_data = NULL; - /* open the IVT file */ - /* IMPORTANT: open the IVT file as a binary file to avoid translation */ - pFile = fopen(filepath, "rb"); - if (!pFile) - { - /* handle error, application-specific */ - return p_ivt_data; - } - /* determine the file size */ - /* fseek returns zero on success, non-zero on failure */ - if (fseek(pFile, 0, SEEK_END)) - { - /* handle error, application-specific */ - fclose(pFile); - return p_ivt_data; - } - cbyFileSize = ftell(pFile); - if (fseek(pFile, 0, SEEK_SET)) - { - /* handle error, application-specific */ - fclose(pFile); - return p_ivt_data; - } - /* allocate a buffer for the IVT data */ - p_ivt_data = (unsigned char *)malloc(cbyFileSize); - if (!p_ivt_data) - { - /* handle error, application-specific */ - fclose(pFile); - return p_ivt_data; - } - /* read the IVT data from the IVT file */ - if (fread(p_ivt_data, 1, cbyFileSize, pFile) != cbyFileSize) - { - /* handle error, application-specific */ - free(p_ivt_data); - p_ivt_data = 0; - fclose(pFile); - return p_ivt_data; - } - /* close the IVT file */ - if (0 != fclose(pFile)) - { - /* handle error, application-specific */ - return p_ivt_data; - } - /* you can now play effects from the IVT data that was loaded into g_pIVTData */ - return p_ivt_data; -} - -/* converts effect type to string*/ -static char *_convert_effect_type_to_string(int effect_type) -{ - switch (effect_type) { - case HAPTIC_EFFECT_TYPE_PERIODIC: - return "HAPTIC_EFFECT_TYPE_PERIODIC"; - case HAPTIC_EFFECT_TYPE_MAGSWEEP: - return "HAPTIC_EFFECT_TYPE_MAGSWEEP"; - case HAPTIC_EFFECT_TYPE_TIMELINE: - return "HAPTIC_EFFECT_TYPE_TIMELINE"; - case HAPTIC_EFFECT_TYPE_STREAMING: - return "HAPTIC_EFFECT_TYPE_STREAMING"; - case HAPTIC_EFFECT_TYPE_WAVEFORM: - return "HAPTIC_EFFECT_TYPE_WAVEFORM"; - } - return NULL; -} - -/*This functions gets Periodic effect details using devman API*/ -static int _get_periodic_effect_details(const unsigned char *pivt_data, int index, HapticPeriodic *periodic_effect) -{ - int result = -1; - result = device_haptic_get_periodic_effect_definition(pivt_data, index, - &periodic_effect->duration, &periodic_effect->magnitude, - &periodic_effect->period, &periodic_effect->style, - &periodic_effect->attacktime, &periodic_effect->attacklevel, - &periodic_effect->fadetime, &periodic_effect->fadelevel); - if (result == 0) { - DBG("device_haptic_get_periodic_effect_definition() Success"); - DBG("Duration : %d", periodic_effect->duration); - DBG("Magnitude : %d", periodic_effect->magnitude); - DBG("Period : %d", periodic_effect->period); - DBG("Style & Wave Type : %d", periodic_effect->style); - DBG("Attacktime : %d", periodic_effect->attacktime); - DBG("Attacklevel : %d", periodic_effect->attacklevel); - DBG("Fadetime : %d", periodic_effect->fadetime); - DBG("Fadelevel : %d", periodic_effect->fadelevel); - } else { - DBG("device_haptic_get_periodic_effect_definition() failed. Reason:%d", result); - } - return result; -} - -/*This functions gets MagSweep effect details using devman API*/ -static int _get_magsweep_effect_details(const unsigned char *p_ivt_data, int index, HapticMagSweep *magsweep_effect) -{ - int result = -1; - result = device_haptic_get_magsweep_effect_definition(p_ivt_data, index, - &magsweep_effect->duration, &magsweep_effect->magnitude, - &magsweep_effect->style, - &magsweep_effect->attacktime, &magsweep_effect->attacklevel, - &magsweep_effect->fadetime, &magsweep_effect->fadelevel); - if (result == 0) { - DBG("device_haptic_get_magsweep_effect_definition() Success"); - DBG("Duration : %d", magsweep_effect->duration); - DBG("Magnitude : %d", magsweep_effect->magnitude); - DBG("Style : %d", magsweep_effect->style); - DBG("Attacktime : %d", magsweep_effect->attacktime); - DBG("Attacklevel : %d", magsweep_effect->attacklevel); - DBG("Fadetime : %d", magsweep_effect->fadetime); - DBG("Fadelevel : %d", magsweep_effect->fadelevel); - } else { - DBG("device_haptic_get_magsweep_effect_definition() failed. Reason:%d", result); - } - return result; -} - -/*This functions gets Timeline effect details using devman API*/ -static int _get_timeline_effect_details(const unsigned char *p_ivt_data, int index, HapticElement *timeline_effect) -{ - unsigned char ivt_buffer[IVT_BUFFER_SIZE+1] = {0,}; - int result = -1; - - result = device_haptic_initialize_buffer(ivt_buffer, sizeof(ivt_buffer)); - if (result ==0) { - result = device_haptic_read_element(ivt_buffer, IVT_BUFFER_SIZE, 0, 0, timeline_effect); - if (result == 0) { - DBG("Element type:%d", timeline_effect->elementtype); - } else { - DBG("device_haptic_read_element() failed. Reason :%d", result); - } - } else { - DBG("device_haptic_initialize_buffer() failed. Reason:%d", result); - } - return result; -} - -/* This function parses the Periodic effect received and generates - * corresponding LED pattern for it */ -static char *_parse_periodic_effect_and_generate_led_pattern(HapticPeriodic periodic, int *buffer_size) -{ - char *led_pattern = NULL; - int unit = periodic.magnitude/10; - int i = 0; - int sample_index = 0; - int value = 0; - int style = 0; - int wave_type = 0; - int mid = periodic.period/2; - int j = 0; - int step = 0; - int delta = 0; - int base = BASE*unit; - char const_value ='0'; - - led_pattern = (char*)calloc(((periodic.duration/SAMPLE_INTERVAL)+1), sizeof(char)); - if (led_pattern == NULL) { - DBG("Memory allocation failure"); - return NULL; - } - - if (periodic.magnitude >0) - const_value = '1'; - - if (periodic.attacktime == 0 && periodic.attacklevel == 0 - && periodic.fadetime == 0 && periodic.fadelevel == 0) { - DBG("Periodic effect"); - - if (periodic.style <=0) { - DBG("Unknown periodic effect"); - free(led_pattern); - return NULL; - } else { - /* Extract Style and wave type*/ - DBG("Style and wave type: %d", periodic.style); - style = periodic.style && HAPTIC_STYLE_SUPPORT_MASK; - wave_type = periodic.style && HAPTIC_WAVETYPE_SUPPORT_MASK; - DBG("Style : %d", style); - DBG("Wave type : %d", wave_type); - - /* Generate pattern based on Wave type. Ignore Style*/ - switch (wave_type) { - case WAVETYPE_SQUARE: - case WAVETYPE_SAWTOOTHDOWN: - { - for (i = 0; i<periodic.duration; i =i+periodic.period) { - for (j =SAMPLE_INTERVAL; j<=periodic.period; j = j+SAMPLE_INTERVAL) { - if (j <= mid) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - break; - } - case WAVETYPE_TRIANGLE: - case WAVETYPE_SINE: - { - step = periodic.magnitude/mid; - delta = step * SAMPLE_INTERVAL; - for (i = 0; i<periodic.duration; i =i+periodic.period) { - value = 0; - for (j =SAMPLE_INTERVAL; j<=periodic.period; j = j+SAMPLE_INTERVAL) { - if (j <= mid) - value = value + delta; - else - value = value - delta; - if (value>= base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - break; - } - case WAVETYPE_SAWTOOTHUP: - { - for (i = 0; i<periodic.duration; i =i+periodic.period) { - for (j =SAMPLE_INTERVAL; j<=periodic.period; j = j+SAMPLE_INTERVAL) { - if (j > mid) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - break; - } - default: DBG("Unknown wave type\n"); - break; - } - } - } else { - /*TODO*/ - /* handling periodic effect if attacktime and fade time less than period*/ - /* Need to keep repeating the pattern with attack and fade effectes within period till duration is reached*/ - if (periodic.attacktime>periodic.period || periodic.fadetime>periodic.period) { - if (periodic.attacktime >0) { - DBG("Attack time present\n"); - - if (periodic.attacklevel >periodic.magnitude) { /* Decrementing effect */ - step = (periodic.attacklevel - periodic.magnitude)/periodic.attacktime; - } else if (periodic.attacklevel <periodic.magnitude) { /* Incrementing effect */ - step = ( periodic.magnitude - periodic.attacklevel)/periodic.attacktime; - } - delta = step * SAMPLE_INTERVAL; - - for (i=SAMPLE_INTERVAL; i<= periodic.attacktime; i = i+SAMPLE_INTERVAL) { - value = value+delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - - for (i = periodic.attacktime+SAMPLE_INTERVAL; i<= (periodic.duration-periodic.fadetime); i = i+ SAMPLE_INTERVAL) { - led_pattern[sample_index++] = const_value; - } - if (periodic.fadetime >0) { - step = (periodic.magnitude - periodic.fadelevel)/periodic.fadetime; - delta = step* SAMPLE_INTERVAL; - value = periodic.magnitude; - for (i = (periodic.duration-periodic.fadetime+SAMPLE_INTERVAL); i<= periodic.duration; i = i+ SAMPLE_INTERVAL) { - value = value - delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - } - } - /*To mark end of effect*/ - led_pattern[sample_index++] = '0'; - *buffer_size = sample_index; - DBG("LED Pattern for Periodic effect: %s", led_pattern); - return led_pattern; -} - -/* This function parses the MagSweep effect received and generates - * corresponding LED pattern for it */ -static char *_parse_magsweep_effect_and_generate_led_pattern(HapticMagSweep mag_sweep, int *buffer_size) -{ - int unit = mag_sweep.magnitude/10; - int i =0; - int sample_index = 0; - int step = 0; - int delta = 0; - int value =0; - int base = BASE*unit; - char const_value ='0'; - char *led_pattern = NULL; - - led_pattern = (char*)calloc(((mag_sweep.duration/SAMPLE_INTERVAL)+1), sizeof(char)); - if (led_pattern == NULL) { - DBG("Memory allocation failure"); - return NULL; - } - - if (mag_sweep.magnitude >0) - const_value = '1'; - - if (mag_sweep.attacktime == 0 && mag_sweep.attacklevel == 0 - && mag_sweep.fadetime == 0 && mag_sweep.fadelevel == 0) { - /* Constant effect with maximum magnitude*/ - DBG("Constant effect"); - - for (i = 0; i<=mag_sweep.duration; i=i+SAMPLE_INTERVAL) { - led_pattern[sample_index++] = const_value; - } - } else { - DBG("Varying effect"); - /* Handling Attack effect*/ - if (mag_sweep.attacktime >0) { - DBG("Attack time present"); - - if (mag_sweep.attacklevel >mag_sweep.magnitude) { /* Decrementing effect */ - step = (mag_sweep.attacklevel - mag_sweep.magnitude)/mag_sweep.attacktime; - } else if (mag_sweep.attacklevel <mag_sweep.magnitude) { /* Incrementing effect */ - step = ( mag_sweep.magnitude - mag_sweep.attacklevel)/mag_sweep.attacktime; - } - delta = step * SAMPLE_INTERVAL; - - for (i=SAMPLE_INTERVAL; i<= mag_sweep.attacktime; i = i+SAMPLE_INTERVAL) { - value = value+delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - /* For Handling constant effect between attacktime and fade time*/ - for (i = mag_sweep.attacktime+SAMPLE_INTERVAL; i<= (mag_sweep.duration-mag_sweep.fadetime); i = i+ SAMPLE_INTERVAL) { - led_pattern[sample_index++] = const_value; - } - /* Handling fading effect*/ - if (mag_sweep.fadetime >0) { - step = (mag_sweep.magnitude - mag_sweep.fadelevel)/mag_sweep.fadetime; - delta = step* SAMPLE_INTERVAL; - value = mag_sweep.magnitude; - for (i = (mag_sweep.duration-mag_sweep.fadetime+ SAMPLE_INTERVAL); i<= mag_sweep.duration; i = i+ SAMPLE_INTERVAL) { - value = value - delta; - if (value>base) - led_pattern[sample_index++] = '1'; - else - led_pattern[sample_index++] = '0'; - } - } - - } - /*To mark end of effect*/ - led_pattern[sample_index++] = '0'; - *buffer_size = sample_index; - DBG("Appending 0 at the end"); - DBG("LED Pattern for MagSweep effect: %s", led_pattern); - return led_pattern; -} - -static int _write_pattern_to_file(const char *binary_path, char *pled_dat, int buf_size, int *opened_flag) -{ - FILE *ptr_myfile = NULL; - - DBG("LED file name:%s", binary_path); - /* Open file for the FIRST time */ - if (*opened_flag) { - ptr_myfile = fopen(binary_path, "wb+"); - if (!ptr_myfile) { - DBG("Unable to open file!"); - return -1; - } - *opened_flag = 0; - } else { - ptr_myfile = fopen(binary_path, "ab+"); - if (!ptr_myfile) { - DBG("Unable to open file!"); - return -1; - } - } - - DBG("Buffer: %s", pled_dat); - if (fwrite(pled_dat, 1, buf_size, ptr_myfile) <= 0) { - DBG("fwrite() failed"); - } else { - DBG("fwrite() success"); - } - - fclose(ptr_myfile); - return 0; -} - -static int _convert_ivt_to_binary(const char *haptic_path, const char *binary_path) -{ - unsigned char *pivt_dat = NULL; - char *pled_dat = NULL; - int result = -1; - int effect_cnt = -1; - int effect_type = -1; - int effect_duration = -1; - int buf_size = -1; - int opened_flag = 1; // 1 : Not opened, 0 : Opened - HapticPeriodic periodic_effect; - HapticMagSweep magsweep_effect; - HapticElement element; - int i; - - /* Load IVT file into memory */ - pivt_dat = _load_ivt_file(haptic_path); - if (!pivt_dat) { - DBG("Loading IVT failed"); - return -1; - } - - /* Get total number of effects in IVT file */ - effect_cnt = device_haptic_get_effect_count(pivt_dat); - DBG("device_haptic_get_effect_count() Return:%d", effect_cnt); - - /* Parse effects in IVT */ - for (i = 0; i < effect_cnt; i++) { - /* Get effect type*/ - result = device_haptic_get_effect_type(pivt_dat, i, &effect_type); - if (result < 0) { - DBG("EffectNo:%d Getting Effect Type Failed. Reason:%d", (i+1), result); - continue; - } - - DBG("EffectNo:%d EffectType:%s\n", (i+1), _convert_effect_type_to_string(effect_type)); - switch (effect_type) { - case HAPTIC_EFFECT_TYPE_PERIODIC: - memset(&periodic_effect, 0x00, sizeof(HapticPeriodic)); - if (_get_periodic_effect_details(pivt_dat, i, &periodic_effect) == 0) { - /* Parse periodic effect type*/ - pled_dat = _parse_periodic_effect_and_generate_led_pattern(periodic_effect, &buf_size); - if (pled_dat) { - _write_pattern_to_file(binary_path, pled_dat, buf_size, &opened_flag); - free(pled_dat); - } - } - break; - case HAPTIC_EFFECT_TYPE_MAGSWEEP: - memset(&magsweep_effect, 0x00, sizeof(HapticMagSweep)); - if (_get_magsweep_effect_details(pivt_dat, i, &magsweep_effect) == 0) { - /* Parse magsweep effect type*/ - pled_dat = _parse_magsweep_effect_and_generate_led_pattern(magsweep_effect, &buf_size); - if (pled_dat) { - _write_pattern_to_file(binary_path, pled_dat, buf_size, &opened_flag); - free(pled_dat); - } - } - break; - case HAPTIC_EFFECT_TYPE_TIMELINE: - memset(&element, 0x00, sizeof(HapticElement)); - if (_get_timeline_effect_details(pivt_dat, i, &element) > 0) { - device_haptic_get_effect_duration(pivt_dat, i, &effect_duration); - DBG("Timeline effect duration:%d", effect_duration); - } - break; - case HAPTIC_EFFECT_TYPE_STREAMING: - case HAPTIC_EFFECT_TYPE_WAVEFORM: - default: - DBG("Unsupported effect type"); - break; - } - } - - free(pivt_dat); - return 0; -} - -EXTAPI int device_haptic_convert_to_binary(const char *haptic_name) -{ - DBG("this api is not implementation yet"); - return -1; -} diff --git a/src/libhaptic/src/haptic.c b/src/libhaptic/src/haptic.c deleted file mode 100644 index cf4088f3..00000000 --- a/src/libhaptic/src/haptic.c +++ /dev/null @@ -1,809 +0,0 @@ -/* - * haptic - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jiyoung Yun <jy910.yun@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 <dlfcn.h> -#include <vconf.h> - -#include "haptic.h" -#include "haptic_plugin_intf.h" -#include "haptic_log.h" - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif - -#define HAPTIC_MODULE_PATH "/usr/lib/libhaptic-module.so" - -/* Haptic Handle Control */ -static unsigned int __handle_cnt; - -/* Haptic Plugin Interface */ -static void *dlopen_handle; -static const haptic_plugin_interface *plugin_intf; - -/* START of Static Function Section */ -static int __module_init(void) -{ - struct stat buf; - - if (stat(HAPTIC_MODULE_PATH, &buf)) { - HAPTIC_ERROR("file(%s) is not presents", HAPTIC_MODULE_PATH); - goto EXIT; - } - - dlopen_handle = dlopen(HAPTIC_MODULE_PATH, RTLD_NOW); - if (!dlopen_handle) { - HAPTIC_ERROR("dlopen failed: %s", dlerror()); - goto EXIT; - } - - const haptic_plugin_interface *(*get_haptic_plugin_interface) () = NULL; - get_haptic_plugin_interface = dlsym(dlopen_handle, "get_haptic_plugin_interface"); - if (!get_haptic_plugin_interface) { - HAPTIC_ERROR("dlsym failed : %s", dlerror()); - goto EXIT; - } - - plugin_intf = get_haptic_plugin_interface(); - if (!plugin_intf) { - HAPTIC_ERROR("get_haptic_plugin_interface() failed"); - goto EXIT; - } - - HAPTIC_LOG("This device can vibe"); - return 0; - -EXIT: - if (dlopen_handle) { - dlclose(dlopen_handle); - dlopen_handle = NULL; - } - - HAPTIC_LOG("This device can not vibe"); - return -1; -} - -static int __module_fini(void) -{ - if (dlopen_handle) { - dlclose(dlopen_handle); - dlopen_handle = NULL; - } - - HAPTIC_LOG("haptic module is released"); - return 0; -} - -static haptic_feedback_e __get_setting_feedback_level(void) -{ - int setting_fb_level; - - if (vconf_get_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, &setting_fb_level) < 0) { - setting_fb_level = SETTING_VIB_FEEDBACK_LEVEL3; - } - - switch (setting_fb_level) { - case SETTING_VIB_FEEDBACK_LEVEL0 : return HAPTIC_FEEDBACK_0; - case SETTING_VIB_FEEDBACK_LEVEL1 : return HAPTIC_FEEDBACK_1; - case SETTING_VIB_FEEDBACK_LEVEL2 : return HAPTIC_FEEDBACK_2; - case SETTING_VIB_FEEDBACK_LEVEL3 : return HAPTIC_FEEDBACK_3; - case SETTING_VIB_FEEDBACK_LEVEL4 : return HAPTIC_FEEDBACK_4; - case SETTING_VIB_FEEDBACK_LEVEL5 : return HAPTIC_FEEDBACK_5; - default: - break; - } - return -1; -} -/* END of Static Function Section */ - -API -int haptic_get_count(int *device_number) -{ - int ret; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_number == NULL) { - HAPTIC_ERROR("Invalid parameter : device_number(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_get_device_count) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_get_device_count == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_get_device_count(device_number); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_get_device_count is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_open(haptic_device_e device_index, haptic_device_h *device_handle) -{ - int ret; - int handle; - - if (!(device_index == HAPTIC_DEVICE_0 || device_index == HAPTIC_DEVICE_1 || device_index == HAPTIC_DEVICE_ALL)) { - HAPTIC_ERROR("Invalid parameter : device_index(%d)", device_index); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (device_handle == NULL) { - HAPTIC_ERROR("Invalid parameter : device_handle(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (__handle_cnt == 0) { - ret = __module_init(); - if (ret < 0) { - HAPTIC_ERROR("__module_init failed"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - } - - if (!plugin_intf || !plugin_intf->haptic_internal_open_device) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_open_device == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_open_device((int)device_index, &handle); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_open_device is failed : %d", ret); - __module_fini(); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - __handle_cnt++; - *device_handle = (haptic_device_h)handle; - return HAPTIC_ERROR_NONE; -} - -API -int haptic_close(haptic_device_h device_handle) -{ - int ret; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_close_device) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_close_device == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_close_device((int)device_handle); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_close_device is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - __handle_cnt--; - if (__handle_cnt == 0) { - __module_fini(); - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_vibrate_monotone(haptic_device_h device_handle, int duration, haptic_effect_h *effect_handle) -{ - return haptic_vibrate_monotone_with_detail(device_handle, - duration, - HAPTIC_FEEDBACK_AUTO, - HAPTIC_PRIORITY_MIN, - effect_handle); -} - -API -int haptic_vibrate_monotone_with_detail(haptic_device_h device_handle, - int duration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle) -{ - int ret; - int handle; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (duration < 0) { - HAPTIC_ERROR("Invalid parameter : duration(%d)", duration); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (feedback < HAPTIC_FEEDBACK_0 || feedback > HAPTIC_FEEDBACK_AUTO) { - HAPTIC_ERROR("Invalid parameter : feedback(%d)", feedback); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (priority < HAPTIC_PRIORITY_MIN || priority > HAPTIC_PRIORITY_HIGH) { - HAPTIC_ERROR("Invalid parameter : priority(%d)", priority); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_vibrate_monotone) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_vibrate_monotone == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - if (feedback == HAPTIC_FEEDBACK_AUTO) { - HAPTIC_LOG("Auto feedback level, feedback value will be changed"); - feedback = __get_setting_feedback_level(); - } - - HAPTIC_LOG("duration : %d, feedback : %d, priority : %d", duration, feedback, priority); - ret = plugin_intf->haptic_internal_vibrate_monotone((int)device_handle, duration, feedback, priority, &handle); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_vibrate_monotone is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - if (effect_handle != NULL) { - *effect_handle = (haptic_effect_h)handle; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_vibrate_file(haptic_device_h device_handle, const char *file_path, haptic_effect_h *effect_handle) -{ - return haptic_vibrate_file_with_detail(device_handle, - file_path, - HAPTIC_ITERATION_ONCE, - HAPTIC_FEEDBACK_AUTO, - HAPTIC_PRIORITY_MIN, - effect_handle); -} - -API -int haptic_vibrate_file_with_detail(haptic_device_h device_handle, - const char *file_path, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle) -{ - int ret; - int handle; - struct stat buf; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (file_path == NULL) { - HAPTIC_ERROR("Invalid parameter : file_path(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (stat(file_path, &buf)) { - HAPTIC_ERROR("Invalid parameter : (%s) is not presents", file_path); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (iteration < HAPTIC_ITERATION_ONCE || iteration > HAPTIC_ITERATION_INFINITE) { - HAPTIC_ERROR("Invalid parameter : iteration(%d)", iteration); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (feedback < HAPTIC_FEEDBACK_0 || feedback > HAPTIC_FEEDBACK_AUTO) { - HAPTIC_ERROR("Invalid parameter : feedback(%d)", feedback); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (priority < HAPTIC_PRIORITY_MIN || priority > HAPTIC_PRIORITY_HIGH) { - HAPTIC_ERROR("Invalid parameter : priority(%d)", priority); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_vibrate_file) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_vibrate_file == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - if (feedback == HAPTIC_FEEDBACK_AUTO) { - HAPTIC_LOG("Auto feedback level, feedback value will be changed"); - feedback = __get_setting_feedback_level(); - } - - HAPTIC_LOG("file_path : %s, iteration : %d, feedback : %d, priority : %d", file_path, iteration, feedback, priority); - ret = plugin_intf->haptic_internal_vibrate_file((int)device_handle, file_path, iteration, feedback, priority, &handle); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_vibrate_file is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - if (effect_handle != NULL) { - *effect_handle = (haptic_effect_h)handle; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_vibrate_buffer(haptic_device_h device_handle, const unsigned char *vibe_buffer, haptic_effect_h *effect_handle) -{ - return haptic_vibrate_buffers_with_detail(device_handle, - vibe_buffer, - 0, - HAPTIC_ITERATION_ONCE, - HAPTIC_FEEDBACK_AUTO, - HAPTIC_PRIORITY_MIN, - effect_handle); -} - -API -int haptic_vibrate_buffer_with_detail(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle) -{ - return haptic_vibrate_buffers_with_detail(device_handle, - vibe_buffer, - 0, - iteration, - feedback, - priority, - effect_handle); -} - -API -int haptic_vibrate_buffers(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - int size, - haptic_effect_h *effect_handle) -{ - return haptic_vibrate_buffers_with_detail(device_handle, - vibe_buffer, - size, - HAPTIC_ITERATION_ONCE, - HAPTIC_FEEDBACK_AUTO, - HAPTIC_PRIORITY_MIN, - effect_handle); -} - -API -int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle, - const unsigned char *vibe_buffer, - int size, - haptic_iteration_e iteration, - haptic_feedback_e feedback, - haptic_priority_e priority, - haptic_effect_h *effect_handle) -{ - int ret; - int handle; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (vibe_buffer == NULL) { - HAPTIC_ERROR("Invalid parameter : vibe_buffer(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (iteration < HAPTIC_ITERATION_ONCE || iteration > HAPTIC_ITERATION_INFINITE) { - HAPTIC_ERROR("Invalid parameter : iteration(%d)", iteration); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (feedback < HAPTIC_FEEDBACK_0 || feedback > HAPTIC_FEEDBACK_AUTO) { - HAPTIC_ERROR("Invalid parameter : feedback(%d)", feedback); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (priority < HAPTIC_PRIORITY_MIN || priority > HAPTIC_PRIORITY_HIGH) { - HAPTIC_ERROR("Invalid parameter : priority(%d)", priority); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_vibrate_buffer) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_vibrate_buffer == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - if (feedback == HAPTIC_FEEDBACK_AUTO) { - HAPTIC_LOG("Auto feedback level, feedback value will be changed"); - feedback = __get_setting_feedback_level(); - } - - HAPTIC_LOG("iteration : %d, feedback : %d, priority : %d", iteration, feedback, priority); - ret = plugin_intf->haptic_internal_vibrate_buffer((int)device_handle, vibe_buffer, iteration, feedback, priority, &handle); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_vibrate_buffer is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - if (effect_handle != NULL) { - *effect_handle = (haptic_effect_h)handle; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_stop_effect(haptic_device_h device_handle, haptic_effect_h effect_handle) -{ - return haptic_stop_all_effects(device_handle); -} - -API -int haptic_stop_all_effects(haptic_device_h device_handle) -{ - int ret; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_stop_all_effects) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_stop_all_effects == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_stop_all_effects((int)device_handle); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_stop_all_effects is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h effect_handle, haptic_state_e *effect_state) -{ - int ret; - int state; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (effect_handle < 0) { - HAPTIC_ERROR("Invalid parameter : effect_handle(%d)", effect_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (effect_state == NULL) { - HAPTIC_ERROR("Invalid parameter : effect_state(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_get_effect_state) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_get_effect_state == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_get_effect_state((int)device_handle, (int)effect_handle, &state); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_get_effect_state is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - *effect_state = (haptic_state_e)state; - return HAPTIC_ERROR_NONE; -} - -API -int haptic_create_effect(unsigned char *vibe_buffer, - int max_bufsize, - haptic_effect_element_s *elem_arr, - int max_elemcnt) -{ - int ret, i, level; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (vibe_buffer == NULL) { - HAPTIC_ERROR("Invalid parameter : vibe_buffer(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (max_bufsize <= 0) { - HAPTIC_ERROR("Invalid parameter : max_bufsize(%d)", max_bufsize); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (elem_arr == NULL) { - HAPTIC_ERROR("Invalid parameter : elem_arr(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (max_elemcnt <= 0) { - HAPTIC_ERROR("Invalid parameter : max_elemcnt(%d)", max_elemcnt); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_create_effect) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_create_effect == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - for (i = 0; i < max_elemcnt; i++) { - if (elem_arr[i].haptic_level == HAPTIC_FEEDBACK_AUTO) { - vconf_get_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, &level); - elem_arr[i].haptic_level = level*20; - } - } - - ret = plugin_intf->haptic_internal_create_effect(vibe_buffer, max_bufsize, (haptic_module_effect_element*)elem_arr, max_elemcnt); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_create_effect is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_save_effect(const unsigned char *vibe_buffer, - int max_bufsize, - const char *file_path) -{ - int ret; - struct stat buf; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (vibe_buffer == NULL) { - HAPTIC_ERROR("Invalid parameter : vibe_buffer(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (max_bufsize <= 0) { - HAPTIC_ERROR("Invalid parameter : max_bufsize(%d)", max_bufsize); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (file_path == NULL) { - HAPTIC_ERROR("Invalid parameter : file_path(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!stat(file_path, &buf)) { - HAPTIC_ERROR("Already exist : file_path(%s)", file_path); - return HAPTIC_ERROR_FILE_EXISTS; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_save_effect) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_save_effect == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - HAPTIC_LOG("file path : %s", file_path); - ret = plugin_intf->haptic_internal_save_effect(vibe_buffer, max_bufsize, file_path); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_save_effect is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - return HAPTIC_ERROR_NONE; -} - -API -int haptic_get_file_duration(haptic_device_h device_handle, const char *file_path, int *file_duration) -{ - int ret; - struct stat buf; - int duration; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (file_path == NULL) { - HAPTIC_ERROR("Invalid parameter : file_path(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (stat(file_path, &buf)) { - HAPTIC_ERROR("Invalid parameter : (%s) is not presents", file_path); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (file_duration == NULL) { - HAPTIC_ERROR("Invalid parameter : file_duration(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_get_file_duration) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_get_file_duration == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_get_file_duration((int)device_handle, file_path, &duration); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_stop_get_file_duration is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - *file_duration = duration; - return HAPTIC_ERROR_NONE; -} - -API -int haptic_get_buffer_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int *buffer_duration) -{ - return haptic_get_buffers_duration(device_handle, - vibe_buffer, - 0, - buffer_duration); -} - -API -API int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigned char *vibe_buffer, int size, int *buffer_duration) -{ - int ret; - int duration; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (device_handle < 0) { - HAPTIC_ERROR("Invalid parameter : device_handle(%d)", device_handle); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (vibe_buffer == NULL) { - HAPTIC_ERROR("Invalid parameter : vibe_buffer(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (buffer_duration == NULL) { - HAPTIC_ERROR("Invalid parameter : buffer_duration(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_get_buffer_duration) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_get_buffer_duration == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - ret = plugin_intf->haptic_internal_get_buffer_duration((int)device_handle, vibe_buffer, &duration); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_stop_get_buffer_duration is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - *buffer_duration = duration; - return HAPTIC_ERROR_NONE; -} - -API -int haptic_save_led(const unsigned char *vibe_buffer, int max_bufsize, const char *file_path) -{ - int ret; - struct stat buf; - - if (__handle_cnt == 0) { - HAPTIC_ERROR("Not initialized"); - return HAPTIC_ERROR_NOT_INITIALIZED; - } - - if (vibe_buffer == NULL) { - HAPTIC_ERROR("Invalid parameter : vibe_buffer(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (max_bufsize <= 0) { - HAPTIC_ERROR("Invalid parameter : max_bufsize(%d)", max_bufsize); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (file_path == NULL) { - HAPTIC_ERROR("Invalid parameter : file_path(NULL)"); - return HAPTIC_ERROR_INVALID_PARAMETER; - } - - if (!stat(file_path, &buf)) { - HAPTIC_ERROR("Already exist : file_path(%s)", file_path); - return HAPTIC_ERROR_FILE_EXISTS; - } - - if (!plugin_intf || !plugin_intf->haptic_internal_convert_binary) { - HAPTIC_ERROR("plugin_intf == NULL || plugin_intf->haptic_internal_convert_binary == NULL"); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - HAPTIC_LOG("file path : %s", file_path); - ret = plugin_intf->haptic_internal_convert_binary(vibe_buffer, max_bufsize, file_path); - if (ret != HAPTIC_MODULE_ERROR_NONE) { - HAPTIC_ERROR("haptic_internal_save_effect is failed : %d", ret); - return HAPTIC_ERROR_OPERATION_FAILED; - } - - return HAPTIC_ERROR_NONE; -} diff --git a/src/libslp-pm/CMakeLists.txt b/src/libslp-pm/CMakeLists.txt deleted file mode 100644 index e11fb62a..00000000 --- a/src/libslp-pm/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(pmapi C) - -SET(SRCS pm.c) -SET(HEADERS pmapi.h pmapi_managed.h SLP_pm_PG.h) - -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") -SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") -SET(VERSION 1.2) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) - -FOREACH(flag ${pkg_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") - -SET(CMAKE_LDFLAGS "-Wl,zdefs") -ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} libdeviced) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) - -CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) - -FOREACH(hfile ${HEADERS}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) -ENDFOREACH(hfile) diff --git a/src/libslp-pm/SLP_pm_PG.h b/src/libslp-pm/SLP_pm_PG.h deleted file mode 100644 index 2dfd57c9..00000000 --- a/src/libslp-pm/SLP_pm_PG.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * libslp-pm - * - * 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_PM Power Manager - * @{ - -<h1 class="pg">Introduction</h1> - -<h2 class="pg">Purpose</h2> -The purpose of this document is to describe how applications can use Power Manager APIs to save system power consumption. -This document gives programming guidelines to application engineers. - -<h2 class="pg">Scope</h2> -The scope of this document is limited to Power Manager API usage. - -<br> -<h1 class="pg">Power Manager Architecture</h1> -The Power Manager (PM) consists of a client API library and a Power Manager daemon. - -<h3 class="pg" align="center">Power Manager Architecture</h3> -@image html SLP_pm_PG_architecture.png -<br> -Power Manager daemon controls a kernel power management module and peripheral device drivers to save system power consumption. -It manages the system power states and makes state transitions according to the events. <br> -There are four power states ? Normal (i.e. LCD on), LCD dimming, LCD off and Sleep. - -<h3 class="pg" align="center">Power Manager State Diagram</h3> -@image html SLP_pm_PG_state_diagram.png - -Applications can put conditions on specific state transitions. For example, Video Player applications do not want the Power Manager -to allow the LCD to be in a dimming state or to turn off the LCD backlight. -For this purpose, Video Player applications can use Power Manager APIs to send the condition to Power Manager. - -<h1 class="pg">Power Manager Features</h1> -- There are four power states, Normal(i.e. LCD on), LCD dimming, LCD off and Sleep. -- If there is no user input for a certain time, PM changes the state of PM to a state that has lower power consumption. -- When user input or another system interrupt occurs, PM rolls the state back immediately. -- However, some applications may want PM not to change the state, for example music players that do not want to suspend, -can sustain PM in the state required by using the pm_lock_power_state() API. - -<h1 class="pg">Power Manager Funtions</h1> - -<h2 class="pg">Power Manager API Introduction</h2> -<i><b>API : pm_lock_state</b></i> -<br><b>Parameter In :</b> unsigned int state, unsigned int flag, unsigned int timeout -<br><b>Return :</b> int -<br><b>Functionality :</b> This API is used to lock a particular power-state as the current power-state.<br> -The parameter state specifies the power state which you want to lock LCD_NORMAL, LCD_DIM, LCD_OFF. \n -The second parameter Flag is set if you want to go the requested lock state directly.\n -The third parameter timeout specifies lock-timeout in milliseconds. -If the value 0 is selected, the power state remains locked until pm_unlock_state is called.<br> -This function returns 0 on success and a negative value (-1) on failure. -<br><br> -<i><b>API : pm_unlock_state</b></i> -<br><b>Parameter In :</b> unsigned int state, unsigned int flag -<br><b>Return :</b> int -<br><b>Functionality :</b> This API is used to Unlock the power state.<br> -The parameter state specifies the power state which you want to unlock .Some examples are LCD_NORMAL, LCD_DIM, LCD_OFF.<br> -The second parameter flag is set if you want to go to the requested state directly after unlocking. <br> -PM_SLEEP_MARGIN - If the current status is lcd off, power-manager reset timer to 5 second. If the current status is not lcd off, power-manager uses the existing timer. <br> -PM_RESET_TIMER - Power-manager resets timer. (lcd normal : reset timer to predfined value which is set in setting module, lcd dim or off : reset timer to 5 seconds)<br> -PM_KEEP_TIMER - Power-manager uses the existing timer (if timer is already expired, pwoer-manager changes the status) <br> -This is valid only when the current state transition was blocked by the locking and this function call releases the blocking.<br> -This function returns 0 on success and a negative value (-1) on failure. -<br><br> -<i><b>API : pm_change_state</b></i> -<br><b>Parameter In :</b> unsigned int (power state) -<br><b>Return :</b> int -<br><b>Functionality :</b> This API is used to change the power manager state by force.<br> -This function returns 0 on success, -1 if failed. - -<b>Power state:</b> -@code -// POWER STATES -#define LCD_NORMAL 0x1 // NORMAL state -#define LCD_DIM 0x2 // LCD dimming state -#define LCD_OFF 0x4 // LCD off state -#define SUSPEND 0x8 // Sleep state -@endcode - -<h2 class="pg">Sample Code</h2> -@code -#include <pmapi.h> -int main() -{ - int result; - - // Lock current state as LCD_NORMAL - result = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0); - if( result < 0 ) { - printf("[ERROR] return value result =%d, \n",result); - } - else - printf("[SUCCESS]return value result =%d \n",result); - - // Do something here - - //Un-lock NORMAL state so that power state change can occur with system-events - - result = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER); - if( result < 0 ) { - printf("[ERROR] return value result =%d, \n",result); - } - else - printf("[SUCCESS]return value result =%d \n",result); - - // change the state into LCD ON - result = pm_change_state(LCD_NORMAL); - if( result < 0 ) - printf("[ERROR] return value result =%d, \n",result); - else - printf("[SUCCESS]return value result =%d \n",result); - - return 0; -} -@endcode - - @} -**/ diff --git a/src/libslp-pm/pm.c b/src/libslp-pm/pm.c deleted file mode 100644 index 0ffa9a2b..00000000 --- a/src/libslp-pm/pm.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * libslp-pm - * - * 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 <dd-display.h> -#include "pmapi.h" -#include "pm.h" - -API int pm_change_state(unsigned int s_bits) -{ - return display_change_state(s_bits); -} - -API int pm_lock_state(unsigned int s_bits, unsigned int flag, - unsigned int timeout) -{ - return display_lock_state(s_bits, flag, timeout); -} - -API int pm_unlock_state(unsigned int s_bits, unsigned int flag) -{ - return display_unlock_state(s_bits, flag); -} - diff --git a/src/libslp-pm/pm.h b/src/libslp-pm/pm.h deleted file mode 100644 index 77d5ab58..00000000 --- a/src/libslp-pm/pm.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * libslp-pm - * - * 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 __POWER_MANAGER_LIBRARY_I_H__ -#define __POWER_MANAGER_LIBRARY_I_H__ - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif - -#if defined(ENABLE_DLOG_OUT) -# define LOG_TAG "PMAPI" -# include <dlog.h> -# define ERR SLOGE -#else -# define ERR perror -#endif - -#endif /* __POWER_MANAGER_LIBRARY_I_H__ */ diff --git a/src/libslp-pm/pmapi.h b/src/libslp-pm/pmapi.h deleted file mode 100644 index 881cc1b9..00000000 --- a/src/libslp-pm/pmapi.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * libslp-pm - * - * 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 __POWER_MANAGER_LIBRARY_H__ -#define __POWER_MANAGER_LIBRARY_H__ - -#include "pmapi_managed.h" - -/** - * @defgroup POWER_MANAGER Power manager library - * @ingroup SYSTEM_FRAMEWORK - * @brief Power manager control API library - * - * @open - * @addtogroup POWER_MANAGER - * @{ - * This library provides APIs to lock/unlock the power state of the system. - * Power Manager controls the power state as following. - * @image html power-manager-fsm.bmp "Fig. 1 State Diagram of Power Manager - * <br> If there is no user input for a certain time, PM changes the power state - * that has lower power consumption. <br> When the user input or other system interrupt occurs, - * PM rolls the state back immediately.<br> If applications or other frameworks want to stop - * enter the specific state of power manager, use pm_lock_state() and pm_unlock_state() - * <br> Be careful! A caller process should unlock the power state after locking without timeout. - * <br> If you want to stay the LCD normal state, you can use - * @li @c pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0) - * <p><br> After finishing your job with locking, call - * @li @c pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER) - * <p><br> Additionally, you can use the timeout for lock the state. - * If timeout is set, caller process doesn't need to call the unlock API. - * But the process should be alive. - * If caller process is dead, lock condition would be drop by the power manager. - * <p><br> Here is sample codes - * @code - -#include "pmapi.h" -int main(int argc, char** argv) -{ - int result; - - printf("=========================================\n"); - printf("= Lock / Unlock to transit a power manager state =\n"); - printf("=========================================\n"); - - result = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW,0); //Lock on lcd-off until explicit unlock. - if (!result) - printf("SUCCESS"); - else - printf("FAILED"); - - // DO something. - - result = pm_unlock_state(LCD_NORMAL,PM_RESET_TIMER); //Unlock - if (!result) - printf("SUCCESS"); - else - printf("FAILED"); - - result = pm_lock_state(LCD_OFF,STAY_CUR_STATE, 5000); // Lock on lcd-off during 5 seconds. - if (!result) - printf("SUCCESS"); - else - printf("FAILED"); - - // DO something. - sleep(10); - - return 0; -} - * @endcode - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __DD_DISPLAY_H__ -#define LCD_NORMAL 0x1 /**< NORMAL state */ -#define LCD_DIM 0x2 /**< LCD dimming state */ -#define LCD_OFF 0x4 /**< LCD off state */ -#define SUSPEND 0x8 /**< Sleep state */ -#define POWER_OFF 0x16 /**< Sleep state */ -#define SETALL (LCD_DIM | LCD_OFF | LCD_NORMAL) /*< select all state - not supported yet */ - -/* parameters for pm_lock_state() */ -#define STAY_CUR_STATE 0x0 -#define GOTO_STATE_NOW 0x1 -#define HOLD_KEY_BLOCK 0x2 - -/* paramters for pm_unlcok_state() - details are described at 162 line */ -#define PM_SLEEP_MARGIN 0x0 /**< keep guard time for unlock */ -#define PM_RESET_TIMER 0x1 /**< reset timer for unlock */ -#define PM_KEEP_TIMER 0x2 /**< keep timer for unlock */ -#endif - -/** - * @fn int pm_lock_state (unsigned int state, - * unsigned int flag, - * unsigned int timeout); - * @brief This API is used to lock a particular power-state as the current power-state.\n - * The parameter state specifies the power state which you want to lock LCD_NORMAL, LCD_DIM, LCD_OFF. \n - * The second parameter Flag is set if you want to go the requested lock state directly.\n - * The third parameter timeout specifies lock-timeout in milliseconds. - * If the value 0 is selected, the power state remains locked until pm_unlock_state is called. - * @param[in] state target power state which you want to lock - LCD_NORMAL, LCD_DIM, LCD_OFF - * @param[in] flag set if you want to go the lock state directly - * GOTO_STATE_NOW - State is changed directly you want to lock. - * STAY_CUR_STATE - State is not changed directly and phone stay current state until timeout expired. - * (Default if there is no value in flag.) - * HOLD_KEY_BLOCK - Hold key is blocked during locking LCD_NORMAL or LCD_DIM. - * Then LCD state transition to LCD_OFF is blocked. - * If this flag is not set, phone state is lcd off after pressing hold key. - * GOTO_STATE_NOW and STAY_CUR_STATE can't be applied at the same time. - * @param[in] timeout lock-timeout in miliseconds. - * 0 is always lock until calling pm_unlock_state - * If you call this function with same state in duplicate, - * only last one will be processed and others are ignored. - * @return 0 on success, -1 if failed - * @see pm_unlock_state(), pm_change_state() - * @par Example - * @code - * ... - * // Lock current state as LCD_NORMAL - * result = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, SET_TIMEOUT); - * if( result < 0 ) - * printf("[ERROR] return value result =%d, \n",result); - * else - * printf("[SUCCESS]return value result =%d \n",result); - * ... - * @endcode - */ - int pm_lock_state(unsigned int, unsigned int, unsigned int); - -/** - * @fn int pm_unlock_state (unsigned int state, - * unsigned int flag) - * @brief This API is used to Unlock the power state. \n - * The parameter state specifies the power state which you want to unlock. - * Some examples are LCD_NORMAL, LCD_DIM, LCD_OFF.\n - * The second parameter flag is set if you want to go to the requested state directly after unlocking. (NOT SUPPOERTED YET) - * This is valid only when the current state transition was blocked by the locking and this function call releases the blocking. - * @param[in] state target power state which you want to unlock - * @param[in] flag set timer which is going to the next state after unlocking - * PM_SLEEP_MARGIN - If the current status is lcd off, pm reset timer to 5 second. If the current status is not lcd off, pm pm uses the existing timer. - * PM_RESET_TIMER - Power-manager resets timer. (lcd normal : reset timer to predfined value which is set in setting module, lcd dim or off : reset timer to 5 seconds) - * PM_KEEP_TIMER - Power-manager uses the existing timer (if timer is already expired, pm changes the status) <br> - * @return 0 on success, -1 if failed - * @see pn_lock_state(), pm_change_state() - * @par Example - * @code - * ... - * //Un-lock NORMAL state so that power state change can occur with system-events - * result = pm_unlock_state(LCD_NORMAL,PM_RESET_TIMER); - * if( result < 0 ) - * printf("[ERROR] return value result =%d, \n",result); - * else - * printf("[SUCCESS]return value result =%d \n",result); - * ... - * @endcode - */ - int pm_unlock_state(unsigned int, unsigned int); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif /* __POWER_MANAGER_LIBRARY_H__ */ - diff --git a/src/libslp-pm/pmapi.pc.in b/src/libslp-pm/pmapi.pc.in deleted file mode 100644 index c030919c..00000000 --- a/src/libslp-pm/pmapi.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDEDIR@ - -Name: libpmapi -Description: power manager library -Version: @VERSION@ -Requires: -Libs: -L${libdir} -lpmapi -Cflags: -I${includedir} diff --git a/src/libslp-pm/pmapi_managed.h b/src/libslp-pm/pmapi_managed.h deleted file mode 100644 index 4deb80d1..00000000 --- a/src/libslp-pm/pmapi_managed.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * libslp-pm - * - * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Seunghun Pi <sh.pi@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 __POWER_MANAGER_LIBRARY_MANAGED_H__ -#define __POWER_MANAGER_LIBRARY_MANAGED_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @fn int pm_change_state(unsigned int state); - * @brief This API is used to change the power manager state by force. - * @param[in] state power manager state - LCD_NORMAL, LCD_DIM, LCD_OFF - * @return 0 on success, -1 if failed. - * @see pm_lock_state(), pm_unlock_state() - * @pat Example - * @code - * ... - * result = pm_change_state(LCD_OFF); - * if( result < 0 ) - * printf("[ERROR] return value result =%d, \n",result); - * else - * printf("[SUCCESS]return value result =%d \n",result); - * ... - * @endcode - */ - int pm_change_state(unsigned int); - -#ifdef __cplusplus -} -#endif -#endif /* __POWER_MANAGER_LIBRARY_MANAGED_H__ */ diff --git a/src/libsysman/CMakeLists.txt b/src/libsysman/CMakeLists.txt deleted file mode 100755 index 65862c3d..00000000 --- a/src/libsysman/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(sysman C) - -SET(SRCS - sysnoti.c - sysconf.c - sysman-util.c ) - -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -SET(EXEC_PREFIX "\${prefix}") -SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") -SET(VERSION_MAJOR 0) -SET(VERSION "${VERSION_MAJOR}.2.0") - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog libtzplatform-config) - -FOREACH(flag ${pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") -ADD_DEFINITIONS("-DSLP_DEBUG -DENABLE_DLOG_OUT") - -SET(CMAKE_LDFLAGS "-Wl,zdefs") -ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl libdeviced) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) - -CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sysman.h DESTINATION include/${PROJECT_NAME}) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sysman_managed.h DESTINATION include/${PROJECT_NAME}) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sysman-internal.h DESTINATION include/${PROJECT_NAME}) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/SLP_sysman_PG.h DESTINATION include/${PROJECT_NAME}) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/src/libsysman/SLP_sysman_PG.h b/src/libsysman/SLP_sysman_PG.h deleted file mode 100644 index 1c036ae3..00000000 --- a/src/libsysman/SLP_sysman_PG.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/** - * - * @ingroup SLP_PG - * @defgroup SLP_PG_SYSMAN System Manager - * @{ - -<h1 class="pg">Introduction</h1> - -<h2 class="pg">Purpose</h2> -The purpose of the document is to describe how applications can use the System Manager APIs. This document gives programming guidelines to application engineers. - -<h2 class="pg">Scope</h2> -The scope of this document is limited to System Manager API usage. - -<br> -<h1 class="pg">System Manager Library Overview</h1> -Sysman library provides convenience functions to get data about processes or to run processes. -It reads the proc file system to check whether a process exists or not, gets a command line and execution path, gets the pid of a process etc. -Some APIs of the sysman library use some device files also. If processes which call APIs of sysman library don't have the correct permission, they will fail. -Most functions return -1 on failure and the errno will be set.<br> -Please refer the manual pages of proc(Linux Programmer's Manual - PROC(5) http://www.kernel.org/doc/man-pages/man5/proc.5.html) -or errno(Linux Programmer's Manual - ERRNO(3) http://www.kernel.org/doc/man-pages/man3/errno.3.html) for more details. - -<h1 class="pg">System Manager Funtions</h1> - -<h2 class="pg">System Manager APIs</h2> -<i><b>API : sysman_get_pid</b></i> -<br><b>Parameter In :</b> const char *execpath -<br><b>Return :</b> int -<br><b>Functionality :</b> This API is used to get the pid of the process which has the specified execpath.<br> -Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. -If there is no process that has same execpath in /proc/{pid}/cmdline, it will return (-1). -<br><br> -<i><b>API : sysman_get_cmdline_name</b></i> -<br><b>Parameter In :</b> pid_t pid -<br><b>Parameter Out :</b> char *cmdline -<br><b>Parameter In :</b> size_t cmdline_size -<br><b>Return :</b> int -<br><b>Functionality :</b>This API is used to get the file name in the command line.<br> -Caller process MUST allocate enough memory for the cmdline parameter. Its size should be assigned to cmdline_size.<br> -Internally it reads the 1st argument of /proc/{pid}/cmdline and copies it to cmdline.<br> -The function returns 0 on success and a negative value (-1) on failure. -<br><br> -<i><b>API : sysman_get_apppath</b></i> -<br><b>Parameter In :</b> pid_t pid -<br><b>Parameter Out :</b> char *app_path -<br><b>Parameter In :</b> size_t app_path_size -<br><b>Return :</b> int -<br><b>Functionality :</b> This API is used to get the execution path of the process specified by the pid parameter.<br> -Caller process MUST allocate enough memory for the app_path parameter. Its size should be assigned to app_path_size.<br> -Internally it reads a link of /proc/{pid}/exe and copies the path to app_path. <br> -The function returns 0 on success and a negative value (-1) on failure. -<br><br> -<i><b>API : sysconf_set_mempolicy</b></i> -<br><b>Parameter In :</b> enum mem_policy mempol -<br><b>Return :</b> int -<br><b>Functionality :</b> This API is used to set the policy of the caller process for the situation of low available memory.<br> -The function returns 0 on success and a negative value (-1) on failure.<br> -If the caller process has no permission, it will be failed. - -<b>Enumerate values</b> -@code -enum mem_policy { - OOM_LIKELY , // For micelloneous applications - OOM_NORMAL , // For fundamental applications - OOM_IGNORE // For daemon -}; -@endcode - - @} -**/ diff --git a/src/libsysman/sysconf.c b/src/libsysman/sysconf.c deleted file mode 100644 index 726097e2..00000000 --- a/src/libsysman/sysconf.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * deviced - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <stdio.h> -#include <unistd.h> -#include <dd-deviced.h> - -#include "sysman-priv.h" - -API int sysconf_set_mempolicy_bypid(int pid, enum mem_policy mempol) -{ - ERR("Don't support this api anymore. Please use deviced api"); - return -1; -} - -API int sysconf_set_mempolicy(enum mem_policy mempol) -{ - ERR("Don't support this api anymore. Please use deviced api"); - return -1; -} - -API int sysconf_set_vip(int pid) -{ - return deviced_conf_set_vip(pid); -} - -API int sysconf_is_vip(int pid) -{ - return deviced_conf_is_vip(pid); -} - -API int sysconf_set_permanent_bypid(int pid) -{ - return deviced_conf_set_permanent_bypid(pid); -} - -API int sysconf_set_permanent() -{ - pid_t pid = getpid(); - return deviced_conf_set_permanent_bypid(pid); -} diff --git a/src/libsysman/sysman-internal.h b/src/libsysman/sysman-internal.h deleted file mode 100644 index 4f3130a7..00000000 --- a/src/libsysman/sysman-internal.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef ___SYSMAN_INTERNAL___ -#define ___SYSMAN_INTERNAL___ -#include <sys/types.h> -#include <sysman.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* This file will be removed */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif /* ___SYSMAN_INTERNAL___ */ diff --git a/src/libsysman/sysman-priv.h b/src/libsysman/sysman-priv.h deleted file mode 100644 index 203921d4..00000000 --- a/src/libsysman/sysman-priv.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef ___SYSNMAN_PRIVATE___ -#define ___SYSNMAN_PRIVATE___ - -#include <stdio.h> -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif - -#define __PRTD(fmt, arg...) \ - do { \ - if (getenv("SLP_DEBUG")) { \ - fprintf(stdout, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \ - } \ - } while (0) -#define _NOUT(fmt, arg...) do { } while (0) - -#ifdef SLP_DEBUG -# define DBG _PRTD -#else -# define DBG _NOUT -#endif - -#define ENABLE_DLOG_OUT 1 -#ifdef ENABLE_DLOG_OUT -# define LOG_TAG "LIBSYSMAN" -# include <dlog.h> -# define _PRTD SLOGD -# define ERR SLOGE -# define INFO SLOGI -#else -# define _PRTD __PRTD -# define ERR perror -# define INFO(fmt, arg...) \ - do { fprintf(stdout, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); } while (0) -#endif - -#define SYSMAN_MAXARG 16 -#define SYSMAN_MAXSTR 100 -#define BUFF_MAX 255 - - struct sysnoti { - int pid; - int cmd; - char *type; - char *path; - int argc; - char *argv[SYSMAN_MAXARG]; - }; - - int util_launch_app_cmd(const char *cmdline); - -#ifdef __cplusplus -} -#endif -#endif /* ___SYSMAN_PRIVATE___ */ diff --git a/src/libsysman/sysman-util.c b/src/libsysman/sysman-util.c deleted file mode 100644 index 91f52cd3..00000000 --- a/src/libsysman/sysman-util.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * deviced - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <stdio.h> -#include <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 <vconf.h> -#include "sysman.h" -#include "sysman-priv.h" - -API int sysman_get_pid(const char *execpath) -{ - DIR *dp; - struct dirent *dentry; - int pid = -1, fd; - char buf[BUFF_MAX]; - char buf2[BUFF_MAX]; - - dp = opendir("/proc"); - if (!dp) { - ERR("open /proc"); - return -1; - } - - while ((dentry = readdir(dp)) != NULL) { - if (!isdigit(dentry->d_name[0])) - continue; - - pid = atoi(dentry->d_name); - - snprintf(buf, BUFF_MAX, "/proc/%d/cmdline", pid); - fd = open(buf, O_RDONLY); - if (fd < 0) - continue; - if (read(fd, buf2, BUFF_MAX) < 0) { - close(fd); - continue; - } - close(fd); - - if (!strcmp(buf2, execpath)) { - closedir(dp); - return pid; - } - } - - errno = ESRCH; - closedir(dp); - return -1; -} - -API int sysman_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size) -{ - int fd, ret; - char buf[PATH_MAX + 1]; - char *filename; - - snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid); - fd = open(buf, O_RDONLY); - if (fd < 0) { - errno = ESRCH; - return -1; - } - - ret = read(fd, buf, PATH_MAX); - close(fd); - if (ret < 0) { - ret = -errno; - ERR("read() failed (%d)", ret); - return ret; - } - buf[PATH_MAX] = '\0'; - - filename = strrchr(buf, '/'); - if (filename == NULL) - filename = buf; - else - filename = filename + 1; - - if (cmdline_size < strlen(filename) + 1) { - errno = EOVERFLOW; - return -1; - } - - strncpy(cmdline, filename, cmdline_size - 1); - cmdline[cmdline_size - 1] = '\0'; - return 0; -} - -API int sysman_get_apppath(pid_t pid, char *app_path, size_t app_path_size) -{ - char buf[PATH_MAX]; - int ret; - - snprintf(buf, PATH_MAX, "/proc/%d/exe", pid); - if (app_path == NULL - || (ret = readlink(buf, app_path, app_path_size)) == -1) - return -1; - if (app_path_size == ret) { - app_path[ret - 1] = '\0'; - errno = EOVERFLOW; - return -1; - } - - app_path[ret] = '\0'; - return 0; -} - diff --git a/src/libsysman/sysman.h b/src/libsysman/sysman.h deleted file mode 100755 index 54ba0e87..00000000 --- a/src/libsysman/sysman.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef ___SYSMAN___ -#define ___SYSMAN___ - -#include <stdlib.h> -#include <string.h> -#include <sys/time.h> -#include <sys/types.h> -#include "sysman_managed.h" - -#ifndef DEPRECATED -#define DEPRECATED __attribute__((deprecated)) -#endif - -/** - * @file sysman.h - * @ingroup libsysman System Manager library - * @brief This library provides APIs related with memory, performance, processes, and so on. - * @author SLP2.0 - * @date 2010-01-24 - * @version 0.1 - */ - -/** - * @defgroup libsysman System Manager library - * @ingroup SYSTEM_FRAMEWORK - * @brief System manager library - * - * This library provides APIs related with memory, performance, processes, and so on. - * <br> Please use libslp-sysman-dev debian package and sysman.pc file for development. - * <br> And include sysman.h file at your source codes as following. - * @addtogroup libsysman System Manager library - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @breif Policy for low memory - */ - enum mem_policy { - OOM_LIKELY, /**< For miscellaneous applications */ - OOM_IGNORE /**< For daemons */ - }; - -/* sysman_util */ - -/** - * @fn int sysman_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size) - * @brief This API is used to get the file name of command line of the process from the proc fs. - * Caller process MUST allocate enough memory for the cmdline parameter. \n - * Its size should be assigned to cmdline_size. \n - * Internally it reads the 1st argument of /proc/{pid}/cmdline and copies it to cmdline. - * @param[in] pid pid of the process that you want to get the file name of command line - * @param[out] cmdline command line of the process that you want to get the file name <br> - * Callers should allocate memory to this parameter before calling this function. - * The allocated memory size must be large enough to store the file name. - * The result will include the terminating null byte('\0') at the end of the string. - * @return 0 on success, -1 if failed. If the size of cmdline is smaller than the result, - * it will return -1 and errno will be set as EOVERFLOW. - */ - int sysman_get_cmdline_name(pid_t pid, char *cmdline, - size_t cmdline_size); - -/** - * @fn char *sysman_get_apppath(pid_t pid, char *app_path, size_t app_path_size) - * @brief This API is used to get the execution path of the process specified by the pid parameter.\n - * Caller process MUST allocate enough memory for the app_path parameter. \n - * Its size should be assigned to app_path_size. \n - * Internally it reads a link of /proc/{pid}/exe and copies the path to app_path. - * @param[in] pid pid of the process that you want to get the executed path - * @param[out] app_path the executed file path of the process <br> - * Callers should allocate memory to this parameter before calling this function. - * The allocated memory size must be large enough to store the executed file path. - * The result will include the terminating null byte('\0') at the end of the string. - * @param[in] app_path_size allocated memory size of char *app_path - * @return 0 on success, -1 if failed. If the size of app_path is smaller than the result, - * it will return -1 and errno will be set as EOVERFLOW. - */ - int sysman_get_apppath(pid_t pid, char *app_path, size_t app_path_size); - -/* sysconf */ - -/** - * @fn int sysconf_set_mempolicy(enum mem_policy mempol) - * @brief This API is used to set the policy of the caller process when the phone has low available memory. - * @param[in] mempol oom adjust value which you want to set - * @return 0 on success, -1 if failed. - * @see sysconf_set_mempolicy_bypid() - */ - int sysconf_set_mempolicy(enum mem_policy mempol); - -/** - * @fn int sysconf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol) - * @brief This API is used to set the policy of the process when the phone has low available memory. - * @param[in] pid process id which you want to set - * @param[in] mempol oom adjust value which you want to set - * @return 0 on success, -1 if failed. - */ - int sysconf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol); - -/** - * @fn int sysconf_set_permanent(void) - * @brief This API is used to set itself as a permanent process.\n - * If the permanent process is dead, system server will relaunch the process automatically. - * @return 0 on success, -1 if failed. - * @see sysconf_set_permanent_bypid() - * @par Example - * @code - * ... - * ret = sysconf_set_permanent(); - * if( ret < 0 ) - * printf("Fail to set a process as permanent\n"); - * ... - * @endcode - */ - int sysconf_set_permanent(void); - -/** - * @fn int sysconf_set_permanent_bypid(pid_t pid) - * @brief This API is used to set a process which has pid as a permanent process.\n - * If the permanent process is dead, system server will relaunch the process automatically. - * @return 0 on success, -1 if failed. - * @see sysconf_set_permanent() - * @par Example - * @code - * ... - * ret = sysconf_set_permanent_bypid(pid); - * if( ret < 0 ) - * printf("Fail to set a process(%d) as permanent\n",pid); - * ... - * @endcode - */ - int sysconf_set_permanent_bypid(pid_t pid); - -/** - * @fn int sysconf_set_vip(pid_t pid) - * @brief This API is used to set a process which has pid as Very Important Process(VIP) .\n - * If the VIP process is dead, restarter program will be run. \n - * Restarter program may kill almost processes and run rc.local scripts again. - * @param[in] pid process id to be vip - * @return 0 on success, -1 if failed. - * @see sysconf_is_vip - * @par Example - * @code - * ... - * ret = sysconf_set_vip(pid); - * if( ret < 0 ) - * printf("Fail to set a process(%d) as VIP\n",pid); - * ... - * @endcode - */ - int sysconf_set_vip(pid_t pid); - -/** - * @fn int sysconf_is_vip(pid_t pid) - * @brief This API is used to verify that process which has pid is Very Important Process(VIP) or not. - * @param[in] pid process id to be vip - * @return 1 on success, 0 if failed. - * @see sysconf_set_vip - * @par Example - * @code - * ... - * ret = sysconf_is_vip(pid); - * if(ret) - * printf("process(%d) is Very Important Process\n",pid); - * ... - * @endcode - */ - int sysconf_is_vip(pid_t pid); - - int sysman_set_timezone(char *tzpath_str); - - int sysman_call_predef_action(const char *type, int num, ...); - - int sysman_inform_foregrd(void); - int sysman_inform_backgrd(void); - int sysman_inform_active(pid_t pid); - int sysman_inform_inactive(pid_t pid); - - int sysman_request_poweroff(void); - int sysman_request_entersleep(void); - int sysman_request_leavesleep(void); - int sysman_request_reboot(void); - - int sysman_request_set_cpu_max_frequency(int val); - int sysman_request_set_cpu_min_frequency(int val); - - int sysman_release_cpu_max_frequency(void); - int sysman_release_cpu_min_frequency(void); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif -#endif /* ___SYSMAN___ */ diff --git a/src/libsysman/sysman.pc.in b/src/libsysman/sysman.pc.in deleted file mode 100644 index 66412e41..00000000 --- a/src/libsysman/sysman.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -# Package Information for pkg-config - -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDEDIR@ - -Name: libsysman -Description: system manager interface library -Version: @VERSION@ -Requires: -Libs: -L${libdir} -lsysman -Cflags: -I${includedir} - - diff --git a/src/libsysman/sysman_managed.h b/src/libsysman/sysman_managed.h deleted file mode 100755 index f993ef68..00000000 --- a/src/libsysman/sysman_managed.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef ___SYSMAN_MANAGED___ -#define ___SYSMAN_MANAGED___ - -#include <sys/time.h> - -/** - * @file sysman_managed.h - * @ingroup libsysman System Manager library - * @brief This library provides APIs related with memory, performance, processes, and so on. - * @author SLP2.0 - * @date 2010-01-24 - * @version 0.1 - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @fn int sysman_get_pid(const char *execpath) - * @brief This API is used to get the pid of the process which has the specified execpath.\n - * Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. \n - * If there is no process that has same execpath in /proc/{pid}/cmdline, it will return -1. - * @param[in] execpath program path which you want to know whether it is run or not - * @return pid when the program is running, -1 if it is not. - */ - int sysman_get_pid(const char *execpath); - -/** - * @fn int sysman_set_datetime(time_t timet) - * @brief This API is used to set date time.\n - * Internally, this API call predefined action API. That is send a notify message. \n - * @param[in] time_t type of time which you want to set. - * @return pid when the program is running, -1 if param is less than 0 or when failed set datetime. - */ - int sysman_set_datetime(time_t timet); - -/** - * @brief This structure defines the data for receive result of mmc operations(mount/unmount/format) - */ - struct mmc_contents { - void (*mmc_cb) (int result, void* data);/**< user callback function for receive result of mmc operations */ - void* user_data;/**< input data for callback function's second-param(data) */ - }; - -/** - * @fn int sysman_request_mount_mmc(struct mmc_contents *mmc_data) - * @brief This API is used to mount mmc.\n - * Internally, this API call predefined action API. That is send a notify message. \n - * and when mount operation is finished, cb of mmc_content struct is called with cb's param1(result). \n - * means of param1 - 0(mount success) , -2(already mounted), non-zero except (-2) (mount fail) \n - * [mount fail value] \n - * 1 : operation not permmitted \n - * 2 : no such file or directory \n - * 6 : no such device or address \n - * 12 : out of memory \n - * 13 : A component of a path was not searchable \n - * 14 : bad address \n - * 15 : block device is requested \n - * 16 : device or resource busy \n - * 19 : filesystemtype not configured in the kernel \n - * 20 : target, or a prefix of source, is not a directory \n - * 22 : point does not exist \n - * 24 : table of dummy devices is full \n - * 36 : requested name is too long \n - * 40 : Too many links encountered during pathname resolution. \n - * Or, a move was attempted, while target is a descendant of source \n - * @param[in] mmc_data for receive result of mount operation - * @return non-zero on success message sending, -1 if message sending is failed. - */ - int sysman_request_mount_mmc(struct mmc_contents *mmc_data); - -/** - * @fn int sysman_request_unmount_mmc(struct mmc_contents *mmc_data,int option) - * @brief This API is used to unmount mmc.\n - * Internally, this API call predefined action API. That is send a notify message. \n - * and when unmount opeation is finished, cb of mmc_content struct is called with cb's param1(result). \n - * means of param1 - 0(unmount success) , non-zero(unmount fail) \n - * [unmount fail value] \n - * 1 : operation not permmitted \n - * 2 : no such file or directory \n - * 11 : try again \n - * 12 : out of memory \n - * 14 : bad address \n - * 16 : device or resource busy \n - * 22 : point does not exist \n - * 36 : requested name is too long \n - * @param[in] mmc_data for receive result of unmount operation - * @param[in] option is must be 1(just only support for force unmount) - * @return non-zero on success message sending, -1 if message sending is failed. - */ - int sysman_request_unmount_mmc(struct mmc_contents *mmc_data, int option); -/** - * @fn int sysman_request_format_mmc(struct mmc_contents *mmc_data) - * @brief This API is used to format mmc.\n - * Internally, this API call predefined action API. That is send a notify message. \n - * and when format opeation is finished, cb of mmc_content struct is called with cb's param1(result). \n - * means of param1 - 0(format success) , -1(format fail) - * @param[in] mmc_data for receive result of format operation - * @return non-zero on success message sending, -1 if message sending is failed. - */ - int sysman_request_format_mmc(struct mmc_contents *mmc_data); - -#ifdef __cplusplus -} -#endif -#endif /* ___SYSMAN_MANAGED___ */ diff --git a/src/libsysman/sysnoti.c b/src/libsysman/sysnoti.c deleted file mode 100644 index b2faead7..00000000 --- a/src/libsysman/sysnoti.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * deviced - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> -#include <stdio.h> -#include <unistd.h> -#include <stdarg.h> -#include <errno.h> -#include <dd-deviced.h> -#include <dd-mmc.h> - -#include "sysman-priv.h" - -enum sysnoti_cmd { - ADD_SYSMAN_ACTION, - CALL_SYSMAN_ACTION -}; - -#define SYSNOTI_SOCKET_PATH "/tmp/sn" -#define RETRY_READ_COUNT 10 - -static inline int send_int(int fd, int val) -{ - return write(fd, &val, sizeof(int)); -} - -static inline int send_str(int fd, char *str) -{ - int len = 0; - int ret; - - if (str == NULL) { - ret = write(fd, &len, sizeof(int)); - if (ret < 0) { - ret = -errno; - ERR("write() failed (%d)", ret); - } - return ret; - } - - len = strlen(str); - if (len > SYSMAN_MAXSTR) - len = SYSMAN_MAXSTR; - - ret = write(fd, &len, sizeof(int)); - if (ret < 0) { - ret = -errno; - ERR("write() failed (%d)", ret); - return ret; - } - - ret = write(fd, str, len); - if (ret < 0) { - ret = -errno; - ERR("write() failed (%d)", ret); - } - - return ret; -} - -static int sysnoti_send(struct sysnoti *msg) -{ - int client_len; - int client_sockfd; - int result; - int r; - int retry_count = 0; - struct sockaddr_un clientaddr; - int i; - - client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (client_sockfd == -1) { - ERR("%s: socket create failed\n", __FUNCTION__); - return -1; - } - bzero(&clientaddr, sizeof(clientaddr)); - clientaddr.sun_family = AF_UNIX; - strncpy(clientaddr.sun_path, SYSNOTI_SOCKET_PATH, sizeof(clientaddr.sun_path) - 1); - client_len = sizeof(clientaddr); - - if (connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) < - 0) { - ERR("%s: connect failed\n", __FUNCTION__); - close(client_sockfd); - return -1; - } - - send_int(client_sockfd, msg->pid); - send_int(client_sockfd, msg->cmd); - send_str(client_sockfd, msg->type); - send_str(client_sockfd, msg->path); - send_int(client_sockfd, msg->argc); - for (i = 0; i < msg->argc; i++) - send_str(client_sockfd, msg->argv[i]); - - while (retry_count < RETRY_READ_COUNT) { - r = read(client_sockfd, &result, sizeof(int)); - if (r < 0) { - if (errno == EINTR) { - ERR("Re-read for error(EINTR)"); - retry_count++; - continue; - } - ERR("Read fail for str length"); - result = -1; - break; - - } - break; - } - if (retry_count == RETRY_READ_COUNT) { - ERR("Read retry failed"); - } - - close(client_sockfd); - return result; -} - -API int sysman_call_predef_action(const char *type, int num, ...) -{ - struct sysnoti *msg; - int ret; - va_list argptr; - - int i; - char *args = NULL; - - if (type == NULL || num > SYSMAN_MAXARG) { - errno = EINVAL; - return -1; - } - - msg = malloc(sizeof(struct sysnoti)); - - if (msg == NULL) { - /* Do something for not enought memory error */ - return -1; - } - - msg->pid = getpid(); - msg->cmd = CALL_SYSMAN_ACTION; - msg->type = (char *)type; - msg->path = NULL; - - msg->argc = num; - va_start(argptr, num); - for (i = 0; i < num; i++) { - args = va_arg(argptr, char *); - msg->argv[i] = args; - } - va_end(argptr); - - ret = sysnoti_send(msg); - free(msg); - - return ret; -} - -API int sysman_inform_foregrd(void) -{ - return deviced_inform_foregrd(); -} - -API int sysman_inform_backgrd(void) -{ - return deviced_inform_backgrd(); -} - -API int sysman_inform_active(pid_t pid) -{ - return deviced_inform_active(pid); -} - -API int sysman_inform_inactive(pid_t pid) -{ - return deviced_inform_inactive(pid); -} - -API int sysman_request_poweroff(void) -{ - return deviced_request_poweroff(); -} - -API int sysman_request_entersleep(void) -{ - return deviced_request_entersleep(); -} - -API int sysman_request_leavesleep(void) -{ - return deviced_request_leavesleep(); -} - -API int sysman_request_reboot(void) -{ - return deviced_request_reboot(); -} - -API int sysman_set_datetime(time_t timet) -{ - return deviced_set_datetime(timet); -} - -API int sysman_set_timezone(char *tzpath_str) -{ - return deviced_set_timezone(tzpath_str); -} - -API int sysman_request_mount_mmc(struct mmc_contents *mmc_data) -{ - return deviced_request_mount_mmc(mmc_data); -} - -API int sysman_request_unmount_mmc(struct mmc_contents *mmc_data, int option) -{ - return deviced_request_unmount_mmc(mmc_data, option); -} - -API int sysman_request_format_mmc(struct mmc_contents *mmc_data) -{ - return deviced_request_format_mmc(mmc_data); -} - -API int sysman_request_set_cpu_max_frequency(int val) -{ - return deviced_request_set_cpu_min_frequency(val); -} - -API int sysman_request_set_cpu_min_frequency(int val) -{ - return deviced_request_set_cpu_min_frequency(val); -} - -API int sysman_release_cpu_max_frequency() -{ - return deviced_release_cpu_max_frequency(); -} - -API int sysman_release_cpu_min_frequency() -{ - return deviced_release_cpu_min_frequency(); -} |