tizen 2.4 release accepted/tizen/2.4/mobile/20151029.031858 submit/tizen_2.4/20151028.064627 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:04:04 +0000 (17:04 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:04:04 +0000 (17:04 +0900)
101 files changed:
CMakeLists.txt
README [new file with mode: 0644]
SLP_FEEDBACK_PG.h [deleted file]
common/data/sound.conf [new file with mode: 0644]
common/data/sound/operation/operation.wav [moved from data/mobile/sound/operation/unlock.wav with 100% similarity]
common/data/sound/operation/shutter.wav [moved from data/mobile/sound/operation/shutter.wav with 100% similarity]
common/data/sound/touch/key0.wav [moved from data/mobile/sound/touch/key0.wav with 100% similarity]
common/data/sound/touch/key1.wav [moved from data/mobile/sound/touch/key1.wav with 100% similarity]
common/data/sound/touch/key2.wav [moved from data/mobile/sound/touch/key2.wav with 100% similarity]
common/data/sound/touch/key3.wav [moved from data/mobile/sound/touch/key3.wav with 100% similarity]
common/data/sound/touch/key4.wav [moved from data/mobile/sound/touch/key4.wav with 100% similarity]
common/data/sound/touch/key5.wav [moved from data/mobile/sound/touch/key5.wav with 100% similarity]
common/data/sound/touch/key6.wav [moved from data/mobile/sound/touch/key6.wav with 100% similarity]
common/data/sound/touch/key7.wav [moved from data/mobile/sound/touch/key7.wav with 100% similarity]
common/data/sound/touch/key8.wav [moved from data/mobile/sound/touch/key8.wav with 100% similarity]
common/data/sound/touch/key9.wav [moved from data/mobile/sound/touch/key9.wav with 100% similarity]
common/data/sound/touch/keyasterisk.wav [moved from data/mobile/sound/touch/keyasterisk.wav with 100% similarity]
common/data/sound/touch/keysharp.wav [moved from data/mobile/sound/touch/keysharp.wav with 100% similarity]
common/data/sound/touch/sip.wav [moved from data/mobile/sound/touch/sip.wav with 100% similarity]
common/data/sound/touch/touch.wav [moved from data/mobile/sound/touch/touch.wav with 100% similarity]
common/data/vibration.conf [new file with mode: 0644]
common/src/check.c [new file with mode: 0644]
data/emulator/sound.xml [deleted file]
data/emulator/sound/operation/notification.ogg [deleted file]
data/emulator/sound/operation/power_on.ogg [deleted file]
data/emulator/sound/operation/ringtone.ogg [deleted file]
data/emulator/sound/operation/shutter.ogg [deleted file]
data/emulator/sound/operation/system.ogg [deleted file]
data/emulator/sound/touch/touch.ogg [deleted file]
data/emulator/vibration.xml [deleted file]
data/micro/sound.xml [deleted file]
data/micro/vibration.xml [deleted file]
data/mobile/sound.xml [deleted file]
data/mobile/sound/operation/call_connect.wav [deleted file]
data/mobile/sound/operation/call_disconnect.wav [deleted file]
data/mobile/sound/operation/charger_connection.wav [deleted file]
data/mobile/sound/operation/fully_charged.wav [deleted file]
data/mobile/sound/operation/list_reorder.wav [deleted file]
data/mobile/sound/operation/lock.wav [deleted file]
data/mobile/sound/operation/low_battery.wav [deleted file]
data/mobile/sound/operation/minute_minder.wav [deleted file]
data/mobile/sound/operation/power_on.wav [deleted file]
data/mobile/vibration.xml [deleted file]
doc/feedback_doc.h
feedback.pc.in
include/feedback-ids.h
include/feedback-internal.h [new file with mode: 0644]
include/feedback.h
include/feedback_doc.h [deleted file]
include/xmlparser.h [deleted file]
mobile/data/sound.conf [new file with mode: 0644]
mobile/data/sound/operation/notification.wav [new file with mode: 0755]
mobile/data/sound/operation/operation.wav [moved from data/mobile/sound/operation/slider_sweep.wav with 100% similarity]
mobile/data/sound/operation/ringtone.wav [new file with mode: 0755]
mobile/data/sound/operation/shutter.wav [new file with mode: 0755]
mobile/data/sound/touch/key0.wav [new file with mode: 0755]
mobile/data/sound/touch/key1.wav [new file with mode: 0755]
mobile/data/sound/touch/key2.wav [new file with mode: 0755]
mobile/data/sound/touch/key3.wav [new file with mode: 0755]
mobile/data/sound/touch/key4.wav [new file with mode: 0755]
mobile/data/sound/touch/key5.wav [new file with mode: 0755]
mobile/data/sound/touch/key6.wav [new file with mode: 0755]
mobile/data/sound/touch/key7.wav [new file with mode: 0755]
mobile/data/sound/touch/key8.wav [new file with mode: 0755]
mobile/data/sound/touch/key9.wav [new file with mode: 0755]
mobile/data/sound/touch/keyasterisk.wav [new file with mode: 0755]
mobile/data/sound/touch/keysharp.wav [new file with mode: 0755]
mobile/data/sound/touch/sip.wav [moved from data/mobile/sound/touch/sip_backspace.wav with 100% similarity]
mobile/data/sound/touch/touch.wav [moved from data/mobile/sound/operation/volume_control.wav with 100% similarity]
mobile/data/vibration.conf [new file with mode: 0644]
mobile/include/feedback-ids-mobile.h [new file with mode: 0644]
mobile/src/check.c [new file with mode: 0644]
packaging/libfeedback.spec
src/common.h [moved from include/common.h with 54% similarity]
src/dbus.c
src/dbus.h [moved from include/dbus.h with 89% similarity]
src/devices.c
src/devices.h [moved from include/devices.h with 84% similarity]
src/feedback.c
src/log.h [moved from include/log.h with 100% similarity]
src/parser.c [new file with mode: 0644]
src/parser.h [new file with mode: 0644]
src/profiles.c [new file with mode: 0644]
src/profiles.h [new file with mode: 0644]
src/sound.c
src/str.c [deleted file]
src/vibrator.c
src/xmlparser.c [deleted file]
test/capi_autofeedback.c
test/capi_feedback.c
test/feedback_test.c
wearable/data/sound.conf [new file with mode: 0644]
wearable/data/sound/operation/notification.ogg [moved from data/micro/sound/operation/notification.ogg with 100% similarity]
wearable/data/sound/operation/power_on.ogg [moved from data/micro/sound/operation/power_on.ogg with 100% similarity]
wearable/data/sound/operation/ringtone.ogg [moved from data/micro/sound/operation/ringtone.ogg with 100% similarity]
wearable/data/sound/operation/shutter.ogg [moved from data/micro/sound/operation/shutter.ogg with 100% similarity]
wearable/data/sound/operation/system.ogg [moved from data/micro/sound/operation/system.ogg with 100% similarity]
wearable/data/sound/touch/touch.ogg [moved from data/micro/sound/touch/touch.ogg with 100% similarity]
wearable/data/vibration.conf [new file with mode: 0644]
wearable/include/feedback-ids-wearable.h [new file with mode: 0644]
wearable/src/check.c [new file with mode: 0644]

index ae8a719..4974015 100644 (file)
@@ -7,48 +7,43 @@ 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)
+IF("${PROFILE}" STREQUAL "tv")
+       SET(PROFILE "common")
 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(FEEDBACK_PROFILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${PROFILE})
 
 SET(SRCS
-       src/devices.c
        src/sound.c
        src/vibrator.c
-       src/xmlparser.c
+       src/devices.c
+       src/parser.c
        src/feedback.c
-       src/str.c
-       src/dbus.c)
+       src/dbus.c
+       ${FEEDBACK_PROFILE_PATH}/src/check.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/feedback-ids.h
+       include/feedback-internal.h)
+
+IF(NOT "${PROFILE}" STREQUAL "common")
+       SET(HEADERS ${HEADERS}
+               ${FEEDBACK_PROFILE_PATH}/include/feedback-ids-${PROFILE}.h)
+       IF("${PROFILE}" STREQUAL "mobile")
+               ADD_DEFINITIONS("-DMOBILE")
+       ELSEIF("${PROFILE}" STREQIAL "wearable")
+               ADD_DEFINITIONS("-DWEARABLE")
+       ENDIF()
+ENDIF()
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES(${FEEDBACK_PROFILE_PATH}/include)
+
+SET(PKG_MODULES vconf mm-keysound dlog glib-2.0 gio-2.0 dbus-1)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED ${DEPENDENTS})
+pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -56,7 +51,6 @@ 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}")
 
@@ -69,14 +63,5 @@ 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)
+INSTALL(FILES ${HEADERS} DESTINATION include/${PROJECT_NAME})
+INSTALL(DIRECTORY ${FEEDBACK_PROFILE_PATH}/data/ DESTINATION share/${PROJECT_NAME})
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..4cac11d
--- /dev/null
+++ b/README
@@ -0,0 +1,88 @@
+
+
+How to add the sound & vibration resources
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In case of sound resources
+- add ./data/[target]/sound/[category]/
+- update the ./data/[target]/sound.xml file
+       <sound>
+               <label>[the pattern enum what you want to set]</label>
+               <data>[the file path]</data>
+       </sound>
+
+In case of vibration resources
+- get the b64 data of the resource using test/getdata application
+    --------------------------------------------------------------
+       | sh-4.1$ su
+       | sh-4.1# ls ./noti
+       | a.ivt
+       | sh-4.1# ./getdata ./noti
+       | <printdir:74> a.ivt
+       | [[[AQABAAoAFAAAACAfAAB/IUFBAABQAGUAcgBpAG]]] <----- b64 data
+       | (((
+       |        !AAPeriodic)))
+       |
+       | <main:85> done
+    --------------------------------------------------------------
+- update the ./data/[target]/vibration.xml file
+       <vibration>
+               <label>[the pattern enum what you want to set]</label>
+               <data>[the b64 data]</data>
+       </vibration>
+
+
+How to test the sound & vibration resources
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Preparation
+- Install Tizen sdk (https://developer.tizen.org/downloads/tizen-sdk)
+- Install Samsung USB controller
+- Test application
+       test/capi_feedback
+       test/capi_autofeedback
+- The resource for testing
+
+Prerequisite for updating the resources
+- Connect PC and Target
+- Copy test application and resource to Target on pc
+  (ex. copy to /Phone/Downloads/feedback/)
+- Execute terminal program
+  (ex. command prompt on window
+       terminal on linux)
+- Enter the below command
+    --------------------------------------------------------------
+       | user@user:~$sdb shell
+       | sh-4.1$ su
+       | sh-4.1# cd /opt/usr/media/Downloads/feedback
+       | sh-4.1# ls
+       | a.ogg capi_autofeedback capi_feedback
+    --------------------------------------------------------------
+
+How to test exisiting resource
+- Play each resource using the test application (capi_feedback)
+  (refer to include/feedback-ids.h)
+    --------------------------------------------------------------
+       | sh-4.1# ./capi_feedback
+       | Which do you want to do?
+       |               0 : Play
+       |               1 : Change the path
+       |               2 : Reset the path
+       |               others : quit
+       | Please input value : 0
+       | Please input value (exit:-1) : 37 (FEEDBACK_PATTERN_POWEROFF)
+    --------------------------------------------------------------
+
+How to test new resource
+- Change the speicifc enum's file path
+    --------------------------------------------------------------
+       | sh-4.1# ./capi_feedback
+       | Which do you want to do?
+       |               0 : Play
+       |               1 : Change the path
+       |               2 : Reset the path
+       |               others : quit
+       | Please input value : 1
+       | Please input type(sound:0,vib:1), enum, new path : 0 37 /opt/usr/media/Downloads/feedback/a.ogg
+    --------------------------------------------------------------
+
diff --git a/SLP_FEEDBACK_PG.h b/SLP_FEEDBACK_PG.h
deleted file mode 100644 (file)
index b7006a2..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- *  libsvi
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seokkyu Jang <seokkyu.jang@samsung.com>
- * Contact: Sangil Yoon <si83.yoon@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
- *
- * @ingroup    SLP_PG
- * @defgroup    SVI_PG SVI
-@{
-
-@par SVI Programming Guide
-
-<h1 class="pg">Brief Information</h1>
-- Sound & Vibration UI
-- Convenient API
-- Header File : svi.h
-
-<h1 class="pg"> Introduction</h1>
-<h2 class="pg"> Purpose of this document</h2>
-The purpose of this document is to describe how applications can use Sound and Vibration Interface Library APIs.\n
-This document gives only programming guidelines to application engineers.
-
-<h2 class="pg"> Scope</h2>
-The scope of this document is limited to Samsung platform Sound and Vibration Interface Library API usage.
-
-<h1 class="pg"> Architecture</h1>
-<h2 class="pg"> Architecture overview</h2>
-Sound and Vibration Interface Library (SVI) is responsible for playing simple sound and vibration.\n
-SVI play sound using mm-sound library and play vibration with device framework.
-
-@image html svi.png "SVI diagram" 
-
-<h2 class="pg"> SLP Features</h2>
-Sound and Vibration Interface Library has the following features:\n
-
- - Play Sound
-       - It can play simple sound with predefined key.
-
- - Play Vibration
-       - It can play simple vibration with predefined key.
-
-<h2 class="pg">API list and description</h2>
- - int svi_init(int *handle)
-       - Unload sound profile and status, and close haptic device.
-
- - int svi_fini(int handle)
-       - Finalize audio ui library.
-       - Unload sound profile and status, and close haptic device.
-
- - int svi_play_sound(int handle, sound_type sound_key)
-       - Play simple sound.
-
- - int svi_play_vib(int handle, vibration_type vibration_key)
-       - Play simple vibration.
-
- - int svi_play(int handle, vibration_type vibration_key, sound_type sound_key)
-       - Play simple sound and vibration.
-
-<h1 class="pg">Programming with Sound & Vibration UI</h1>
-
-<h2 class="pg">Defines</h2>
-@code
-#define SVI_SUCCESS    0
-#define SVI_ERROR      -1
-@endcode
-
-<h2 class="pg">Functions</h2>
-@code
-int svi_init(int *handle)
-int svi_fini(int handle)
-int svi_play_sound(int handle, sound_type sound_key)
-int svi_play_vib(int handle, vibration_type vibration_key)
-int svi_play(int handle, vibration_type vibration_key, sound_type sound_key)
-@endcode
-
-<h2 class="pg">Example code</h2>
-@code
-#include <svi.h>
-
-int r = 0;
-int handle = 0;
-
-r = svi_init(&handle);
-if (r != SVI_SUCCESS){
-
-       printf("Cannot initialize svi.\n");     
-
-} else {
-
-       r = svi_play (handle, SVI_VIB_TOUCH, SVI_SND_TOUCH1);
-       if (r != SVI_SUCCESS) {
-               printf("Cannot play sound or vibration.\n");
-       }
-
-       r = svi_play_sound (handle, SVI_SND_TOUCH1);
-       if (r != SVI_SUCCESS) {
-               printf("Cannot play sound.\n");
-       }
-
-       r = svi_play_vib (handle, SVI_VIB_TOUCH);
-       if (r != SVI_SUCCESS) {
-               printf("Cannot play vibration.\n");
-       }
-
-       r = svi_fini(handle);
-       if (r != SVI_SUCCESS) {
-               printf("Cannot close svi.\n");  
-       }
-}
-@endcode
-
-<h2 class="pg">Vibration IDs</h2>
-@code
-       SVI_VIB_TOUCH_TOUCH
-       SVI_VIB_TOUCH_SIP
-       SVI_VIB_TOUCH_HOLD
-       SVI_VIB_TOUCH_MULTI_TAP
-       SVI_VIB_TOUCH_HW_TAP
-       SVI_VIB_TOUCH_HW_HOLD
-       SVI_VIB_TOUCH_KEY00
-       SVI_VIB_TOUCH_KEY01
-       SVI_VIB_TOUCH_KEY02
-       SVI_VIB_TOUCH_KEY03
-       SVI_VIB_TOUCH_KEY04
-       SVI_VIB_TOUCH_KEY05
-       SVI_VIB_TOUCH_KEY06
-       SVI_VIB_TOUCH_KEY07
-       SVI_VIB_TOUCH_KEY08
-       SVI_VIB_TOUCH_KEY09
-       SVI_VIB_TOUCH_KEY_STAR
-       SVI_VIB_TOUCH_KEY_SHARP
-       SVI_VIB_NOTIFICATION_INCOMING_CALL01
-       SVI_VIB_NOTIFICATION_INCOMING_CALL02
-       SVI_VIB_NOTIFICATION_INCOMING_CALL03
-       SVI_VIB_NOTIFICATION_MESSAGE
-       SVI_VIB_NOTIFICATION_EMAIL
-       SVI_VIB_NOTIFICATION_WAKEUP
-       SVI_VIB_NOTIFICATION_SCHEDULE
-       SVI_VIB_NOTIFICATION_TIMER
-       SVI_VIB_NOTIFICATION_GENERAL
-       SVI_VIB_OPERATION_POWER_ON
-       SVI_VIB_OPERATION_POWER_OFF
-       SVI_VIB_OPERATION_CHARGERCONN
-       SVI_VIB_OPERATION_FULLCHARGED
-       SVI_VIB_OPERATION_LOWBATT
-       SVI_VIB_OPERATION_LOCK
-       SVI_VIB_OPERATION_UNLOCK
-       SVI_VIB_OPERATION_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
-
-<h2 class="pg">Sound IDs</h2>
-@code
-       SVI_SND_TOUCH_TOUCH1
-       SVI_SND_TOUCH_TOUCH2
-       SVI_SND_TOUCH_TOUCH3
-       SVI_SND_TOUCH_SIP
-       SVI_SND_TOUCH_HOLD
-       SVI_SND_TOUCH_MULTI_TAP
-       SVI_SND_TOUCH_HW_TAP
-       SVI_SND_TOUCH_HW_HOLD
-       SVI_SND_TOUCH_KEY00
-       SVI_SND_TOUCH_KEY01
-       SVI_SND_TOUCH_KEY02
-       SVI_SND_TOUCH_KEY03
-       SVI_SND_TOUCH_KEY04
-       SVI_SND_TOUCH_KEY05
-       SVI_SND_TOUCH_KEY06
-       SVI_SND_TOUCH_KEY07
-       SVI_SND_TOUCH_KEY08
-       SVI_SND_TOUCH_KEY09
-       SVI_SND_TOUCH_KEY_STAR
-       SVI_SND_TOUCH_KEY_SHARP
-       SVI_SND_OPERATION_POWERON
-       SVI_SND_OPERATION_POWEROF
-       SVI_SND_OPERATION_CHARGERCONN
-       SVI_SND_OPERATION_FULLCHARGED
-       SVI_SND_OPERATION_LOWBATT
-       SVI_SND_OPERATION_LOCK
-       SVI_SND_OPERATION_UNLOCK
-       SVI_SND_OPERATION_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/common/data/sound.conf b/common/data/sound.conf
new file mode 100644 (file)
index 0000000..5cce08c
--- /dev/null
@@ -0,0 +1,39 @@
+[Sound]
+FEEDBACK_PATTERN_TAP=/usr/share/feedback/sound/touch/touch.wav
+FEEDBACK_PATTERN_SIP=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_KEY0=/usr/share/feedback/sound/touch/key0.wav
+FEEDBACK_PATTERN_KEY1=/usr/share/feedback/sound/touch/key1.wav
+FEEDBACK_PATTERN_KEY2=/usr/share/feedback/sound/touch/key2.wav
+FEEDBACK_PATTERN_KEY3=/usr/share/feedback/sound/touch/key3.wav
+FEEDBACK_PATTERN_KEY4=/usr/share/feedback/sound/touch/key4.wav
+FEEDBACK_PATTERN_KEY5=/usr/share/feedback/sound/touch/key5.wav
+FEEDBACK_PATTERN_KEY6=/usr/share/feedback/sound/touch/key6.wav
+FEEDBACK_PATTERN_KEY7=/usr/share/feedback/sound/touch/key7.wav
+FEEDBACK_PATTERN_KEY8=/usr/share/feedback/sound/touch/key8.wav
+FEEDBACK_PATTERN_KEY9=/usr/share/feedback/sound/touch/key9.wav
+FEEDBACK_PATTERN_KEY_STAR=/usr/share/feedback/sound/touch/keyasterisk.wav
+FEEDBACK_PATTERN_KEY_SHARP=/usr/share/feedback/sound/touch/keysharp.wav
+FEEDBACK_PATTERN_KEY_BACK=/usr/share/feedback/sound/touch/touch.wav
+FEEDBACK_PATTERN_HW_TAP=/usr/share/feedback/sound/touch/touch.wav
+FEEDBACK_PATTERN_POWERON=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_CHARGERCONN=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LOWBATT=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LOCK=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_UNLOCK=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_SILENT_OFF=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LIST_REORDER=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LIST_SLIDER=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_VOLUME_KEY=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_SIP_FUNCTION=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_SIP_FJKEY=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_MAX_CHARACTER=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_LOCK_SWIPE=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_UNLOCK_SWIPE=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_GEOMETRIC_LOCK=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_CALLCONNECT=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_DISCALLCONNECT=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_MINUTEMINDER=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_SCREEN_CAPTURE=/usr/share/feedback/sound/operation/shutter.wav
diff --git a/common/data/vibration.conf b/common/data/vibration.conf
new file mode 100644 (file)
index 0000000..e6d8f71
--- /dev/null
@@ -0,0 +1,29 @@
+[Vibration]
+FEEDBACK_PATTERN_SIP=mono
+FEEDBACK_PATTERN_KEY0=mono
+FEEDBACK_PATTERN_KEY1=mono
+FEEDBACK_PATTERN_KEY2=mono
+FEEDBACK_PATTERN_KEY3=mono
+FEEDBACK_PATTERN_KEY4=mono
+FEEDBACK_PATTERN_KEY5=mono
+FEEDBACK_PATTERN_KEY6=mono
+FEEDBACK_PATTERN_KEY7=mono
+FEEDBACK_PATTERN_KEY8=mono
+FEEDBACK_PATTERN_KEY9=mono
+FEEDBACK_PATTERN_KEY_STAR=mono
+FEEDBACK_PATTERN_KEY_SHARP=mono
+FEEDBACK_PATTERN_KEY_BACK=mono
+FEEDBACK_PATTERN_HOLD=mono
+FEEDBACK_PATTERN_HW_TAP=mono
+FEEDBACK_PATTERN_HW_HOLD=mono
+FEEDBACK_PATTERN_MESSAGE=mono
+FEEDBACK_PATTERN_EMAIL=mono
+FEEDBACK_PATTERN_WAKEUP=mono
+FEEDBACK_PATTERN_SCHEDULE=mono
+FEEDBACK_PATTERN_TIMER=mono
+FEEDBACK_PATTERN_GENERAL=mono
+FEEDBACK_PATTERN_POWERON=mono
+FEEDBACK_PATTERN_POWEROFF=mono
+FEEDBACK_PATTERN_CHARGERCONN=mono
+FEEDBACK_PATTERN_LOWBATT=mono
+FEEDBACK_PATTERN_VIBRATION_ON=mono
diff --git a/common/src/check.c b/common/src/check.c
new file mode 100644 (file)
index 0000000..eb3936f
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * libfeedback
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+
+#include "feedback.h"
+#include "profiles.h"
+#include "log.h"
+
+
+static const char *common_str_type[] = {
+       "FEEDBACK_TYPE_NONE",
+       "FEEDBACK_TYPE_SOUND",
+       "FEEDBACK_TYPE_VIBRATION",
+};
+
+static const char *common_str_pattern[] = {
+       "FEEDBACK_PATTERN_TAP",
+       "FEEDBACK_PATTERN_SIP",
+       "",
+       "",
+       "",
+       "",
+       "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_HW_TAP",
+       "FEEDBACK_PATTERN_HW_HOLD",
+
+       "FEEDBACK_PATTERN_MESSAGE",
+       "",
+       "FEEDBACK_PATTERN_EMAIL",
+       "",
+       "FEEDBACK_PATTERN_WAKEUP",
+       "",
+       "FEEDBACK_PATTERN_SCHEDULE",
+       "",
+       "FEEDBACK_PATTERN_TIMER",
+       "",
+       "FEEDBACK_PATTERN_GENERAL",
+       "",
+       "",
+
+       "FEEDBACK_PATTERN_POWERON",
+       "FEEDBACK_PATTERN_POWEROFF",
+       "FEEDBACK_PATTERN_CHARGERCONN",
+       "",
+       "FEEDBACK_PATTERN_CHARGING_ERROR",
+       "",
+       "FEEDBACK_PATTERN_FULLCHARGED",
+       "",
+       "FEEDBACK_PATTERN_LOWBATT",
+       "",
+       "FEEDBACK_PATTERN_LOCK",
+       "FEEDBACK_PATTERN_UNLOCK",
+       "",
+       "",
+       "",
+       "",
+       "",
+       "",
+       "",
+       "FEEDBACK_PATTERN_VIBRATION_ON",
+       "FEEDBACK_PATTERN_SILENT_OFF",
+       "FEEDBACK_PATTERN_BT_CONNECTED",
+       "FEEDBACK_PATTERN_BT_DISCONNECTED",
+       "",
+       "",
+       "",
+       "FEEDBACK_PATTERN_LIST_REORDER",
+       "FEEDBACK_PATTERN_LIST_SLIDER",
+       "FEEDBACK_PATTERN_VOLUME_KEY",
+};
+
+static bool common_get_always_alert_case(int type, int pattern)
+{
+       switch (pattern) {
+       case FEEDBACK_PATTERN_SIP:
+       case FEEDBACK_PATTERN_TIMER:
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_WAKEUP:
+               return true;
+       default:
+               break;
+       }
+       return false;
+}
+
+static bool common_get_always_off_case(int type, int pattern)
+{
+       switch (pattern) {
+       case FEEDBACK_PATTERN_TAP ... FEEDBACK_PATTERN_SIP:
+       case FEEDBACK_PATTERN_HOLD ... FEEDBACK_PATTERN_HW_HOLD:
+               if (CHECK_SOUND(type) && !is_touch_sndstatus())
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+               if (CHECK_SOUND(type) && !is_keytone_sndstatus())
+                       return true;
+               break;
+       default:
+               break;
+       }
+       return false;
+}
+
+static int common_get_strength_type(int type, int pattern)
+{
+       if (CHECK_SOUND(type)) {
+               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
+                       return VOLUME_TYPE_SYSTEM;
+       } else if (CHECK_VIBRATION(type)) {
+               return DEFAULT_VIB_LEVEL * HAPTIC_FEEDBACK_STEP;
+       }
+
+       return -EINVAL;
+}
+
+static const struct profile_ops common_profile_ops = {
+       .profile               = "common",
+       .get_always_alert_case = common_get_always_alert_case,
+       .get_always_off_case   = common_get_always_off_case,
+       .get_strength_type     = common_get_strength_type,
+       .max_type              = FEEDBACK_TYPE_END,
+       .max_pattern           = FEEDBACK_PATTERN_END,
+       .str_type              = common_str_type,
+       .str_pattern           = common_str_pattern,
+};
+
+PROFILE_OPS_REGISTER(&common_profile_ops);
diff --git a/data/emulator/sound.xml b/data/emulator/sound.xml
deleted file mode 100644 (file)
index fa8c279..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <label>svi-data</label>
-       <description>Sound Resource</description>
-       <sound>
-               <label>FEEDBACK_PATTERN_TAP</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY0</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY1</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY2</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY3</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY4</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY5</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY6</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY7</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY8</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY9</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_STAR</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_SHARP</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_BACK</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_POWERON</label>
-               <data>/usr/share/feedback/sound/operation/power_on.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGERCONN</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGERCONN_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOWBATT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOWBATT_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOCK</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_UNLOCK</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CALLCONNECT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_DISCALLCONNECT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SILENT_OFF</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_VOLUME_KEY</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SCREEN_CAPTURE</label>
-               <data>/usr/share/feedback/sound/operation/shutter.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_HOURLY_ALERT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SAFETY_ALERT</label>
-               <data>/usr/share/feedback/sound/operation/ringtone.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SAFETY_LOW_POWER</label>
-               <data>/usr/share/feedback/sound/operation/ringtone.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CMAS</label>
-               <data>/usr/share/feedback/sound/operation/notification.ogg</data>
-       </sound>
-</config>
diff --git a/data/emulator/sound/operation/notification.ogg b/data/emulator/sound/operation/notification.ogg
deleted file mode 100755 (executable)
index 457f7e8..0000000
Binary files a/data/emulator/sound/operation/notification.ogg and /dev/null differ
diff --git a/data/emulator/sound/operation/power_on.ogg b/data/emulator/sound/operation/power_on.ogg
deleted file mode 100755 (executable)
index 7756406..0000000
Binary files a/data/emulator/sound/operation/power_on.ogg and /dev/null differ
diff --git a/data/emulator/sound/operation/ringtone.ogg b/data/emulator/sound/operation/ringtone.ogg
deleted file mode 100755 (executable)
index 2653dd6..0000000
Binary files a/data/emulator/sound/operation/ringtone.ogg and /dev/null differ
diff --git a/data/emulator/sound/operation/shutter.ogg b/data/emulator/sound/operation/shutter.ogg
deleted file mode 100755 (executable)
index c22c810..0000000
Binary files a/data/emulator/sound/operation/shutter.ogg and /dev/null differ
diff --git a/data/emulator/sound/operation/system.ogg b/data/emulator/sound/operation/system.ogg
deleted file mode 100755 (executable)
index 69c8425..0000000
Binary files a/data/emulator/sound/operation/system.ogg and /dev/null differ
diff --git a/data/emulator/sound/touch/touch.ogg b/data/emulator/sound/touch/touch.ogg
deleted file mode 100755 (executable)
index 8be60ce..0000000
Binary files a/data/emulator/sound/touch/touch.ogg and /dev/null differ
diff --git a/data/emulator/vibration.xml b/data/emulator/vibration.xml
deleted file mode 100644 (file)
index 09887c2..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <label>svi-data</label>
-       <description>Vibration Resource</description>
-       <vibration>
-               <label>FEEDBACK_PATTERN_TAP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HOLD</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MESSAGE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MESSAGE_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_EMAIL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_EMAIL_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_WAKEUP</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_WAKEUP_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SCHEDULE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SCHEDULE_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_TIMER</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_TIMER_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GENERAL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GENERAL_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGERCONN</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGERCONN_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_LOWBATT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_LOWBATT_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CALLCONNECT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_DISCALLCONNECT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_VIBRATION_ON</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CONNECTED</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_DISCONNECTED</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_BT_PAIRING</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SAFETY_ALERT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SEND_SOS_MESSAGE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_END_SOS_MESSAGE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CMAS</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SPEED_UP</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SLOW_DOWN</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEEP_THIS_PACE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GOAL_ACHIEVED</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_EXERCISE_COUNT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_START_CUE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SUCCESS</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_FAILURE</label>
-               <data>SYSTEM</data>
-       </vibration>
-</config>
diff --git a/data/micro/sound.xml b/data/micro/sound.xml
deleted file mode 100644 (file)
index 2ff9be9..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <label>svi-data</label>
-       <description>Sound Resource</description>
-       <sound>
-               <label>FEEDBACK_PATTERN_TAP</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP_BACKSPACE</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP_FUNCTION</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP_FJKEY</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY0</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY1</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY2</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY3</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY4</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY5</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY6</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY7</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY8</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY9</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_STAR</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_SHARP</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_BACK</label>
-               <data>/usr/share/feedback/sound/touch/touch.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_WAKEUP_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/notification.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SCHEDULE_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/notification.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_TIMER_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/notification.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_POWERON</label>
-               <data>/usr/share/feedback/sound/operation/power_on.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGERCONN</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOWBATT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CALLCONNECT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_DISCALLCONNECT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SILENT_OFF</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_VOLUME_KEY</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_BT_CONNECTED</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_BT_DISCONNECTED</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_BT_PAIRING</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_BT_WAITING</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SCREEN_CAPTURE</label>
-               <data>/usr/share/feedback/sound/operation/shutter.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SAFETY_ALERT</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SAFETY_LOW_POWER</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CMAS</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_GOAL_ACHIEVED</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_MEASURING_SUCCESS</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_MEASURING_FAILURE</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_UV_PROCESSING</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SHEALTH_START</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SHEALTH_PAUSE</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SHEALTH_STOP</label>
-               <data>/usr/share/feedback/sound/operation/system.ogg</data>
-       </sound>
-</config>
diff --git a/data/micro/vibration.xml b/data/micro/vibration.xml
deleted file mode 100644 (file)
index 80a5849..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <label>svi-data</label>
-       <description>Vibration Resource</description>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP_BACKSPACE</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP_FUNCTION</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP_FJKEY</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HOLD</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY_STAR</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY_SHARP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY_BACK</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_WAKEUP</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SCHEDULE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_TIMER</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GENERAL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_3RD_APPLICATION</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGERCONN</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGERCONN_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_LOWBATT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_LOWBATT_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CALLCONNECT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_DISCALLCONNECT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_VIBRATION_ON</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_BT_CONNECTED</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_BT_DISCONNECTED</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_BT_PAIRING</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_BT_WAITING</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SAFETY_ALERT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SEND_SOS_MESSAGE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_END_SOS_MESSAGE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CMAS</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SPEED_UP</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SLOW_DOWN</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEEP_THIS_PACE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GOAL_ACHIEVED</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_START_CUE</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HEALTH_PACE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_INACTIVE_TIME</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MEASURING_SUCCESS</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MEASURING_FAILURE</label>
-               <data>SYSTEM</data>
-       </vibration>
-</config>
diff --git a/data/mobile/sound.xml b/data/mobile/sound.xml
deleted file mode 100755 (executable)
index d5738b8..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <label>svi-data</label>
-       <description>Sound Resource</description>
-       <sound>
-               <label>FEEDBACK_PATTERN_TAP</label>
-               <data>/usr/share/feedback/sound/touch/touch.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP</label>
-               <data>/usr/share/feedback/sound/touch/sip.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP_BACKSPACE</label>
-               <data>/usr/share/feedback/sound/touch/sip_backspace.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP_FUNCTION</label>
-               <data>/usr/share/feedback/sound/touch/sip.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SIP_FJKEY</label>
-               <data>/usr/share/feedback/sound/touch/sip.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_MAX_CHARACTER</label>
-               <data>/usr/share/feedback/sound/touch/sip.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY0</label>
-               <data>/usr/share/feedback/sound/touch/key0.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY1</label>
-               <data>/usr/share/feedback/sound/touch/key1.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY2</label>
-               <data>/usr/share/feedback/sound/touch/key2.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY3</label>
-               <data>/usr/share/feedback/sound/touch/key3.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY4</label>
-               <data>/usr/share/feedback/sound/touch/key4.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY5</label>
-               <data>/usr/share/feedback/sound/touch/key5.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY6</label>
-               <data>/usr/share/feedback/sound/touch/key6.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY7</label>
-               <data>/usr/share/feedback/sound/touch/key7.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY8</label>
-               <data>/usr/share/feedback/sound/touch/key8.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY9</label>
-               <data>/usr/share/feedback/sound/touch/key9.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_STAR</label>
-               <data>/usr/share/feedback/sound/touch/keyasterisk.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_SHARP</label>
-               <data>/usr/share/feedback/sound/touch/keysharp.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_KEY_BACK</label>
-               <data>/usr/share/feedback/sound/touch/touch.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_HW_TAP</label>
-               <data>/usr/share/feedback/sound/touch/touch.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_POWERON</label>
-               <data>/usr/share/feedback/sound/operation/power_on.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGERCONN</label>
-               <data>/usr/share/feedback/sound/operation/charger_connection.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CHARGERCONN_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/charger_connection.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOWBATT</label>
-               <data>/usr/share/feedback/sound/operation/low_battery.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOWBATT_ON_CALL</label>
-               <data>/usr/share/feedback/sound/operation/low_battery.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOCK</label>
-               <data>/usr/share/feedback/sound/operation/lock.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_UNLOCK</label>
-               <data>/usr/share/feedback/sound/operation/unlock.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LOCK_SWIPE</label>
-               <data>/usr/share/feedback/sound/operation/lock.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_UNLOCK_SWIPE</label>
-               <data>/usr/share/feedback/sound/operation/unlock.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_GEOMETRIC_LOCK</label>
-               <data>/usr/share/feedback/sound/operation/lock.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_CALLCONNECT</label>
-               <data>/usr/share/feedback/sound/operation/call_connect.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_DISCALLCONNECT</label>
-               <data>/usr/share/feedback/sound/operation/call_disconnect.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_MINUTEMINDER</label>
-               <data>/usr/share/feedback/sound/operation/minute_minder.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SILENT_OFF</label>
-               <data>/usr/share/feedback/sound/operation/volume_control.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_SCREEN_CAPTURE</label>
-               <data>/usr/share/feedback/sound/operation/shutter.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LIST_REORDER</label>
-               <data>/usr/share/feedback/sound/operation/list_reorder.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_LIST_SLIDER</label>
-               <data>/usr/share/feedback/sound/operation/slider_sweep.wav</data>
-       </sound>
-       <sound>
-               <label>FEEDBACK_PATTERN_VOLUME_KEY</label>
-               <data>/usr/share/feedback/sound/operation/volume_control.wav</data>
-       </sound>
-</config>
diff --git a/data/mobile/sound/operation/call_connect.wav b/data/mobile/sound/operation/call_connect.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/call_connect.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/call_disconnect.wav b/data/mobile/sound/operation/call_disconnect.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/call_disconnect.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/charger_connection.wav b/data/mobile/sound/operation/charger_connection.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/charger_connection.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/fully_charged.wav b/data/mobile/sound/operation/fully_charged.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/fully_charged.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/list_reorder.wav b/data/mobile/sound/operation/list_reorder.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/list_reorder.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/lock.wav b/data/mobile/sound/operation/lock.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/lock.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/low_battery.wav b/data/mobile/sound/operation/low_battery.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/low_battery.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/minute_minder.wav b/data/mobile/sound/operation/minute_minder.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/minute_minder.wav and /dev/null differ
diff --git a/data/mobile/sound/operation/power_on.wav b/data/mobile/sound/operation/power_on.wav
deleted file mode 100755 (executable)
index 5383bdf..0000000
Binary files a/data/mobile/sound/operation/power_on.wav and /dev/null differ
diff --git a/data/mobile/vibration.xml b/data/mobile/vibration.xml
deleted file mode 100644 (file)
index 8221ffa..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<config>
-       <label>svi-data</label>
-       <description>Vibration Resource</description>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP_BACKSPACE</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP_FUNCTION</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SIP_FJKEY</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MAX_CHARACTER</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY0</label>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY1</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY2</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY3</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY4</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY5</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY6</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY7</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY8</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY9</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY_STAR</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY_SHARP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_KEY_BACK</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HOLD</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MULTI_TAP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HW_TAP</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HW_HOLD</label>
-               <data>TOUCH</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MESSAGE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MESSAGE_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_EMAIL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_EMAIL_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_WAKEUP</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_WAKEUP_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SCHEDULE</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SCHEDULE_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_TIMER</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_TIMER_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GENERAL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_GENERAL_ON_CALL</label>
-               <data>NOTIFICATION</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SMART_ALERT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_POWERON</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_POWEROFF</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGERCONN</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_CHARGERCONN_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_LOWBATT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_LOWBATT_ON_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_OUTGOING_CALL</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MINUTEMINDER</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_VIBRATION_ON</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_MMS</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_HOURLY_ALERT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SAFETY_ALERT</label>
-               <data>SYSTEM</data>
-       </vibration>
-       <vibration>
-               <label>FEEDBACK_PATTERN_SEND_SOS_MESSAGE</label>
-               <data>SYSTEM</data>
-       </vibration>
-</config>
index 0b0131e..ef3b17f 100755 (executable)
  *   \#include <feedback.h>
  *
  * @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 <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * The FEEDBACK API is responsible for playing simple sound and vibration.
+ * It plays sound using mm-sound library and vibration with system framework.
  *
  */
 
index 392a254..781aca6 100644 (file)
@@ -3,9 +3,9 @@ exec_prefix=@EXEC_PREFIX@
 libdir=@LIBDIR@
 includedir=@INCLUDEDIR@
 
-Name: @PC_NAME@
-Description: @PACKAGE_DESCRIPTION@
+Name: feedback
+Description: Feedback library for playing sound and vibration
 Version: @VERSION@
-Requires: @PC_REQUIRED@
-Libs: -L${libdir} @PC_LDFLAGS@
+Requires: capi-base-common
+Libs: -L${libdir} -lfeedback
 Cflags: -I${includedir}
index 84e9430..445c7fe 100644 (file)
@@ -24,27 +24,20 @@ extern "C" {
 #endif
 
 /**
- * @file feedback-ids.h
- * @brief This file contains the feedback API
- */
-
-/**
- * @addtogroup CAPI_FEEDBACK_MODULE
+ * @addtogroup CAPI_SYSTEM_FEEDBACK_MODULE
  * @{
  */
 
 /**
  * @brief Enumerations of the type for feedback interface
- * @details
- *
+ * @since_tizen 2.4
  */
 typedef enum
 {
-       FEEDBACK_TYPE_NONE,
-       FEEDBACK_TYPE_SOUND,
-       FEEDBACK_TYPE_VIBRATION,
-       FEEDBACK_TYPE_LED,
-       FEEDBACK_TYPE_END
+       FEEDBACK_TYPE_NONE,                             /**< Feedback type none */
+       FEEDBACK_TYPE_SOUND,                            /**< Feedback type for sound */
+       FEEDBACK_TYPE_VIBRATION,                        /**< Feedback type for vibration */
+       FEEDBACK_TYPE_END,
 } feedback_type_e;
 
 /**
@@ -53,124 +46,56 @@ typedef enum
  * Each feedback pattern can have separate media files of each types.
  * But Depending on vendor design, pattern may not have any type of file.
  *
+ * @since_tizen 2.4
  */
 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_TAP = 0,                       /**< Feedback pattern when general touch */
+       FEEDBACK_PATTERN_SIP,                           /**< Feedback pattern when touch text key */
+       FEEDBACK_PATTERN_KEY0 = 6,                      /**< 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_HW_TAP = 21,                   /**< 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_EMAIL = 25,                    /**< Feedback pattern when incoming an email */
+       FEEDBACK_PATTERN_WAKEUP = 27,                   /**< Feedback pattern when alert wake up call */
+       FEEDBACK_PATTERN_SCHEDULE = 29,                 /**< Feedback pattern when alert schedule alarm */
+       FEEDBACK_PATTERN_TIMER = 31,                    /**< Feedback pattern when alert timer */
+       FEEDBACK_PATTERN_GENERAL = 33,                  /**< Feedback pattern when alert general event */
+
+       FEEDBACK_PATTERN_POWERON = 36,                  /**< Feedback pattern when power on */
+       FEEDBACK_PATTERN_POWEROFF,                      /**< Feedback pattern when power off */
+       FEEDBACK_PATTERN_CHARGERCONN,                   /**< Feedback pattern when connecting charger */
+       FEEDBACK_PATTERN_CHARGING_ERROR = 40,           /**< Feedback pattern when occuring charging error */
+       FEEDBACK_PATTERN_FULLCHARGED = 42,              /**< Feedback pattern when full charged */
+       FEEDBACK_PATTERN_LOWBATT = 44,                  /**< Feedback pattern when low battery */
+       FEEDBACK_PATTERN_LOCK = 46,                     /**< Feedback pattern when lock */
+       FEEDBACK_PATTERN_UNLOCK,                        /**< Feedback pattern when unlock */
+       FEEDBACK_PATTERN_VIBRATION_ON = 55,             /**< 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_LIST_REORDER = 62,             /**< 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_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;
 
 /**
diff --git a/include/feedback-internal.h b/include/feedback-internal.h
new file mode 100644 (file)
index 0000000..08c5e0a
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * 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_INTERNAL_H__
+#define __FEEDBACK_INTERNAL_H__
+
+#include <tizen_error.h>
+#include "feedback-ids.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file feedback-internal.h
+ * @brief This file contains the feedback internal API
+ */
+
+#define FEEDBACK_SUCCEEDED(n)                ((n) == FEEDBACK_ERROR_NONE)
+#define FEEDBACK_FAILED(n)                   ((n) != FEEDBACK_ERROR_NONE)
+
+/**
+ *
+ * @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 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_INTERNAL_H__
index 532e24e..7894597 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef __FEEDBACK_H__
 #define __FEEDBACK_H__
 
+#include <tizen.h>
 #include <tizen_error.h>
 #include "feedback-ids.h"
 
@@ -38,7 +39,7 @@ extern "C" {
 
 /**
  * @brief Enumerations of error codes for the Feedback API.
- * @since_tizen 2.3
+ * @since_tizen 2.4
  */
 typedef enum
 {
@@ -46,24 +47,25 @@ typedef enum
     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_PERMISSION_DENIED   = TIZEN_ERROR_PERMISSION_DENIED,   /**< Permission denied */
+    FEEDBACK_ERROR_NOT_INITIALIZED     = TIZEN_ERROR_FEEDBACK | 0x01,     /**< Not 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
+ * @since_tizen 2.4
  *
  * @remarks
  * If this function is not called in advance, other function will return #FEEDBACK_ERROR_NOT_INITIALIZED.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, this function initializes only sound.
+ * It does not return any error in this case.
  *
  * @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
+ *
+ * @post feedback_deinitialize()
  *
  * @see feedback_deinitialize()
  */
@@ -73,12 +75,19 @@ 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
+ * @since_tizen 2.4
+ *
+ * @remarks
+ * If you don't want to use feedback anymore, you need to deinitialize with this function.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, this function deinitializes only sound.
+ * It does not return any error in this case.
  *
  * @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
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED      Not initialized
+ *
+ * @pre feedback_initialize()
  *
  * @see feedback_initialize()
  */
@@ -90,19 +99,27 @@ int feedback_deinitialize(void);
  * 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
+ * @since_tizen 2.4
  *
  * @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.
+ * If to play one of devices is successful, this function regards as success.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, it only works sound operation.
+ * It does not return any error in this case.
  *
  * @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
+ * @retval #FEEDBACK_ERROR_NONE                 Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED     Operation not permitted
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval #FEEDBACK_ERROR_NOT_SUPPORTED        Not supported device
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED      Not initialized
+ *
+ * @pre feedback_initialize()
  */
 int feedback_play(feedback_pattern_e pattern);
 
@@ -113,104 +130,77 @@ int feedback_play(feedback_pattern_e pattern);
  * 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
+ * @since_tizen 2.4
  *
  * @remarks
- * Currently, there are two types of reactions: sound and vibration.
+ * 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.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, it returns FEEDBACK_ERROR_PERMISSION_DENIED error.
  *
  * @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
+ * @retval #FEEDBACK_ERROR_NONE                 Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED     Operation not permitted
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval #FEEDBACK_ERROR_NOT_SUPPORTED        Not supported device
+ * @retval #FEEDBACK_ERROR_PERMISSION_DENIED    Permission denied
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED      Not initialized
+ *
+ * @pre feedback_initialize()
  */
 int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern);
 
 /**
- *
- * @brief Plays specific type of reactions that are pre-defined.
+ * @brief Stop various types of reactions
  * @details
- * This function can be used to react to pre-defined actions. \n
- * It play specific type of system pre-defined pattern.
+ * This functon can be used to stop react to pre-defined actions. \n
+ * It stops system pre-defined vibration patterns.
  *
- * @since_tizen 2.3
+ * @since_tizen 2.4
  *
  * @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
+ * This function does not support to stop media sound actions. \n
+ * In this case, it will return FEEDBACK_ERROR_NOT_SUPPORTED error.
+ * And for controlling haptic device, the privilege should be set to, %http://tizen.org/privilege/haptic.
+ * If you don't have the haptic privilege, it only works sound operation.
+ * It does not return any error in this case.
  *
  * @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
+ * @retval #FEEDBACK_ERROR_NONE                 Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED     Operation not permitted
+ * @retval #FEEDBACK_ERROR_NOT_SUPPORTED        Not supported device
+ * @retval #FEEDBACK_ERROR_PERMISSION_DENIED    Permission denied
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED      Not initialized
  *
- * @return 0 on success, otherwise a negative error value.
- * @retval #FEEDBACK_ERROR_NONE               Successful
- * @retval #FEEDBACK_ERROR_NOT_SUPPORTED      Not supported device
+ * @pre feedback_initialize()
  */
 int feedback_stop(void);
 
 /**
- * @brief Gets the file path of resource for the given feedback type and pattern.
+ * @brief Checks if the pattern is supported
  * @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.
+ * This functon can be used to check if a specific pattern is supported.
  *
- * @since_tizen 2.3
+ * @since_tizen 2.4
  *
- * @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
+ * @param[in] type      The pattern type
+ * @param[in] pattern   The pre-defined pattern
+ * @param[out] status   True means the pattern is supported, otherwise not supported.
  *
  * @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
+ * @retval #FEEDBACK_ERROR_NONE                 Successful
+ * @retval #FEEDBACK_ERROR_OPERATION_FAILED     Operation not permitted
+ * @retval #FEEDBACK_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval #FEEDBACK_ERROR_NOT_SUPPORTED        Not supported device
+ * @retval #FEEDBACK_ERROR_NOT_INITIALIZED      Not initialized
  *
- * @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
+ * @pre feedback_initialize()
  */
-int feedback_set_resource_path(feedback_type_e type, feedback_pattern_e pattern, char *path);
+int feedback_is_supported_pattern(feedback_type_e type, feedback_pattern_e pattern, bool *status);
 
 /**
  * @}
diff --git a/include/feedback_doc.h b/include/feedback_doc.h
deleted file mode 100755 (executable)
index c11960d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 <feedback.h>
- *
- * @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/xmlparser.h b/include/xmlparser.h
deleted file mode 100644 (file)
index 0c38672..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 <libxml/parser.h>
-
-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/mobile/data/sound.conf b/mobile/data/sound.conf
new file mode 100644 (file)
index 0000000..5cce08c
--- /dev/null
@@ -0,0 +1,39 @@
+[Sound]
+FEEDBACK_PATTERN_TAP=/usr/share/feedback/sound/touch/touch.wav
+FEEDBACK_PATTERN_SIP=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_KEY0=/usr/share/feedback/sound/touch/key0.wav
+FEEDBACK_PATTERN_KEY1=/usr/share/feedback/sound/touch/key1.wav
+FEEDBACK_PATTERN_KEY2=/usr/share/feedback/sound/touch/key2.wav
+FEEDBACK_PATTERN_KEY3=/usr/share/feedback/sound/touch/key3.wav
+FEEDBACK_PATTERN_KEY4=/usr/share/feedback/sound/touch/key4.wav
+FEEDBACK_PATTERN_KEY5=/usr/share/feedback/sound/touch/key5.wav
+FEEDBACK_PATTERN_KEY6=/usr/share/feedback/sound/touch/key6.wav
+FEEDBACK_PATTERN_KEY7=/usr/share/feedback/sound/touch/key7.wav
+FEEDBACK_PATTERN_KEY8=/usr/share/feedback/sound/touch/key8.wav
+FEEDBACK_PATTERN_KEY9=/usr/share/feedback/sound/touch/key9.wav
+FEEDBACK_PATTERN_KEY_STAR=/usr/share/feedback/sound/touch/keyasterisk.wav
+FEEDBACK_PATTERN_KEY_SHARP=/usr/share/feedback/sound/touch/keysharp.wav
+FEEDBACK_PATTERN_KEY_BACK=/usr/share/feedback/sound/touch/touch.wav
+FEEDBACK_PATTERN_HW_TAP=/usr/share/feedback/sound/touch/touch.wav
+FEEDBACK_PATTERN_POWERON=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_CHARGERCONN=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LOWBATT=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LOCK=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_UNLOCK=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_SILENT_OFF=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LIST_REORDER=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_LIST_SLIDER=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_VOLUME_KEY=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_SIP_FUNCTION=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_SIP_FJKEY=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_MAX_CHARACTER=/usr/share/feedback/sound/touch/sip.wav
+FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_LOCK_SWIPE=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_UNLOCK_SWIPE=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_GEOMETRIC_LOCK=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_CALLCONNECT=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_DISCALLCONNECT=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_MINUTEMINDER=/usr/share/feedback/sound/operation/operation.wav
+FEEDBACK_PATTERN_MOBILE_SCREEN_CAPTURE=/usr/share/feedback/sound/operation/shutter.wav
diff --git a/mobile/data/sound/operation/notification.wav b/mobile/data/sound/operation/notification.wav
new file mode 100755 (executable)
index 0000000..6487389
Binary files /dev/null and b/mobile/data/sound/operation/notification.wav differ
diff --git a/mobile/data/sound/operation/ringtone.wav b/mobile/data/sound/operation/ringtone.wav
new file mode 100755 (executable)
index 0000000..f159e35
Binary files /dev/null and b/mobile/data/sound/operation/ringtone.wav differ
diff --git a/mobile/data/sound/operation/shutter.wav b/mobile/data/sound/operation/shutter.wav
new file mode 100755 (executable)
index 0000000..9dea92b
Binary files /dev/null and b/mobile/data/sound/operation/shutter.wav differ
diff --git a/mobile/data/sound/touch/key0.wav b/mobile/data/sound/touch/key0.wav
new file mode 100755 (executable)
index 0000000..e2cd877
Binary files /dev/null and b/mobile/data/sound/touch/key0.wav differ
diff --git a/mobile/data/sound/touch/key1.wav b/mobile/data/sound/touch/key1.wav
new file mode 100755 (executable)
index 0000000..fa77cf4
Binary files /dev/null and b/mobile/data/sound/touch/key1.wav differ
diff --git a/mobile/data/sound/touch/key2.wav b/mobile/data/sound/touch/key2.wav
new file mode 100755 (executable)
index 0000000..53da84c
Binary files /dev/null and b/mobile/data/sound/touch/key2.wav differ
diff --git a/mobile/data/sound/touch/key3.wav b/mobile/data/sound/touch/key3.wav
new file mode 100755 (executable)
index 0000000..ede9a2b
Binary files /dev/null and b/mobile/data/sound/touch/key3.wav differ
diff --git a/mobile/data/sound/touch/key4.wav b/mobile/data/sound/touch/key4.wav
new file mode 100755 (executable)
index 0000000..105bddc
Binary files /dev/null and b/mobile/data/sound/touch/key4.wav differ
diff --git a/mobile/data/sound/touch/key5.wav b/mobile/data/sound/touch/key5.wav
new file mode 100755 (executable)
index 0000000..a34b4d0
Binary files /dev/null and b/mobile/data/sound/touch/key5.wav differ
diff --git a/mobile/data/sound/touch/key6.wav b/mobile/data/sound/touch/key6.wav
new file mode 100755 (executable)
index 0000000..34a8bec
Binary files /dev/null and b/mobile/data/sound/touch/key6.wav differ
diff --git a/mobile/data/sound/touch/key7.wav b/mobile/data/sound/touch/key7.wav
new file mode 100755 (executable)
index 0000000..3b845a4
Binary files /dev/null and b/mobile/data/sound/touch/key7.wav differ
diff --git a/mobile/data/sound/touch/key8.wav b/mobile/data/sound/touch/key8.wav
new file mode 100755 (executable)
index 0000000..2a05528
Binary files /dev/null and b/mobile/data/sound/touch/key8.wav differ
diff --git a/mobile/data/sound/touch/key9.wav b/mobile/data/sound/touch/key9.wav
new file mode 100755 (executable)
index 0000000..80699c8
Binary files /dev/null and b/mobile/data/sound/touch/key9.wav differ
diff --git a/mobile/data/sound/touch/keyasterisk.wav b/mobile/data/sound/touch/keyasterisk.wav
new file mode 100755 (executable)
index 0000000..9ec2e71
Binary files /dev/null and b/mobile/data/sound/touch/keyasterisk.wav differ
diff --git a/mobile/data/sound/touch/keysharp.wav b/mobile/data/sound/touch/keysharp.wav
new file mode 100755 (executable)
index 0000000..ce7cd88
Binary files /dev/null and b/mobile/data/sound/touch/keysharp.wav differ
diff --git a/mobile/data/vibration.conf b/mobile/data/vibration.conf
new file mode 100644 (file)
index 0000000..3879564
--- /dev/null
@@ -0,0 +1,47 @@
+[Vibration]
+FEEDBACK_PATTERN_SIP=mono
+FEEDBACK_PATTERN_KEY0=mono
+FEEDBACK_PATTERN_KEY1=mono
+FEEDBACK_PATTERN_KEY2=mono
+FEEDBACK_PATTERN_KEY3=mono
+FEEDBACK_PATTERN_KEY4=mono
+FEEDBACK_PATTERN_KEY5=mono
+FEEDBACK_PATTERN_KEY6=mono
+FEEDBACK_PATTERN_KEY7=mono
+FEEDBACK_PATTERN_KEY8=mono
+FEEDBACK_PATTERN_KEY9=mono
+FEEDBACK_PATTERN_KEY_STAR=mono
+FEEDBACK_PATTERN_KEY_SHARP=mono
+FEEDBACK_PATTERN_KEY_BACK=mono
+FEEDBACK_PATTERN_HOLD=mono
+FEEDBACK_PATTERN_HW_TAP=mono
+FEEDBACK_PATTERN_HW_HOLD=mono
+FEEDBACK_PATTERN_MESSAGE=mono
+FEEDBACK_PATTERN_EMAIL=mono
+FEEDBACK_PATTERN_WAKEUP=mono
+FEEDBACK_PATTERN_SCHEDULE=mono
+FEEDBACK_PATTERN_TIMER=mono
+FEEDBACK_PATTERN_GENERAL=mono
+FEEDBACK_PATTERN_POWERON=mono
+FEEDBACK_PATTERN_POWEROFF=mono
+FEEDBACK_PATTERN_CHARGERCONN=mono
+FEEDBACK_PATTERN_LOWBATT=mono
+FEEDBACK_PATTERN_VIBRATION_ON=mono
+FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE=mono
+FEEDBACK_PATTERN_MOBILE_SIP_FUNCTION=mono
+FEEDBACK_PATTERN_MOBILE_SIP_FJKEY=mono
+FEEDBACK_PATTERN_MOBILE_MAX_CHARACTER=mono
+FEEDBACK_PATTERN_MOBILE_MULTI_TAP=mono
+FEEDBACK_PATTERN_MOBILE_MESSAGE_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_EMAIL_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_WAKEUP_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_SCHEDULE_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_TIMER_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_GENERAL_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_SMART_ALERT=mono
+FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL=mono
+FEEDBACK_PATTERN_MOBILE_OUTGOING_CALL=mono
+FEEDBACK_PATTERN_MOBILE_MINUTEMINDER=mono
+FEEDBACK_PATTERN_MOBILE_MMS=mono
+FEEDBACK_PATTERN_MOBILE_HOURLY_ALERT=mono
diff --git a/mobile/include/feedback-ids-mobile.h b/mobile/include/feedback-ids-mobile.h
new file mode 100644 (file)
index 0000000..10c001d
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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_MOBILE_H__
+#define __FEEDBACK_IDS_MOBILE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file feedback-ids-mobile.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_MOBILE_LED = FEEDBACK_TYPE_END,
+       FEEDBACK_TYPE_MOBILE_END,
+} feedback_mobile_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_MOBILE_NONE = -1,
+
+       FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE = 2, /**< feedback pattern when touch backspace key */
+       FEEDBACK_PATTERN_MOBILE_SIP_FUNCTION = 3,                       /**< feedback pattern when touch function key */
+       FEEDBACK_PATTERN_MOBILE_SIP_FJKEY = 4,                          /**< feedback pattern when touch F,J key */
+       FEEDBACK_PATTERN_MOBILE_MAX_CHARACTER = 5,                      /**< feedback pattern when max character */
+
+       FEEDBACK_PATTERN_MOBILE_MULTI_TAP = 20,                         /**< feedback pattern when multi touch */
+
+       FEEDBACK_PATTERN_MOBILE_MESSAGE_ON_CALL = 24,           /**< feedback pattern when incoming a message on call */
+       FEEDBACK_PATTERN_MOBILE_EMAIL_ON_CALL = 26,             /**< feedback pattern when incoming an email on call */
+       FEEDBACK_PATTERN_MOBILE_WAKEUP_ON_CALL = 28,            /**< feedback pattern when alert wake up call on call */
+       FEEDBACK_PATTERN_MOBILE_SCHEDULE_ON_CALL = 30,          /**< feedback pattern when alert schedule alarm on call */
+       FEEDBACK_PATTERN_MOBILE_TIMER_ON_CALL = 32,             /**< feedback pattern when alert timer on call */
+       FEEDBACK_PATTERN_MOBILE_GENERAL_ON_CALL = 34,           /**< feedback pattern when alert general event on call */
+       FEEDBACK_PATTERN_MOBILE_SMART_ALERT = 35,               /**< feedback pattern when alert noti on motion */
+
+       FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL = 39,       /**< feedback pattern when connecting charger on call */
+       FEEDBACK_PATTERN_MOBILE_CHARGING_ERROR_ON_CALL = 41,/**< feedback pattern when occuring charging error on call */
+       FEEDBACK_PATTERN_MOBILE_FULLCHARGED_ON_CALL = 43,       /**< feedback pattern when full charged on call */
+       FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL = 45,           /**< feedback pattern when low battery on call */
+       FEEDBACK_PATTERN_MOBILE_LOCK_SWIPE = 48,                /**< feedback pattern when lock swipe */
+       FEEDBACK_PATTERN_MOBILE_UNLOCK_SWIPE = 49,              /**< feedback pattern when unlock swipe*/
+       FEEDBACK_PATTERN_MOBILE_GEOMETRIC_LOCK = 50,            /**< feedback pattern when lock by geometric effect */
+       FEEDBACK_PATTERN_MOBILE_CALLCONNECT = 51,               /**< feedback pattern when connecting call */
+       FEEDBACK_PATTERN_MOBILE_DISCALLCONNECT = 52,            /**< feedback pattern when disconnecting call */
+       FEEDBACK_PATTERN_MOBILE_OUTGOING_CALL = 53,             /**< feedback pattern when connected outgoing call */
+       FEEDBACK_PATTERN_MOBILE_MINUTEMINDER = 54,              /**< feedback pattern when minute minder */
+       FEEDBACK_PATTERN_MOBILE_BT_PAIRING = 59,                /**< feedback pattern when starting pare with bluetooth */
+       FEEDBACK_PATTERN_MOBILE_BT_WAITING = 60,                /**< feedback pattern when pairing bluetooth */
+       FEEDBACK_PATTERN_MOBILE_SCREEN_CAPTURE = 61,            /**< feedback pattern when screen capture */
+       FEEDBACK_PATTERN_MOBILE_MMS = 65,                       /**< feedback pattern when message state changed to MMS */
+       FEEDBACK_PATTERN_MOBILE_HOURLY_ALERT,           /**< feedback pattern when alert every hour on the hour */
+
+       FEEDBACK_PATTERN_MOBILE_SAFETY_ALERT,           /**< feedback pattern when safety alert from phone */
+       FEEDBACK_PATTERN_MOBILE_ACCIDENT_DETECT,        /**< feedback pattern when accident detect */
+       FEEDBACK_PATTERN_MOBILE_SEND_SOS_MESSAGE,       /**< feedback pattern when sending SOS message */
+       FEEDBACK_PATTERN_MOBILE_END_SOS_MESSAGE,        /**< feedback pattern when finishing SOS message */
+       FEEDBACK_PATTERN_MOBILE_EMERGENCY_BUZZER,       /**< feedback pattern when occurs emergency buzzer */
+       FEEDBACK_PATTERN_MOBILE_SAFETY_LOW_POWER,       /**< this pattern is a low power ringtone */
+       FEEDBACK_PATTERN_MOBILE_CMAS,                   /**< feedback pattern when alerting commercial mobile */
+
+       FEEDBACK_PATTERN_MOBILE_END,
+
+} feedback_pattern_mobile_e;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__FEEDBACK_IDS_MOBILE_H__
diff --git a/mobile/src/check.c b/mobile/src/check.c
new file mode 100644 (file)
index 0000000..a542a60
--- /dev/null
@@ -0,0 +1,517 @@
+/*
+ * libfeedback
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <vconf.h>
+
+#include "feedback.h"
+#include "feedback-ids-mobile.h"
+#include "profiles.h"
+#include "log.h"
+#include "dbus.h"
+
+#define CM_CALL_STATUS_IDLE    0
+#define CALLMGR_BUS_NAME                    "org.tizen.callmgr"
+#define CALLMGR_INTERFACE                   "org.tizen.callmgr"
+#define CALLMGR_OBJECT_PATH                 "/org/tizen/callmgr"
+#define CALLMGR_GET_CALL_STATUS             "GetCallStatus"
+#define CALLMGR_CALL_STATUS                 "CallStatus"
+
+static const char *mobile_str_type[] = {
+       "FEEDBACK_TYPE_NONE",
+       "FEEDBACK_TYPE_SOUND",
+       "FEEDBACK_TYPE_VIBRATION",
+       "FEEDBACK_TYPE_MOBILE_LED",
+};
+
+static const char *mobile_str_pattern[] = {
+       "FEEDBACK_PATTERN_TAP",
+       "FEEDBACK_PATTERN_SIP",
+       "FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE",
+       "FEEDBACK_PATTERN_MOBILE_SIP_FUNCTION",
+       "FEEDBACK_PATTERN_MOBILE_SIP_FJKEY",
+       "FEEDBACK_PATTERN_MOBILE_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_MOBILE_MULTI_TAP",
+       "FEEDBACK_PATTERN_HW_TAP",
+       "FEEDBACK_PATTERN_HW_HOLD",
+
+       "FEEDBACK_PATTERN_MESSAGE",
+       "FEEDBACK_PATTERN_MOBILE_MESSAGE_ON_CALL",
+       "FEEDBACK_PATTERN_EMAIL",
+       "FEEDBACK_PATTERN_MOBILE_EMAIL_ON_CALL",
+       "FEEDBACK_PATTERN_WAKEUP",
+       "FEEDBACK_PATTERN_MOBILE_WAKEUP_ON_CALL",
+       "FEEDBACK_PATTERN_SCHEDULE",
+       "FEEDBACK_PATTERN_MOBILE_SCHEDULE_ON_CALL",
+       "FEEDBACK_PATTERN_TIMER",
+       "FEEDBACK_PATTERN_MOBILE_TIMER_ON_CALL",
+       "FEEDBACK_PATTERN_GENERAL",
+       "FEEDBACK_PATTERN_MOBILE_GENERAL_ON_CALL",
+       "FEEDBACK_PATTERN_MOBILE_SMART_ALERT",
+
+       "FEEDBACK_PATTERN_POWERON",
+       "FEEDBACK_PATTERN_POWEROFF",
+       "FEEDBACK_PATTERN_CHARGERCONN",
+       "FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL",
+       "FEEDBACK_PATTERN_CHARGING_ERROR",
+       "FEEDBACK_PATTERN_MOBILE_CHARGING_ERROR_ON_CALL",
+       "FEEDBACK_PATTERN_FULLCHARGED",
+       "FEEDBACK_PATTERN_MOBILE_FULLCHARGED_ON_CALL",
+       "FEEDBACK_PATTERN_LOWBATT",
+       "FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL",
+       "FEEDBACK_PATTERN_LOCK",
+       "FEEDBACK_PATTERN_UNLOCK",
+       "FEEDBACK_PATTERN_MOBILE_LOCK_SWIPE",
+       "FEEDBACK_PATTERN_MOBILE_UNLOCK_SWIPE",
+       "FEEDBACK_PATTERN_MOBILE_GEOMETRIC_LOCK",
+       "FEEDBACK_PATTERN_MOBILE_CALLCONNECT",
+       "FEEDBACK_PATTERN_MOBILE_DISCALLCONNECT",
+       "FEEDBACK_PATTERN_MOBILE_OUTGOING_CALL",
+       "FEEDBACK_PATTERN_MOBILE_MINUTEMINDER",
+       "FEEDBACK_PATTERN_VIBRATION_ON",
+       "FEEDBACK_PATTERN_SILENT_OFF",
+       "FEEDBACK_PATTERN_BT_CONNECTED",
+       "FEEDBACK_PATTERN_BT_DISCONNECTED",
+       "FEEDBACK_PATTERN_MOBILE_BT_PAIRING",
+       "FEEDBACK_PATTERN_MOBILE_BT_WAITING",
+       "FEEDBACK_PATTERN_MOBILE_SCREEN_CAPTURE",
+       "FEEDBACK_PATTERN_LIST_REORDER",
+       "FEEDBACK_PATTERN_LIST_SLIDER",
+       "FEEDBACK_PATTERN_VOLUME_KEY",
+       "FEEDBACK_PATTERN_MOBILE_MMS",
+       "FEEDBACK_PATTERN_MOBILE_HOURLY_ALERT",
+
+       "FEEDBACK_PATTERN_MOBILE_SAFETY_ALERT",
+       "FEEDBACK_PATTERN_MOBILE_ACCIDENT_DETECT",
+       "FEEDBACK_PATTERN_MOBILE_SEND_SOS_MESSAGE",
+       "FEEDBACK_PATTERN_MOBILE_END_SOS_MESSAGE",
+       "FEEDBACK_PATTERN_MOBILE_EMERGENCY_BUZZER",
+       "FEEDBACK_PATTERN_MOBILE_SAFETY_LOW_POWER",
+       "FEEDBACK_PATTERN_MOBILE_CMAS",
+};
+
+static int lock_sndstatus;
+static int camerastatus;
+static int shutter_sndstatus;
+static int noti_vibstatus;
+static int vib_level;
+static int noti_level;
+static int feedbackstatus;
+static int callstatus;
+static guint gdbus_id;
+
+static int dbus_call_status_watch(GDBusSignalCallback call_status_cb)
+{
+       GDBusConnection *conn;
+       GError *err = NULL;
+
+       g_type_init();
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (!conn) {
+               _E("fail to get connection");
+               g_clear_error(&err);
+               return -EPERM;
+       }
+
+       if (gdbus_id > 0) {
+               g_dbus_connection_signal_unsubscribe(conn, gdbus_id);
+               gdbus_id = 0;
+       }
+
+       gdbus_id = g_dbus_connection_signal_subscribe(conn,
+                       NULL,
+                       CALLMGR_INTERFACE,
+                       CALLMGR_CALL_STATUS,
+                       CALLMGR_OBJECT_PATH,
+                       NULL,
+                       G_DBUS_SIGNAL_FLAGS_NONE,
+                       call_status_cb,
+                       NULL,
+                       NULL);
+
+       if (gdbus_id == 0) {
+               _E("fail to subscribe signal");
+               return -EPERM;
+       }
+       return 0;
+}
+
+static int dbus_call_status_remove()
+{
+       GDBusConnection *conn;
+       GError *err = NULL;
+
+       if (gdbus_id == 0)
+               return 0;
+
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (!conn) {
+               _E("fail to get connection");
+               g_clear_error(&err);
+               return -EPERM;
+       }
+
+       g_dbus_connection_signal_unsubscribe(conn, gdbus_id);
+       gdbus_id = 0;
+       return 0;
+}
+
+static int get_call_status()
+{
+       DBusMessage *reply;
+       DBusError err;
+       int ret;
+       int call_status;
+       int call_type;
+
+       dbus_error_init(&err);
+
+       reply = dbus_method_sync_with_reply(CALLMGR_BUS_NAME, CALLMGR_OBJECT_PATH,
+                       CALLMGR_INTERFACE, CALLMGR_GET_CALL_STATUS, NULL, NULL);
+       if (!reply)
+               return -EPERM;
+
+       ret = dbus_message_get_args(reply, &err, DBUS_TYPE_INT32, &call_status,
+                       DBUS_TYPE_INT32, &call_type, DBUS_TYPE_INVALID);
+       dbus_message_unref(reply);
+       if (!ret) {
+               if (dbus_error_is_set(&err)) {
+                       _E("no message : [:%s:%s]", err.name, err.message);
+                       dbus_error_free(&err);
+               } else
+                       _E("no message");
+               return -EPERM;
+       }
+       callstatus = call_status;
+       _D("Initialize call status : %d", callstatus);
+       return 0;
+}
+
+static void feedback_callstatus_cb(GDBusConnection *connection,
+               const gchar *sender_name,
+               const gchar *object_path,
+               const gchar *interface_name,
+               const gchar *signal_name,
+               GVariant *parameters,
+               gpointer user_data)
+{
+       int call_status;
+       int call_type;
+       char *call_num;
+
+       if (strncmp(interface_name, CALLMGR_INTERFACE, strlen(CALLMGR_INTERFACE)) ||
+                       strncmp(signal_name, CALLMGR_CALL_STATUS, strlen(CALLMGR_CALL_STATUS))) {
+               _D("Not CallStatus");
+               return;
+       }
+
+       g_variant_get(parameters, "(iis)",
+                       &call_status,
+                       &call_type,
+                       &call_num);
+
+       callstatus = call_status;
+       _D("CallStatus : %d", callstatus);
+}
+
+static void feedback_lock_sndstatus_cb(keynode_t *key, void* data)
+{
+       lock_sndstatus = vconf_keynode_get_bool(key);
+}
+
+static void feedback_camerastatus_cb(keynode_t *key, void* data)
+{
+       camerastatus = vconf_keynode_get_int(key);
+}
+
+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 void mobile_init(void)
+{
+       int ret;
+
+       /* get call status */
+       ret = get_call_status();
+       if (ret < 0)
+               _W("fail to initialize call status value");
+
+       /* set call status callback*/
+       ret = dbus_call_status_watch(feedback_callstatus_cb);
+       if (ret < 0)
+               _W("fail to set call status callback : %d", ret);
+
+       if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &lock_sndstatus) < 0)
+               _W("VCONFKEY_SETAPPL_SOUND_LOCK_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!!");
+
+       /* check vibration status */
+       if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, &noti_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, &noti_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_SOUND_LOCK_BOOL, feedback_lock_sndstatus_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_CAMERA_STATE, feedback_camerastatus_cb, NULL);
+       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 mobile_exit(void)
+{
+       int ret;
+
+       /* unset call status callback */
+       ret = dbus_call_status_remove();
+       if (ret < 0)
+               _W("fail to unset call status callback : %d", ret);
+
+       /* remove watch */
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, feedback_lock_sndstatus_cb);
+       vconf_ignore_key_changed(VCONFKEY_CAMERA_STATE, feedback_camerastatus_cb);
+       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);
+
+}
+
+static bool mobile_get_switched_pattern(int pattern, int *switched)
+{
+       if (!switched)
+               return false;
+
+       if (callstatus == CM_CALL_STATUS_IDLE)
+               return false;
+
+       /* in case of call connected or connecting */
+       _D("Call status is connected or connecting.");
+       if (pattern == FEEDBACK_PATTERN_MESSAGE)
+               *switched = FEEDBACK_PATTERN_MOBILE_MESSAGE_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_EMAIL)
+               *switched = FEEDBACK_PATTERN_MOBILE_EMAIL_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_WAKEUP)
+               *switched = FEEDBACK_PATTERN_MOBILE_WAKEUP_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_SCHEDULE)
+               *switched = FEEDBACK_PATTERN_MOBILE_SCHEDULE_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_TIMER)
+               *switched = FEEDBACK_PATTERN_MOBILE_TIMER_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_GENERAL)
+               *switched = FEEDBACK_PATTERN_MOBILE_GENERAL_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_CHARGERCONN)
+               *switched = FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_CHARGING_ERROR)
+               *switched = FEEDBACK_PATTERN_MOBILE_CHARGING_ERROR_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_FULLCHARGED)
+               *switched = FEEDBACK_PATTERN_MOBILE_FULLCHARGED_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_LOWBATT)
+               *switched = FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL;
+       else
+               return false;
+
+       return true;
+}
+
+static bool mobile_get_always_alert_case(int type, int pattern)
+{
+       switch (pattern) {
+       case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+       case FEEDBACK_PATTERN_HOLD:
+               if (CHECK_VIBRATION(type) && feedbackstatus)
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_SIP:
+       case FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE:
+       case FEEDBACK_PATTERN_MOBILE_SIP_FUNCTION:
+       case FEEDBACK_PATTERN_MOBILE_SIP_FJKEY:
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_MESSAGE:
+       case FEEDBACK_PATTERN_EMAIL:
+               if (CHECK_VIBRATION(type) && noti_vibstatus)
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_TIMER:
+       case FEEDBACK_PATTERN_MOBILE_TIMER_ON_CALL:
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_WAKEUP:
+       case FEEDBACK_PATTERN_MOBILE_WAKEUP_ON_CALL:
+               return true;
+       case FEEDBACK_PATTERN_MOBILE_MESSAGE_ON_CALL:
+       case FEEDBACK_PATTERN_MOBILE_EMAIL_ON_CALL:
+       case FEEDBACK_PATTERN_MOBILE_GENERAL_ON_CALL:
+               break;
+       case FEEDBACK_PATTERN_MOBILE_CHARGERCONN_ON_CALL:
+       case FEEDBACK_PATTERN_MOBILE_CHARGING_ERROR_ON_CALL:
+       case FEEDBACK_PATTERN_MOBILE_LOWBATT_ON_CALL:
+       case FEEDBACK_PATTERN_MOBILE_MMS:
+       case FEEDBACK_PATTERN_MOBILE_HOURLY_ALERT:
+               /* no matter sound profile */
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_MOBILE_SMART_ALERT:
+       case FEEDBACK_PATTERN_MOBILE_SEND_SOS_MESSAGE:
+       case FEEDBACK_PATTERN_MOBILE_END_SOS_MESSAGE:
+       case FEEDBACK_PATTERN_MOBILE_CMAS:
+       case FEEDBACK_PATTERN_MOBILE_OUTGOING_CALL:
+               return true;
+       case FEEDBACK_PATTERN_MOBILE_SCREEN_CAPTURE:
+               if (CHECK_SOUND(type) && camerastatus && shutter_sndstatus)
+                       return true;
+               break;
+       default:
+               break;
+       }
+       return false;
+}
+
+static bool mobile_get_always_off_case(int type, int pattern)
+{
+       int ret;
+
+       /* check if the state of voice recorder is recording */
+       if (vconf_get_int(VCONFKEY_RECORDER_STATE, &ret) < 0) {
+               _W("fail to get media sound status, status will be zero");
+               ret = 0;
+       }
+
+       if (CHECK_SOUND(type) && ret == VCONFKEY_RECORDER_STATE_RECORDING) {
+               _D("voice recording status is RECORDING");
+               return true;
+       }
+
+       switch (pattern) {
+       case FEEDBACK_PATTERN_TAP:
+       case FEEDBACK_PATTERN_HOLD ... FEEDBACK_PATTERN_HW_HOLD:
+               if (CHECK_SOUND(type) && !is_touch_sndstatus())
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+               if (CHECK_SOUND(type) && !is_keytone_sndstatus())
+                       return true;
+               else if (CHECK_VIBRATION(type) && !feedbackstatus)
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_LOCK:
+       case FEEDBACK_PATTERN_UNLOCK:
+       case FEEDBACK_PATTERN_MOBILE_LOCK_SWIPE:
+       case FEEDBACK_PATTERN_MOBILE_UNLOCK_SWIPE:
+               if (CHECK_SOUND(type) && !lock_sndstatus)
+                       return true;
+               break;
+       default:
+               break;
+       }
+       return false;
+}
+
+static int mobile_get_strength_type(int type, int pattern)
+{
+       if (CHECK_SOUND(type)) {
+               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_MOBILE_SCREEN_CAPTURE)
+                       return VOLUME_TYPE_FIXED;
+               else
+                       return VOLUME_TYPE_SYSTEM;
+       } else if (CHECK_VIBRATION(type)) {
+               if (pattern >= FEEDBACK_PATTERN_MESSAGE &&
+                   pattern <= FEEDBACK_PATTERN_GENERAL)
+                       return noti_level * HAPTIC_FEEDBACK_STEP;
+               else
+                       return vib_level * HAPTIC_FEEDBACK_STEP;
+       }
+
+       return -EINVAL;
+}
+
+static const struct profile_ops mobile_profile_ops = {
+       .profile               = "mobile",
+       .init                  = mobile_init,
+       .exit                  = mobile_exit,
+       .get_switched_pattern  = mobile_get_switched_pattern,
+       .get_always_alert_case = mobile_get_always_alert_case,
+       .get_always_off_case   = mobile_get_always_off_case,
+       .get_strength_type     = mobile_get_strength_type,
+       .max_type              = FEEDBACK_TYPE_MOBILE_END,
+       .max_pattern           = FEEDBACK_PATTERN_MOBILE_END,
+       .str_type              = mobile_str_type,
+       .str_pattern           = mobile_str_pattern,
+};
+
+PROFILE_OPS_REGISTER(&mobile_profile_ops);
index dd43f18..7db8500 100644 (file)
@@ -13,10 +13,10 @@ 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)
+BuildRequires:  pkgconfig(gio-2.0)
 Requires(post):        svi-data
 
 %description
@@ -34,6 +34,7 @@ Feedback library for playing sound and vibration (devel)
 %package -n svi-data
 Summary:       svi resource package
 Group:         Development/Libraries
+Requires:      findutils
 Requires(post):        smack-utils
 
 %description -n svi-data
@@ -47,17 +48,7 @@ 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}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPROFILE=%{tizen_profile_name}
 make
 
 %install
similarity index 54%
rename from include/common.h
rename to src/common.h
index 71fa321..c83dbc5 100644 (file)
@@ -19,6 +19,9 @@
 #ifndef __COMMON_H__
 #define __COMMON_H__
 
+#include <stdbool.h>
+#include <mm_sound_private.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -28,18 +31,40 @@ extern "C" {
  * @brief This file contains the common information
  */
 
+#ifndef __CONSTRUCTOR__
+#define __CONSTRUCTOR__ __attribute__ ((constructor))
+#endif
+
+#ifndef __DESTRUCTOR__
+#define __DESTRUCTOR__ __attribute__ ((destructor))
+#endif
+
+#ifndef __DD_LIST__
+#define __DD_LIST__
+#include <glib.h>
+typedef GList dd_list;
+#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)
+#endif
+
 #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[];
+#define DEFAULT_VIB_LEVEL       3
+#define HAPTIC_FEEDBACK_STEP    20 /**< feedback max / slider step */
 
 int is_sound_mode(void);
+int is_touch_sndstatus(void);
+int is_keytone_sndstatus(void);
+int is_vibration_mode(void);
 
 #ifdef __cplusplus
 }
index f013abe..348b1d0 100644 (file)
@@ -134,3 +134,54 @@ int dbus_method_sync(const char *dest, const char *path,
 
        return result;
 }
+
+DBusMessage *dbus_method_sync_with_reply(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;
+
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (!conn) {
+               _E("dbus_bus_get error");
+               return NULL;
+       }
+
+       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 NULL;
+       }
+
+       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 NULL;
+       }
+
+       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(No reply) %s %s:%s-%s",
+                       dest, path, interface, method);
+
+       if (dbus_error_is_set(&err)) {
+               _E("dbus_connection_send error(%s:%s) %s %s:%s-%s",
+                       err.name, err.message, dest, path, interface, method);
+               dbus_error_free(&err);
+               reply = NULL;
+       }
+
+       return reply;
+}
similarity index 89%
rename from include/dbus.h
rename to src/dbus.h
index 9710b59..f42fbfe 100644 (file)
@@ -21,6 +21,7 @@
 #define __DBUS_H__
 
 #include <dbus/dbus.h>
+#include <gio/gio.h>
 
 /*
  * Device daemon
@@ -43,4 +44,7 @@ struct dbus_byte {
 int dbus_method_sync(const char *dest, const char *path,
                const char *interface, const char *method,
                const char *sig, char *param[]);
+DBusMessage *dbus_method_sync_with_reply(const char *dest, const char *path,
+               const char *interface, const char *method,
+               const char *sig, char *param[]);
 #endif
index e135e07..e176ea0 100644 (file)
 
 
 #include <stdio.h>
-#include <glib.h>
 
 #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)
@@ -64,7 +52,7 @@ void devices_init(void)
        const struct device_ops *dev;
 
        DD_LIST_FOREACH(dev_head, elem, dev) {
-               _D("[%s] initialize", str_type[dev->type]);
+               _D("[%s] initialize", dev->name);
                if (dev->init)
                        dev->init();
        }
@@ -76,30 +64,45 @@ void devices_exit(void)
        const struct device_ops *dev;
 
        DD_LIST_FOREACH(dev_head, elem, dev) {
-               _D("[%s] deinitialize", str_type[dev->type]);
+               _D("[%s] deinitialize", dev->name);
                if (dev->exit)
                        dev->exit();
        }
 }
 
-void devices_play(int pattern)
+int devices_play(int pattern)
 {
        dd_list *elem;
        const struct device_ops *dev;
+       int ret, prev = -EPERM;
 
        DD_LIST_FOREACH(dev_head, elem, dev) {
-               if (dev->play)
-                       dev->play(pattern);
+               if (dev->play) {
+                       ret = dev->play(pattern);
+                       if ((prev < 0 && ret == 0) ||
+                           (prev == 0 && ret < 0))
+                               prev = 0;
+                       else if ((prev < 0 && ret == -ENOTSUP) ||
+                                       (prev == -ENOTSUP && ret < 0))
+                               prev = -ENOTSUP;
+                       else
+                               prev = ret;
+               }
        }
+
+       return prev;
 }
 
-void devices_stop(void)
+int devices_stop(void)
 {
        dd_list *elem;
        const struct device_ops *dev;
+       int ret = -ENOTSUP;
 
        DD_LIST_FOREACH(dev_head, elem, dev) {
                if (dev->stop)
-                       dev->stop();
+                       ret = dev->stop();
        }
+
+       return ret;
 }
similarity index 84%
rename from include/devices.h
rename to src/devices.h
index 2fdd215..2774967 100644 (file)
 #ifndef __DEVICES_H__
 #define __DEVICES_H__
 
+#include <stdbool.h>
+#include "common.h"
+
 struct device_ops {
        int type;
+       const char *name;
        void (*init) (void);
        void (*exit) (void);
        int (*play) (int);
        int (*stop) (void);
+       int (*is_supported) (int, bool *);
        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
+int devices_play(int pattern);
+int devices_stop(void);
 
 #define DEVICE_OPS_REGISTER(dev)       \
 static void __CONSTRUCTOR__ module_init(void)  \
index f14ffef..bee3687 100644 (file)
 #include <stdbool.h>
 #include <string.h>
 #include <limits.h>
-#include <vconf.h>
 
 #include "feedback.h"
-#include "common.h"
-#include "log.h"
+#include "profiles.h"
 #include "devices.h"
+#include "log.h"
 
 #ifndef API
 #define API __attribute__ ((visibility("default")))
 #endif
 
-int callstatus;
-int alert_callstatus;
-
-static bool binit;
+static unsigned int init_cnt;
+static pthread_mutex_t fmutex = PTHREAD_MUTEX_INITIALIZER;
 
-static void feedback_callstatus_cb(keynode_t *key, void* data)
+API int feedback_initialize(void)
 {
-       callstatus = vconf_keynode_get_int(key);
-}
+       pthread_mutex_lock(&fmutex);
+       if (!profile) {
+               _E("there is no valid profile module.");
+               pthread_mutex_unlock(&fmutex);
+               return FEEDBACK_ERROR_NOT_SUPPORTED;
+       }
 
-static void feedback_alertstatus_cb(keynode_t *key, void* data)
-{
-       alert_callstatus = vconf_keynode_get_int(key);
-}
+       if (init_cnt++ > 0) {
+               pthread_mutex_unlock(&fmutex);
+               return FEEDBACK_ERROR_NONE;
+       }
 
-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;
+       /* initialize device */
+       devices_init();
+
+       /* initialize profile feature */
+       if (profile->init)
+               profile->init();
+
+       pthread_mutex_unlock(&fmutex);
+       return FEEDBACK_ERROR_NONE;
 }
 
-static void __DESTRUCTOR__ module_exit(void)
+API int feedback_deinitialize(void)
 {
-       if (!binit)
-               return;
+       pthread_mutex_lock(&fmutex);
+       if (!init_cnt) {
+               pthread_mutex_unlock(&fmutex);
+               return FEEDBACK_ERROR_NOT_INITIALIZED;
+       }
 
-       vconf_ignore_key_changed(VCONFKEY_CALL_STATE, feedback_callstatus_cb);
-       vconf_ignore_key_changed(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, feedback_alertstatus_cb);
+       if (init_cnt-- > 1) {
+               pthread_mutex_unlock(&fmutex);
+               return FEEDBACK_ERROR_NONE;
+       }
 
        /* deinitialize device */
        devices_exit();
 
-       binit = false;
+       /* deinitialize profile feature */
+       if (profile->exit)
+               profile->exit();
+
+       pthread_mutex_unlock(&fmutex);
+       return FEEDBACK_ERROR_NONE;
 }
 
-API int feedback_initialize()
+API int feedback_play(feedback_pattern_e pattern)
 {
-       if (binit)
-               return FEEDBACK_ERROR_NONE;
-
-       /* check call status */
-       if (vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) < 0)
-               _W("VCONFKEY_CALL_STATE ==> FAIL!!");
+       int err;
+       bool result;
+       int switched;
 
+       /* check initialize */
+       pthread_mutex_lock(&fmutex);
+       if (!init_cnt) {
+               _E("Not initialized");
+               pthread_mutex_unlock(&fmutex);
+               return FEEDBACK_ERROR_NOT_INITIALIZED;
+       }
+       pthread_mutex_unlock(&fmutex);
 
-       /* alert option on call */
-       if (vconf_get_int(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT, &alert_callstatus) < 0)
-               _W("VCONFKEY_CISSAPPL_ON_CALL_INT ==> FAIL!!");
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern) {
+               _E("Invalid parameter : pattern(%d)", pattern);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
 
-       /* 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);
+       /* if you need to switch pattern */
+       if (profile->get_switched_pattern) {
+               result = profile->get_switched_pattern(pattern, &switched);
+               if (result) {
+                       _W("pattern is changed : (%s) -> (%s)",
+                                       profile->str_pattern[pattern], profile->str_pattern[switched]);
+                       pattern = switched;
+               }
+       }
 
-       /* initialize device */
-       devices_init();
+       /* play all device */
+       err = devices_play(pattern);
+       /**
+        * devices_play() returns error even if all devices are failed.
+        * It means if to play anything is successful,
+        * this function regards as success.
+        */
+       if (err == -ENOTSUP)
+               return FEEDBACK_ERROR_NOT_SUPPORTED;
+       else if (err < 0)
+               return FEEDBACK_ERROR_OPERATION_FAILED;
 
-       binit = true;
        return FEEDBACK_ERROR_NONE;
 }
 
-API int feedback_deinitialize()
+API int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern)
 {
-       return FEEDBACK_ERROR_NONE;
-}
+       const struct device_ops *dev;
+       int err;
+       bool result;
+       int switched;
 
-API int feedback_play(feedback_pattern_e pattern)
-{
        /* check initialize */
-       if (!binit) {
+       pthread_mutex_lock(&fmutex);
+       if (!init_cnt) {
                _E("Not initialized");
+               pthread_mutex_unlock(&fmutex);
                return FEEDBACK_ERROR_NOT_INITIALIZED;
        }
+       pthread_mutex_unlock(&fmutex);
+
+       if (type <= FEEDBACK_TYPE_NONE ||
+           type >= profile->max_type) {
+               _E("Invalid parameter : type(%d)", type);
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
 
-       if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern) {
                _E("Invalid parameter : pattern(%d)", pattern);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
 
-       if (pattern == FEEDBACK_PATTERN_NONE) {
-               _D("pattern is NONE");
-               return FEEDBACK_ERROR_NONE;
+       /* if you need to switch pattern */
+       if (profile->get_switched_pattern) {
+               result = profile->get_switched_pattern(pattern, &switched);
+               if (result) {
+                       _W("pattern is changed : (%s) -> (%s)",
+                                       profile->str_pattern[pattern], profile->str_pattern[switched]);
+                       pattern = switched;
+               }
        }
 
-       /* 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 proper device */
+       dev = find_device(type);
+       if (!dev) {
+               _E("Not supported device : type(%s)", profile->str_type[type]);
+               return FEEDBACK_ERROR_NOT_SUPPORTED;
        }
 
-       /* play all device */
-       devices_play(pattern);
+       err = dev->play(pattern);
+       if (err == -ENOTSUP)
+               return FEEDBACK_ERROR_NOT_SUPPORTED;
+       else if (err == -ECOMM)
+               return FEEDBACK_ERROR_PERMISSION_DENIED;
+       else if (err < 0)
+               return FEEDBACK_ERROR_OPERATION_FAILED;
 
        return FEEDBACK_ERROR_NONE;
 }
 
-API int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern)
+API int feedback_stop(void)
+{
+       int err;
+
+       /* check initialize */
+       pthread_mutex_lock(&fmutex);
+       if (!init_cnt) {
+               _E("Not initialized");
+               pthread_mutex_unlock(&fmutex);
+               return FEEDBACK_ERROR_NOT_INITIALIZED;
+       }
+       pthread_mutex_unlock(&fmutex);
+
+       /* stop all device */
+       err = devices_stop();
+       if (err == -ENOTSUP)
+               return FEEDBACK_ERROR_NOT_SUPPORTED;
+       else if (err == -ECOMM)
+               return FEEDBACK_ERROR_PERMISSION_DENIED;
+       else if (err < 0)
+               return FEEDBACK_ERROR_OPERATION_FAILED;
+
+       return FEEDBACK_ERROR_NONE;
+}
+
+API int feedback_is_supported_pattern(feedback_type_e type, feedback_pattern_e pattern, bool *status)
 {
        const struct device_ops *dev;
+       bool supported;
        int err;
+       bool result;
+       int switched;
 
        /* check initialize */
-       if (!binit) {
+       pthread_mutex_lock(&fmutex);
+       if (!init_cnt) {
                _E("Not initialized");
+               pthread_mutex_unlock(&fmutex);
                return FEEDBACK_ERROR_NOT_INITIALIZED;
        }
+       pthread_mutex_unlock(&fmutex);
+
+       if (!status) {
+               _E("Invalid parameter : status(NULL)");
+               return FEEDBACK_ERROR_INVALID_PARAMETER;
+       }
 
-       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+       if (type <= FEEDBACK_TYPE_NONE ||
+           type >= profile->max_type) {
                _E("Invalid parameter : type(%d)", type);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
 
-       if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern) {
                _E("Invalid parameter : pattern(%d)", pattern);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
 
-       if (pattern == FEEDBACK_PATTERN_NONE) {
-               _D("pattern is NONE");
-               return FEEDBACK_ERROR_NONE;
+       /* if you need to switch pattern */
+       if (profile->get_switched_pattern) {
+               result = profile->get_switched_pattern(pattern, &switched);
+               if (result) {
+                       _W("pattern is changed : (%s) -> (%s)",
+                                       profile->str_pattern[pattern], profile->str_pattern[switched]);
+                       pattern = switched;
+               }
        }
 
-       /* 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 proper device */
+       dev = find_device(type);
+       if (!dev) {
+               _E("Not supported device : type(%s)", profile->str_type[type]);
+               return FEEDBACK_ERROR_NOT_SUPPORTED;
        }
 
-       /* 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");
+       err = dev->is_supported(pattern, &supported);
+       if (err < 0) {
+               _E("fail to invoke is_supported() : pattern(%s)", profile->str_pattern[pattern]);
+               return FEEDBACK_ERROR_OPERATION_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");
-       }
+       *status = supported;
 
        return FEEDBACK_ERROR_NONE;
 }
 
+/* Internal APIs */
 API int feedback_play_type_by_name(char *type, char *pattern)
 {
        feedback_type_e etype;
        feedback_pattern_e epattern;
+       int type_max;
+       int pattern_max;
 
        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)))
+       type_max = profile->max_type;
+       for (etype = 0; etype < type_max; ++etype) {
+               if (!strncmp(type, profile->str_type[etype], strlen(type)))
                        break;
        }
 
-       if (etype == FEEDBACK_TYPE_END) {
+       if (etype == type_max) {
                _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)))
+       pattern_max = profile->max_pattern;
+       for (epattern = 0; epattern < pattern_max; ++epattern) {
+               if (!strncmp(pattern, profile->str_pattern[epattern], strlen(pattern)))
                        break;
        }
 
-       if (epattern == FEEDBACK_PATTERN_END) {
-               _E("Invalid parameter : pattern(%d)", pattern);
+       if (epattern == pattern_max) {
+               _E("Invalid parameter : pattern(%s)", 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;
@@ -253,12 +320,14 @@ API int feedback_get_resource_path(feedback_type_e type, feedback_pattern_e patt
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
 
-       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+       if (type <= FEEDBACK_TYPE_NONE ||
+           type >= profile->max_type) {
                _E("Invalid parameter : type(%d)", type);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
 
-       if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern) {
                _E("Invalid parameter : pattern(%d)", pattern);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
@@ -280,12 +349,14 @@ API int feedback_set_resource_path(feedback_type_e type, feedback_pattern_e patt
        const struct device_ops *dev;
        int err;
 
-       if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
+       if (type <= FEEDBACK_TYPE_NONE ||
+           type >= profile->max_type) {
                _E("Invalid parameter : type(%d)", type);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
 
-       if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern) {
                _E("Invalid parameter : pattern(%d)", pattern);
                return FEEDBACK_ERROR_INVALID_PARAMETER;
        }
similarity index 100%
rename from include/log.h
rename to src/log.h
diff --git a/src/parser.c b/src/parser.c
new file mode 100644 (file)
index 0000000..9854328
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ * libfeedback
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "parser.h"
+#include "profiles.h"
+#include "log.h"
+
+#define MAX_DATA       256
+#define MAX_LINE       256
+#define MAX_SECTION    64
+#define WHITESPACE     " \t"
+#define NEWLINE                "\n\r"
+#define COMMENT                '#'
+
+#define MATCH(a, b)             (!strncmp(a, b, strlen(a)))
+#define SET_CONF(a, b)          (a = (b > 0.0 ? b : a))
+
+struct parse_result {
+       char *section;
+       char *name;
+       char *value;
+};
+
+static inline char *trim_str(char *s)
+{
+       char *t;
+       /* left trim */
+       s += strspn(s, WHITESPACE);
+
+       /* right trim */
+       for (t = strchr(s, 0); t > s; t--)
+               if (!strchr(WHITESPACE, t[-1]))
+                       break;
+       *t = 0;
+       return s;
+}
+
+static int config_parse(const char *file_name,
+               int cb(struct parse_result *result, void *user_data),
+               void *user_data)
+{
+       FILE *f = NULL;
+       struct parse_result result;
+       /* use stack for parsing */
+       char line[MAX_LINE];
+       char section[MAX_SECTION];
+       char *start, *end, *name, *value;
+       int lineno = 0, ret = 0;
+
+       if (!file_name || !cb) {
+               ret = -EINVAL;
+               goto error;
+       }
+
+       /* open conf file */
+       f = fopen(file_name, "r");
+       if (!f) {
+               _E("Failed to open file %s", file_name);
+               ret = -EIO;
+               goto error;
+       }
+
+       /* parsing line by line */
+       while (fgets(line, MAX_LINE, f) != NULL) {
+               lineno++;
+
+               start = line;
+               start[strcspn(start, NEWLINE)] = '\0';
+               start = trim_str(start);
+
+               if (*start == COMMENT) {
+                       continue;
+               } else if (*start == '[') {
+                       /* parse section */
+                       end = strchr(start, ']');
+                       if (!end || *end != ']') {
+                               ret = -EBADMSG;
+                               goto error;
+                       }
+
+                       *end = '\0';
+                       strncpy(section, start + 1, sizeof(section));
+                       section[MAX_SECTION-1] = '\0';
+               } else if (*start) {
+                       /* parse name & value */
+                       end = strchr(start, '=');
+                       if (!end || *end != '=') {
+                               ret = -EBADMSG;
+                               goto error;
+                       }
+                       *end = '\0';
+                       name = trim_str(start);
+                       value = trim_str(end + 1);
+                       end = strchr(value, COMMENT);
+                       if (end && *end == COMMENT) {
+                               *end = '\0';
+                               value = trim_str(value);
+                       }
+
+                       result.section = section;
+                       result.name = name;
+                       result.value = value;
+                       /* callback with parse result */
+                       ret = cb(&result, user_data);
+                       if (ret < 0) {
+                               ret = -EBADMSG;
+                               goto error;
+                       }
+               }
+       }
+       _D("Success to load %s", file_name);
+       fclose(f);
+       return 0;
+
+error:
+       if (f)
+               fclose(f);
+       _E("Failed to read %s:%d!", file_name, lineno);
+       return ret;
+}
+
+static int load_config(struct parse_result *result, void *user_data)
+{
+       struct feedback_config_info *info = (struct feedback_config_info *)user_data;
+       char *name;
+       char *value;
+       int i;
+
+       if (!info)
+               return -EINVAL;
+
+       if (!MATCH(result->section, info->name))
+               return -ENOENT;
+
+       if (!result->name || !result->value)
+               return -ENOENT;
+
+       name = result->name;
+       value = result->value;
+
+       for (i = 0; i < profile->max_pattern; i++) {
+               if (!MATCH(name, (char *)profile->str_pattern[i]))
+                       continue;
+
+               info->data[i].origin = strdup(value);
+               if (!info->data[i].origin)
+                       _E("fail to copy %s sound data",
+                                       profile->str_pattern[i]);
+               break;
+       }
+
+       return 0;
+}
+
+int feedback_load_config(const char *path,
+               struct feedback_config_info *info)
+{
+       int ret;
+
+       if (!path || !info)
+               return -EINVAL;
+
+       info->data = calloc(1,
+                       sizeof(struct feedback_data) * profile->max_pattern);
+       if (!info->data) {
+               _E("fail to allocate %s data", path);
+               return -ENOMEM;
+       }
+
+       ret = config_parse(path, load_config, info);
+       if (ret < 0)
+               _E("Failed to load %s, %d Use default value!",
+                               path, ret);
+
+       return ret;
+}
+
+void feedback_free_config(struct feedback_config_info *info)
+{
+       int i;
+
+       if (!info || !(info->data))
+               return;
+
+       if (!profile)
+               return;
+
+       for (i = 0; i < profile->max_pattern; i++) {
+               if (info->data[i].origin) {
+                       free(info->data[i].origin);
+                       info->data[i].origin = NULL;
+               }
+               if (info->data[i].changed) {
+                       free(info->data[i].changed);
+                       info->data[i].changed = NULL;
+               }
+       }
+
+       free(info->data);
+       info->data = NULL;
+}
+
diff --git a/src/parser.h b/src/parser.h
new file mode 100644 (file)
index 0000000..54bd8f0
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * libfeedback
+ * Copyright (c) 2015 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 __PARSER_H__
+#define __PARSER_H__
+
+struct feedback_data {
+       char *origin;
+       char *changed;
+};
+
+struct feedback_config_info {
+       char *name;
+       struct feedback_data *data;
+};
+
+int feedback_load_config(const char *path,
+               struct feedback_config_info *info);
+void feedback_free_config(struct feedback_config_info *info);
+
+#endif
+
diff --git a/src/profiles.c b/src/profiles.c
new file mode 100644 (file)
index 0000000..1f7f2f9
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * deviced
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <limits.h>
+
+#include "profiles.h"
+#include "log.h"
+
+static dd_list *profile_head;
+
+void add_profile(const struct profile_ops *ops)
+{
+       DD_LIST_APPEND(profile_head, (struct profile_ops*)ops);
+}
+
+void remove_profile(const struct profile_ops *ops)
+{
+       DD_LIST_REMOVE(profile_head, (struct profile_ops*)ops);
+}
diff --git a/src/profiles.h b/src/profiles.h
new file mode 100644 (file)
index 0000000..786b4c7
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * libfeedback
+
+ * Copyright (c) 2015 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 __PROFILES_H__
+#define __PROFILES_H__
+
+#include <stdbool.h>
+#include "common.h"
+
+struct profile_ops {
+       const char *profile;
+       void (*init) (void);
+       void (*exit) (void);
+       bool (*get_switched_pattern)(int pattern, int *switched);
+       bool (*get_always_alert_case)(int type, int pattern);
+       bool (*get_always_off_case)(int type, int pattern);
+       int (*get_strength_type)(int type, int pattern);
+       const int max_type;
+       const int max_pattern;
+       const char **str_type;
+       const char **str_pattern;
+};
+
+#define PROFILE_OPS_REGISTER(ops)      \
+       const struct profile_ops *profile = ops
+
+extern const struct profile_ops *profile;
+
+#define CHECK_VIBRATION(type)   (type == FEEDBACK_TYPE_VIBRATION)
+#define CHECK_SOUND(type)       (type == FEEDBACK_TYPE_SOUND)
+
+#endif
index 1325b70..327b6c4 100644 (file)
@@ -17,6 +17,7 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
 #include <unistd.h>
 #include <mm_sound_private.h>
 
 #include "feedback-ids.h"
-#include "common.h"
-#include "log.h"
+#include "profiles.h"
 #include "devices.h"
-#include "xmlparser.h"
+#include "log.h"
+#include "parser.h"
 
-#define SOUND_XML                                      "/usr/share/feedback/sound.xml"
+#define SOUND_CONF_FILE "/usr/share/feedback/sound.conf"
 
 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];
+static struct feedback_config_info sound_info = {
+       .name = "Sound",
+};
 
-inline int is_sound_mode(void)
+static char *get_data(feedback_pattern_e pattern)
 {
-       return sndstatus;
-}
+       char *data;
 
-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);
-}
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern)
+               return NULL;
 
-static void feedback_keytone_sndstatus_cb(keynode_t *key, void* data)
-{
-       keytone_sndstatus = vconf_keynode_get_bool(key);
-}
+       if (sound_info.data[pattern].changed)
+               data = sound_info.data[pattern].changed;
+       else
+               data = sound_info.data[pattern].origin;
 
-static void feedback_camerastatus_cb(keynode_t *key, void* data)
-{
-       camerastatus = vconf_keynode_get_int(key);
+       return data;
 }
 
-static volume_type_t get_volume_type(feedback_pattern_e pattern)
+inline int is_sound_mode(void)
 {
-       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;
+       return sndstatus;
 }
 
-static bool get_always_alert_case(feedback_pattern_e pattern)
+inline int is_touch_sndstatus(void)
 {
-       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;
+       return touch_sndstatus;
 }
 
-static bool get_always_off_case(feedback_pattern_e pattern)
+inline int is_keytone_sndstatus(void)
 {
-       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;
+       return keytone_sndstatus;
 }
 
-static int get_xml_data(xmlDocPtr doc, feedback_pattern_e pattern, struct xmlData **data)
+static void feedback_touch_sndstatus_cb(keynode_t *key, void* 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;
+       touch_sndstatus = vconf_keynode_get_bool(key);
 }
 
-static void release_xml_data(struct xmlData *data)
+static void feedback_keytone_sndstatus_cb(keynode_t *key, void* data)
 {
-       if (data == NULL)
-               return;
-
-       xml_free(data);
+       keytone_sndstatus = vconf_keynode_get_bool(key);
 }
 
 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;
-       }
+       /* get sound data */
+       feedback_load_config(SOUND_CONF_FILE, &sound_info);
 
        /* 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!!");
+       if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) < 0) {
+               _D("fail to get sound status, will work as turning off");
+               sndstatus = 0;
+       }
 
        /* 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;
-       }
+       /* free sound data */
+       feedback_free_config(&sound_info);
 }
 
 static int sound_play(feedback_pattern_e pattern)
@@ -221,116 +121,96 @@ 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;
-       }
+       int level;
 
        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)) {
+       if (sndstatus == 0 && profile->get_always_alert_case &&
+           !profile->get_always_alert_case(FEEDBACK_TYPE_SOUND, pattern)) {
                _D("Sound condition is OFF (sndstatus : %d)", sndstatus);
                return 0;
        }
 
-       if (sndstatus && get_always_off_case(pattern)) {
+       if (sndstatus && profile->get_always_off_case &&
+           profile->get_always_off_case(FEEDBACK_TYPE_SOUND, 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;
+       /* get sound file path */
+       path = get_data(pattern);
+       if (!path || stat(path, &buf)) {
+               _E("Not supported sound pattern");
+               return -ENOTSUP;
        }
 
-       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];
+       /* play sound file */
+       do {
+               if (profile->get_strength_type)
+                       level = profile->get_strength_type(FEEDBACK_TYPE_SOUND, pattern);
+               else
+                       level = VOLUME_TYPE_SYSTEM;
 
-       /* if not */
-       if (!(*path)) {
-               ret = get_xml_data(v_doc, pattern, &data);
-               if (ret == -ENOENT) {
-                       _D("No sound case(%s)", str_pattern[pattern]);
+               ret = mm_sound_play_keysound(path, level);
+               if (ret == MM_ERROR_NONE) {
+                       _D("Play success! SND filename is %s", path);
                        return 0;
                }
+               _E("mm_sound_play_keysound() returned error(%d)", ret);
+       } while (retry--);
 
-               if (ret < 0) {
-                       _E("get_xml_data fail");
-                       return -EPERM;
-               }
+       return -EPERM;
+}
 
-               if (!data->data) {
-                       _D("No sound case(%s)", str_pattern[pattern]);
-                       release_xml_data(data);
-                       return 0;
-               }
+static int sound_is_supported(feedback_pattern_e pattern, bool *supported)
+{
+       struct stat buf;
+       char *path;
+       bool ret = true;
 
-               path = data->data;
+       if (!supported) {
+               _E("Invalid parameter : supported(NULL)");
+               return -EINVAL;
        }
 
-       if (stat(path, &buf)) {
+       /* get sound file path */
+       path = get_data(pattern);
+       if (!path || stat(path, &buf)) {
                _E("%s is not presents", path);
-               release_xml_data(data);
-               return -ENOENT;
+               ret = false;
        }
 
-       /* 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;
+       *supported = ret;
+       return 0;
 }
 
 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;
-       }
-
+       /* get sound file path */
+       cur_path = get_data(pattern);
        if (!cur_path) {
-               _E("This pattern(%s) in sound type is not supported to play", str_pattern[pattern]);
+               _E("This pattern(%s) in sound type is not supported to play",
+                               profile->str_pattern[pattern]);
                cur_path = "NULL";
                ret = -ENOENT;
        }
 
        snprintf(buf, buflen, "%s", cur_path);
-       release_xml_data(data);
-       return 0;
+       return ret;
 }
 
 static int sound_set_path(feedback_pattern_e pattern, char *path)
 {
        struct stat buf;
-       char *ppath;
 
        /*
         * check the path is valid
@@ -341,23 +221,27 @@ static int sound_set_path(feedback_pattern_e pattern, char *path)
                return -errno;
        }
 
-       ppath = sound_file[pattern];
+       if (sound_info.data[pattern].changed) {
+               free(sound_info.data[pattern].changed);
+               sound_info.data[pattern].changed = NULL;
+       }
 
        /* if path is NULL, this pattern set to default file */
        if (path)
-               snprintf(ppath, NAME_MAX, "%s", path);
-       else
-               memset(ppath, 0, NAME_MAX);
+               sound_info.data[pattern].changed = strdup(path);
 
-       _D("The file of pattern(%s) is changed to [%s]", str_pattern[pattern], path);
+       _D("The file of pattern(%s) is changed to [%s]",
+                       profile->str_pattern[pattern], path);
        return 0;
 }
 
 static const struct device_ops sound_device_ops = {
        .type = FEEDBACK_TYPE_SOUND,
+       .name = "Sound",
        .init = sound_init,
        .exit = sound_exit,
        .play = sound_play,
+       .is_supported = sound_is_supported,
        .get_path = sound_get_path,
        .set_path = sound_set_path,
 };
diff --git a/src/str.c b/src/str.c
deleted file mode 100644 (file)
index 13c2b53..0000000
--- a/src/str.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * libfeedback
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-
-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",
-};
index 90464b3..5632ad7 100644 (file)
@@ -17,6 +17,7 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/stat.h>
 
 #include "feedback-ids.h"
-#include "common.h"
-#include "log.h"
+#include "profiles.h"
+#include "parser.h"
 #include "devices.h"
-#include "xmlparser.h"
+#include "log.h"
 #include "dbus.h"
-
-#define DEFAULT_VIB_LEVEL                      3
-#define HAPTIC_FEEDBACK_STEP           20 /**< feedback max / slider step */
+#ifdef MOBILE
+#include "feedback-ids-mobile.h"
+#endif
+#ifdef WEARABLE
+#include "feedback-ids-wearable.h"
+#endif
 
 #define HAPTIC_DEVICE                          0
 
-enum haptic_priority
-{
+enum haptic_priority {
        HAPTIC_PRIORITY_MIN = 0,
        HAPTIC_PRIORITY_MIDDLE,
        HAPTIC_PRIORITY_HIGH,
 };
 
-enum haptic_iteration
-{
+enum haptic_iteration {
        HAPTIC_ITERATION_ONCE = 1,
        HAPTIC_ITERATION_INFINITE = 256,
 };
 
-#define VIBRATION_XML                          "/usr/share/feedback/vibration.xml"
+#define VIBRATION_CONF_FILE         "/usr/share/feedback/vibration.conf"
 
-#define METHOD_OPEN                                    "OpenDevice"
-#define METHOD_CLOSE                           "CloseDevice"
-#define METHOD_VIBRATE_BUFFER          "VibrateBuffer"
-#define METHOD_STOP                                    "StopDevice"
+#define METHOD_OPEN                 "OpenDevice"
+#define METHOD_CLOSE                "CloseDevice"
+#define METHOD_VIBRATE_MONOTONE     "VibrateMonotone"
+#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;
+#define DEFAULT_DURATION            100
+#define SIP_DURATION                60
 
+static int vibstatus;
 static unsigned int v_handle;
-static xmlDocPtr v_doc;
+static struct feedback_config_info vib_info = {
+       .name = "Vibration",
+};
+
+static char *get_data(feedback_pattern_e pattern)
+{
+       char *data;
+
+       if (pattern <= FEEDBACK_PATTERN_NONE ||
+           pattern >= profile->max_pattern)
+               return NULL;
+
+       if (vib_info.data[pattern].changed)
+               data = vib_info.data[pattern].changed;
+       else
+               data = vib_info.data[pattern].origin;
+
+       return data;
+}
 
-static char haptic_file[FEEDBACK_PATTERN_END][NAME_MAX];
+inline int is_vibration_mode(void)
+{
+       return vibstatus;
+}
 
 static int haptic_open(void)
 {
@@ -112,7 +134,7 @@ static int haptic_vibrate_buffer(unsigned int handle,
        arr[0] = buf_handle;
        bytes.size = size;
        bytes.data = buffer;
-       arr[2] = (char*)&bytes;
+       arr[2] = (char *)&bytes;
        snprintf(buf_iteration, sizeof(buf_iteration), "%d", iteration);
        arr[3] = buf_iteration;
        snprintf(buf_feedback, sizeof(buf_feedback), "%d", feedback);
@@ -125,6 +147,31 @@ static int haptic_vibrate_buffer(unsigned int handle,
                        "uayiii", arr);
 }
 
+static int haptic_vibrate_monotone(unsigned int handle,
+                                                               int duration,
+                                                               int feedback,
+                                                               int priority)
+{
+       char *arr[4];
+       char buf_handle[32];
+       char buf_duration[32];
+       char buf_feedback[32];
+       char buf_priority[32];
+
+       snprintf(buf_handle, sizeof(buf_handle), "%u", handle);
+       arr[0] = buf_handle;
+       snprintf(buf_duration, sizeof(buf_duration), "%d", duration);
+       arr[1] = buf_duration;
+       snprintf(buf_feedback, sizeof(buf_feedback), "%d", feedback);
+       arr[2] = buf_feedback;
+       snprintf(buf_priority, sizeof(buf_priority), "%d", priority);
+       arr[3] = buf_priority;
+
+       return dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_HAPTIC,
+                       DEVICED_INTERFACE_HAPTIC, METHOD_VIBRATE_MONOTONE,
+                       "uiii", arr);
+}
+
 static int haptic_vibrate_stop(unsigned int handle)
 {
        char *arr[1];
@@ -138,7 +185,7 @@ static int haptic_vibrate_stop(unsigned int handle)
                        "u", arr);
 }
 
-static unsigned charconvert_file_to_buffer(const char *file_name, int *size)
+static unsigned char *convert_file_to_buffer(const char *file_name, int *size)
 {
        FILE *pf;
        long file_size;
@@ -150,7 +197,7 @@ static unsigned char* convert_file_to_buffer(const char *file_name, int *size)
        /* Get File Stream Pointer */
        pf = fopen(file_name, "rb");
        if (!pf) {
-               _E("fopen failed : %d", errno);
+               _E("fopen failed : %s", strerror(errno));
                return NULL;
        }
 
@@ -164,7 +211,7 @@ static unsigned char* convert_file_to_buffer(const char *file_name, int *size)
        if (file_size < 0)
                goto error;
 
-       pdata = (unsigned char*)malloc(file_size);
+       pdata = (unsigned char *)malloc(file_size);
        if (!pdata)
                goto error;
 
@@ -181,30 +228,10 @@ err_free:
 error:
        fclose(pf);
 
-       _E("failed to convert file to buffer (%d)", errno);
+       _E("failed to convert file to buffer (%s)", strerror(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)
@@ -213,271 +240,130 @@ static int get_priority(feedback_pattern_e pattern)
        return HAPTIC_PRIORITY_MIDDLE;
 }
 
-static int get_haptic_level(feedback_pattern_e pattern)
+static int get_duration(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);
+       if (pattern == FEEDBACK_PATTERN_SIP)
+               return SIP_DURATION;
+#ifdef MOBILE
+       if (pattern == (feedback_pattern_e)FEEDBACK_PATTERN_MOBILE_SIP_BACKSPACE)
+               return SIP_DURATION;
+#endif
+#ifdef WEARABLE
+       if (pattern == (feedback_pattern_e)FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE)
+               return SIP_DURATION;
+#endif
+       return DEFAULT_DURATION;
 }
 
 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;
+               v_handle = -ENOTSUP;
                return;
        }
 
        /* Set vibration handle */
        v_handle = (unsigned int)ret;
 
-       /* check vibration status */
-       if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, &noti_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, &noti_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);
+       /* get vibration data */
+       feedback_load_config(VIBRATION_CONF_FILE, &vib_info);
 }
 
 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) {
+       if (v_handle > 0) {
                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;
-       }
+       /* free vibration data */
+       feedback_free_config(&vib_info);
 }
 
 static int vibrator_play(feedback_pattern_e pattern)
 {
-       int ret, size;
-       struct xmlData *data;
-       char *path;
-       unsigned char *buf;
+       struct stat buf;
+       char *data;
+       unsigned char *pbuf;
+       int size;
+       int ret;
+       int level;
+       int duration;
 
-       if (!v_handle || !v_doc) {
+       if (!v_handle) {
                _E("Not initialize");
                return -EPERM;
        }
 
+       if (v_handle == -ENOTSUP) {
+               _E("Not supported vibration");
+               return -ENOTSUP;
+       }
+
        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))  {
+       if (vibstatus == 0 && profile->get_always_alert_case &&
+           !profile->get_always_alert_case(FEEDBACK_TYPE_VIBRATION, pattern))  {
                _D("Vibration condition is OFF (vibstatus : %d)", vibstatus);
                return 0;
        }
 
-       if (vibstatus && get_always_off_case(pattern)) {
+       if (vibstatus && profile->get_always_off_case &&
+           profile->get_always_off_case(FEEDBACK_TYPE_VIBRATION, 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;
-       }
+       if (profile->get_strength_type)
+               level = profile->get_strength_type(FEEDBACK_TYPE_VIBRATION, pattern);
+       else
+               level = DEFAULT_VIB_LEVEL * HAPTIC_FEEDBACK_STEP;
 
-       ret = get_xml_data(v_doc, pattern, &data);
-       if (ret == -ENOENT) {
-               _D("No vibration case(%s)", str_pattern[pattern]);
-               return 0;
+       /* get vibration data */
+       data = get_data(pattern);
+       if (!data) {
+               _E("Not supported vibration pattern");
+               return -ENOTSUP;
        }
 
-       if (ret < 0) {
-               _E("get_xml_data fail");
-               return -EPERM;
-       }
+       /* if it has a file path */
+       if (!stat(data, &buf)) {
+               pbuf = convert_file_to_buffer(data, &size);
+               if (!pbuf) {
+                       _E("fail to convert file to buffer");
+                       return -EPERM;
+               }
 
-       if (data->data == NULL) {
-               _D("No vibration case(%s)", str_pattern[pattern]);
-               release_xml_data(data);
-               return 0;
+               ret = haptic_vibrate_buffer(v_handle, pbuf, size,
+                               HAPTIC_ITERATION_ONCE,
+                               level, get_priority(pattern));
+               free(pbuf);
+       } else {
+               duration = get_duration(pattern);
+               ret = haptic_vibrate_monotone(v_handle, duration,
+                               level, get_priority(pattern));
        }
 
-       /* 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);
+               _E("fail to play vibration");
+               if (ret == -ECOMM)
+                       return ret;
                return -EPERM;
        }
 
-       release_xml_data(data);
+       _D("Play success! Data is %s", data);
        return 0;
 }
 
@@ -485,70 +371,124 @@ static int vibrator_stop(void)
 {
        int ret;
 
-       if (!v_handle || !v_doc) {
+       if (!v_handle) {
                _E("Not initialize");
                return -EPERM;
        }
 
+       if (v_handle == -ENOTSUP) {
+               _E("Not supported vibration");
+               return -ENOTSUP;
+       }
+
        /* stop haptic device */
        ret = haptic_vibrate_stop(v_handle);
        if (ret < 0) {
                _E("haptic_vibrate_stop is failed");
+               if (ret == -ECOMM)
+                       return ret;
                return -EPERM;
        }
 
        return 0;
 }
 
-static int vibrator_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen)
+static int vibrator_is_supported(int pattern, bool *supported)
 {
-       const char *cur_path;
+       char *data;
+       bool ret = true;
 
-       assert(buf != NULL && buflen > 0);
+       if (!supported) {
+               _E("Invalid parameter : supported(NULL)");
+               return -EINVAL;
+       }
 
-       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;
+       if (!v_handle) {
+               _E("Not initialize");
+               return -EPERM;
        }
 
-       snprintf(buf, buflen, "%s", cur_path);
+       if (v_handle == -ENOTSUP) {
+               _E("Not supported vibration");
+               *supported = false;
+               return 0;
+       }
+
+       /* get vibration data */
+       data = get_data(pattern);
+       if (!data) {
+               _E("Not supported vibration pattern");
+               ret = false;
+       }
+
+       *supported = ret;
        return 0;
 }
 
+static int vibrator_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen)
+{
+       char *data;
+       int ret = 0;
+
+       if (!buf || buflen <= 0)
+               return -EINVAL;
+
+       /* get vibration data */
+       data = get_data(pattern);
+       if (!data) {
+               _E("This pattern(%s) in vibrator type is not supported to play",
+                               profile->str_pattern[pattern]);
+               data = "NULL";
+               ret = -ENOENT;
+       }
+
+       snprintf(buf, buflen, "%s", data);
+       return ret;
+}
+
 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 is null, reset vibration path
         */
+       if (!path) {
+               if (vib_info.data[pattern].changed) {
+                       free(vib_info.data[pattern].changed);
+                       vib_info.data[pattern].changed = NULL;
+               }
+               return 0;
+       }
+
        if (path && stat(path, &buf)) {
                _E("%s is not presents", path);
                return -errno;
        }
 
-       ppath = haptic_file[pattern];
+       if (vib_info.data[pattern].changed) {
+               free(vib_info.data[pattern].changed);
+               vib_info.data[pattern].changed = NULL;
+       }
 
        /* if path is NULL, this pattern set to default file */
        if (path)
-               snprintf(ppath, NAME_MAX, "%s", path);
-       else
-               memset(ppath, 0, NAME_MAX);
+               vib_info.data[pattern].changed = strdup(path);
 
-       _D("The file of pattern(%s) is changed to [%s]", str_pattern[pattern], path);
+       _D("The file of pattern(%s) is changed to [%s]",
+                       profile->str_pattern[pattern], path);
        return 0;
 }
 
 static const struct device_ops vibrator_device_ops = {
        .type = FEEDBACK_TYPE_VIBRATION,
+       .name = "Vibrator",
        .init = vibrator_init,
        .exit = vibrator_exit,
        .play = vibrator_play,
        .stop = vibrator_stop,
+       .is_supported = vibrator_is_supported,
        .get_path = vibrator_get_path,
        .set_path = vibrator_set_path,
 };
diff --git a/src/xmlparser.c b/src/xmlparser.c
deleted file mode 100644 (file)
index 7b1a850..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * libfeedback
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <assert.h>
-#include <errno.h>
-#include <glib.h>
-
-#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);
-}
index 2b4d59e..38d2754 100644 (file)
@@ -13,8 +13,7 @@ int main(int argc, char* argv[])
                return -1;
        }
 
-       while(1)
-       {
+       while (1) {
                val = feedback_play(++i);
                printf("[%2d] result : %d\n", i, val);
                if (val < 0) break;
index d864d37..fd4d619 100644 (file)
@@ -24,7 +24,7 @@ static void play(void)
 {
        int a, b, val;
 
-       while(1) {
+       while (1) {
                print_play_menu();
                printf("Please enter the play menu : ");
                scanf("%d", &a);
@@ -56,26 +56,25 @@ int main(int argc, char* argv[])
                return -1;
        }
 
-       while(1)
-       {
+       while (1) {
                print_menu();
                printf("Please input value : ");
                scanf("%d", &a);
 
-               switch(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);
+                       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);
+                       val = feedback_set_resource_path((a == 0) ? FEEDBACK_TYPE_SOUND : FEEDBACK_TYPE_VIBRATION, b, NULL);
                        printf("ret value : %d\n", val);
                        break;
                default:
index 57e4edd..aa80fb7 100644 (file)
@@ -36,8 +36,7 @@ int main(int argc, char* argv[])
                return -1;
        }
 
-       while(1)
-       {
+       while (1) {
                printf("Which do you want to work play(0) or change the path(1)?");
                scanf("%d", &a);
                if (a == 0) {
@@ -46,15 +45,15 @@ int main(int argc, char* argv[])
                        if (a == -1)
                                break;
                        val = feedback_play(a);
-                       printf("ret value : %d\n", val);        
+                       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);
+                       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);
+                       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 {
diff --git a/wearable/data/sound.conf b/wearable/data/sound.conf
new file mode 100644 (file)
index 0000000..f5c9f97
--- /dev/null
@@ -0,0 +1,45 @@
+[Sound]
+FEEDBACK_PATTERN_TAP=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_SIP=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY0=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY1=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY2=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY3=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY4=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY5=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY6=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY7=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY8=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY9=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY_STAR=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY_SHARP=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_KEY_BACK=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_POWERON=/usr/share/feedback/sound/operation/power_on.ogg
+FEEDBACK_PATTERN_CHARGERCONN=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_CHARGING_ERROR=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_LOWBATT=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_SILENT_OFF=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_BT_CONNECTED=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_BT_DISCONNECTED=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_VOLUME_KEY=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_WEARABLE_SIP_FUNCTION=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_WEARABLE_SIP_FJKEY=/usr/share/feedback/sound/touch/touch.ogg
+FEEDBACK_PATTERN_WEARABLE_WAKEUP_ON_CALL=/usr/share/feedback/sound/operation/notification.ogg
+FEEDBACK_PATTERN_WEARABLE_SCHEDULE_ON_CALL=/usr/share/feedback/sound/operation/notification.ogg
+FEEDBACK_PATTERN_WEARABLE_TIMER_ON_CALL=/usr/share/feedback/sound/operation/notification.ogg
+FEEDBACK_PATTERN_WEARABLE_SAFETY_ALERT=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_CALLCONNECT=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_DISCALLCONNECT=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_BT_PAIRING=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_BT_WAITING=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_SCREEN_CAPTURE=/usr/share/feedback/sound/operation/shutter.ogg
+FEEDBACK_PATTERN_WEARABLE_SAFETY_LOW_POWER=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_CMAS=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_GOAL_ACHIEVED=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_MEASURING_SUCCESS=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_MEASURING_FAILURE=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_UV_PROCESSING=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_SHEALTH_START=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_SHEALTH_PAUSE=/usr/share/feedback/sound/operation/system.ogg
+FEEDBACK_PATTERN_WEARABLE_SHEALTH_STOP=/usr/share/feedback/sound/operation/system.ogg
diff --git a/wearable/data/vibration.conf b/wearable/data/vibration.conf
new file mode 100644 (file)
index 0000000..f3ee32c
--- /dev/null
@@ -0,0 +1,39 @@
+[Vibration]
+FEEDBACK_PATTERN_TAP=mono
+FEEDBACK_PATTERN_SIP=mono
+FEEDBACK_PATTERN_HOLD=mono
+FEEDBACK_PATTERN_MESSAGE=mono
+FEEDBACK_PATTERN_EMAIL=mono
+FEEDBACK_PATTERN_WAKEUP=mono
+FEEDBACK_PATTERN_SCHEDULE=mono
+FEEDBACK_PATTERN_TIMER=mono
+FEEDBACK_PATTERN_GENERAL=mono
+FEEDBACK_PATTERN_CHARGERCONN=mono
+FEEDBACK_PATTERN_LOWBATT=mono
+FEEDBACK_PATTERN_VIBRATION_ON=mono
+FEEDBACK_PATTERN_BT_CONNECTED=mono
+FEEDBACK_PATTERN_BT_DISCONNECTED=mono
+FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE=mono
+FEEDBACK_PATTERN_WEARABLE_SIP_FUNCTION=mono
+FEEDBACK_PATTERN_WEARABLE_SIP_FJKEY=mono
+FEEDBACK_PATTERN_WEARABLE_CHARGERCONN_ON_CALL=mono
+FEEDBACK_PATTERN_WEARABLE_LOWBATT_ON_CALL=mono
+FEEDBACK_PATTERN_WEARABLE_CALLCONNECT=mono
+FEEDBACK_PATTERN_WEARABLE_DISCALLCONNECT=mono
+FEEDBACK_PATTERN_WEARABLE_BT_PAIRING=mono
+FEEDBACK_PATTERN_WEARABLE_BT_WAITING=mono
+FEEDBACK_PATTERN_WEARABLE_SAFETY_ALERT=mono
+FEEDBACK_PATTERN_WEARABLE_SEND_SOS_MESSAGE=mono
+FEEDBACK_PATTERN_WEARABLE_END_SOS_MESSAGE=mono
+FEEDBACK_PATTERN_WEARABLE_CMAS=mono
+FEEDBACK_PATTERN_WEARABLE_SPEED_UP=mono
+FEEDBACK_PATTERN_WEARABLE_SLOW_DOWN=mono
+FEEDBACK_PATTERN_WEARABLE_KEEP_THIS_PACE=mono
+FEEDBACK_PATTERN_WEARABLE_GOAL_ACHIEVED=mono
+FEEDBACK_PATTERN_WEARABLE_START_CUE=mono
+FEEDBACK_PATTERN_WEARABLE_HEALTH_PACE=mono
+FEEDBACK_PATTERN_WEARABLE_INACTIVE_TIME=mono
+FEEDBACK_PATTERN_WEARABLE_MEASURING_SUCCESS=mono
+FEEDBACK_PATTERN_WEARABLE_MEASURING_FAILURE=mono
+FEEDBACK_PATTERN_WEARABLE_3RD_APPLICATION=mono
+
diff --git a/wearable/include/feedback-ids-wearable.h b/wearable/include/feedback-ids-wearable.h
new file mode 100644 (file)
index 0000000..2b66be4
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * 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_WEARABLE_H__
+#define __FEEDBACK_IDS_WEARABLE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file feedback-ids-mobile.h
+ * @brief This file contains the feedback API
+ */
+
+/**
+ * @addtogroup CAPI_FEEDBACK_MODULE
+ * @{
+ */
+
+/**
+ * @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_WEARABLE_NONE = -1,
+
+       FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE = 2, /**< feedback pattern when touch backspace key */
+       FEEDBACK_PATTERN_WEARABLE_SIP_FUNCTION = 3,                     /**< feedback pattern when touch function key */
+       FEEDBACK_PATTERN_WEARABLE_SIP_FJKEY = 4,                        /**< feedback pattern when touch F,J key */
+       FEEDBACK_PATTERN_WEARABLE_MAX_CHARACTER = 5,                    /**< feedback pattern when max character */
+
+       FEEDBACK_PATTERN_WEARABLE_MESSAGE_ON_CALL = 24,                 /**< feedback pattern when incoming a message on call */
+       FEEDBACK_PATTERN_WEARABLE_EMAIL_ON_CALL = 26,                   /**< feedback pattern when incoming an email on call */
+       FEEDBACK_PATTERN_WEARABLE_WAKEUP_ON_CALL = 28,                  /**< feedback pattern when alert wake up call on call */
+       FEEDBACK_PATTERN_WEARABLE_SCHEDULE_ON_CALL = 30,                /**< feedback pattern when alert schedule alarm on call */
+       FEEDBACK_PATTERN_WEARABLE_TIMER_ON_CALL = 32,                   /**< feedback pattern when alert timer on call */
+       FEEDBACK_PATTERN_WEARABLE_GENERAL_ON_CALL = 34,                 /**< feedback pattern when alert general event on call */
+       FEEDBACK_PATTERN_WEARABLE_SMART_ALERT = 35,                     /**< feedback pattern when alert noti on motion */
+
+       FEEDBACK_PATTERN_WEARABLE_CHARGERCONN_ON_CALL = 39,     /**< feedback pattern when connecting charger on call */
+       FEEDBACK_PATTERN_WEARABLE_CHARGING_ERROR_ON_CALL = 41,/**< feedback pattern when occuring charging error on call */
+       FEEDBACK_PATTERN_WEARABLE_FULLCHARGED_ON_CALL = 43,     /**< feedback pattern when full charged on call */
+       FEEDBACK_PATTERN_WEARABLE_LOWBATT_ON_CALL = 45,         /**< feedback pattern when low battery on call */
+       FEEDBACK_PATTERN_WEARABLE_CALLCONNECT = 51,             /**< feedback pattern when connecting call */
+       FEEDBACK_PATTERN_WEARABLE_DISCALLCONNECT = 52,          /**< feedback pattern when disconnecting call */
+       FEEDBACK_PATTERN_WEARABLE_OUTGOING_CALL = 53,           /**< feedback pattern when connected outgoing call */
+       FEEDBACK_PATTERN_WEARABLE_MINUTEMINDER = 54,            /**< feedback pattern when minute minder */
+       FEEDBACK_PATTERN_WEARABLE_BT_PAIRING = 59,              /**< feedback pattern when starting pare with bluetooth */
+       FEEDBACK_PATTERN_WEARABLE_BT_WAITING = 60,              /**< feedback pattern when pairing bluetooth */
+       FEEDBACK_PATTERN_WEARABLE_SCREEN_CAPTURE = 61,          /**< feedback pattern when screen capture */
+       FEEDBACK_PATTERN_WEARABLE_MMS = 65,                     /**< feedback pattern when message state changed to MMS */
+       FEEDBACK_PATTERN_WEARABLE_HOURLY_ALERT,         /**< feedback pattern when alert every hour on the hour */
+
+       FEEDBACK_PATTERN_WEARABLE_SAFETY_ALERT,         /**< feedback pattern when safety alert from phone */
+       FEEDBACK_PATTERN_WEARABLE_ACCIDENT_DETECT,      /**< feedback pattern when accident detect */
+       FEEDBACK_PATTERN_WEARABLE_SEND_SOS_MESSAGE,     /**< feedback pattern when sending SOS message */
+       FEEDBACK_PATTERN_WEARABLE_END_SOS_MESSAGE,      /**< feedback pattern when finishing SOS message */
+       FEEDBACK_PATTERN_WEARABLE_EMERGENCY_BUZZER,     /**< feedback pattern when occurs emergency buzzer */
+       FEEDBACK_PATTERN_WEARABLE_SAFETY_LOW_POWER,     /**< this pattern is a low power ringtone */
+       FEEDBACK_PATTERN_WEARABLE_CMAS,                 /**< feedback pattern when alerting commercial mobile */
+       FEEDBACK_PATTERN_WEARABLE_SPEED_UP,             /**< feedback pattern when advising user to speed up */
+       FEEDBACK_PATTERN_WEARABLE_SLOW_DOWN,            /**< feedback pattern when advising user to slow down */
+       FEEDBACK_PATTERN_WEARABLE_KEEP_THIS_PACE,       /**< feedback pattern when advising user to keep this pace */
+       FEEDBACK_PATTERN_WEARABLE_GOAL_ACHIEVED,        /**< feedback pattern when alerting goal achieved */
+       FEEDBACK_PATTERN_WEARABLE_EXERCISE_COUNT,       /**< feedback pattern when changing count number */
+       FEEDBACK_PATTERN_WEARABLE_START_CUE,            /**< feedback pattern when starting cue */
+       FEEDBACK_PATTERN_WEARABLE_HEALTH_PACE,          /**< feedback pattern when alerting health pace */
+       FEEDBACK_PATTERN_WEARABLE_INACTIVE_TIME,        /**< feedback pattern when alerting inactive time */
+       FEEDBACK_PATTERN_WEARABLE_MEASURING_SUCCESS,    /**< feedback pattern when measuring is succeeded */
+       FEEDBACK_PATTERN_WEARABLE_MEASURING_FAILURE,    /**< feedback pattern when measuring is failed */
+       FEEDBACK_PATTERN_WEARABLE_UV_PROCESSING,        /**< feedback pattern when UV is processing */
+       FEEDBACK_PATTERN_WEARABLE_SHEALTH_START,        /**< feedback pattern when starting s-health */
+       FEEDBACK_PATTERN_WEARABLE_SHEALTH_PAUSE,        /**< feedback pattern when pausing s-health */
+       FEEDBACK_PATTERN_WEARABLE_SHEALTH_STOP,         /**< feedback pattern when stoping s-health */
+       FEEDBACK_PATTERN_WEARABLE_3RD_APPLICATION,      /**< feedback pattern when alert 3rd event */
+
+       FEEDBACK_PATTERN_WEARABLE_END,
+
+} feedback_pattern_wearable_e;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__FEEDBACK_IDS_WEARABLE_H__
diff --git a/wearable/src/check.c b/wearable/src/check.c
new file mode 100644 (file)
index 0000000..b0937e1
--- /dev/null
@@ -0,0 +1,395 @@
+/*
+ * libfeedback
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <vconf.h>
+
+#include "feedback.h"
+#include "feedback-ids-wearable.h"
+#include "profiles.h"
+#include "log.h"
+
+
+static const char *wearable_str_type[] = {
+       "FEEDBACK_TYPE_NONE",
+       "FEEDBACK_TYPE_SOUND",
+       "FEEDBACK_TYPE_VIBRATION",
+};
+
+static const char *wearable_str_pattern[] = {
+       "FEEDBACK_PATTERN_TAP",
+       "FEEDBACK_PATTERN_SIP",
+       "FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE",
+       "FEEDBACK_PATTERN_WEARABLE_SIP_FUNCTION",
+       "FEEDBACK_PATTERN_WEARABLE_SIP_FJKEY",
+       "FEEDBACK_PATTERN_WEARABLE_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_HW_TAP",
+       "FEEDBACK_PATTERN_HW_HOLD",
+
+       "FEEDBACK_PATTERN_MESSAGE",
+       "FEEDBACK_PATTERN_WEARABLE_MESSAGE_ON_CALL",
+       "FEEDBACK_PATTERN_EMAIL",
+       "FEEDBACK_PATTERN_WEARABLE_EMAIL_ON_CALL",
+       "FEEDBACK_PATTERN_WAKEUP",
+       "FEEDBACK_PATTERN_WEARABLE_WAKEUP_ON_CALL",
+       "FEEDBACK_PATTERN_SCHEDULE",
+       "FEEDBACK_PATTERN_WEARABLE_SCHEDULE_ON_CALL",
+       "FEEDBACK_PATTERN_TIMER",
+       "FEEDBACK_PATTERN_WEARABLE_TIMER_ON_CALL",
+       "FEEDBACK_PATTERN_GENERAL",
+       "FEEDBACK_PATTERN_WEARABLE_GENERAL_ON_CALL",
+       "FEEDBACK_PATTERN_WEARABLE_SMART_ALERT",
+
+       "FEEDBACK_PATTERN_POWERON",
+       "FEEDBACK_PATTERN_POWEROFF",
+       "FEEDBACK_PATTERN_CHARGERCONN",
+       "FEEDBACK_PATTERN_WEARABLE_CHARGERCONN_ON_CALL",
+       "FEEDBACK_PATTERN_CHARGING_ERROR",
+       "FEEDBACK_PATTERN_WEARABLE_CHARGING_ERROR_ON_CALL",
+       "FEEDBACK_PATTERN_FULLCHARGED",
+       "FEEDBACK_PATTERN_WEARABLE_FULLCHARGED_ON_CALL",
+       "FEEDBACK_PATTERN_LOWBATT",
+       "FEEDBACK_PATTERN_WEARABLE_LOWBATT_ON_CALL",
+       "FEEDBACK_PATTERN_LOCK",
+       "FEEDBACK_PATTERN_UNLOCK",
+       "",
+       "",
+       "",
+       "FEEDBACK_PATTERN_WEARABLE_CALLCONNECT",
+       "FEEDBACK_PATTERN_WEARABLE_DISCALLCONNECT",
+       "FEEDBACK_PATTERN_WEARABLE_OUTGOING_CALL",
+       "FEEDBACK_PATTERN_WEARABLE_MINUTEMINDER",
+       "FEEDBACK_PATTERN_VIBRATION_ON",
+       "FEEDBACK_PATTERN_SILENT_OFF",
+       "FEEDBACK_PATTERN_BT_CONNECTED",
+       "FEEDBACK_PATTERN_BT_DISCONNECTED",
+       "FEEDBACK_PATTERN_WEARABLE_BT_PAIRING",
+       "FEEDBACK_PATTERN_WEARABLE_BT_WAITING",
+       "FEEDBACK_PATTERN_WEARABLE_SCREEN_CAPTURE",
+       "FEEDBACK_PATTERN_LIST_REORDER",
+       "FEEDBACK_PATTERN_LIST_SLIDER",
+       "FEEDBACK_PATTERN_VOLUME_KEY",
+       "FEEDBACK_PATTERN_WEARABLE_MMS",
+       "FEEDBACK_PATTERN_WEARABLE_HOURLY_ALERT",
+
+       "FEEDBACK_PATTERN_WEARABLE_SAFETY_ALERT",
+       "FEEDBACK_PATTERN_WEARABLE_ACCIDENT_DETECT",
+       "FEEDBACK_PATTERN_WEARABLE_SEND_SOS_MESSAGE",
+       "FEEDBACK_PATTERN_WEARABLE_END_SOS_MESSAGE",
+       "FEEDBACK_PATTERN_WEARABLE_EMERGENCY_BUZZER",
+       "FEEDBACK_PATTERN_WEARABLE_SAFETY_LOW_POWER",
+       "FEEDBACK_PATTERN_WEARABLE_CMAS",
+       "FEEDBACK_PATTERN_WEARABLE_SPEED_UP",
+       "FEEDBACK_PATTERN_WEARABLE_SLOW_DOWN",
+       "FEEDBACK_PATTERN_WEARABLE_KEEP_THIS_PACE",
+       "FEEDBACK_PATTERN_WEARABLE_GOAL_ACHIEVED",
+       "FEEDBACK_PATTERN_WEARABLE_EXERCISE_COUNT",
+       "FEEDBACK_PATTERN_WEARABLE_START_CUE",
+       "FEEDBACK_PATTERN_WEARABLE_HEALTH_PACE",
+       "FEEDBACK_PATTERN_WEARABLE_INACTIVE_TIME",
+       "FEEDBACK_PATTERN_WEARABLE_MEASURING_SUCCESS",
+       "FEEDBACK_PATTERN_WEARABLE_MEASURING_FAILURE",
+       "FEEDBACK_PATTERN_WEARABLE_UV_PROCESSING",
+       "FEEDBACK_PATTERN_WEARABLE_SHEALTH_START",
+       "FEEDBACK_PATTERN_WEARABLE_SHEALTH_PAUSE",
+       "FEEDBACK_PATTERN_WEARABLE_SHEALTH_STOP",
+       "FEEDBACK_PATTERN_WEARABLE_3RD_APPLICATION",
+};
+
+static int callstatus;
+static int camerastatus;
+static int shutter_sndstatus;
+static int noti_vibstatus;
+static int vib_level;
+static int noti_level;
+static int feedbackstatus;
+
+static void feedback_callstatus_cb(keynode_t *key, void* data)
+{
+       callstatus = vconf_keynode_get_int(key);
+}
+
+static void feedback_camerastatus_cb(keynode_t *key, void* data)
+{
+       camerastatus = vconf_keynode_get_int(key);
+}
+
+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 void wearable_init(void)
+{
+       /* check call status */
+       if (vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) < 0)
+               _W("VCONFKEY_CALL_STATE ==> 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!!");
+
+       /* check vibration status */
+       if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, &noti_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, &noti_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_CALL_STATE, feedback_callstatus_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_CAMERA_STATE, feedback_camerastatus_cb, NULL);
+       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 wearable_exit(void)
+{
+       /* remove watch */
+       vconf_ignore_key_changed(VCONFKEY_CALL_STATE, feedback_callstatus_cb);
+       vconf_ignore_key_changed(VCONFKEY_CAMERA_STATE, feedback_camerastatus_cb);
+       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);
+}
+
+static bool wearable_get_switched_pattern(int pattern, int *switched)
+{
+       if (!switched)
+               return false;
+
+       if (callstatus == VCONFKEY_CALL_OFF)
+               return false;
+
+       /* in case of call connected or connecting */
+       _D("Call status is connected or connecting.");
+       if (pattern == FEEDBACK_PATTERN_MESSAGE)
+               *switched = FEEDBACK_PATTERN_WEARABLE_MESSAGE_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_EMAIL)
+               *switched = FEEDBACK_PATTERN_WEARABLE_EMAIL_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_WAKEUP)
+               *switched = FEEDBACK_PATTERN_WEARABLE_WAKEUP_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_SCHEDULE)
+               *switched = FEEDBACK_PATTERN_WEARABLE_SCHEDULE_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_TIMER)
+               *switched = FEEDBACK_PATTERN_WEARABLE_TIMER_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_GENERAL)
+               *switched = FEEDBACK_PATTERN_WEARABLE_GENERAL_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_CHARGERCONN)
+               *switched = FEEDBACK_PATTERN_WEARABLE_CHARGERCONN_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_CHARGING_ERROR)
+               *switched = FEEDBACK_PATTERN_WEARABLE_CHARGING_ERROR_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_FULLCHARGED)
+               *switched = FEEDBACK_PATTERN_WEARABLE_FULLCHARGED_ON_CALL;
+       else if (pattern == FEEDBACK_PATTERN_LOWBATT)
+               *switched = FEEDBACK_PATTERN_WEARABLE_LOWBATT_ON_CALL;
+       else
+               return false;
+
+       return true;
+}
+
+static bool wearable_get_always_alert_case(int type, int pattern)
+{
+       switch (pattern) {
+       case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+       case FEEDBACK_PATTERN_HOLD:
+               if (CHECK_VIBRATION(type) && feedbackstatus)
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_SIP:
+       case FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE:
+       case FEEDBACK_PATTERN_WEARABLE_SIP_FUNCTION:
+       case FEEDBACK_PATTERN_WEARABLE_SIP_FJKEY:
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_MESSAGE:
+       case FEEDBACK_PATTERN_EMAIL:
+               if (CHECK_VIBRATION(type) && noti_vibstatus)
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_TIMER:
+       case FEEDBACK_PATTERN_WEARABLE_TIMER_ON_CALL:
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_WAKEUP:
+       case FEEDBACK_PATTERN_WEARABLE_WAKEUP_ON_CALL:
+               return true;
+       case FEEDBACK_PATTERN_WEARABLE_MESSAGE_ON_CALL:
+       case FEEDBACK_PATTERN_WEARABLE_EMAIL_ON_CALL:
+       case FEEDBACK_PATTERN_WEARABLE_GENERAL_ON_CALL:
+               break;
+       case FEEDBACK_PATTERN_WEARABLE_CHARGERCONN_ON_CALL:
+       case FEEDBACK_PATTERN_WEARABLE_CHARGING_ERROR_ON_CALL:
+       case FEEDBACK_PATTERN_WEARABLE_LOWBATT_ON_CALL:
+       case FEEDBACK_PATTERN_WEARABLE_3RD_APPLICATION:
+       case FEEDBACK_PATTERN_WEARABLE_MMS:
+       case FEEDBACK_PATTERN_WEARABLE_HOURLY_ALERT:
+               /* no matter sound profile */
+               if (CHECK_VIBRATION(type))
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_WEARABLE_SMART_ALERT:
+       case FEEDBACK_PATTERN_WEARABLE_SEND_SOS_MESSAGE:
+       case FEEDBACK_PATTERN_WEARABLE_END_SOS_MESSAGE:
+       case FEEDBACK_PATTERN_WEARABLE_CMAS:
+       case FEEDBACK_PATTERN_WEARABLE_OUTGOING_CALL:
+               return true;
+       case FEEDBACK_PATTERN_WEARABLE_SCREEN_CAPTURE:
+               if (CHECK_SOUND(type) && camerastatus && shutter_sndstatus)
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_WEARABLE_SPEED_UP:
+       case FEEDBACK_PATTERN_WEARABLE_SLOW_DOWN:
+       case FEEDBACK_PATTERN_WEARABLE_KEEP_THIS_PACE:
+       case FEEDBACK_PATTERN_WEARABLE_GOAL_ACHIEVED:
+       case FEEDBACK_PATTERN_WEARABLE_EXERCISE_COUNT:
+       case FEEDBACK_PATTERN_WEARABLE_START_CUE:
+               /* except mute case */
+               if (CHECK_VIBRATION(type) &&
+                       (is_sound_mode() || is_vibration_mode()))
+                       return true;
+               break;
+       default:
+               break;
+       }
+       return false;
+}
+
+static bool wearable_get_always_off_case(int type, int pattern)
+{
+       int ret;
+
+       /* check if the state of voice recorder is recording */
+       if (vconf_get_int(VCONFKEY_RECORDER_STATE, &ret) < 0) {
+               _W("fail to get media sound status, status will be zero");
+               ret = 0;
+       }
+
+       if (CHECK_SOUND(type) && ret == VCONFKEY_RECORDER_STATE_RECORDING) {
+               _D("voice recording status is RECORDING");
+               return true;
+       }
+
+       switch (pattern) {
+       case FEEDBACK_PATTERN_TAP ... FEEDBACK_PATTERN_SIP:
+       case FEEDBACK_PATTERN_HOLD ... FEEDBACK_PATTERN_HW_HOLD:
+       case FEEDBACK_PATTERN_WEARABLE_SIP_BACKSPACE ... FEEDBACK_PATTERN_WEARABLE_MAX_CHARACTER:
+               if (CHECK_SOUND(type) && !is_touch_sndstatus())
+                       return true;
+               break;
+       case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+               if (CHECK_SOUND(type) && !is_keytone_sndstatus())
+                       return true;
+               else if (CHECK_VIBRATION(type) && !feedbackstatus)
+                       return true;
+               break;
+       default:
+               break;
+       }
+       return false;
+}
+
+static int wearable_get_strength_type(int type, int pattern)
+{
+       if (CHECK_SOUND(type)) {
+               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_WEARABLE_SCREEN_CAPTURE)
+                       return VOLUME_TYPE_FIXED;
+               else
+                       return VOLUME_TYPE_SYSTEM;
+       } else if (CHECK_VIBRATION(type)) {
+               if (pattern >= FEEDBACK_PATTERN_MESSAGE &&
+                   pattern <= FEEDBACK_PATTERN_GENERAL)
+                       return noti_level * HAPTIC_FEEDBACK_STEP;
+               else
+                       return vib_level * HAPTIC_FEEDBACK_STEP;
+       }
+
+       return -EINVAL;
+}
+
+static const struct profile_ops wearable_profile_ops = {
+       .profile               = "wearable",
+       .init                  = wearable_init,
+       .exit                  = wearable_exit,
+       .get_switched_pattern  = wearable_get_switched_pattern,
+       .get_always_alert_case = wearable_get_always_alert_case,
+       .get_always_off_case   = wearable_get_always_off_case,
+       .get_strength_type     = wearable_get_strength_type,
+       .max_type              = FEEDBACK_TYPE_END,
+       .max_pattern           = FEEDBACK_PATTERN_WEARABLE_END,
+       .str_type              = wearable_str_type,
+       .str_pattern           = wearable_str_pattern,
+};
+
+PROFILE_OPS_REGISTER(&wearable_profile_ops);