From: jk7744.park Date: Mon, 14 Sep 2015 13:29:58 +0000 (+0900) Subject: tizen 2.3.1 release X-Git-Tag: submit/tizen_2.3.1/20150915.082049^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc673ae4f144f760fb0ca61ff5063bb7406ef0dc;p=framework%2Fsystem%2Flibfeedback.git tizen 2.3.1 release --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ae8a719 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,82 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(feedback C) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "\${prefix}") +SET(LIBDIR "\${prefix}/lib") +SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") +SET(VERSION 0.1.4) + +IF("${ARCH}" STREQUAL "emulator") + OPTION(USE_EMULATOR "Use Emulator" ON) +ELSEIF("${ARCH}" STREQUAL "arm") + OPTION(USE_ARM "Use Arm" ON) +ENDIF() + +SET(FEEDBACK_DATA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data) +IF(USE_EMULATOR) +SET(FEEDBACK_DATA_DIRS ${FEEDBACK_DATA_PATH}/emulator) +ELSE(USE_EMULATOR) +IF(MICRO_DD) +SET(FEEDBACK_DATA_DIRS ${FEEDBACK_DATA_PATH}/micro) +ELSE(MICRO_DD) +SET(FEEDBACK_DATA_DIRS ${FEEDBACK_DATA_PATH}/mobile) +ENDIF(MICRO_DD) +ENDIF(USE_EMULATOR) + +SET(SRCS + src/devices.c + src/sound.c + src/vibrator.c + src/xmlparser.c + src/feedback.c + src/str.c + src/dbus.c) + +SET(HEADERS + SLP_FEEDBACK_PG.h + include/feedback.h + include/feedback-ids.h) + +SET(DEPENDENTS "vconf mm-keysound dlog libxml-2.0 glib-2.0 dbus-1") +SET(PC_DEPENDENTS "capi-base-common") + +SET(PC_NAME ${PROJECT_NAME}) +SET(PC_REQUIRED ${PC_DEPENDENTS}) +SET(PC_LDFLAGS -l${PROJECT_NAME}) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED ${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(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) + +FOREACH(hfile ${HEADERS}) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) +ENDFOREACH(hfile) + +IF(MICRO_DD OR USE_EMULATOR) + INSTALL(DIRECTORY ${FEEDBACK_DATA_DIRS}/ DESTINATION share/${PROJECT_NAME}) +ELSE(MICRO_DD OR USE_EMULATOR) + INSTALL(DIRECTORY ${FEEDBACK_DATA_DIRS}/sound DESTINATION share/${PROJECT_NAME}) + INSTALL(FILES ${FEEDBACK_DATA_DIRS}/sound.xml DESTINATION share/${PROJECT_NAME}) + INSTALL(FILES ${FEEDBACK_DATA_DIRS}/vibration.xml DESTINATION share/${PROJECT_NAME}) +ENDIF(MICRO_DD OR USE_EMULATOR) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a06208b --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..ccdad52 --- /dev/null +++ b/NOTICE @@ -0,0 +1,3 @@ +Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE file for Apache License terms and conditions. diff --git a/SLP_FEEDBACK_PG.h b/SLP_FEEDBACK_PG.h new file mode 100644 index 0000000..b7006a2 --- /dev/null +++ b/SLP_FEEDBACK_PG.h @@ -0,0 +1,225 @@ +/* + * libsvi + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seokkyu Jang + * Contact: Sangil Yoon + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * + * @ingroup SLP_PG + * @defgroup SVI_PG SVI +@{ + +@par SVI Programming Guide + +

Brief Information

+- Sound & Vibration UI +- Convenient API +- Header File : svi.h + +

Introduction

+

Purpose of this document

+The purpose of this document is to describe how applications can use Sound and Vibration Interface Library APIs.\n +This document gives only programming guidelines to application engineers. + +

Scope

+The scope of this document is limited to Samsung platform Sound and Vibration Interface Library API usage. + +

Architecture

+

Architecture overview

+Sound and Vibration Interface Library (SVI) is responsible for playing simple sound and vibration.\n +SVI play sound using mm-sound library and play vibration with device framework. + +@image html svi.png "SVI diagram" + +

SLP Features

+Sound and Vibration Interface Library has the following features:\n + + - Play Sound + - It can play simple sound with predefined key. + + - Play Vibration + - It can play simple vibration with predefined key. + +

API list and description

+ - int svi_init(int *handle) + - Unload sound profile and status, and close haptic device. + + - int svi_fini(int handle) + - Finalize audio ui library. + - Unload sound profile and status, and close haptic device. + + - int svi_play_sound(int handle, sound_type sound_key) + - Play simple sound. + + - int svi_play_vib(int handle, vibration_type vibration_key) + - Play simple vibration. + + - int svi_play(int handle, vibration_type vibration_key, sound_type sound_key) + - Play simple sound and vibration. + +

Programming with Sound & Vibration UI

+ +

Defines

+@code +#define SVI_SUCCESS 0 +#define SVI_ERROR -1 +@endcode + +

Functions

+@code +int svi_init(int *handle) +int svi_fini(int handle) +int svi_play_sound(int handle, sound_type sound_key) +int svi_play_vib(int handle, vibration_type vibration_key) +int svi_play(int handle, vibration_type vibration_key, sound_type sound_key) +@endcode + +

Example code

+@code +#include + +int r = 0; +int handle = 0; + +r = svi_init(&handle); +if (r != SVI_SUCCESS){ + + printf("Cannot initialize svi.\n"); + +} else { + + r = svi_play (handle, SVI_VIB_TOUCH, SVI_SND_TOUCH1); + if (r != SVI_SUCCESS) { + printf("Cannot play sound or vibration.\n"); + } + + r = svi_play_sound (handle, SVI_SND_TOUCH1); + if (r != SVI_SUCCESS) { + printf("Cannot play sound.\n"); + } + + r = svi_play_vib (handle, SVI_VIB_TOUCH); + if (r != SVI_SUCCESS) { + printf("Cannot play vibration.\n"); + } + + r = svi_fini(handle); + if (r != SVI_SUCCESS) { + printf("Cannot close svi.\n"); + } +} +@endcode + +

Vibration IDs

+@code + SVI_VIB_TOUCH_TOUCH + SVI_VIB_TOUCH_SIP + SVI_VIB_TOUCH_HOLD + SVI_VIB_TOUCH_MULTI_TAP + SVI_VIB_TOUCH_HW_TAP + SVI_VIB_TOUCH_HW_HOLD + SVI_VIB_TOUCH_KEY00 + SVI_VIB_TOUCH_KEY01 + SVI_VIB_TOUCH_KEY02 + SVI_VIB_TOUCH_KEY03 + SVI_VIB_TOUCH_KEY04 + SVI_VIB_TOUCH_KEY05 + SVI_VIB_TOUCH_KEY06 + SVI_VIB_TOUCH_KEY07 + SVI_VIB_TOUCH_KEY08 + SVI_VIB_TOUCH_KEY09 + SVI_VIB_TOUCH_KEY_STAR + SVI_VIB_TOUCH_KEY_SHARP + SVI_VIB_NOTIFICATION_INCOMING_CALL01 + SVI_VIB_NOTIFICATION_INCOMING_CALL02 + SVI_VIB_NOTIFICATION_INCOMING_CALL03 + SVI_VIB_NOTIFICATION_MESSAGE + SVI_VIB_NOTIFICATION_EMAIL + SVI_VIB_NOTIFICATION_WAKEUP + SVI_VIB_NOTIFICATION_SCHEDULE + SVI_VIB_NOTIFICATION_TIMER + SVI_VIB_NOTIFICATION_GENERAL + SVI_VIB_OPERATION_POWER_ON + SVI_VIB_OPERATION_POWER_OFF + SVI_VIB_OPERATION_CHARGERCONN + SVI_VIB_OPERATION_FULLCHARGED + SVI_VIB_OPERATION_LOWBATT + SVI_VIB_OPERATION_LOCK + SVI_VIB_OPERATION_UNLOCK + SVI_VIB_OPERATION_LOCK_SWIPE + SVI_VIB_OPERATION_UNLOCK_SWIPE + SVI_VIB_OPERATION_CALLCONNECT + SVI_VIB_OPERATION_DISCALLCONNECT + SVI_VIB_OPERATION_MINUTEMINDER + SVI_VIB_OPERATION_VIBRATION + SVI_VIB_OPERATION_NEWCHAT + SVI_VIB_OPERATION_SENDCHAT + SVI_VIB_OPERATION_ONOFFSLIDER + SVI_VIB_OPERATION_SHUTTER + SVI_VIB_OPERATION_HOURLY_ALERT +@endcode + +

Sound IDs

+@code + SVI_SND_TOUCH_TOUCH1 + SVI_SND_TOUCH_TOUCH2 + SVI_SND_TOUCH_TOUCH3 + SVI_SND_TOUCH_SIP + SVI_SND_TOUCH_HOLD + SVI_SND_TOUCH_MULTI_TAP + SVI_SND_TOUCH_HW_TAP + SVI_SND_TOUCH_HW_HOLD + SVI_SND_TOUCH_KEY00 + SVI_SND_TOUCH_KEY01 + SVI_SND_TOUCH_KEY02 + SVI_SND_TOUCH_KEY03 + SVI_SND_TOUCH_KEY04 + SVI_SND_TOUCH_KEY05 + SVI_SND_TOUCH_KEY06 + SVI_SND_TOUCH_KEY07 + SVI_SND_TOUCH_KEY08 + SVI_SND_TOUCH_KEY09 + SVI_SND_TOUCH_KEY_STAR + SVI_SND_TOUCH_KEY_SHARP + SVI_SND_OPERATION_POWERON + SVI_SND_OPERATION_POWEROF + SVI_SND_OPERATION_CHARGERCONN + SVI_SND_OPERATION_FULLCHARGED + SVI_SND_OPERATION_LOWBATT + SVI_SND_OPERATION_LOCK + SVI_SND_OPERATION_UNLOCK + SVI_SND_OPERATION_LOCK_SWIPE + SVI_SND_OPERATION_UNLOCK_SWIPE + SVI_SND_OPERATION_CALLCONN + SVI_SND_OPERATION_CALLDISCONN + SVI_SND_OPERATION_MINUTE_MINDER + SVI_SND_OPERATION_VIBRATION + SVI_SND_OPERATION_NEWCHAT + SVI_SND_OPERATION_SENTCHAT + SVI_SND_OPERATION_ONOFFSLIDER + SVI_SND_OPERATION_SCRCAPTURE + SVI_SND_OPERATION_HOURLY_ALERT +@endcode + +*/ + +/** +@} +*/ diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..72a11ec --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100755 index 0000000..5ddaa53 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,7 @@ +#!/bin/sh +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..d58c039 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh new file mode 100755 index 0000000..29743e0 --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +RESULT_DIR=results + +tcc -c -p ./ # executing tcc, with clean option (-c) +rm -r $RESULT_DIR +rm -r tet_tmp_dir +rm testcase/tet_captured diff --git a/TC/config b/TC/config new file mode 100644 index 0000000..359c6eb --- /dev/null +++ b/TC/config @@ -0,0 +1,2 @@ +TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TETware +TET_INSTALL_TARGET_PATH=/var/tmp/dts_fw/TETware diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..a4f6095 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./_export_target_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/push.sh b/TC/push.sh new file mode 100755 index 0000000..2bbab27 --- /dev/null +++ b/TC/push.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./config + +TC_PATH=/opt/home/$PKG_NAME + +echo $TC_PATH + +sdb root on +sdb shell "mkdir -p $TC_PATH" +sdb push . $TC_PATH diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile new file mode 100644 index 0000000..6ab95dc --- /dev/null +++ b/TC/testcase/Makefile @@ -0,0 +1,28 @@ +CC = gcc + +C_FILES = $(shell ls *.c) + +PKGS = dlog feedback + +#TET_ROOT = /home/idkiller/work/tetware/TETware/tetware-target + +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s +LDFLAGS += `pkg-config --libs $(PKGS)` + +CFLAGS += `pkg-config --cflags $(PKGS)` +CFLAGS += -I. +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +#TARGETS = $(C_FILES:%.c=tc-%) +TCS := $(shell ls -1 *.c | cut -d. -f1) + +all: $(TCS) + +%: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist new file mode 100644 index 0000000..bdbd7ca --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1 @@ +/testcase/utc_system_feedback diff --git a/TC/testcase/utc_system_feedback.c b/TC/testcase/utc_system_feedback.c new file mode 100644 index 0000000..b784598 --- /dev/null +++ b/TC/testcase/utc_system_feedback.c @@ -0,0 +1,297 @@ +/* + * + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * PROPRIETARY/CONFIDENTIAL + * + * This software is the confidential and proprietary information of SAMSUNG + * ELECTRONICS ("Confidential Information"). You agree and acknowledge that + * this software is owned by Samsung and you shall not disclose such + * Confidential Information and shall use it only in accordance with the terms + * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG + * make no representations or warranties about the suitability of the software, + * either express or implied, including but not limited to the implied + * warranties of merchantability, fitness for a particular purpose, or + * non-infringement. SAMSUNG shall not be liable for any damages suffered by + * licensee arising out of or related to this software. + * + */ +#include +#include + +#define API_NAME_FEEDBACK_INITIALIZE "feedback_initialize" +#define API_NAME_FEEDBACK_DEINITIALIZE "feedback_deinitialize" +#define API_NAME_FEEDBACK_PLAY "feedback_play" +#define API_NAME_FEEDBACK_PLAY_TYPE "feedback_play_type" +#define API_NAME_FEEDBACK_GET_RESOURCE_PATH "feedback_get_resource_path" +#define API_NAME_FEEDBACK_SET_RESOURCE_PATH "feedback_set_resource_path" + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + + +static void utc_system_feedback_initialize_p(void); +static void utc_system_feedback_deinitialize_p(void); +static void utc_system_feedback_play_p(void); +static void utc_system_feedback_play_n(void); +static void utc_system_feedback_play_type_p(void); +static void utc_system_feedback_play_type_n_1(void); +static void utc_system_feedback_play_type_n_2(void); +static void utc_system_feedback_get_resource_path_p(void); +static void utc_system_feedback_get_resource_path_n_1(void); +static void utc_system_feedback_get_resource_path_n_2(void); +static void utc_system_feedback_get_resource_path_n_3(void); +static void utc_system_feedback_set_resource_path_p(void); +static void utc_system_feedback_set_resource_path_n_1(void); +static void utc_system_feedback_set_resource_path_n_2(void); +static void utc_system_feedback_set_resource_path_n_3(void); +static void utc_system_feedback_set_resource_path_n_4(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_system_feedback_initialize_p, POSITIVE_TC_IDX }, + { utc_system_feedback_deinitialize_p, POSITIVE_TC_IDX }, + { utc_system_feedback_play_p, POSITIVE_TC_IDX }, + { utc_system_feedback_play_n, NEGATIVE_TC_IDX }, + { utc_system_feedback_play_type_p, POSITIVE_TC_IDX }, + { utc_system_feedback_play_type_n_1, NEGATIVE_TC_IDX }, + { utc_system_feedback_play_type_n_2, NEGATIVE_TC_IDX }, + { utc_system_feedback_get_resource_path_p, POSITIVE_TC_IDX }, + { utc_system_feedback_get_resource_path_n_1, NEGATIVE_TC_IDX }, + { utc_system_feedback_get_resource_path_n_2, NEGATIVE_TC_IDX }, + { utc_system_feedback_get_resource_path_n_3, NEGATIVE_TC_IDX }, + { utc_system_feedback_set_resource_path_p, POSITIVE_TC_IDX }, + { utc_system_feedback_set_resource_path_n_1, NEGATIVE_TC_IDX }, + { utc_system_feedback_set_resource_path_n_2, NEGATIVE_TC_IDX }, + { utc_system_feedback_set_resource_path_n_3, NEGATIVE_TC_IDX }, + { utc_system_feedback_set_resource_path_n_4, NEGATIVE_TC_IDX }, + { NULL, 0 }, +}; + +#define SOUND_FILE_PATH "/usr/share/feedback/sound/touch/touch.ogg" +#define VIBRATION_FILE_PATH "/usr/share/deviced/HW_touch_30ms_sharp.ivt" + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of feedback_initialize() + */ +static void utc_system_feedback_initialize_p(void) +{ + int ret; + + ret = feedback_initialize(); + dts_check_eq(API_NAME_FEEDBACK_INITIALIZE, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Positive test case of feedback_deinitialize() + */ +static void utc_system_feedback_deinitialize_p(void) +{ + int ret; + + ret = feedback_deinitialize(); + dts_check_eq(API_NAME_FEEDBACK_DEINITIALIZE, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Positive test case of feedback_play() + */ +static void utc_system_feedback_play_p(void) +{ + int i, ret; + + for (i = 0; i < FEEDBACK_PATTERN_END; ++i) { + dts_message(API_NAME_FEEDBACK_PLAY, "Play [%d] pattern", i); + + ret = feedback_play(i); + dts_check_eq(API_NAME_FEEDBACK_PLAY, ret, FEEDBACK_ERROR_NONE); + } +} + +/** + * @brief Negative test case of feedback_play() + */ +static void utc_system_feedback_play_n(void) +{ + int ret; + + ret = feedback_play(-1); + dts_check_ne(API_NAME_FEEDBACK_PLAY, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Positive test case of feedback_play_type() + */ +static void utc_system_feedback_play_type_p(void) +{ + int i, ret; + + for (i = 0; i < FEEDBACK_PATTERN_END; ++i) { + dts_message(API_NAME_FEEDBACK_PLAY_TYPE, "Play [%d] pattern", i); + + ret = feedback_play_type(FEEDBACK_TYPE_SOUND, i); + dts_check_eq(API_NAME_FEEDBACK_PLAY_TYPE, ret, FEEDBACK_ERROR_NONE, "Sound Test"); + + ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, i); + dts_check_eq(API_NAME_FEEDBACK_PLAY_TYPE, ret, FEEDBACK_ERROR_NONE, "Vibration Test"); + } +} + +/** + * @brief Negative test case of feedback_play_type() + */ +static void utc_system_feedback_play_type_n_1(void) +{ + int ret; + + ret = feedback_play_type(-1, FEEDBACK_PATTERN_TAP); + dts_check_ne(API_NAME_FEEDBACK_PLAY_TYPE, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Negative test case of feedback_play_type() + */ +static void utc_system_feedback_play_type_n_2(void) +{ + int ret; + + ret = feedback_play_type(FEEDBACK_TYPE_SOUND, -1); + dts_check_ne(API_NAME_FEEDBACK_PLAY_TYPE, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Positive test case of feedback_get_resource_path() + */ +static void utc_system_feedback_get_resource_path_p(void) +{ + int i, ret; + char *str = NULL; + + for (i = 0; i < FEEDBACK_PATTERN_END; ++i) { + dts_message(API_NAME_FEEDBACK_GET_RESOURCE_PATH, "Get [%d] pattern path", i); + + ret = feedback_get_resource_path(FEEDBACK_TYPE_SOUND, i, &str); + dts_check_eq(API_NAME_FEEDBACK_GET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE, + "[%d] sound file path : %s", i, str); + free(str); + str = NULL; + + ret = feedback_get_resource_path(FEEDBACK_TYPE_VIBRATION, i, &str); + dts_check_eq(API_NAME_FEEDBACK_GET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE, + "[%d] vibration file path : %s", i, str); + free(str); + str = NULL; + } +} + +/** + * @brief Negative test case of feedback_get_resource_path() + */ +static void utc_system_feedback_get_resource_path_n_1(void) +{ + int ret; + char *str = NULL; + + ret = feedback_get_resource_path(-1, FEEDBACK_PATTERN_TAP, &str); + dts_check_ne(API_NAME_FEEDBACK_GET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Negative test case of feedback_get_resource_path() + */ +static void utc_system_feedback_get_resource_path_n_2(void) +{ + int ret; + char *str = NULL; + + ret = feedback_get_resource_path(FEEDBACK_TYPE_SOUND, -1, &str); + dts_check_ne(API_NAME_FEEDBACK_GET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Negative test case of feedback_get_resource_path() + */ +static void utc_system_feedback_get_resource_path_n_3(void) +{ + int ret; + + ret = feedback_get_resource_path(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP, NULL); + dts_check_ne(API_NAME_FEEDBACK_GET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Positive test case of feedback_set_resource_path() + */ +static void utc_system_feedback_set_resource_path_p(void) +{ + int i, ret; + + for (i = 0; i < FEEDBACK_PATTERN_END; ++i) { + dts_message(API_NAME_FEEDBACK_SET_RESOURCE_PATH, "Set [%d] pattern path", i); + + ret = feedback_set_resource_path(FEEDBACK_TYPE_SOUND, i, SOUND_FILE_PATH); + dts_check_eq(API_NAME_FEEDBACK_SET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); + + ret = feedback_set_resource_path(FEEDBACK_TYPE_VIBRATION, i, VIBRATION_FILE_PATH); + dts_check_eq(API_NAME_FEEDBACK_SET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); + } +} + +/** + * @brief Negative test case of feedback_set_resource_path() + */ +static void utc_system_feedback_set_resource_path_n_1(void) +{ + int ret; + + ret = feedback_set_resource_path(-1, FEEDBACK_PATTERN_TAP, SOUND_FILE_PATH); + dts_check_ne(API_NAME_FEEDBACK_SET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Negative test case of feedback_set_resource_path() + */ +static void utc_system_feedback_set_resource_path_n_2(void) +{ + int ret; + + ret = feedback_set_resource_path(FEEDBACK_TYPE_SOUND, -1, SOUND_FILE_PATH); + dts_check_ne(API_NAME_FEEDBACK_SET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Negative test case of feedback_set_resource_path() + */ +static void utc_system_feedback_set_resource_path_n_3(void) +{ + int ret; + + ret = feedback_set_resource_path(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP, NULL); + dts_check_ne(API_NAME_FEEDBACK_SET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + +/** + * @brief Negative test case of feedback_set_resource_path() + */ +static void utc_system_feedback_set_resource_path_n_4(void) +{ + int ret; + + ret = feedback_set_resource_path(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP, "/usr/share/no_file"); + dts_check_ne(API_NAME_FEEDBACK_SET_RESOURCE_PATH, ret, FEEDBACK_ERROR_NONE); +} + diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/data/emulator/sound.xml b/data/emulator/sound.xml new file mode 100644 index 0000000..fa8c279 --- /dev/null +++ b/data/emulator/sound.xml @@ -0,0 +1,133 @@ + + + + Sound Resource + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/operation/power_on.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/shutter.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/ringtone.ogg + + + + /usr/share/feedback/sound/operation/ringtone.ogg + + + + /usr/share/feedback/sound/operation/notification.ogg + + diff --git a/data/emulator/sound/operation/notification.ogg b/data/emulator/sound/operation/notification.ogg new file mode 100755 index 0000000..457f7e8 Binary files /dev/null and b/data/emulator/sound/operation/notification.ogg differ diff --git a/data/emulator/sound/operation/power_on.ogg b/data/emulator/sound/operation/power_on.ogg new file mode 100755 index 0000000..7756406 Binary files /dev/null and b/data/emulator/sound/operation/power_on.ogg differ diff --git a/data/emulator/sound/operation/ringtone.ogg b/data/emulator/sound/operation/ringtone.ogg new file mode 100755 index 0000000..2653dd6 Binary files /dev/null and b/data/emulator/sound/operation/ringtone.ogg differ diff --git a/data/emulator/sound/operation/shutter.ogg b/data/emulator/sound/operation/shutter.ogg new file mode 100755 index 0000000..c22c810 Binary files /dev/null and b/data/emulator/sound/operation/shutter.ogg differ diff --git a/data/emulator/sound/operation/system.ogg b/data/emulator/sound/operation/system.ogg new file mode 100755 index 0000000..69c8425 Binary files /dev/null and b/data/emulator/sound/operation/system.ogg differ diff --git a/data/emulator/sound/touch/touch.ogg b/data/emulator/sound/touch/touch.ogg new file mode 100755 index 0000000..8be60ce Binary files /dev/null and b/data/emulator/sound/touch/touch.ogg differ diff --git a/data/emulator/vibration.xml b/data/emulator/vibration.xml new file mode 100644 index 0000000..09887c2 --- /dev/null +++ b/data/emulator/vibration.xml @@ -0,0 +1,157 @@ + + + + Vibration Resource + + + TOUCH + + + + TOUCH + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + diff --git a/data/micro/sound.xml b/data/micro/sound.xml new file mode 100644 index 0000000..2ff9be9 --- /dev/null +++ b/data/micro/sound.xml @@ -0,0 +1,181 @@ + + + + Sound Resource + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/touch/touch.ogg + + + + /usr/share/feedback/sound/operation/notification.ogg + + + + /usr/share/feedback/sound/operation/notification.ogg + + + + /usr/share/feedback/sound/operation/notification.ogg + + + + /usr/share/feedback/sound/operation/power_on.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/shutter.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + + + /usr/share/feedback/sound/operation/system.ogg + + diff --git a/data/micro/sound/operation/notification.ogg b/data/micro/sound/operation/notification.ogg new file mode 100755 index 0000000..457f7e8 Binary files /dev/null and b/data/micro/sound/operation/notification.ogg differ diff --git a/data/micro/sound/operation/power_on.ogg b/data/micro/sound/operation/power_on.ogg new file mode 100755 index 0000000..7756406 Binary files /dev/null and b/data/micro/sound/operation/power_on.ogg differ diff --git a/data/micro/sound/operation/ringtone.ogg b/data/micro/sound/operation/ringtone.ogg new file mode 100755 index 0000000..2653dd6 Binary files /dev/null and b/data/micro/sound/operation/ringtone.ogg differ diff --git a/data/micro/sound/operation/shutter.ogg b/data/micro/sound/operation/shutter.ogg new file mode 100755 index 0000000..c22c810 Binary files /dev/null and b/data/micro/sound/operation/shutter.ogg differ diff --git a/data/micro/sound/operation/system.ogg b/data/micro/sound/operation/system.ogg new file mode 100755 index 0000000..69c8425 Binary files /dev/null and b/data/micro/sound/operation/system.ogg differ diff --git a/data/micro/sound/touch/touch.ogg b/data/micro/sound/touch/touch.ogg new file mode 100755 index 0000000..8be60ce Binary files /dev/null and b/data/micro/sound/touch/touch.ogg differ diff --git a/data/micro/vibration.xml b/data/micro/vibration.xml new file mode 100644 index 0000000..80a5849 --- /dev/null +++ b/data/micro/vibration.xml @@ -0,0 +1,161 @@ + + + + Vibration Resource + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + SYSTEM + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + SYSTEM + + + + NOTIFICATION + + + + NOTIFICATION + + + + SYSTEM + + + + SYSTEM + + diff --git a/data/mobile/sound.xml b/data/mobile/sound.xml new file mode 100755 index 0000000..d5738b8 --- /dev/null +++ b/data/mobile/sound.xml @@ -0,0 +1,157 @@ + + + + Sound Resource + + + /usr/share/feedback/sound/touch/touch.wav + + + + /usr/share/feedback/sound/touch/sip.wav + + + + /usr/share/feedback/sound/touch/sip_backspace.wav + + + + /usr/share/feedback/sound/touch/sip.wav + + + + /usr/share/feedback/sound/touch/sip.wav + + + + /usr/share/feedback/sound/touch/sip.wav + + + + /usr/share/feedback/sound/touch/key0.wav + + + + /usr/share/feedback/sound/touch/key1.wav + + + + /usr/share/feedback/sound/touch/key2.wav + + + + /usr/share/feedback/sound/touch/key3.wav + + + + /usr/share/feedback/sound/touch/key4.wav + + + + /usr/share/feedback/sound/touch/key5.wav + + + + /usr/share/feedback/sound/touch/key6.wav + + + + /usr/share/feedback/sound/touch/key7.wav + + + + /usr/share/feedback/sound/touch/key8.wav + + + + /usr/share/feedback/sound/touch/key9.wav + + + + /usr/share/feedback/sound/touch/keyasterisk.wav + + + + /usr/share/feedback/sound/touch/keysharp.wav + + + + /usr/share/feedback/sound/touch/touch.wav + + + + /usr/share/feedback/sound/touch/touch.wav + + + + /usr/share/feedback/sound/operation/power_on.wav + + + + /usr/share/feedback/sound/operation/charger_connection.wav + + + + /usr/share/feedback/sound/operation/charger_connection.wav + + + + /usr/share/feedback/sound/operation/low_battery.wav + + + + /usr/share/feedback/sound/operation/low_battery.wav + + + + /usr/share/feedback/sound/operation/lock.wav + + + + /usr/share/feedback/sound/operation/unlock.wav + + + + /usr/share/feedback/sound/operation/lock.wav + + + + /usr/share/feedback/sound/operation/unlock.wav + + + + /usr/share/feedback/sound/operation/lock.wav + + + + /usr/share/feedback/sound/operation/call_connect.wav + + + + /usr/share/feedback/sound/operation/call_disconnect.wav + + + + /usr/share/feedback/sound/operation/minute_minder.wav + + + + /usr/share/feedback/sound/operation/volume_control.wav + + + + /usr/share/feedback/sound/operation/shutter.wav + + + + /usr/share/feedback/sound/operation/list_reorder.wav + + + + /usr/share/feedback/sound/operation/slider_sweep.wav + + + + /usr/share/feedback/sound/operation/volume_control.wav + + diff --git a/data/mobile/sound/operation/call_connect.wav b/data/mobile/sound/operation/call_connect.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/call_connect.wav differ diff --git a/data/mobile/sound/operation/call_disconnect.wav b/data/mobile/sound/operation/call_disconnect.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/call_disconnect.wav differ diff --git a/data/mobile/sound/operation/charger_connection.wav b/data/mobile/sound/operation/charger_connection.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/charger_connection.wav differ diff --git a/data/mobile/sound/operation/fully_charged.wav b/data/mobile/sound/operation/fully_charged.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/fully_charged.wav differ diff --git a/data/mobile/sound/operation/list_reorder.wav b/data/mobile/sound/operation/list_reorder.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/list_reorder.wav differ diff --git a/data/mobile/sound/operation/lock.wav b/data/mobile/sound/operation/lock.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/lock.wav differ diff --git a/data/mobile/sound/operation/low_battery.wav b/data/mobile/sound/operation/low_battery.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/low_battery.wav differ diff --git a/data/mobile/sound/operation/minute_minder.wav b/data/mobile/sound/operation/minute_minder.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/minute_minder.wav differ diff --git a/data/mobile/sound/operation/power_on.wav b/data/mobile/sound/operation/power_on.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/power_on.wav differ diff --git a/data/mobile/sound/operation/shutter.wav b/data/mobile/sound/operation/shutter.wav new file mode 100755 index 0000000..9dea92b Binary files /dev/null and b/data/mobile/sound/operation/shutter.wav differ diff --git a/data/mobile/sound/operation/slider_sweep.wav b/data/mobile/sound/operation/slider_sweep.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/slider_sweep.wav differ diff --git a/data/mobile/sound/operation/unlock.wav b/data/mobile/sound/operation/unlock.wav new file mode 100755 index 0000000..5383bdf Binary files /dev/null and b/data/mobile/sound/operation/unlock.wav differ diff --git a/data/mobile/sound/operation/volume_control.wav b/data/mobile/sound/operation/volume_control.wav new file mode 100755 index 0000000..1ec9de4 Binary files /dev/null and b/data/mobile/sound/operation/volume_control.wav differ diff --git a/data/mobile/sound/touch/key0.wav b/data/mobile/sound/touch/key0.wav new file mode 100755 index 0000000..e2cd877 Binary files /dev/null and b/data/mobile/sound/touch/key0.wav differ diff --git a/data/mobile/sound/touch/key1.wav b/data/mobile/sound/touch/key1.wav new file mode 100755 index 0000000..fa77cf4 Binary files /dev/null and b/data/mobile/sound/touch/key1.wav differ diff --git a/data/mobile/sound/touch/key2.wav b/data/mobile/sound/touch/key2.wav new file mode 100755 index 0000000..53da84c Binary files /dev/null and b/data/mobile/sound/touch/key2.wav differ diff --git a/data/mobile/sound/touch/key3.wav b/data/mobile/sound/touch/key3.wav new file mode 100755 index 0000000..ede9a2b Binary files /dev/null and b/data/mobile/sound/touch/key3.wav differ diff --git a/data/mobile/sound/touch/key4.wav b/data/mobile/sound/touch/key4.wav new file mode 100755 index 0000000..105bddc Binary files /dev/null and b/data/mobile/sound/touch/key4.wav differ diff --git a/data/mobile/sound/touch/key5.wav b/data/mobile/sound/touch/key5.wav new file mode 100755 index 0000000..a34b4d0 Binary files /dev/null and b/data/mobile/sound/touch/key5.wav differ diff --git a/data/mobile/sound/touch/key6.wav b/data/mobile/sound/touch/key6.wav new file mode 100755 index 0000000..34a8bec Binary files /dev/null and b/data/mobile/sound/touch/key6.wav differ diff --git a/data/mobile/sound/touch/key7.wav b/data/mobile/sound/touch/key7.wav new file mode 100755 index 0000000..3b845a4 Binary files /dev/null and b/data/mobile/sound/touch/key7.wav differ diff --git a/data/mobile/sound/touch/key8.wav b/data/mobile/sound/touch/key8.wav new file mode 100755 index 0000000..2a05528 Binary files /dev/null and b/data/mobile/sound/touch/key8.wav differ diff --git a/data/mobile/sound/touch/key9.wav b/data/mobile/sound/touch/key9.wav new file mode 100755 index 0000000..80699c8 Binary files /dev/null and b/data/mobile/sound/touch/key9.wav differ diff --git a/data/mobile/sound/touch/keyasterisk.wav b/data/mobile/sound/touch/keyasterisk.wav new file mode 100755 index 0000000..9ec2e71 Binary files /dev/null and b/data/mobile/sound/touch/keyasterisk.wav differ diff --git a/data/mobile/sound/touch/keysharp.wav b/data/mobile/sound/touch/keysharp.wav new file mode 100755 index 0000000..ce7cd88 Binary files /dev/null and b/data/mobile/sound/touch/keysharp.wav differ diff --git a/data/mobile/sound/touch/sip.wav b/data/mobile/sound/touch/sip.wav new file mode 100755 index 0000000..5b44d12 Binary files /dev/null and b/data/mobile/sound/touch/sip.wav differ diff --git a/data/mobile/sound/touch/sip_backspace.wav b/data/mobile/sound/touch/sip_backspace.wav new file mode 100755 index 0000000..5b44d12 Binary files /dev/null and b/data/mobile/sound/touch/sip_backspace.wav differ diff --git a/data/mobile/sound/touch/touch.wav b/data/mobile/sound/touch/touch.wav new file mode 100755 index 0000000..1ec9de4 Binary files /dev/null and b/data/mobile/sound/touch/touch.wav differ diff --git a/data/mobile/vibration.xml b/data/mobile/vibration.xml new file mode 100644 index 0000000..8221ffa --- /dev/null +++ b/data/mobile/vibration.xml @@ -0,0 +1,196 @@ + + + + Vibration Resource + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + TOUCH + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + NOTIFICATION + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + + + SYSTEM + + diff --git a/doc/feedback_doc.h b/doc/feedback_doc.h new file mode 100755 index 0000000..0b0131e --- /dev/null +++ b/doc/feedback_doc.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 __TIZEN_SYSTEM_FEEDBACK_DOC_H__ +#define __TIZEN_SYSTEM_FEEDBACK_DOC_H__ + +/** + * @ingroup CAPI_SYSTEM_FRAMEWORK + * @defgroup CAPI_SYSTEM_FEEDBACK_MODULE Feedback + * @brief The FEEDBACK API provides functions to play sound or vibration associated with properties. + * + * @section CAPI_SYSTEM_FEEDBACK_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_SYSTEM_FEEDBACK_MODULE_OVERVIEW Overview + * The FEEDBACK API provides functions to play sound or vibration associated with properties. + * @section CAPI_SYSTEM_FEEDBACK_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://developer.samsung.com/tizen/feature/haptic\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature Element. + * + */ + +#endif /* __TIZEN_SYSTEM_FEEDBACK_DOC_H__ */ diff --git a/feedback.pc.in b/feedback.pc.in new file mode 100644 index 0000000..392a254 --- /dev/null +++ b/feedback.pc.in @@ -0,0 +1,11 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: @PC_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @VERSION@ +Requires: @PC_REQUIRED@ +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} diff --git a/image/svi.png b/image/svi.png new file mode 100644 index 0000000..e381203 Binary files /dev/null and b/image/svi.png differ diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..71fa321 --- /dev/null +++ b/include/common.h @@ -0,0 +1,48 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __COMMON_H__ +#define __COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file common.h + * @brief This file contains the common information + */ + +#define FEEDBACK_DATA_DIR "/opt/usr/share/feedback" +#define FEEDBACK_ORIGIN_DATA_DIR "/usr/share/feedback" + +#define FEEDBACK_RETRY_CNT 1 + +extern int callstatus; +extern int alert_callstatus; + +extern const char *str_type[]; +extern const char *str_pattern[]; + +int is_sound_mode(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/dbus.h b/include/dbus.h new file mode 100644 index 0000000..9710b59 --- /dev/null +++ b/include/dbus.h @@ -0,0 +1,46 @@ +/* + * feedback + * + * 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. + */ + + +#ifndef __DBUS_H__ +#define __DBUS_H__ + +#include + +/* + * Device daemon + */ +#define DEVICED_BUS_NAME "org.tizen.system.deviced" +#define DEVICED_OBJECT_PATH "/Org/Tizen/System/DeviceD" +#define DEVICED_INTERFACE_NAME DEVICED_BUS_NAME +/* Led service: play/stop led operations about led */ +#define DEVICED_PATH_LED DEVICED_OBJECT_PATH"/Led" +#define DEVICED_INTERFACE_LED DEVICED_INTERFACE_NAME".Led" +/* Haptic service: operatioins about haptic */ +#define DEVICED_PATH_HAPTIC DEVICED_OBJECT_PATH"/Haptic" +#define DEVICED_INTERFACE_HAPTIC DEVICED_INTERFACE_NAME".haptic" + +struct dbus_byte { + const unsigned char *data; + int size; +}; + +int dbus_method_sync(const char *dest, const char *path, + const char *interface, const char *method, + const char *sig, char *param[]); +#endif diff --git a/include/devices.h b/include/devices.h new file mode 100644 index 0000000..2fdd215 --- /dev/null +++ b/include/devices.h @@ -0,0 +1,56 @@ +/* + * libfeedback + + * 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. + */ + + +#ifndef __DEVICES_H__ +#define __DEVICES_H__ + +struct device_ops { + int type; + void (*init) (void); + void (*exit) (void); + int (*play) (int); + int (*stop) (void); + int (*get_path) (int, char *, unsigned int); + int (*set_path) (int, char *); +}; + +void devices_init(void); +void devices_exit(void); +void devices_play(int pattern); +void devices_stop(void); + +#ifndef __CONSTRUCTOR__ +#define __CONSTRUCTOR__ __attribute__ ((constructor)) +#endif + +#ifndef __DESTRUCTOR__ +#define __DESTRUCTOR__ __attribute__ ((destructor)) +#endif + +#define DEVICE_OPS_REGISTER(dev) \ +static void __CONSTRUCTOR__ module_init(void) \ +{ \ + add_device(dev); \ +} + +void add_device(const struct device_ops *dev); +void remove_device(const struct device_ops *dev); +const struct device_ops *find_device(int type); + +#endif diff --git a/include/feedback-ids.h b/include/feedback-ids.h new file mode 100644 index 0000000..84e9430 --- /dev/null +++ b/include/feedback-ids.h @@ -0,0 +1,184 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __FEEDBACK_IDS_H__ +#define __FEEDBACK_IDS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file feedback-ids.h + * @brief This file contains the feedback API + */ + +/** + * @addtogroup CAPI_FEEDBACK_MODULE + * @{ + */ + +/** + * @brief Enumerations of the type for feedback interface + * @details + * + */ +typedef enum +{ + FEEDBACK_TYPE_NONE, + FEEDBACK_TYPE_SOUND, + FEEDBACK_TYPE_VIBRATION, + FEEDBACK_TYPE_LED, + FEEDBACK_TYPE_END +} feedback_type_e; + +/** + * @brief Enumerations of the system pre-defined patterns for feedback interface + * @details + * Each feedback pattern can have separate media files of each types. + * But Depending on vendor design, pattern may not have any type of file. + * + */ +typedef enum +{ + FEEDBACK_PATTERN_NONE = -1, + + FEEDBACK_PATTERN_TAP = 0, /**< feedback pattern when general touch */ + FEEDBACK_PATTERN_SIP, /**< feedback pattern when touch text key */ + FEEDBACK_PATTERN_SIP_BACKSPACE, /**< feedback pattern when touch backspace key */ + FEEDBACK_PATTERN_SIP_FUNCTION, /**< feedback pattern when touch function key */ + FEEDBACK_PATTERN_SIP_FJKEY, /**< feedback pattern when touch F,J key */ + FEEDBACK_PATTERN_MAX_CHARACTER, /**< feedback pattern when max character */ + FEEDBACK_PATTERN_KEY0, /**< feedback pattern when touch numeric 0 key */ + FEEDBACK_PATTERN_KEY1, /**< feedback pattern when touch numeric 1 key */ + FEEDBACK_PATTERN_KEY2, /**< feedback pattern when touch numeric 2 key */ + FEEDBACK_PATTERN_KEY3, /**< feedback pattern when touch numeric 3 key */ + FEEDBACK_PATTERN_KEY4, /**< feedback pattern when touch numeric 4 key */ + FEEDBACK_PATTERN_KEY5, /**< feedback pattern when touch numeric 5 key */ + FEEDBACK_PATTERN_KEY6, /**< feedback pattern when touch numeric 6 key */ + FEEDBACK_PATTERN_KEY7, /**< feedback pattern when touch numeric 7 key */ + FEEDBACK_PATTERN_KEY8, /**< feedback pattern when touch numeric 8 key */ + FEEDBACK_PATTERN_KEY9, /**< feedback pattern when touch numeric 9 key */ + FEEDBACK_PATTERN_KEY_STAR, /**< feedback pattern when touch star key */ + FEEDBACK_PATTERN_KEY_SHARP, /**< feedback pattern when touch sharp key */ + FEEDBACK_PATTERN_KEY_BACK, /**< feedback pattern when touch backspace key */ + FEEDBACK_PATTERN_HOLD, /**< feedback pattern when touch hold */ + FEEDBACK_PATTERN_MULTI_TAP, /**< feedback pattern when multi touch */ + FEEDBACK_PATTERN_HW_TAP, /**< feedback pattern when press hardware key */ + FEEDBACK_PATTERN_HW_HOLD, /**< feedback pattern when holding press hardware key */ + + FEEDBACK_PATTERN_MESSAGE, /**< feedback pattern when incoming a message */ + FEEDBACK_PATTERN_MESSAGE_ON_CALL, /**< feedback pattern when incoming a message on call */ + FEEDBACK_PATTERN_EMAIL, /**< feedback pattern when incoming an email */ + FEEDBACK_PATTERN_EMAIL_ON_CALL, /**< feedback pattern when incoming an email on call */ + FEEDBACK_PATTERN_WAKEUP, /**< feedback pattern when alert wake up call */ + FEEDBACK_PATTERN_WAKEUP_ON_CALL, /**< feedback pattern when alert wake up call on call */ + FEEDBACK_PATTERN_SCHEDULE, /**< feedback pattern when alert schedule alarm */ + FEEDBACK_PATTERN_SCHEDULE_ON_CALL, /**< feedback pattern when alert schedule alarm on call */ + FEEDBACK_PATTERN_TIMER, /**< feedback pattern when alert timer */ + FEEDBACK_PATTERN_TIMER_ON_CALL, /**< feedback pattern when alert timer on call */ + FEEDBACK_PATTERN_GENERAL, /**< feedback pattern when alert general event */ + FEEDBACK_PATTERN_GENERAL_ON_CALL, /**< feedback pattern when alert general event on call */ + FEEDBACK_PATTERN_SMART_ALERT, /**< feedback pattern when alert noti on motion */ + + FEEDBACK_PATTERN_POWERON, /**< feedback pattern when power on */ + FEEDBACK_PATTERN_POWEROFF, /**< feedback pattern when power off */ + FEEDBACK_PATTERN_CHARGERCONN, /**< feedback pattern when connecting charger */ + FEEDBACK_PATTERN_CHARGERCONN_ON_CALL, /**< feedback pattern when connecting charger on call */ + FEEDBACK_PATTERN_CHARGING_ERROR, /**< feedback pattern when occuring charging error */ + FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL,/**< feedback pattern when occuring charging error on call */ + FEEDBACK_PATTERN_FULLCHARGED, /**< feedback pattern when full charged */ + FEEDBACK_PATTERN_FULLCHARGED_ON_CALL, /**< feedback pattern when full charged on call */ + FEEDBACK_PATTERN_LOWBATT, /**< feedback pattern when low battery */ + FEEDBACK_PATTERN_LOWBATT_ON_CALL, /**< feedback pattern when low battery on call */ + FEEDBACK_PATTERN_LOCK, /**< feedback pattern when lock */ + FEEDBACK_PATTERN_UNLOCK, /**< feedback pattern when unlock */ + FEEDBACK_PATTERN_LOCK_SWIPE, /**< feedback pattern when lock swipe */ + FEEDBACK_PATTERN_UNLOCK_SWIPE, /**< feedback pattern when unlock swipe*/ + FEEDBACK_PATTERN_GEOMETRIC_LOCK, /**< feedback pattern when lock by geometric effect */ + FEEDBACK_PATTERN_CALLCONNECT, /**< feedback pattern when connecting call */ + FEEDBACK_PATTERN_DISCALLCONNECT, /**< feedback pattern when disconnecting call */ + FEEDBACK_PATTERN_OUTGOING_CALL, /**< feedback pattern when connected outgoing call */ + FEEDBACK_PATTERN_MINUTEMINDER, /**< feedback pattern when minute minder */ + FEEDBACK_PATTERN_VIBRATION_ON, /**< feedback pattern when turn on vibration mode */ + FEEDBACK_PATTERN_SILENT_OFF, /**< feedback pattern when turn off silent mode */ + FEEDBACK_PATTERN_BT_CONNECTED, /**< feedback pattern when connecting with bluetooth */ + FEEDBACK_PATTERN_BT_DISCONNECTED, /**< feedback pattern when disconnecting with bluetooth */ + FEEDBACK_PATTERN_BT_PAIRING, /**< feedback pattern when starting pare with bluetooth */ + FEEDBACK_PATTERN_BT_WAITING, /**< feedback pattern when pairing bluetooth */ + FEEDBACK_PATTERN_SCREEN_CAPTURE, /**< feedback pattern when screen capture */ + FEEDBACK_PATTERN_LIST_REORDER, /**< feedback pattern when list reorder */ + FEEDBACK_PATTERN_LIST_SLIDER, /**< feedback pattern when list slider sweep */ + FEEDBACK_PATTERN_VOLUME_KEY, /**< feedback pattern when pressed volume key */ + FEEDBACK_PATTERN_MMS, /**< feedback pattern when message state changed to MMS */ + FEEDBACK_PATTERN_HOURLY_ALERT, /**< feedback pattern when alert every hour on the hour */ + + FEEDBACK_PATTERN_SAFETY_ALERT, /**< feedback pattern when safety alert from phone */ + FEEDBACK_PATTERN_ACCIDENT_DETECT, /**< feedback pattern when accident detect */ + FEEDBACK_PATTERN_SEND_SOS_MESSAGE, /**< feedback pattern when sending SOS message */ + FEEDBACK_PATTERN_END_SOS_MESSAGE, /**< feedback pattern when finishing SOS message */ + FEEDBACK_PATTERN_EMERGENCY_BUZZER, /**< feedback pattern when occurs emergency buzzer */ + FEEDBACK_PATTERN_SAFETY_LOW_POWER, /**< this pattern is a low power ringtone */ + FEEDBACK_PATTERN_CMAS, /**< feedback pattern when alerting commercial mobile */ + FEEDBACK_PATTERN_SPEED_UP, /**< feedback pattern when advising user to speed up */ + FEEDBACK_PATTERN_SLOW_DOWN, /**< feedback pattern when advising user to slow down */ + FEEDBACK_PATTERN_KEEP_THIS_PACE, /**< feedback pattern when advising user to keep this pace */ + FEEDBACK_PATTERN_GOAL_ACHIEVED, /**< feedback pattern when alerting goal achieved */ + FEEDBACK_PATTERN_EXERCISE_COUNT, /**< feedback pattern when changing count number */ + FEEDBACK_PATTERN_START_CUE, /**< feedback pattern when starting cue */ + FEEDBACK_PATTERN_HEALTH_PACE, /**< feedback pattern when alerting health pace */ + FEEDBACK_PATTERN_INACTIVE_TIME, /**< feedback pattern when alerting inactive time */ + FEEDBACK_PATTERN_MEASURING_SUCCESS, /**< feedback pattern when measuring is succeeded */ + FEEDBACK_PATTERN_MEASURING_FAILURE, /**< feedback pattern when measuring is failed */ + FEEDBACK_PATTERN_UV_PROCESSING, /**< feedback pattern when UV is processing */ + FEEDBACK_PATTERN_SHEALTH_START, /**< feedback pattern when starting s-health */ + FEEDBACK_PATTERN_SHEALTH_PAUSE, /**< feedback pattern when pausing s-health */ + FEEDBACK_PATTERN_SHEALTH_STOP, /**< feedback pattern when stoping s-health */ + FEEDBACK_PATTERN_3RD_APPLICATION, /**< feedback pattern when alert 3rd event */ + + FEEDBACK_PATTERN_END, + + /* START : Will be removed */ + FEEDBACK_PATTERN_TOUCH_TAP = FEEDBACK_PATTERN_TAP, + FEEDBACK_PATTERN_TOUCH_MULTI_TAP = FEEDBACK_PATTERN_MULTI_TAP, + FEEDBACK_PATTERN_TOUCH_KEY = FEEDBACK_PATTERN_KEY0, + FEEDBACK_PATTERN_TOUCH_HOLD = FEEDBACK_PATTERN_HOLD, + FEEDBACK_PATTERN_REACTIVE_ALERT = FEEDBACK_PATTERN_SMART_ALERT, + FEEDBACK_PATTERN_VIBRATION = FEEDBACK_PATTERN_VIBRATION_ON, + FEEDBACK_PATTERN_SOUND_ON = FEEDBACK_PATTERN_SILENT_OFF, + FEEDBACK_PATTERN_SHUTTER = FEEDBACK_PATTERN_SCREEN_CAPTURE, + FEEDBACK_PATTERN_SLIDER_SWEEP = FEEDBACK_PATTERN_LIST_SLIDER, + FEEDBACK_PATTERN_SAFETY_ASSISTANCE = FEEDBACK_PATTERN_SEND_SOS_MESSAGE, + FEEDBACK_PATTERN_BT_PARING = FEEDBACK_PATTERN_BT_PAIRING, + FEEDBACK_PATTERN_CONNECTED = FEEDBACK_PATTERN_BT_CONNECTED, + FEEDBACK_PATTERN_DISCONNECTED = FEEDBACK_PATTERN_BT_DISCONNECTED, + FEEDBACK_PATTERN_SUCCESS = FEEDBACK_PATTERN_MEASURING_SUCCESS, + FEEDBACK_PATTERN_FAILURE = FEEDBACK_PATTERN_MEASURING_FAILURE, + /* END : Will be removed */ + +} feedback_pattern_e; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif //__FEEDBACK_IDS_H__ diff --git a/include/feedback.h b/include/feedback.h new file mode 100644 index 0000000..532e24e --- /dev/null +++ b/include/feedback.h @@ -0,0 +1,223 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __FEEDBACK_H__ +#define __FEEDBACK_H__ + +#include +#include "feedback-ids.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file feedback.h + * @brief This file contains the feedback API + */ + +/** + * @addtogroup CAPI_SYSTEM_FEEDBACK_MODULE + * @{ + */ + +/** + * @brief Enumerations of error codes for the Feedback API. + * @since_tizen 2.3 + */ +typedef enum +{ + FEEDBACK_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + FEEDBACK_ERROR_OPERATION_FAILED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */ + FEEDBACK_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + FEEDBACK_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported in this device */ + FEEDBACK_ERROR_NOT_INITIALIZED = TIZEN_ERROR_SYSTEM_CLASS | 0x52, /**< Has not yet been Initialized */ +} feedback_error_e; + +#define FEEDBACK_SUCCEEDED(n) ((n) == FEEDBACK_ERROR_NONE) +#define FEEDBACK_FAILED(n) ((n) != FEEDBACK_ERROR_NONE) + +/** + * @brief Initializes feedback API. + * + * @since_tizen 2.3 + * + * @remarks + * If this function is not called in advance, other function will return #FEEDBACK_ERROR_NOT_INITIALIZED. + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + * + * @see feedback_deinitialize() + */ +int feedback_initialize(void); + +/** + * @brief Deinitializes feedback API. + * @details This function must be called when feedback functions are no longer needed. + * + * @since_tizen 2.3 + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + * + * @see feedback_initialize() + */ +int feedback_deinitialize(void); + +/** + * @brief Plays various types of reactions that are pre-defined. + * @details + * This functon can be used to react to pre-defined actions. \n + * It play various types of system pre-defined media or vibration patterns. + * + * @since_tizen 2.3 + * + * @remarks + * Currently, there are two types of reactions: sound and vibration. \n + * Depending on the settings, some types cannot operate. + * For example, when set to silent mode, the device doesn't produce any sound. + * + * @param[in] pattern The pre-defined pattern + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + */ +int feedback_play(feedback_pattern_e pattern); + +/** + * + * @brief Plays specific type of reactions that are pre-defined. + * @details + * This function can be used to react to pre-defined actions. \n + * It play specific type of system pre-defined pattern. + * + * @since_tizen 2.3 + * + * @remarks + * Currently, there are two types of reactions: sound and vibration. + * + * @param[in] type The pattern type + * @param[in] pattern The pre-defined pattern + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + */ +int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern); + +/** + * + * @brief Plays specific type of reactions that are pre-defined. + * @details + * This function can be used to react to pre-defined actions. \n + * It play specific type of system pre-defined pattern. + * + * @since_tizen 2.3 + * + * @remarks + * Currently, there are two types of reactions: sound and vibration. + * + * @param[in] type string The pattern type + * @param[in] pattern string The pre-defined pattern + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + */ +int feedback_play_type_by_name(char *type, char *pattern); + +/** + * @brief Stop various types of reactions + * @details + * This functon can be used to stop react to pre-defined actions. \n + * It stops various types of system pre-defined media or vibration patterns. + * + * @since_tizen 2.3 + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + */ +int feedback_stop(void); + +/** + * @brief Gets the file path of resource for the given feedback type and pattern. + * @details + * Depending on the type of each pattern resouorce has a different format. \n + * Currently, System supports two pattern types. \n + * #FEEDBACK_TYPE_SOUND type uses .wav format. \n + * #FEEDBACK_TYPE_VIBRATION type uses .ivt format. \n + * If the given pattern doesn't have a file for the type, @a path will return NULL. + * + * @since_tizen 2.3 + * + * @remarks @a path must be released with free() by you. + * + * @param[in] type The pattern type + * @param[in] pattern The pre-defined pattern + * @param[out] path The file path of resource for feedback type and pattern + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + */ +int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e pattern, char **path); + +/** + * @brief Sets the new file path of resource for the given feedback type and pattern. + * @details + * Depending on the type of each pattern resouorce has a different format. \n + * Currently, System supports two pattern types. \n + * #FEEDBACK_TYPE_SOUND type uses .wav format. \n + * #FEEDBACK_TYPE_VIBRATION type uses .ivt format. \n + * If the given pattern doesn't have a file for the type, @a path will return NULL. + * + * @since_tizen 2.3 + * + * @param[in] type The pattern type + * @param[in] pattern The pre-defined pattern + * @param[in] path The new file path of resource for feedback type and pattern + * + * @return 0 on success, otherwise a negative error value. + * @retval #FEEDBACK_ERROR_NONE Successful + * @retval #FEEDBACK_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #FEEDBACK_ERROR_OPERATION_FAILED Operation failed + * @retval #FEEDBACK_ERROR_NOT_SUPPORTED Not supported device + */ +int feedback_set_resource_path(feedback_type_e type, feedback_pattern_e pattern, char *path); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif //__FEEDBACK_H__ diff --git a/include/feedback_doc.h b/include/feedback_doc.h new file mode 100755 index 0000000..c11960d --- /dev/null +++ b/include/feedback_doc.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __FEEDBACK_DOC_H__ +#define __FEEDBACK_DOC_H__ + +/** + * @defgroup CAPI_FEEDBACK_MODULE Feedback + * @brief The FEEDBACK API provides functions to play simple sound and vibration. + * @ingroup CAPI_UIX_FRAMEWORK + * + * @section CAPI_FEEDBACK_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_FEEDBACK_MODULE_OVERVIEW Overview + * The feedback library is responsible for playing simple sound and vibration. + * Feedback play sound using mm-sound library and play vibration with system framework. + * + */ + +#endif /* __FEEDBACK_DOC_H__ */ diff --git a/include/log.h b/include/log.h new file mode 100644 index 0000000..d07bb81 --- /dev/null +++ b/include/log.h @@ -0,0 +1,36 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __LOG_H__ +#define __LOG_H__ + +#define FEATURE_FEEDBACK_DLOG + +#ifdef FEATURE_FEEDBACK_DLOG + #define LOG_TAG "FEEDBACK" + #include + #define _D(fmt, args...) SLOGD(fmt, ##args) + #define _W(fmt, args...) SLOGW(fmt, ##args) + #define _E(fmt, args...) SLOGE(fmt, ##args) +#else + #define _D(x, ...) + #define _W(x, ...) + #define _E(x, ...) +#endif + +#endif //__LOG_H__ diff --git a/include/xmlparser.h b/include/xmlparser.h new file mode 100644 index 0000000..0c38672 --- /dev/null +++ b/include/xmlparser.h @@ -0,0 +1,47 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __XMLPARSER_H__ +#define __XMLPARSER_H__ + +#include + +struct xmlData { + char *label; + char *data; + int size; +}; + +enum xmlType { + XML_LABEL = 0, + XML_DATA, +}; + +#define VIBRATION_STR "vibration" +#define SOUND_STR "sound" + +xmlDocPtr xml_open(const char *xml); +void xml_close(xmlDocPtr doc); + +xmlNodePtr xml_find(xmlDocPtr doc, const char *label, const xmlChar* expr); +struct xmlData *xml_parse(xmlDocPtr doc, xmlNodePtr cur); +int xml_decode_data(struct xmlData *data); +int xml_save(xmlDocPtr doc, const char *path); +void xml_free(struct xmlData* data); + +#endif //__XMLPARSER_H__ diff --git a/packaging/libfeedback.manifest b/packaging/libfeedback.manifest new file mode 100644 index 0000000..f13bba5 --- /dev/null +++ b/packaging/libfeedback.manifest @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packaging/libfeedback.spec b/packaging/libfeedback.spec new file mode 100644 index 0000000..dd43f18 --- /dev/null +++ b/packaging/libfeedback.spec @@ -0,0 +1,105 @@ +Name: libfeedback +Summary: Feedback library +Version: 0.1.3 +Release: 1 +Group: System/Libraries +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +source1: libfeedback.manifest +source2: svi-data.manifest +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: cmake +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(mm-keysound) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(dbus-1) +Requires(post): svi-data + +%description +Feedback library for playing sound and vibration + + +%package -n libfeedback-devel +Summary: Feedback library for (devel) +Group: Development/Libraries +Requires: libfeedback = %{version}-%{release} + +%description -n libfeedback-devel +Feedback library for playing sound and vibration (devel) + +%package -n svi-data +Summary: svi resource package +Group: Development/Libraries +Requires(post): smack-utils + +%description -n svi-data +svi resource package + +%prep +%setup -q + +%build +export CFLAGS+=" -DTIZEN_ENGINEER_MODE" +cp %{SOURCE1} . +cp %{SOURCE2} . + +%ifarch %{arm} +%define ARCH arm +%else +%define ARCH emulator +%endif + +cmake \ +%if "%{?tizen_profile_name}" == "wearable" + -DMICRO_DD=YES \ +%endif + . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DARCH=%{ARCH} +make + +%install +rm -rf %{buildroot} +%make_install + +mkdir -p %{buildroot}%{_datadir}/license +cp LICENSE %{buildroot}/usr/share/license/%{name} +cp LICENSE %{buildroot}/usr/share/license/svi-data + +mkdir -p %{buildroot}/opt/usr/share/feedback/haptic/custom + +%post -p /sbin/ldconfig + +%post -n svi-data + +if [ -f %{_libdir}/rpm-plugins/msm.so ]; then + find /opt/usr/share/feedback/ | xargs chsmack -a 'svi-data' +fi + +%postun -p /sbin/ldconfig + +%postun -n svi-data +rm -rf %{_datadir}/feedback/ +rm -rf /opt/usr/share/feedback/ + +%files +%defattr(-,root,root,-) +%{_libdir}/libfeedback.so.* +%{_datadir}/license/%{name} +%manifest libfeedback.manifest + +%files -n libfeedback-devel +%defattr(-,root,root,-) +%{_includedir}/feedback/*.h +%{_libdir}/libfeedback.so +%{_libdir}/pkgconfig/feedback.pc + +%files -n svi-data +%defattr(644,root,root,-) +%{_datadir}/feedback/* +%defattr(666,app,app,-) +%dir /opt/usr/share/feedback/haptic/custom +%{_datadir}/license/svi-data +%manifest svi-data.manifest diff --git a/packaging/svi-data.manifest b/packaging/svi-data.manifest new file mode 100644 index 0000000..9e74af7 --- /dev/null +++ b/packaging/svi-data.manifest @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/pg-doxy/doxygen.conf b/pg-doxy/doxygen.conf new file mode 100755 index 0000000..a7cd424 --- /dev/null +++ b/pg-doxy/doxygen.conf @@ -0,0 +1,850 @@ +# Doxyfile 1.5.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = SLP-Developer Library +PROJECT_NUMBER = +OUTPUT_DIRECTORY = ./doxygen_output +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = NO +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = YES +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = YES +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = YES +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = YES +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = YES +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = YES +SORT_BY_SCOPE_NAME = YES +SORT_GROUP_NAMES = YES +GENERATE_TODOLIST = NO +USE_INLINE_TREES = NO +SHOW_NAMESPACES = NO +HTML DYNAMIC SECTIONS = YES +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= NO +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = .. + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.h \ + *.doxy +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = */test/* \ + */debian/* \ + */lost+found/* \ + */i386/* \ + */arm/* \ + */simulator/* \ + *test* \ + */voda3rd/* +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = ../image +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 10 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET =./slp_doxy.css + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 190 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = YES + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = NO + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = NO + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = NO + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = NO + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = NO + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = jpg + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen will always +# show the root nodes and its direct children regardless of this setting. + +DOT_GRAPH_MAX_NODES = 50 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = NO + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = NO + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = YES diff --git a/pg-doxy/pg-doxy.sh b/pg-doxy/pg-doxy.sh new file mode 100755 index 0000000..f542386 --- /dev/null +++ b/pg-doxy/pg-doxy.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Create doxygen from debian package server +# By Jungbae Lee (yi_jungbae@samsung.com) + +cd `dirname $0` +CWD=`pwd` + +# Use doxygen 1.7.0 +export PATH=/usr/local/bin:${HOME}/mytools/bin:${PATH} +export LD_LIBRARY_PATH=${HOME}/mytools/lib:${LD_LIBRARY_PATH} + + +### Configuration +SBOX=/scratchbox/users/$USER/home/$USER +DOXYGEN_OUTPUT_DIR=$CWD/doxygen_output +DOXYGEN=./tool/bin/doxygen +DOXY_CONF=doxygen.conf +IMAGE_DIR=../image #need to change +#IMAGE_DIR=[fill your image path] + + + +####doxygen configuration :: output Directory +mkdir $DOXYGEN_OUTPUT_DIR + +echo "Doxygen running..." +if [ ! -e $CWD/doxygen_output ]; then + mkdir $CWD/doxygen_output +fi +# Run doxygen +$DOXYGEN $DOXY_CONF 2>&1 + +#image copy +cp $CWD/$IMAGE_DIR/* $DOXYGEN_OUTPUT_DIR/html/ + +echo "Finished!" +exit; + diff --git a/pg-doxy/slp_doxy.css b/pg-doxy/slp_doxy.css new file mode 100644 index 0000000..12c03ac --- /dev/null +++ b/pg-doxy/slp_doxy.css @@ -0,0 +1,699 @@ +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 18pt; + color: #3366ED; +} + +h1.pg { + font-size: 18pt; + color: #336666; + margin-right:-0.6pt; + margin-left:0cm; + padding-top:0cm; + padding-right:0cm; + padding-bottom:1pt; + padding-left:0cm; + border-bottom-width:1.5pt; + border-bottom-color:#336666; + border-top-style:none; + border-right-style:none; + border-bottom-style:solid; + border-left-style:none; +} + +h2 { + font-size: 14pt; + color: #336666; +} +h2.pg { + font-size: 14pt; + color: #336666; + margin-right:-0.1pt; + margin-left:0cm; + padding-top:0cm; + padding-right:0cm; + padding-bottom:1pt; + padding-left:0cm; + border-bottom-width:1.2pt; + border-bottom-color:#336666; + border-top-style:none; + border-right-style:none; + border-bottom-style:solid; + border-left-style:none; +} + + +h3 { + font-size: 12pt; + color: #336666; +} +h3.pg { + font-size: 12pt; + color: #336666; +} + + + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + padding: 2px; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px + padding: .2em; + border: solid thin #333; + border-radius: .5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 10px; + margin-right: 10px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 3px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.memitem { + padding: 0; + margin-bottom: 10px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F8 95%, #F0); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FF), color-stop(0.95,#F8), to(#F0)); +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} +*/ + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right: 15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath a:hover +{ + color:#6884BD; +} + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + diff --git a/pg-doxy/tool/bin/doxygen b/pg-doxy/tool/bin/doxygen new file mode 100755 index 0000000..3662da8 Binary files /dev/null and b/pg-doxy/tool/bin/doxygen differ diff --git a/pg-doxy/tool/bin/doxytag b/pg-doxy/tool/bin/doxytag new file mode 100755 index 0000000..adb0c90 Binary files /dev/null and b/pg-doxy/tool/bin/doxytag differ diff --git a/pg-doxy/tool/man/man1/doxygen.1 b/pg-doxy/tool/man/man1/doxygen.1 new file mode 100644 index 0000000..a3d8c9a --- /dev/null +++ b/pg-doxy/tool/man/man1/doxygen.1 @@ -0,0 +1,46 @@ +.TH DOXYGEN "1" "July 2010" "doxygen 1.7.0" "User Commands" +.SH NAME +doxygen \- documentation system for various programming languages +.SH DESCRIPTION +Doxygen is a documentation system for C++, C, Java, Objective-C, IDL +(Corba and Microsoft flavors) and to some extent PHP, C#, and D. +.PP +You can use doxygen in a number of ways: +.TP +1) Use doxygen to generate a template configuration file: +.IP +doxygen [-s] \fB\-g\fR [configName] +.IP +If - is used for configName doxygen will write to standard output. +.TP +2) Use doxygen to update an old configuration file: +.IP +doxygen [-s] \fB\-u\fR [configName] +.TP +3) Use doxygen to generate documentation using an existing configuration file: +.IP +doxygen [configName] +.IP +If - is used for configName doxygen will read from standard input. +.TP +4) Use doxygen to generate a template style sheet file for RTF, HTML or Latex. +.TP +RTF: +doxygen \fB\-w\fR rtf styleSheetFile +.TP +HTML: +doxygen \fB\-w\fR html headerFile footerFile styleSheetFile [configFile] +.TP +LaTeX: doxygen \fB\-w\fR latex headerFile styleSheetFile [configFile] +.TP +5) Use doxygen to generate an rtf extensions file +.TP +RTF: +doxygen \fB\-e\fR rtf extensionsFile +.PP +If \fB\-s\fR is specified the comments in the config file will be omitted. +If configName is omitted `Doxyfile' will be used as a default. +.SH AUTHOR +Doxygen version 1.7.0, Copyright Dimitri van Heesch 1997-2007 +.SH SEE ALSO +doxytag(1), doxywizard(1). diff --git a/pg-doxy/tool/man/man1/doxytag.1 b/pg-doxy/tool/man/man1/doxytag.1 new file mode 100644 index 0000000..f496899 --- /dev/null +++ b/pg-doxy/tool/man/man1/doxytag.1 @@ -0,0 +1,21 @@ +.TH DOXYTAG "1" "July 2010" "doxytag 1.7.0" "User Commands" +.SH NAME +doxytag \- generates a tag file and/or a search index for a set of HTML files +.SH SYNOPSIS +.B doxytag +[\fI-t tag_file\fR] [\fI-s index_file\fR] [ \fIhtml_file \fR[\fIhtml_file\fR...] ] +.SH DESCRIPTION +Generates a tag file and/or a search index for a set of HTML files. Use +doxysearch as a CGI program to search the tag file generated by doxytag. +.SH OPTIONS +.TP +\fB\-t\fR +Generate tag file . +.TP +\fB\-s\fR +Generate search index . +.PP +If no HTML files are given all files in the current dir that +have a .html extension are parsed. +.SH SEE ALSO +doxygen(1), doxywizard(1). diff --git a/src/dbus.c b/src/dbus.c new file mode 100644 index 0000000..f013abe --- /dev/null +++ b/src/dbus.c @@ -0,0 +1,136 @@ +/* + * feedback + * + * 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 +#include +#include +#include + +#include "common.h" +#include "log.h" +#include "dbus.h" + +/* -1 is a default timeout value, it's converted to 25*1000 internally. */ +#define DBUS_REPLY_TIMEOUT (-1) + +static int append_variant(DBusMessageIter *iter, const char *sig, char *param[]) +{ + char *ch; + int i; + int int_type; + uint64_t int64_type; + DBusMessageIter arr; + struct dbus_byte *byte; + + if (!sig || !param) + return 0; + + for (ch = (char*)sig, i = 0; *ch != '\0'; ++i, ++ch) { + switch (*ch) { + case 'i': + int_type = atoi(param[i]); + dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &int_type); + break; + case 'u': + int_type = strtoul(param[i], NULL, 10); + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &int_type); + break; + case 't': + int64_type = atoll(param[i]); + dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT64, &int64_type); + break; + case 's': + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, ¶m[i]); + break; + case 'a': + ++i, ++ch; + switch (*ch) { + case 'y': + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &arr); + byte = (struct dbus_byte*)param[i]; + dbus_message_iter_append_fixed_array(&arr, DBUS_TYPE_BYTE, &(byte->data), byte->size); + dbus_message_iter_close_container(iter, &arr); + break; + default: + break; + } + break; + default: + return -EINVAL; + } + } + + return 0; +} + +int dbus_method_sync(const char *dest, const char *path, + const char *interface, const char *method, + const char *sig, char *param[]) +{ + DBusConnection *conn; + DBusMessage *msg; + DBusMessageIter iter; + DBusMessage *reply; + DBusError err; + int ret, result; + + conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); + if (!conn) { + _E("dbus_bus_get error"); + return -EPERM; + } + + msg = dbus_message_new_method_call(dest, path, interface, method); + if (!msg) { + _E("dbus_message_new_method_call(%s:%s-%s)", + path, interface, method); + return -EBADMSG; + } + + dbus_message_iter_init_append(msg, &iter); + ret = append_variant(&iter, sig, param); + if (ret < 0) { + _E("append_variant error(%d) %s %s:%s-%s", + ret, dest, path, interface, method); + dbus_message_unref(msg); + return ret; + } + + dbus_error_init(&err); + + reply = dbus_connection_send_with_reply_and_block(conn, msg, DBUS_REPLY_TIMEOUT, &err); + dbus_message_unref(msg); + if (!reply) { + _E("dbus_connection_send error(%s:%s) %s %s:%s-%s", + err.name, err.message, dest, path, interface, method); + dbus_error_free(&err); + return -ECOMM; + } + + ret = dbus_message_get_args(reply, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID); + dbus_message_unref(reply); + if (!ret) { + _E("no message : [%s:%s] %s %s:%s-%s", + err.name, err.message, dest, path, interface, method); + dbus_error_free(&err); + return -ENOMSG; + } + + return result; +} diff --git a/src/devices.c b/src/devices.c new file mode 100644 index 0000000..e135e07 --- /dev/null +++ b/src/devices.c @@ -0,0 +1,105 @@ +/* + * 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 +#include + +#include "devices.h" +#include "common.h" +#include "log.h" + +#define DD_LIST_PREPEND(a, b) \ + a = g_list_prepend(a, b) +#define DD_LIST_APPEND(a, b) \ + a = g_list_append(a, b) +#define DD_LIST_REMOVE(a, b) \ + a = g_list_remove(a, b) +#define DD_LIST_FOREACH(head, elem, node) \ + for (elem = head; elem && ((node = elem->data) != NULL); elem = elem->next, node = NULL) + +typedef GList dd_list; +static dd_list *dev_head; + +void add_device(const struct device_ops *dev) +{ + DD_LIST_APPEND(dev_head, (struct device_ops*)dev); +} + +void remove_device(const struct device_ops *dev) +{ + DD_LIST_REMOVE(dev_head, (struct device_ops*)dev); +} + +const struct device_ops *find_device(int type) +{ + dd_list *elem; + const struct device_ops *dev; + + DD_LIST_FOREACH(dev_head, elem, dev) { + if (dev->type == type) + return dev; + } + return NULL; +} + +void devices_init(void) +{ + dd_list *elem; + const struct device_ops *dev; + + DD_LIST_FOREACH(dev_head, elem, dev) { + _D("[%s] initialize", str_type[dev->type]); + if (dev->init) + dev->init(); + } +} + +void devices_exit(void) +{ + dd_list *elem; + const struct device_ops *dev; + + DD_LIST_FOREACH(dev_head, elem, dev) { + _D("[%s] deinitialize", str_type[dev->type]); + if (dev->exit) + dev->exit(); + } +} + +void devices_play(int pattern) +{ + dd_list *elem; + const struct device_ops *dev; + + DD_LIST_FOREACH(dev_head, elem, dev) { + if (dev->play) + dev->play(pattern); + } +} + +void devices_stop(void) +{ + dd_list *elem; + const struct device_ops *dev; + + DD_LIST_FOREACH(dev_head, elem, dev) { + if (dev->stop) + dev->stop(); + } +} diff --git a/src/feedback.c b/src/feedback.c new file mode 100644 index 0000000..f14ffef --- /dev/null +++ b/src/feedback.c @@ -0,0 +1,302 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include +#include + +#include "feedback.h" +#include "common.h" +#include "log.h" +#include "devices.h" + +#ifndef API +#define API __attribute__ ((visibility("default"))) +#endif + +int callstatus; +int alert_callstatus; + +static bool binit; + +static void feedback_callstatus_cb(keynode_t *key, void* data) +{ + callstatus = vconf_keynode_get_int(key); +} + +static void feedback_alertstatus_cb(keynode_t *key, void* data) +{ + alert_callstatus = vconf_keynode_get_int(key); +} + +static feedback_pattern_e get_alert_on_call_key(feedback_pattern_e pattern) +{ + switch(pattern) { + case FEEDBACK_PATTERN_MESSAGE: + case FEEDBACK_PATTERN_EMAIL: + case FEEDBACK_PATTERN_WAKEUP: + case FEEDBACK_PATTERN_SCHEDULE: + case FEEDBACK_PATTERN_TIMER: + case FEEDBACK_PATTERN_GENERAL: + case FEEDBACK_PATTERN_CHARGERCONN: + case FEEDBACK_PATTERN_CHARGING_ERROR: + case FEEDBACK_PATTERN_FULLCHARGED: + case FEEDBACK_PATTERN_LOWBATT: + return (feedback_pattern_e)(pattern+1); + default: + break; + } + + return pattern; +} + +static void __DESTRUCTOR__ module_exit(void) +{ + if (!binit) + return; + + vconf_ignore_key_changed(VCONFKEY_CALL_STATE, feedback_callstatus_cb); + vconf_ignore_key_changed(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, feedback_alertstatus_cb); + + /* deinitialize device */ + devices_exit(); + + binit = false; +} + +API int feedback_initialize() +{ + if (binit) + return FEEDBACK_ERROR_NONE; + + /* check call status */ + if (vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) < 0) + _W("VCONFKEY_CALL_STATE ==> FAIL!!"); + + + /* alert option on call */ + if (vconf_get_int(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, &alert_callstatus) < 0) + _W("VCONFKEY_CISSAPPL_ON_CALL_INT ==> FAIL!!"); + + /* add watch for status value */ + vconf_notify_key_changed(VCONFKEY_CALL_STATE, feedback_callstatus_cb, NULL); + vconf_notify_key_changed(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, feedback_alertstatus_cb, NULL); + + /* initialize device */ + devices_init(); + + binit = true; + return FEEDBACK_ERROR_NONE; +} + +API int feedback_deinitialize() +{ + return FEEDBACK_ERROR_NONE; +} + +API int feedback_play(feedback_pattern_e pattern) +{ + /* check initialize */ + if (!binit) { + _E("Not initialized"); + return FEEDBACK_ERROR_NOT_INITIALIZED; + } + + if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) { + _E("Invalid parameter : pattern(%d)", pattern); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + if (pattern == FEEDBACK_PATTERN_NONE) { + _D("pattern is NONE"); + return FEEDBACK_ERROR_NONE; + } + + /* in case of call connected or connecting */ + if (callstatus != VCONFKEY_CALL_OFF) { + pattern = get_alert_on_call_key(pattern); + _D("Call status is connected or connecting. pattern changed : %s", str_pattern[pattern]); + } + + /* play all device */ + devices_play(pattern); + + return FEEDBACK_ERROR_NONE; +} + +API int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern) +{ + const struct device_ops *dev; + int err; + + /* check initialize */ + if (!binit) { + _E("Not initialized"); + return FEEDBACK_ERROR_NOT_INITIALIZED; + } + + if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) { + _E("Invalid parameter : type(%d)", type); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) { + _E("Invalid parameter : pattern(%d)", pattern); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + if (pattern == FEEDBACK_PATTERN_NONE) { + _D("pattern is NONE"); + return FEEDBACK_ERROR_NONE; + } + + /* in case of call connected or connecting */ + if (callstatus != VCONFKEY_CALL_OFF) { + pattern = get_alert_on_call_key(pattern); + _D("Call status is connected or connecting. pattern changed : %s", str_pattern[pattern]); + } + + /* should play led regardless of sound or vibration */ + dev = find_device(FEEDBACK_TYPE_LED); + if (dev) { + err = dev->play(pattern); + if (err < 0) + _E("feedback_play_led is failed"); + } + + if (type == FEEDBACK_TYPE_LED) + return FEEDBACK_ERROR_NONE; + + /* play proper device */ + dev = find_device(type); + if (dev) { + err = dev->play(pattern); + if (err < 0) + _E("fail to play sound"); + } + + return FEEDBACK_ERROR_NONE; +} + +API int feedback_play_type_by_name(char *type, char *pattern) +{ + feedback_type_e etype; + feedback_pattern_e epattern; + + if (!type || !pattern) { + _E("Invalid parameter : type(%x), pattern(%x)", type, pattern); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + for (etype = FEEDBACK_TYPE_NONE; etype < FEEDBACK_TYPE_END; ++etype) { + if (!strncmp(type, str_type[etype], strlen(type))) + break; + } + + if (etype == FEEDBACK_TYPE_END) { + _E("Invalid parameter : type(%s)", type); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + for (epattern = 0; epattern < FEEDBACK_PATTERN_END; ++epattern) { + if (!strncmp(pattern, str_pattern[epattern], strlen(pattern))) + break; + } + + if (epattern == FEEDBACK_PATTERN_END) { + _E("Invalid parameter : pattern(%d)", pattern); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + return feedback_play_type(etype, epattern); +} + +API int feedback_stop(void) +{ + /* check initialize */ + if (!binit) { + _E("Not initialized"); + return FEEDBACK_ERROR_NOT_INITIALIZED; + } + + /* stop all device */ + devices_stop(); + + return FEEDBACK_ERROR_NONE; +} + +API int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e pattern, char** path) +{ + const struct device_ops *dev; + char buf[PATH_MAX] = {0,}; + int err; + + if (path == NULL) { + _E("Invalid parameter : path(NULL)"); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) { + _E("Invalid parameter : type(%d)", type); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) { + _E("Invalid parameter : pattern(%d)", pattern); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + /* proper device get path */ + dev = find_device(type); + if (dev) { + err = dev->get_path(pattern, buf, sizeof(buf)); + if (err < 0) + return FEEDBACK_ERROR_OPERATION_FAILED; + } + + *path = strdup(buf); + return FEEDBACK_ERROR_NONE; +} + +API int feedback_set_resource_path(feedback_type_e type, feedback_pattern_e pattern, char *path) +{ + const struct device_ops *dev; + int err; + + if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) { + _E("Invalid parameter : type(%d)", type); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) { + _E("Invalid parameter : pattern(%d)", pattern); + return FEEDBACK_ERROR_INVALID_PARAMETER; + } + + /* proper device set path */ + dev = find_device(type); + if (dev) { + err = dev->set_path(pattern, path); + if (err < 0) + return FEEDBACK_ERROR_OPERATION_FAILED; + } + + return FEEDBACK_ERROR_NONE; +} diff --git a/src/sound.c b/src/sound.c new file mode 100644 index 0000000..1325b70 --- /dev/null +++ b/src/sound.c @@ -0,0 +1,365 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "feedback-ids.h" +#include "common.h" +#include "log.h" +#include "devices.h" +#include "xmlparser.h" + +#define SOUND_XML "/usr/share/feedback/sound.xml" + +static int sndstatus; +static int touch_sndstatus; +static int lock_sndstatus; +static int keytone_sndstatus; +static int camerastatus; +static int shutter_sndstatus; + +static xmlDocPtr v_doc; + +static char sound_file[FEEDBACK_PATTERN_END][NAME_MAX]; + +inline int is_sound_mode(void) +{ + return sndstatus; +} + +static void feedback_touch_sndstatus_cb(keynode_t *key, void* data) +{ + touch_sndstatus = vconf_keynode_get_bool(key); +} + +static void feedback_lock_sndstatus_cb(keynode_t *key, void* data) +{ + lock_sndstatus = vconf_keynode_get_bool(key); +} + +static void feedback_keytone_sndstatus_cb(keynode_t *key, void* data) +{ + keytone_sndstatus = vconf_keynode_get_bool(key); +} + +static void feedback_camerastatus_cb(keynode_t *key, void* data) +{ + camerastatus = vconf_keynode_get_int(key); +} + +static volume_type_t get_volume_type(feedback_pattern_e pattern) +{ + if (pattern == FEEDBACK_PATTERN_TAP) + return VOLUME_TYPE_SYSTEM|VOLUME_GAIN_TOUCH; + else if (pattern >= FEEDBACK_PATTERN_KEY0 && pattern <= FEEDBACK_PATTERN_KEY_BACK) + return VOLUME_TYPE_SYSTEM|VOLUME_GAIN_DIALER; + else if (pattern == FEEDBACK_PATTERN_VOLUME_KEY) + return VOLUME_TYPE_RINGTONE; + else if (camerastatus && shutter_sndstatus && pattern == FEEDBACK_PATTERN_SCREEN_CAPTURE) + return VOLUME_TYPE_FIXED; + + return VOLUME_TYPE_SYSTEM; +} + +static bool get_always_alert_case(feedback_pattern_e pattern) +{ + switch (pattern) { + case FEEDBACK_PATTERN_WAKEUP: + case FEEDBACK_PATTERN_WAKEUP_ON_CALL: + return true; + case FEEDBACK_PATTERN_MESSAGE_ON_CALL: + case FEEDBACK_PATTERN_EMAIL_ON_CALL: + case FEEDBACK_PATTERN_GENERAL_ON_CALL: + if (alert_callstatus) + return true; + break; + case FEEDBACK_PATTERN_SMART_ALERT: + case FEEDBACK_PATTERN_SEND_SOS_MESSAGE: + case FEEDBACK_PATTERN_END_SOS_MESSAGE: + case FEEDBACK_PATTERN_CMAS: + return true; + case FEEDBACK_PATTERN_SCREEN_CAPTURE: + if (camerastatus && shutter_sndstatus) + return true; + break; + case FEEDBACK_PATTERN_OUTGOING_CALL: + return true; + default: + break; + } + return false; +} + +static bool get_always_off_case(feedback_pattern_e pattern) +{ + switch (pattern) { + case FEEDBACK_PATTERN_TAP ... FEEDBACK_PATTERN_MAX_CHARACTER: + case FEEDBACK_PATTERN_HOLD ... FEEDBACK_PATTERN_HW_HOLD: + if (!touch_sndstatus) + return true; + break; + case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK: + if (!keytone_sndstatus) + return true; + break; + case FEEDBACK_PATTERN_LOCK: + case FEEDBACK_PATTERN_UNLOCK: + case FEEDBACK_PATTERN_LOCK_SWIPE: + case FEEDBACK_PATTERN_UNLOCK_SWIPE: + if (!lock_sndstatus) + return true; + break; + default: + break; + } + return false; +} + +static int get_xml_data(xmlDocPtr doc, feedback_pattern_e pattern, struct xmlData **data) +{ + xmlNodePtr cur; + struct xmlData *retData; + + cur = xml_find(doc, SOUND_STR, (const xmlChar*)str_pattern[pattern]); + /* This pattern does not have sound file to play */ + if (cur == NULL) + return -ENOENT; + + retData = xml_parse(doc, cur); + if (retData == NULL) { + _E("xml_parse fail"); + return -EPERM; + } + + *data = retData; + return 0; +} + +static void release_xml_data(struct xmlData *data) +{ + if (data == NULL) + return; + + xml_free(data); +} + +static void sound_init(void) +{ + /* xml Init */ + v_doc = xml_open(SOUND_XML); + if (v_doc == NULL) { + _E("xml_open(%s) fail", SOUND_XML); + return; + } + + /* check sound status */ + if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sndstatus) < 0) + _W("VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL ==> FAIL!!"); + + if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &lock_sndstatus) < 0) + _W("VCONFKEY_SETAPPL_SOUND_LOCK_BOOL ==> FAIL!!"); + + if (vconf_get_bool(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, &keytone_sndstatus) < 0) + _W("VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL ==> FAIL!!"); + + /* check camera status */ + if (vconf_get_int(VCONFKEY_CAMERA_STATE, &camerastatus) < 0) + _W("VCONFKEY_CAMERA_STATE ==> FAIL!!"); + + /* shutter sound policy */ + // This vconf is read just once, because this value is not changed in running time. + if (vconf_get_int(VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY, &shutter_sndstatus) < 0) + _W("VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY ==> FAIL!!"); + + /* add watch for status value */ + vconf_notify_key_changed(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, feedback_touch_sndstatus_cb, NULL); + vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, feedback_lock_sndstatus_cb, NULL); + vconf_notify_key_changed(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, feedback_keytone_sndstatus_cb, NULL); + vconf_notify_key_changed(VCONFKEY_CAMERA_STATE, feedback_camerastatus_cb, NULL); +} + +static void sound_exit(void) +{ + /* remove watch */ + vconf_ignore_key_changed(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, feedback_touch_sndstatus_cb); + vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, feedback_lock_sndstatus_cb); + vconf_ignore_key_changed(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, feedback_keytone_sndstatus_cb); + vconf_ignore_key_changed(VCONFKEY_CAMERA_STATE, feedback_camerastatus_cb); + + if (v_doc) { + xml_close(v_doc); + v_doc = NULL; + } +} + +static int sound_play(feedback_pattern_e pattern) +{ + struct stat buf; + int retry = FEEDBACK_RETRY_CNT, ret; + char *path; + struct xmlData *data = NULL; + + if (!v_doc) { + _E("Not initialize"); + return -EPERM; + } + + if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) < 0) { + _D("fail to get sound status, will work as turning off"); + sndstatus = 0; + } + + if (sndstatus == 0 && !get_always_alert_case(pattern)) { + _D("Sound condition is OFF (sndstatus : %d)", sndstatus); + return 0; + } + + if (sndstatus && get_always_off_case(pattern)) { + _D("Sound always off condition"); + return 0; + } + + /* check if the state of voice recorder is recording */ + if (vconf_get_int(VCONFKEY_SOUND_STATUS, &ret) < 0) { + _D("fail to get media sound status, status will be zero"); + ret = 0; + } + + if (ret & VCONFKEY_SOUND_STATUS_AVRECORDING) { + _D("voice recording status is RECORDING"); + return 0; + } + + /* check whether there is a user defined file */ + path = sound_file[pattern]; + + /* if not */ + if (!(*path)) { + ret = get_xml_data(v_doc, pattern, &data); + if (ret == -ENOENT) { + _D("No sound case(%s)", str_pattern[pattern]); + return 0; + } + + if (ret < 0) { + _E("get_xml_data fail"); + return -EPERM; + } + + if (!data->data) { + _D("No sound case(%s)", str_pattern[pattern]); + release_xml_data(data); + return 0; + } + + path = data->data; + } + + if (stat(path, &buf)) { + _E("%s is not presents", path); + release_xml_data(data); + return -ENOENT; + } + + /* play sound file */ + do { + ret = mm_sound_play_keysound(path, get_volume_type(pattern)); + if (ret == MM_ERROR_NONE) { + _D("Play success! SND filename is %s", path); + release_xml_data(data); + return 0; + } + _E("mm_sound_play_keysound() returned error(%d)", ret); + } while(retry--); + + release_xml_data(data); + return -EPERM; +} + +static int sound_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen) +{ + char *cur_path; + int ret = 0; + struct xmlData *data = NULL; + + if (!buf || buflen <= 0) + return -EINVAL; + + cur_path = sound_file[pattern]; + if (!strncmp(cur_path, "", 1)) { + ret = get_xml_data(v_doc, pattern, &data); + if (ret >= 0 && data && data->data) + cur_path = (char*)data->data; + } + + if (!cur_path) { + _E("This pattern(%s) in sound type is not supported to play", str_pattern[pattern]); + cur_path = "NULL"; + ret = -ENOENT; + } + + snprintf(buf, buflen, "%s", cur_path); + release_xml_data(data); + return 0; +} + +static int sound_set_path(feedback_pattern_e pattern, char *path) +{ + struct stat buf; + char *ppath; + + /* + * check the path is valid + * if path is null, below operation is ignored + */ + if (path && stat(path, &buf)) { + _E("%s is not presents", path); + return -errno; + } + + ppath = sound_file[pattern]; + + /* if path is NULL, this pattern set to default file */ + if (path) + snprintf(ppath, NAME_MAX, "%s", path); + else + memset(ppath, 0, NAME_MAX); + + _D("The file of pattern(%s) is changed to [%s]", str_pattern[pattern], path); + return 0; +} + +static const struct device_ops sound_device_ops = { + .type = FEEDBACK_TYPE_SOUND, + .init = sound_init, + .exit = sound_exit, + .play = sound_play, + .get_path = sound_get_path, + .set_path = sound_set_path, +}; + +DEVICE_OPS_REGISTER(&sound_device_ops); diff --git a/src/str.c b/src/str.c new file mode 100644 index 0000000..13c2b53 --- /dev/null +++ b/src/str.c @@ -0,0 +1,124 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +const char *str_type[] = +{ + "FEEDBACK_TYPE_NONE", + "FEEDBACK_TYPE_SOUND", + "FEEDBACK_TYPE_VIBRATION", + "FEEDBACK_TYPE_LED", + "FEEDBACK_TYPE_END", +}; + +const char *str_pattern[] = +{ + "FEEDBACK_PATTERN_TAP", + "FEEDBACK_PATTERN_SIP", + "FEEDBACK_PATTERN_SIP_BACKSPACE", + "FEEDBACK_PATTERN_SIP_FUNCTION", + "FEEDBACK_PATTERN_SIP_FJKEY", + "FEEDBACK_PATTERN_MAX_CHARACTER", + "FEEDBACK_PATTERN_KEY0", + "FEEDBACK_PATTERN_KEY1", + "FEEDBACK_PATTERN_KEY2", + "FEEDBACK_PATTERN_KEY3", + "FEEDBACK_PATTERN_KEY4", + "FEEDBACK_PATTERN_KEY5", + "FEEDBACK_PATTERN_KEY6", + "FEEDBACK_PATTERN_KEY7", + "FEEDBACK_PATTERN_KEY8", + "FEEDBACK_PATTERN_KEY9", + "FEEDBACK_PATTERN_KEY_STAR", + "FEEDBACK_PATTERN_KEY_SHARP", + "FEEDBACK_PATTERN_KEY_BACK", + "FEEDBACK_PATTERN_HOLD", + "FEEDBACK_PATTERN_MULTI_TAP", + "FEEDBACK_PATTERN_HW_TAP", + "FEEDBACK_PATTERN_HW_HOLD", + + "FEEDBACK_PATTERN_MESSAGE", + "FEEDBACK_PATTERN_MESSAGE_ON_CALL", + "FEEDBACK_PATTERN_EMAIL", + "FEEDBACK_PATTERN_EMAIL_ON_CALL", + "FEEDBACK_PATTERN_WAKEUP", + "FEEDBACK_PATTERN_WAKEUP_ON_CALL", + "FEEDBACK_PATTERN_SCHEDULE", + "FEEDBACK_PATTERN_SCHEDULE_ON_CALL", + "FEEDBACK_PATTERN_TIMER", + "FEEDBACK_PATTERN_TIMER_ON_CALL", + "FEEDBACK_PATTERN_GENERAL", + "FEEDBACK_PATTERN_GENERAL_ON_CALL", + "FEEDBACK_PATTERN_SMART_ALERT", + + "FEEDBACK_PATTERN_POWERON", + "FEEDBACK_PATTERN_POWEROFF", + "FEEDBACK_PATTERN_CHARGERCONN", + "FEEDBACK_PATTERN_CHARGERCONN_ON_CALL", + "FEEDBACK_PATTERN_CHARGING_ERROR", + "FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL", + "FEEDBACK_PATTERN_FULLCHARGED", + "FEEDBACK_PATTERN_FULLCHARGED_ON_CALL", + "FEEDBACK_PATTERN_LOWBATT", + "FEEDBACK_PATTERN_LOWBATT_ON_CALL", + "FEEDBACK_PATTERN_LOCK", + "FEEDBACK_PATTERN_UNLOCK", + "FEEDBACK_PATTERN_LOCK_SWIPE", + "FEEDBACK_PATTERN_UNLOCK_SWIPE", + "FEEDBACK_PATTERN_GEOMETRIC_LOCK", + "FEEDBACK_PATTERN_CALLCONNECT", + "FEEDBACK_PATTERN_DISCALLCONNECT", + "FEEDBACK_PATTERN_OUTGOING_CALL", + "FEEDBACK_PATTERN_MINUTEMINDER", + "FEEDBACK_PATTERN_VIBRATION_ON", + "FEEDBACK_PATTERN_SILENT_OFF", + "FEEDBACK_PATTERN_BT_CONNECTED", + "FEEDBACK_PATTERN_BT_DISCONNECTED", + "FEEDBACK_PATTERN_BT_PAIRING", + "FEEDBACK_PATTERN_BT_WAITING", + "FEEDBACK_PATTERN_SCREEN_CAPTURE", + "FEEDBACK_PATTERN_LIST_REORDER", + "FEEDBACK_PATTERN_LIST_SLIDER", + "FEEDBACK_PATTERN_VOLUME_KEY", + "FEEDBACK_PATTERN_MMS", + "FEEDBACK_PATTERN_HOURLY_ALERT", + + "FEEDBACK_PATTERN_SAFETY_ALERT", + "FEEDBACK_PATTERN_ACCIDENT_DETECT", + "FEEDBACK_PATTERN_SEND_SOS_MESSAGE", + "FEEDBACK_PATTERN_END_SOS_MESSAGE", + "FEEDBACK_PATTERN_EMERGENCY_BUZZER", + "FEEDBACK_PATTERN_SAFETY_LOW_POWER", + "FEEDBACK_PATTERN_CMAS", + "FEEDBACK_PATTERN_SPEED_UP", + "FEEDBACK_PATTERN_SLOW_DOWN", + "FEEDBACK_PATTERN_KEEP_THIS_PACE", + "FEEDBACK_PATTERN_GOAL_ACHIEVED", + "FEEDBACK_PATTERN_EXERCISE_COUNT", + "FEEDBACK_PATTERN_START_CUE", + "FEEDBACK_PATTERN_HEALTH_PACE", + "FEEDBACK_PATTERN_INACTIVE_TIME", + "FEEDBACK_PATTERN_MEASURING_SUCCESS", + "FEEDBACK_PATTERN_MEASURING_FAILURE", + "FEEDBACK_PATTERN_UV_PROCESSING", + "FEEDBACK_PATTERN_SHEALTH_START", + "FEEDBACK_PATTERN_SHEALTH_PAUSE", + "FEEDBACK_PATTERN_SHEALTH_STOP", + "FEEDBACK_PATTERN_3RD_APPLICATION", +}; diff --git a/src/vibrator.c b/src/vibrator.c new file mode 100644 index 0000000..90464b3 --- /dev/null +++ b/src/vibrator.c @@ -0,0 +1,556 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "feedback-ids.h" +#include "common.h" +#include "log.h" +#include "devices.h" +#include "xmlparser.h" +#include "dbus.h" + +#define DEFAULT_VIB_LEVEL 3 +#define HAPTIC_FEEDBACK_STEP 20 /**< feedback max / slider step */ + +#define HAPTIC_DEVICE 0 + +enum haptic_priority +{ + HAPTIC_PRIORITY_MIN = 0, + HAPTIC_PRIORITY_MIDDLE, + HAPTIC_PRIORITY_HIGH, +}; + +enum haptic_iteration +{ + HAPTIC_ITERATION_ONCE = 1, + HAPTIC_ITERATION_INFINITE = 256, +}; + +#define VIBRATION_XML "/usr/share/feedback/vibration.xml" + +#define METHOD_OPEN "OpenDevice" +#define METHOD_CLOSE "CloseDevice" +#define METHOD_VIBRATE_BUFFER "VibrateBuffer" +#define METHOD_STOP "StopDevice" + +static int vibstatus; +static int noti_vibstatus; +static int vib_level; +static int noti_level; +static int feedbackstatus; + +static unsigned int v_handle; +static xmlDocPtr v_doc; + +static char haptic_file[FEEDBACK_PATTERN_END][NAME_MAX]; + +static int haptic_open(void) +{ + char *arr[1]; + char buf_index[32]; + + snprintf(buf_index, sizeof(buf_index), "%d", HAPTIC_DEVICE); + arr[0] = buf_index; + + return dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_HAPTIC, + DEVICED_INTERFACE_HAPTIC, METHOD_OPEN, + "i", arr); +} + +static int haptic_close(unsigned int handle) +{ + char *arr[1]; + char buf_handle[32]; + + snprintf(buf_handle, sizeof(buf_handle), "%u", handle); + arr[0] = buf_handle; + + return dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_HAPTIC, + DEVICED_INTERFACE_HAPTIC, METHOD_CLOSE, + "u", arr); +} + +static int haptic_vibrate_buffer(unsigned int handle, + const unsigned char *buffer, + int size, + int iteration, + int feedback, + int priority) +{ + char *arr[6]; + char buf_handle[32]; + char buf_iteration[32]; + char buf_feedback[32]; + char buf_priority[32]; + struct dbus_byte bytes; + + snprintf(buf_handle, sizeof(buf_handle), "%u", handle); + arr[0] = buf_handle; + bytes.size = size; + bytes.data = buffer; + arr[2] = (char*)&bytes; + snprintf(buf_iteration, sizeof(buf_iteration), "%d", iteration); + arr[3] = buf_iteration; + snprintf(buf_feedback, sizeof(buf_feedback), "%d", feedback); + arr[4] = buf_feedback; + snprintf(buf_priority, sizeof(buf_priority), "%d", priority); + arr[5] = buf_priority; + + return dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_HAPTIC, + DEVICED_INTERFACE_HAPTIC, METHOD_VIBRATE_BUFFER, + "uayiii", arr); +} + +static int haptic_vibrate_stop(unsigned int handle) +{ + char *arr[1]; + char buf_handle[32]; + + snprintf(buf_handle, sizeof(buf_handle), "%u", handle); + arr[0] = buf_handle; + + return dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_HAPTIC, + DEVICED_INTERFACE_HAPTIC, METHOD_STOP, + "u", arr); +} + +static unsigned char* convert_file_to_buffer(const char *file_name, int *size) +{ + FILE *pf; + long file_size; + unsigned char *pdata = NULL; + + if (!file_name) + return NULL; + + /* Get File Stream Pointer */ + pf = fopen(file_name, "rb"); + if (!pf) { + _E("fopen failed : %d", errno); + return NULL; + } + + if (fseek(pf, 0, SEEK_END)) + goto error; + + file_size = ftell(pf); + if (fseek(pf, 0, SEEK_SET)) + goto error; + + if (file_size < 0) + goto error; + + pdata = (unsigned char*)malloc(file_size); + if (!pdata) + goto error; + + if (fread(pdata, 1, file_size, pf) != file_size) + goto err_free; + + fclose(pf); + *size = file_size; + return pdata; + +err_free: + free(pdata); + +error: + fclose(pf); + + _E("failed to convert file to buffer (%d)", errno); + return NULL; +} + +static void feedback_noti_vibstatus_cb(keynode_t *key, void* data) +{ + noti_vibstatus = vconf_keynode_get_bool(key); +} + +static void feedback_vib_cb(keynode_t *key, void* data) +{ + vib_level = vconf_keynode_get_int(key); +} + +static void feedback_noti_cb(keynode_t *key, void* data) +{ + noti_level = vconf_keynode_get_int(key); +} + +static void feedback_feedbackstatus_cb(keynode_t *key, void* data) +{ + feedbackstatus = vconf_keynode_get_bool(key); +} + +static int get_priority(feedback_pattern_e pattern) +{ + if (pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD) + return HAPTIC_PRIORITY_MIN; + + return HAPTIC_PRIORITY_MIDDLE; +} + +static int get_haptic_level(feedback_pattern_e pattern) +{ + int level; + + if (pattern >= FEEDBACK_PATTERN_MESSAGE && pattern <= FEEDBACK_PATTERN_SMART_ALERT) + level = noti_level * HAPTIC_FEEDBACK_STEP; + else + level = vib_level * HAPTIC_FEEDBACK_STEP; + + _D("Call status : %d, pattern : %s, level : %d", callstatus, str_pattern[pattern], level); + if (callstatus == VCONFKEY_CALL_VOICE_ACTIVE + || callstatus == VCONFKEY_CALL_VIDEO_ACTIVE) { + // if call status is ON, vibration magnitude is 20% + level = 20; + _D("level changed : %d", level); + } + + return level; +} + +static bool get_always_alert_case(feedback_pattern_e pattern) +{ + switch (pattern) { + case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK: + case FEEDBACK_PATTERN_HOLD: + if (feedbackstatus) + return true; + break; + case FEEDBACK_PATTERN_SIP: + case FEEDBACK_PATTERN_SIP_BACKSPACE: + case FEEDBACK_PATTERN_SIP_FUNCTION: + case FEEDBACK_PATTERN_SIP_FJKEY: + return true; + case FEEDBACK_PATTERN_TIMER: + case FEEDBACK_PATTERN_TIMER_ON_CALL: + case FEEDBACK_PATTERN_WAKEUP: + case FEEDBACK_PATTERN_WAKEUP_ON_CALL: + return true; + case FEEDBACK_PATTERN_MESSAGE_ON_CALL: + case FEEDBACK_PATTERN_EMAIL_ON_CALL: + case FEEDBACK_PATTERN_GENERAL_ON_CALL: + if (alert_callstatus) + return true; + break; + case FEEDBACK_PATTERN_MESSAGE: + case FEEDBACK_PATTERN_EMAIL: + if (noti_vibstatus) + return true; + break; + case FEEDBACK_PATTERN_3RD_APPLICATION: + case FEEDBACK_PATTERN_SMART_ALERT: + case FEEDBACK_PATTERN_SEND_SOS_MESSAGE: + case FEEDBACK_PATTERN_END_SOS_MESSAGE: + case FEEDBACK_PATTERN_CMAS: + case FEEDBACK_PATTERN_OUTGOING_CALL: + case FEEDBACK_PATTERN_MMS: + case FEEDBACK_PATTERN_HOURLY_ALERT: + return true; + case FEEDBACK_PATTERN_SPEED_UP: + case FEEDBACK_PATTERN_SLOW_DOWN: + case FEEDBACK_PATTERN_KEEP_THIS_PACE: + case FEEDBACK_PATTERN_GOAL_ACHIEVED: + case FEEDBACK_PATTERN_EXERCISE_COUNT: + case FEEDBACK_PATTERN_START_CUE: + /* except mute case */ + if (is_sound_mode() || vibstatus) + return true; + break; + case FEEDBACK_PATTERN_CHARGERCONN_ON_CALL: + case FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL: + case FEEDBACK_PATTERN_LOWBATT_ON_CALL: + /* no matter sound profile */ + return true; + default: + break; + } + return false; +} + +static bool get_always_off_case(feedback_pattern_e pattern) +{ + switch (pattern) { + case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK: + case FEEDBACK_PATTERN_HOLD: + if (!feedbackstatus) + return true; + break; + default: + break; + } + return false; +} + +static int get_xml_data(xmlDocPtr doc, feedback_pattern_e pattern, struct xmlData **data) +{ + xmlNodePtr cur; + struct xmlData *retData; + + cur = xml_find(doc, VIBRATION_STR, (const xmlChar*)str_pattern[pattern]); + /* This pattern does not have sound file to play */ + if (cur == NULL) + return -ENOENT; + + retData = xml_parse(doc, cur); + if (retData == NULL) { + _E("xml_parse fail"); + return -EPERM; + } + + *data = retData; + return 0; +} + +static void release_xml_data(struct xmlData *data) +{ + if (data == NULL) + return; + + xml_free(data); +} + +static void vibrator_init(void) +{ + int ret; + + /* xml Init */ + v_doc = xml_open(VIBRATION_XML); + if (v_doc == NULL) { + _E("xml_open(%s) fail", VIBRATION_XML); + return; + } + + /* Vibration Init */ + ret = haptic_open(); + if (ret < 0) { + _E("haptic_open ==> FAIL!! : %d", ret); + xml_close(v_doc); + v_doc = NULL; + return; + } + + /* Set vibration handle */ + v_handle = (unsigned int)ret; + + /* check vibration status */ + if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, ¬i_vibstatus) < 0) + _W("VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL ==> FAIL!!"); + + /* check vib_level */ + if (vconf_get_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, &vib_level) < 0) + _W("VCONFKEY_FEEDBACK_VIBRATION_LEVEL_INT ==> FAIL!!"); + + /* check noti_level */ + if (vconf_get_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, ¬i_level) < 0) + _W("VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT ==> FAIL!!"); + + /* feedback Init */ + if(vconf_get_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, &feedbackstatus) < 0) + _W("VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL ==> FAIL!!"); + + /* add watch for status value */ + vconf_notify_key_changed(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, feedback_noti_vibstatus_cb, NULL); + vconf_notify_key_changed(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, feedback_vib_cb, NULL); + vconf_notify_key_changed(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, feedback_noti_cb, NULL); + vconf_notify_key_changed(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, feedback_feedbackstatus_cb, NULL); +} + +static void vibrator_exit(void) +{ + int ret; + + /* remove watch */ + vconf_ignore_key_changed(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, feedback_noti_vibstatus_cb); + vconf_ignore_key_changed(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, feedback_vib_cb); + vconf_ignore_key_changed(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, feedback_noti_cb); + vconf_ignore_key_changed(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, feedback_feedbackstatus_cb); + + if (v_handle) { + ret = haptic_close(v_handle); + if (ret < 0) + _E("haptic_close is failed : %d", ret); + v_handle = 0; + } + + if (v_doc) { + xml_close(v_doc); + v_doc = NULL; + } +} + +static int vibrator_play(feedback_pattern_e pattern) +{ + int ret, size; + struct xmlData *data; + char *path; + unsigned char *buf; + + if (!v_handle || !v_doc) { + _E("Not initialize"); + return -EPERM; + } + + if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) < 0) { + _D("fail to get vibration status, will work as turning off"); + vibstatus = 0; + } + + if (vibstatus == 0 && !get_always_alert_case(pattern)) { + _D("Vibration condition is OFF (vibstatus : %d)", vibstatus); + return 0; + } + + if (vibstatus && get_always_off_case(pattern)) { + _D("Vibration always off condition"); + return 0; + } + + /* if there is a file path user defined */ + path = haptic_file[pattern]; + if (*path) { + buf = convert_file_to_buffer(path, &size); + if (!buf) { + _E("convert_file_to_buffer is failed"); + return -EPERM; + } + + ret = haptic_vibrate_buffer(v_handle, buf, size, HAPTIC_ITERATION_ONCE, + get_haptic_level(pattern), get_priority(pattern)); + if (ret < 0) { + _E("haptic_vibrate_buffer is failed"); + free(buf); + return -EPERM; + } + + free(buf); + return 0; + } + + ret = get_xml_data(v_doc, pattern, &data); + if (ret == -ENOENT) { + _D("No vibration case(%s)", str_pattern[pattern]); + return 0; + } + + if (ret < 0) { + _E("get_xml_data fail"); + return -EPERM; + } + + if (data->data == NULL) { + _D("No vibration case(%s)", str_pattern[pattern]); + release_xml_data(data); + return 0; + } + + /* play haptic buffer */ + ret = haptic_vibrate_buffer(v_handle, (unsigned char*)data->data, data->size, HAPTIC_ITERATION_ONCE, + get_haptic_level(pattern), get_priority(pattern)); + if (ret < 0) { + _E("haptic_vibrate_buffer is failed"); + release_xml_data(data); + return -EPERM; + } + + release_xml_data(data); + return 0; +} + +static int vibrator_stop(void) +{ + int ret; + + if (!v_handle || !v_doc) { + _E("Not initialize"); + return -EPERM; + } + + /* stop haptic device */ + ret = haptic_vibrate_stop(v_handle); + if (ret < 0) { + _E("haptic_vibrate_stop is failed"); + return -EPERM; + } + + return 0; +} + +static int vibrator_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen) +{ + const char *cur_path; + + assert(buf != NULL && buflen > 0); + + cur_path = haptic_file[pattern]; + if (*cur_path) { + _E("This pattern(%s) in vibrator type is not supported to play", str_pattern[pattern]); + snprintf(buf, buflen, "NULL"); + return -ENOENT; + } + + snprintf(buf, buflen, "%s", cur_path); + return 0; +} + +static int vibrator_set_path(feedback_pattern_e pattern, char *path) +{ + struct stat buf; + char *ppath; + + /* + * check the path is valid + * if path is null, below operation is ignored + */ + if (path && stat(path, &buf)) { + _E("%s is not presents", path); + return -errno; + } + + ppath = haptic_file[pattern]; + + /* if path is NULL, this pattern set to default file */ + if (path) + snprintf(ppath, NAME_MAX, "%s", path); + else + memset(ppath, 0, NAME_MAX); + + _D("The file of pattern(%s) is changed to [%s]", str_pattern[pattern], path); + return 0; +} + +static const struct device_ops vibrator_device_ops = { + .type = FEEDBACK_TYPE_VIBRATION, + .init = vibrator_init, + .exit = vibrator_exit, + .play = vibrator_play, + .stop = vibrator_stop, + .get_path = vibrator_get_path, + .set_path = vibrator_set_path, +}; + +DEVICE_OPS_REGISTER(&vibrator_device_ops); diff --git a/src/xmlparser.c b/src/xmlparser.c new file mode 100644 index 0000000..7b1a850 --- /dev/null +++ b/src/xmlparser.c @@ -0,0 +1,173 @@ +/* + * libfeedback + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include + +#include "xmlparser.h" +#include "log.h" + +static const char* data_str[] = { + [XML_LABEL] = "label", + [XML_DATA] = "data", +}; + +xmlDocPtr xml_open(const char *xml) +{ + xmlDocPtr doc; + + doc = xmlReadFile(xml, NULL, 0); + if (doc == NULL) { + _E("xmlReadFile fail"); + return NULL; + } + + return doc; +} + +void xml_close(xmlDocPtr doc) +{ + xmlFreeDoc(doc); +} + +static int xml_compare(xmlDocPtr doc, xmlNodePtr cur, const xmlChar* expr) +{ + xmlNodePtr node; + xmlChar *key; + int r; + + assert(doc); + assert(cur); + assert(expr); + + for (node = cur->children; node != NULL; node = node->next) { + if (xmlStrcmp(node->name, (const xmlChar*)data_str[XML_LABEL])) + continue; + + key = xmlNodeListGetString(doc, node->children, 1); + r = xmlStrcmp(key, expr); + xmlFree(key); + + if (r == 0) + return 1; + + break; + } + + return 0; +} + +xmlNodePtr xml_find(xmlDocPtr doc, const char *label, const xmlChar* expr) +{ + xmlNodePtr root; + xmlNodePtr cur; + + assert(doc); + assert(expr); + + root = xmlDocGetRootElement(doc); + if (root == NULL) { + _E("xmlDocGetRootElement fail"); + return NULL; + } + + for (cur = root->children; cur != NULL; cur = cur->next) { + if (xmlStrcmp(cur->name, (const xmlChar*)label)) + continue; + + if (!xml_compare(doc, cur, expr)) + continue; + + return cur; + } + + return NULL; +} + +struct xmlData *xml_parse(xmlDocPtr doc, xmlNodePtr cur) +{ + xmlNodePtr node; + struct xmlData *data; + + assert(doc); + assert(cur); + + data = (struct xmlData*)malloc(sizeof(struct xmlData)); + if (data == NULL) { + _E("out of memory"); + return NULL; + } + + memset(data, 0, sizeof(struct xmlData)); + for (node = cur->children; node != NULL; node = node->next) { + if (!xmlStrcmp(node->name, (const xmlChar*)data_str[XML_LABEL])) { + data->label = (char*)xmlNodeListGetString(doc, node->children, 1); + _D("label : %s", data->label); + } else if (!xmlStrcmp(node->name, (const xmlChar*)data_str[XML_DATA])) { + data->data = (char*)xmlNodeListGetString(doc, node->children, 1); + if (data->data) + data->size = strlen(data->data); + } + } + + return data; +} + +int xml_decode_data(struct xmlData *data) +{ + char *decode; + unsigned int len; + + if (!data || !data->data) + return -EINVAL; + + _D("b64_data : %s", data->data); + decode = (char*)g_base64_decode(data->data, &len); + free(data->data); + + data->data = decode; + data->size = len; + return 0; +} + +int xml_save(xmlDocPtr doc, const char *path) +{ + int r; + + assert(doc); + assert(path); + + r = xmlSaveFile(path, doc); + if (r < 0) { + _E("xmlSaveFile fail"); + return -1; + } + + return 0; +} + +void xml_free(struct xmlData* data) +{ + assert(data); + + free(data->label); + free(data->data); + free(data); +} diff --git a/svi.pc.in b/svi.pc.in new file mode 100644 index 0000000..9ec1dcf --- /dev/null +++ b/svi.pc.in @@ -0,0 +1,11 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=/usr/include/svi + +Name: svi +Description: configuration system library +Version: @VERSION@ +Requires: +Libs: -L${libdir} -lsvi +Cflags: -I${includedir} diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..651f465 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,12 @@ +CFLAGS=`pkg-config --cflags feedback glib-2.0` -Wall -g +LDFLAGS=`pkg-config --libs feedback glib-2.0` + +TARGETS=capi_autofeedback capi_feedback getdata + +all: $(TARGETS) + +$(TARGETS): % : %.c + $(CC) -o $@ $@.c $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TARGETS) diff --git a/test/capi_autofeedback.c b/test/capi_autofeedback.c new file mode 100644 index 0000000..2b4d59e --- /dev/null +++ b/test/capi_autofeedback.c @@ -0,0 +1,32 @@ +#include +#include +#include + +int main(int argc, char* argv[]) +{ + int val; + int i = -1; + + val = feedback_initialize(); + if (val != FEEDBACK_ERROR_NONE) { + printf("feedback_initialize error : %d\n", val); + return -1; + } + + while(1) + { + val = feedback_play(++i); + printf("[%2d] result : %d\n", i, val); + if (val < 0) break; + + usleep(100000); + } + + val = feedback_deinitialize(); + if (val != FEEDBACK_ERROR_NONE) { + printf("feedback_initialize error : %d\n", val); + return -1; + } + + return 0; +} diff --git a/test/capi_feedback.c b/test/capi_feedback.c new file mode 100644 index 0000000..d864d37 --- /dev/null +++ b/test/capi_feedback.c @@ -0,0 +1,94 @@ +#include +#include + +static void print_menu(void) +{ + printf("Which do you want to do?\n"); + printf("\t0 : Play\n"); + printf("\t1 : Change the path\n"); + printf("\t2 : Reset the path\n"); + printf("\tothers : quit\n"); +} + +static void print_play_menu(void) +{ + printf("Which do you want to do?\n"); + printf("\t0. all\n"); + printf("\t1. sound\n"); + printf("\t2. vibration\n"); + printf("\t3. led\n"); + printf("\tothers. quit\n"); +} + +static void play(void) +{ + int a, b, val; + + while(1) { + print_play_menu(); + printf("Please enter the play menu : "); + scanf("%d", &a); + if (a < 0 || a > 4) + break; + printf("Please input value (exit:-1) : "); + scanf("%d", &b); + if (b == -1) + break; + + if (a == 0) + val = feedback_play(b); + else + val = feedback_play_type(a, b); + + printf("ret value : %d\n", val); + } +} + +int main(int argc, char* argv[]) +{ + char buf[4096] = {0,}; + int val; + int a, b; + + val = feedback_initialize(); + if (val != FEEDBACK_ERROR_NONE) { + printf("feedback_initialize error : %d\n", val); + return -1; + } + + while(1) + { + print_menu(); + printf("Please input value : "); + scanf("%d", &a); + + switch(a) { + case 0: + play(); + break; + case 1: + printf("Please input type(sound:0,vib:1), enum, new path : "); + scanf("%d %d %s", &a, &b, buf); + val = feedback_set_resource_path( (a == 0) ? FEEDBACK_TYPE_SOUND : FEEDBACK_TYPE_VIBRATION, b, buf); + printf("ret value : %d\n", val); + break; + case 2: + printf("Please input type(sound:0,vib:1), enum : "); + scanf("%d %d", &a, &b); + val = feedback_set_resource_path( (a == 0) ? FEEDBACK_TYPE_SOUND : FEEDBACK_TYPE_VIBRATION, b, NULL); + printf("ret value : %d\n", val); + break; + default: + goto exit; + } + } + +exit: + val = feedback_deinitialize(); + if (val != FEEDBACK_ERROR_NONE) { + printf("feedback_initialize error : %d\n", val); + return -1; + } + + return 0; +} diff --git a/test/feedback_test.c b/test/feedback_test.c new file mode 100644 index 0000000..57e4edd --- /dev/null +++ b/test/feedback_test.c @@ -0,0 +1,72 @@ +/* + * libfeedback + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seokkyu Jang + * Contact: Sangil Yoon + * + * 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 +#include "feedback.h" + +int main(int argc, char* argv[]) +{ + char buf[4096] = {0,}; + char *temp = NULL; + int val, input; + int a, b; + + val = feedback_initialize(); + if (val != FEEDBACK_ERROR_NONE) { + printf("feedback_initialize error : %d\n", val); + return -1; + } + + while(1) + { + printf("Which do you want to work play(0) or change the path(1)?"); + scanf("%d", &a); + if (a == 0) { + printf("Please input value : "); + scanf("%d", &a); + if (a == -1) + break; + val = feedback_play(a); + printf("ret value : %d\n", val); + } else if (a == 1) { + printf("Please input type(sound:0,vib:1), enum, new path : "); + scanf("%d %d %s", &a, &b, buf); + val = feedback_get_resource_path( (a == 0) ? FEEDBACK_TYPE_SOUND : FEEDBACK_TYPE_VIBRATION, b, &temp); + printf("Prev : %s", temp); + free(temp); + val = feedback_set_resource_path( (a == 0) ? FEEDBACK_TYPE_SOUND : FEEDBACK_TYPE_VIBRATION, b, buf); + val = feedback_get_resource_path( (a == 0) ? FEEDBACK_TYPE_SOUND : FEEDBACK_TYPE_VIBRATION, b, &temp); + printf("Curr : %s", temp); + free(temp); + } else { + printf("Input error!!"); + } + } + + val = feedback_deinitialize(); + if (val != FEEDBACK_ERROR_NONE) { + printf("feedback_initialize error : %d\n", val); + return -1; + } + + return 0; +} diff --git a/test/getdata.c b/test/getdata.c new file mode 100644 index 0000000..ba54aa6 --- /dev/null +++ b/test/getdata.c @@ -0,0 +1,82 @@ +#include +#include +#include +#include +#include +#include +#include + +#define DBG(fmt, argc...) printf("<%s:%d> "fmt"\n", __func__, __LINE__, ##argc) +#define ERR(fmt, argc...) printf("<%s:%d> [ERROR] "fmt"\n", __func__, __LINE__, ##argc) + +#define BUF_SIZE 1024 + +static int print_content(const char *filename) +{ + FILE *fp; + unsigned char buf[BUF_SIZE]; + char *b64_de, *b64_en; + unsigned int n; + + fp = fopen(filename, "r"); + if (fp == NULL) { + ERR("fopen fail"); + return -1; + } + + while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) { + printf("[[["); + b64_en = g_base64_encode(buf, n); + fwrite(b64_en, 1, n, stdout); + printf("]]]\n((("); + b64_de = (char*)g_base64_decode(b64_en, &n); + fwrite(b64_de, 1, n, stdout); + printf(")))\n"); + + free(b64_en); + free(b64_de); + } + + fclose(fp); + printf("\n"); + return 0; + +} + +static void printdir(char *dir, int depth) +{ + DIR *dp; + struct dirent *entry; + struct stat statbuf; + + if ((dp = opendir(dir)) == NULL) { + ERR("opendir fail"); + return; + } + + chdir(dir); + while ((entry = readdir(dp)) != NULL) { + lstat(entry->d_name, &statbuf); + if (S_ISDIR(statbuf.st_mode)) { + if (strcmp(".", entry->d_name) == 0 || + strcmp("..", entry->d_name) == 0) + continue; + + DBG("%*s%s", depth, "", entry->d_name); + printdir(entry->d_name, depth+strlen(entry->d_name)); + } else { + + DBG("%*s%s", depth, "", entry->d_name); + print_content(entry->d_name); + } + } + chdir(".."); + closedir(dp); +} + +int main(int argc, char *argv[]) +{ + printdir(argv[1], 0); + DBG("done"); + return 0; +}