Seperate iot profile 12/164812/6
authorpr.jung <pr.jung@samsung.com>
Thu, 21 Dec 2017 06:20:28 +0000 (15:20 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 18 Jan 2018 08:27:30 +0000 (08:27 +0000)
- GPIO_HAPTIC is used on iot profile

Change-Id: I755261b3248ed30cea41a2d02c1aff12f0623a47
Signed-off-by: pr.jung <pr.jung@samsung.com>
CMakeLists.txt
packaging/feedbackd.spec
src/haptic/haptic-iot.conf [new file with mode: 0644]

index 00813c1..63c0854 100755 (executable)
@@ -19,8 +19,8 @@ SET(SRCS
        src/haptic/external.c
        src/haptic/emulator.c
        src/haptic/circle.c
-       src/haptic/gpio_haptic.c
 )
+
 IF(STANDARD_MIX STREQUAL on)
        SET(SRCS ${SRCS} src/haptic/standard-mix.c)
 ELSE()
@@ -38,9 +38,13 @@ SET(PKG_MODULES
        capi-base-common
        gio-2.0
        capi-system-info
-       capi-system-peripheral-io
 )
 
+IF(GPIO_HAPTIC STREQUAL on)
+       SET(SRCS ${SRCS} src/haptic/gpio_haptic.c)
+       SET(PKG_MODULES ${PKG_MODULES} capi-system-peripheral-io)
+ENDIF()
+
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs2 REQUIRED ${PKG_MODULES})
 
@@ -64,8 +68,4 @@ INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system
        FILES_MATCHING
        PATTERN "feedbackd.service")
 
-IF(PROFILE STREQUAL wearable)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/haptic-wearable.conf DESTINATION /etc/feedbackd)
-ELSE()
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/haptic-mobile.conf DESTINATION /etc/feedbackd)
-ENDIF()
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/haptic-${PROFILE}.conf DESTINATION /etc/feedbackd)
index 6aa2e72..69e1a79 100644 (file)
@@ -46,6 +46,7 @@ feedback daemon.
 Summary:       Deviced binaries targeting mobile profile
 Provides:      %{name}-compat = %{version}-%{release}
 Conflicts:     %{name}-profile_wearable
+Conflicts:     %{name}-profile_iot
 %description profile_mobile
 Deviced binaries targeting mobile profile. Required by main deviced package
 # if profile = wearable or common or undefined
@@ -53,8 +54,17 @@ Deviced binaries targeting mobile profile. Required by main deviced package
 Summary:       Deviced binaries targeting wearable profile
 Provides:      %{name}-compat = %{version}-%{release}
 Conflicts:     %{name}-profile_mobile
+Conflicts:     %{name}-profile_iot
 %description profile_wearable
 Deviced binaries targeting wearable profile. Required by main deviced package
+# if profile = iot or common or undefined
+%package profile_iot
+Summary:       Deviced binaries targeting iot profile
+Provides:      %{name}-compat = %{version}-%{release}
+Conflicts:     %{name}-profile_mobile
+Conflicts:     %{name}-profile_wearable
+%description profile_iot
+Deviced binaries targeting iot profile. Required by main deviced package
 
 %prep
 %setup -q
@@ -67,6 +77,7 @@ pushd build_mobile
        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DPROFILE=mobile \
        -DSTANDARD_MIX=%{standard_mix} \
+       -DGPIO_HAPTIC=off \
        #eol
 popd
 
@@ -77,6 +88,19 @@ pushd build_wearable
        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DPROFILE=wearable \
        -DSTANDARD_MIX=%{standard_mix} \
+       -DGPIO_HAPTIC=off \
+       #eol
+popd
+
+# Build per profile
+# if profile = iot or common or undefined
+mkdir -p build_iot
+pushd build_iot
+%cmake .. \
+       -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+       -DPROFILE=iot \
+       -DSTANDARD_MIX=%{standard_mix} \
+       -DGPIO_HAPTIC=on \
        #eol
 popd
 
@@ -94,6 +118,11 @@ pushd build_wearable
 make %{?jobs:-j%jobs}
 popd
 
+# if profile = iot or common or undefined
+pushd build_iot
+make %{?jobs:-j%jobs}
+popd
+
 %install
 rm -rf %{buildroot}
 # Build per profile
@@ -109,17 +138,24 @@ pushd build_wearable
 mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.wearable
 popd
 
-%install_service multi-user.target.wants feedbackd.service
+# if profile = iot or common or undefined
+pushd build_iot
+%make_install
+mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.iot
+popd
 
-%post profile_mobile
-mv %{_bindir}/feedbackd.mobile %{_bindir}/feedbackd
-mv %{_sysconfdir}/feedbackd/haptic-mobile.conf %{_sysconfdir}/feedbackd/haptic.conf 
+%install_service multi-user.target.wants feedbackd.service
 
+%post
 systemctl daemon-reload
 if [ "$1" == "1" ]; then
     systemctl restart feedbackd.service
 fi
 
+%post profile_mobile
+mv %{_bindir}/feedbackd.mobile %{_bindir}/feedbackd
+mv %{_sysconfdir}/feedbackd/haptic-mobile.conf %{_sysconfdir}/feedbackd/haptic.conf
+
 %preun profile_mobile
 mv %{_bindir}/feedbackd %{_bindir}/feedbackd.mobile
 
@@ -131,11 +167,6 @@ fi
 mv %{_bindir}/feedbackd.wearable %{_bindir}/feedbackd
 mv %{_sysconfdir}/feedbackd/haptic-wearable.conf %{_sysconfdir}/feedbackd/haptic.conf 
 
-systemctl daemon-reload
-if [ "$1" == "1" ]; then
-    systemctl restart feedbackd.service
-fi
-
 %preun profile_wearable
 mv %{_bindir}/feedbackd %{_bindir}/feedbackd.wearable
 
@@ -143,6 +174,17 @@ if [ "$1" == "0" ]; then
     systemctl stop feedbackd.service
 fi
 
+%post profile_iot
+mv %{_bindir}/feedbackd.iot %{_bindir}/feedbackd
+mv %{_sysconfdir}/feedbackd/haptic-iot.conf %{_sysconfdir}/feedbackd/haptic.conf
+
+%preun profile_iot
+mv %{_bindir}/feedbackd %{_bindir}/feedbackd.iot
+
+if [ "$1" == "0" ]; then
+    systemctl stop feedbackd.service
+fi
+
 %files -n feedbackd 
 %manifest %{name}.manifest
 %license LICENSE
@@ -161,3 +203,10 @@ fi
 %manifest %{name}.manifest
 %config %{_sysconfdir}/feedbackd/haptic-wearable.conf
 %{_bindir}/feedbackd.wearable
+
+%files profile_iot
+%license LICENSE
+%manifest %{name}.manifest
+%config %{_sysconfdir}/feedbackd/haptic-iot.conf
+%{_bindir}/feedbackd.iot
+
diff --git a/src/haptic/haptic-iot.conf b/src/haptic/haptic-iot.conf
new file mode 100644 (file)
index 0000000..84271f1
--- /dev/null
@@ -0,0 +1,24 @@
+[Haptic]
+# level
+#   how much does the vibration level to subdivide.
+#   The max value of vibration level fixed at 100.
+#   The min value of vibration level fixed at 0.
+level=6
+
+[level0]
+value=0
+
+[level1]
+value=20
+
+[level2]
+value=40
+
+[level3]
+value=60
+
+[level4]
+value=80
+
+[level5]
+value=100