src/hbcore/feedback/hbfeedbacknamespace.h
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 23 e6ad4ef83b23
child 34 ed14f46c0e55
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    28 
    28 
    29 #include <QtGlobal>
    29 #include <QtGlobal>
    30 #include <QObject>
    30 #include <QObject>
    31 #include <hbglobal.h>
    31 #include <hbglobal.h>
    32 
    32 
    33 /*!
       
    34     \namespace HbFeedback
       
    35     \brief The HbFeedback namespace lists the feedback effects supported 
       
    36     by the current haptic software and hardware.
       
    37 */
       
    38 
       
    39 #ifndef HB_DOXYGEN
    33 #ifndef HB_DOXYGEN
    40 class HB_CORE_EXPORT HbFeedback
    34 class HB_CORE_EXPORT HbFeedback
    41 {
    35 {
    42     Q_GADGET
    36     Q_GADGET
    43     Q_ENUMS(Type InstantEffect ContinuousEffect TacticonEffect HitAreaType IntensityLevel Modality)
    37     Q_ENUMS(Type InstantEffect ContinuousEffect IntensityLevel Modality)
    44     Q_FLAGS(Types Modalities)
    38     Q_FLAGS(Types Modalities)
    45 
    39 
    46 public:
    40 public:
    47 #else
    41 #else
    48 namespace HbFeedback
    42 namespace HbFeedback
    49 {
    43 {
    50 #endif // HB_DOXYGEN
    44 #endif // HB_DOXYGEN
    51 
    45 
    52     /*!
       
    53         Three different types of feedback mechanisms are supported: instant,
       
    54         continuous and hit area feedbacks.
       
    55      */
       
    56 
       
    57     enum Type {
    46     enum Type {
    58         TypeInstant = 0x001,
    47         TypeInstant = 0x001,
    59         TypeContinuous = 0x002,
    48         TypeContinuous = 0x002
    60         TypeHitArea = 0x004,
       
    61         TypeTacticon = 0x008
       
    62     };
    49     };
    63 
    50 
    64     Q_DECLARE_FLAGS(Types, Type)
    51     Q_DECLARE_FLAGS(Types, Type)
    65 
       
    66     /*!
       
    67         Instant feedback is fire&forget approach that initiates short
       
    68         haptic and sound effect which lasts on average between 100-500
       
    69         milliseconds. Each effect value corresponds to a certain haptic
       
    70         and/or sound effect defined in the themes.
       
    71 
       
    72         \sa HbInstantFeedback
       
    73      */
       
    74 
    52 
    75     enum InstantEffect {
    53     enum InstantEffect {
    76         None,
    54         None,
    77         Basic, // For generic instant feedback for custom widgets
    55         Basic, // For generic instant feedback for custom widgets
    78         Sensitive, // For generic instant feedback for custom widgets
    56         Sensitive, // For generic instant feedback for custom widgets
   107         PositiveTacticon,
    85         PositiveTacticon,
   108         NeutralTacticon,
    86         NeutralTacticon,
   109         NegativeTacticon,
    87         NegativeTacticon,
   110         /* new standard instant feedbacks here */
    88         /* new standard instant feedbacks here */
   111         NumberOfInstantFeedbacks,
    89         NumberOfInstantFeedbacks,
   112         NoOverride, // utility effect
       
   113         InstantUser = 65535,
    90         InstantUser = 65535,
   114         /* user defined custom instant feedbacks */
    91         /* user defined custom instant feedbacks */
   115         InstantMaxUser = 262140
    92         InstantMaxUser = 262140
   116     };
    93     };
   117 
       
   118     /*!
       
   119         Continuous feedback has to be explicitly started, updated and
       
   120         cancelled by the system and is used to provide ongoing feedback
       
   121         whenever user is dragging slider handles or swiping flickable widgets
       
   122         with her finger. Continuous feedback intensity can be varied
       
   123         during playback between values 0 and 100.
       
   124 
       
   125         \sa HbContinuousFeedback
       
   126      */
       
   127 
    94 
   128     enum ContinuousEffect {
    95     enum ContinuousEffect {
   129         ContinuousNone,
    96         ContinuousNone,
   130         ContinuousSmooth, // For generic continuous feedback for custom widgets
    97         ContinuousSmooth, // For generic continuous feedback for custom widgets
   131         ContinuousSlider,
    98         ContinuousSlider,
   132         ContinuousPopup,
    99         ContinuousPopup,
   133         ContinuousInput,
   100         ContinuousInput,
   134         ContinuousPinch,
   101         ContinuousPinch,
   135         /* new standard continuous feedbacks here */
   102         /* new standard continuous feedbacks here */
   136         NumberOfContinuousFeedbacks,
   103         NumberOfContinuousFeedbacks,
   137         NoContinuousOverride, // utility effect
       
   138         ContinuousUser = 1000,
   104         ContinuousUser = 1000,
   139         /* user defined continuous instant feedbacks */
   105         /* user defined continuous instant feedbacks */
   140         ContinuousMaxUser = 65535
   106         ContinuousMaxUser = 65535
   141     };
   107     };
   142 
   108 
   143     /*!
       
   144         \deprecated HbFeedback::TacticonEffect
       
   145             is deprecated. Use HbFeedback::InstantEffect instead.
       
   146 
       
   147         Tacticon feedback is a special kind of instant
       
   148         feedback reserved for tacticon use cases.
       
   149 
       
   150         \sa HbTacticonsFeedback
       
   151      */
       
   152 
       
   153     enum TacticonEffect {
       
   154         TacticonNone,
       
   155         TacticonPositive,
       
   156         TacticonNeutral,
       
   157         TacticonNegative,
       
   158         /* new tacticon feedbacks here */
       
   159         NumberOfTacticonFeedbacks
       
   160     };
       
   161 
       
   162     /*!
       
   163         Minimum, smooth and maximum intensity values of continuous feedback.
       
   164 
       
   165         \sa HbContinuousFeedback
       
   166      */
       
   167     enum IntensityLevel {
   109     enum IntensityLevel {
   168         IntensityZero = 0,
   110         IntensityZero = 0,
   169         IntensitySmooth = 50,
   111         IntensitySmooth = 50,
   170         IntensityFull = 100
   112         IntensityFull = 100
   171     };
   113     };
   172 
   114 
   173     /*!
       
   174         Hit area feedback is a special type of low-latency instant
       
   175         feedback that is initiated by preregistered hit area rectangles
       
   176         in the windowing system that are hit area matched before the
       
   177         touch events are even forwarded to the application windows.
       
   178         Hit area feedback can be set to initiate either when finger or
       
   179         stylus a.) presses down the screen or b.) is released from the
       
   180         screen.
       
   181 
       
   182         \sa HbHitAreaFeedback
       
   183      */
       
   184     enum HitAreaType {
       
   185         MouseButtonPress,
       
   186         MouseButtonRelease
       
   187     };
       
   188 
       
   189     /*!
       
   190       \enum Modality
       
   191       The available modalities for feedback effects.
       
   192       Effects can be synthesized using one or several of the available modalities.
       
   193     */
       
   194     enum Modality {
   115     enum Modality {
   195         All     = 0xFFFF,
   116         All     = 0xFFFF,
   196         Audio   = 0x0001,
   117         Audio   = 0x0001,
   197         Tactile = 0x0002
   118         Tactile = 0x0002
   198     };
   119     };
   199 
   120 
   200     Q_DECLARE_FLAGS(Modalities, Modality)
   121     Q_DECLARE_FLAGS(Modalities, Modality)
   201 
   122 
   202     /*!
       
   203         Timeout value has to be defined for each continuous feedback
       
   204         to avoid situations where continuous feedback is never cancelled
       
   205         and accidentally continues to play infinitely.
       
   206 
       
   207         Recommended standard value is 300 milliseconds.
       
   208 
       
   209         \sa HbContinuousFeedback
       
   210      */
       
   211     static const int StandardFeedbackTimeout = 300;
   123     static const int StandardFeedbackTimeout = 300;
   212 };
   124 };
   213 
   125 
   214 Q_DECLARE_OPERATORS_FOR_FLAGS(HbFeedback::Types)
   126 Q_DECLARE_OPERATORS_FOR_FLAGS(HbFeedback::Types)
   215 Q_DECLARE_OPERATORS_FOR_FLAGS(HbFeedback::Modalities)
   127 Q_DECLARE_OPERATORS_FOR_FLAGS(HbFeedback::Modalities)
   216 
   128 
   217 #endif // HBFEEDBACKNAMESPACE_H
   129 #endif // HBFEEDBACKNAMESPACE_H
   218