Add get_priority which return priority MIDDLE 32/93632/3
authorpr.jung <pr.jung@samsung.com>
Tue, 25 Oct 2016 04:21:41 +0000 (13:21 +0900)
committerJung <pr.jung@samsung.com>
Thu, 27 Oct 2016 06:36:55 +0000 (23:36 -0700)
Change-Id: I5eedb209cd4fad4e45335f4716847b8792c20161
Signed-off-by: pr.jung <pr.jung@samsung.com>
mobile/src/check.c
src/profiles.h
src/vibrator.c
wearable/src/check.c

index 4a80953..36f6a42 100644 (file)
@@ -280,6 +280,11 @@ static bool mobile_is_notification_type(int pattern)
        return false;
 }
 
+static int mobile_get_priority(int pattern)
+{
+       return PRIORITY_MIDDLE;
+}
+
 static bool mobile_get_always_alert_case(int type, int pattern)
 {
        switch (pattern) {
@@ -401,6 +406,7 @@ static const struct profile_ops mobile_profile_ops = {
        .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,
+       .get_priority          = mobile_get_priority,
        .is_notification_type  = mobile_is_notification_type,
        .max_type              = FEEDBACK_TYPE_END,
        .max_pattern           = FEEDBACK_PATTERN_INTERNAL_END,
index 306485a..398b78d 100644 (file)
 #include <stdbool.h>
 #include "common.h"
 
+enum priority_level {
+       PRIORITY_MIN = 0,
+       PRIORITY_MIDDLE,
+       PRIORITY_HIGH,
+       PRIORITY_TOP,
+};
+
 struct profile_ops {
        const char *profile;
        void (*init) (void);
@@ -31,6 +38,7 @@ struct profile_ops {
        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);
+       int (*get_priority)(int pattern);
        bool (*is_notification_type)(int pattern);
        const int max_type;
        const int max_pattern;
index 6efba65..aa0eeaf 100644 (file)
 
 #define HAPTIC_DEVICE                          0
 
-enum haptic_priority {
-       HAPTIC_PRIORITY_MIN = 0,
-       HAPTIC_PRIORITY_MIDDLE,
-       HAPTIC_PRIORITY_HIGH,
-};
-
 enum haptic_iteration {
        HAPTIC_ITERATION_ONCE = 1,
        HAPTIC_ITERATION_INFINITE = 256,
@@ -155,10 +149,9 @@ static int haptic_vibrate_stop(unsigned int handle)
 
 static int get_priority(feedback_pattern_e pattern)
 {
-       if (pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD)
-               return HAPTIC_PRIORITY_MIN;
-
-       return HAPTIC_PRIORITY_MIDDLE;
+       if (profile->get_priority)
+               return profile->get_priority(pattern);
+       return PRIORITY_MIDDLE;
 }
 
 static void vibrator_init(void)
index e7901c6..cc8de3f 100644 (file)
@@ -269,6 +269,11 @@ static bool wearable_is_system_type(int pattern)
        return false;
 }
 
+static int wearable_get_priority(int pattern)
+{
+       return PRIORITY_MIDDLE;
+}
+
 static bool wearable_get_always_alert_case(int type, int pattern)
 {
        if (CHECK_SOUND(type)) {
@@ -409,6 +414,7 @@ static const struct profile_ops wearable_profile_ops = {
        .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,
+       .get_priority          = wearable_get_priority,
        .is_notification_type  = wearable_is_notification_type,
        .max_type              = FEEDBACK_TYPE_END,
        .max_pattern           = FEEDBACK_PATTERN_INTERNAL_END,