Symbian3/SDK/Source/GUID-581A8E4B-12BE-41C0-A20E-3087A80FEECF.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-581A8E4B-12BE-41C0-A20E-3087A80FEECF" xml:lang="en"><title>Tactile
       
    13 feedback</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>There are two methods where vibration or audio of the device is used as
       
    15 an output method (when mobile device users interact with the device touch
       
    16 screen):</p>
       
    17 <ul>
       
    18 <li><p>As a <i>tacticon</i> to inform users through physical feedback, that
       
    19 an important event is occurring in the device. For example, when a new message
       
    20 arrives or a warning note is displayed.</p></li>
       
    21 <li><p>As <i>tactile feedback</i> to indicate to the user that an interaction
       
    22 event has been successful. For example, users receive tactile feedback when
       
    23 they press a button on the touch screen.</p></li>
       
    24 </ul>
       
    25 <p>As with sounds, tactile feedback must be used carefully so as not to desensitize
       
    26 the user to the vibration; the attention grabbing quality remains and functions
       
    27 so long as the feedback is not too frequent.</p>
       
    28 <p>Tactile feedback is enabled for all the Symbian platform UI components.
       
    29 Tactile feedback can be disabled for the common UI components in an application.
       
    30 However, this is acceptable only if tactile feedback causes interference with
       
    31 other device functions.</p>
       
    32 <p>The user can choose the level of tactile feedback and turn tacticons ON
       
    33 and OFF.</p>
       
    34 <p>The following table lists the tactile feedback effects:</p>
       
    35 <p><table id="GUID-4969AEA7-3BE4-4644-8232-1FA26D49010B"><title>Tactile feedback
       
    36 effects</title>
       
    37 <tgroup cols="2"><colspec colname="col1" colwidth="0.40*"/><colspec colname="col2" colwidth="1.60*"/>
       
    38 <thead>
       
    39 <row>
       
    40 <entry valign="top"><p>Effects</p></entry>
       
    41 <entry valign="top"><p>Description</p></entry>
       
    42 </row>
       
    43 </thead>
       
    44 <tbody>
       
    45 <row>
       
    46 <entry><p><b>Sensitive button</b></p></entry>
       
    47 <entry><p>It provides single pulse effect on repeated key presses with buttons.
       
    48 It is also possible with other similar components.</p></entry>
       
    49 </row>
       
    50 <row>
       
    51 <entry><p><b>Basic button</b></p></entry>
       
    52 <entry><p>It provides stronger single pulse effect to buttons. It is also
       
    53 possible with other similar components.</p></entry>
       
    54 </row>
       
    55 <row>
       
    56 <entry><p><b>Sensitive list</b></p></entry>
       
    57 <entry><p>It provides single pulse effect to lists and grids. Effect is used
       
    58 with move (drag and flick) when new item appears on the screen.</p></entry>
       
    59 </row>
       
    60 <row>
       
    61 <entry><p><b>Basic list</b></p></entry>
       
    62 <entry><p>It provides stronger single pulse effect to lists and grids. Effect
       
    63 is used with touch down and release when tap makes an action. </p><p>In hierarchical
       
    64 list, collapsing/expanding item provides basic list effect with touch down
       
    65 and release.</p></entry>
       
    66 </row>
       
    67 <row>
       
    68 <entry><p><b>Bounce effect</b></p></entry>
       
    69 <entry><p>It provides pulse effect when list returns to its normal state after
       
    70 boundary effect.</p></entry>
       
    71 </row>
       
    72 <row>
       
    73 <entry><p><b>Sensitive slider</b></p></entry>
       
    74 <entry><p>It provides pulse effect with scrollbar and slider thumbs. Effect
       
    75 is provided with touch down and release in thumb area.</p></entry>
       
    76 </row>
       
    77 <row>
       
    78 <entry><p><b>Smooth slider</b></p></entry>
       
    79 <entry><p>It provides continuous smooth feedback when dragging scrollbar or
       
    80 slider thumb. This can also be increasing or decreasing depending of the slider
       
    81 type.</p></entry>
       
    82 </row>
       
    83 <row>
       
    84 <entry><p><b>Hold slider</b></p></entry>
       
    85 <entry><p>It provides sensitive pulse effect when touch down and hold on the
       
    86 slider or scrollbar area. Slider thumb starts moving step by step towards
       
    87 the touch point. Every step gives one sensitive pulse. If slider thumb moves
       
    88 directly to the touch point, then basic slider effect is provided.</p></entry>
       
    89 </row>
       
    90 <row>
       
    91 <entry><p><b>Pop-up</b></p></entry>
       
    92 <entry><p>It provides sensitive pulse effect when pop-up is opened or closed.
       
    93 If the theme animations are ON, then pop-up effect is used with opening event
       
    94 after increasing long touch effect. In this scenario, there is no pop-up effect
       
    95 while closing. <note> All pop-ups does not have theme animation.</note></p></entry>
       
    96 </row>
       
    97 <row>
       
    98 <entry><p><b>Pop-up close</b></p></entry>
       
    99 <entry><p>It provides decreasing smooth feedback while closing pop-up and
       
   100 when theme animations are ON.</p></entry>
       
   101 </row>
       
   102 <row>
       
   103 <entry><p><b>Increasing long touch</b></p></entry>
       
   104 <entry><p>It provides increasing smooth feedback. This can be used with either
       
   105 long tap animation or pop-up opening theme effects. If the theme effects are
       
   106 ON and long tap opens a pop-up, then feedback is provided only with long tap.
       
   107 This is followed by pop-up.</p></entry>
       
   108 </row>
       
   109 <row>
       
   110 <entry><p><b>Basic tab</b></p></entry>
       
   111 <entry><p>It provides strong pulse effect with touch down event in tab area.</p></entry>
       
   112 </row>
       
   113 <row>
       
   114 <entry><p><b>Smooth flick</b></p></entry>
       
   115 <entry><p>It provides smooth feedback with drag when horizontal movement is
       
   116 possible.</p></entry>
       
   117 </row>
       
   118 <row>
       
   119 <entry><p><b>Sensitive flick</b></p></entry>
       
   120 <entry><p>It provides sensitive pulse effect with touch release when horizontal
       
   121 movement is possible.</p></entry>
       
   122 </row>
       
   123 <row>
       
   124 <entry><p><b>Sensitive edit</b></p></entry>
       
   125 <entry><p>It provides sensitive pulse effect in editors with touch down and
       
   126 release.</p></entry>
       
   127 </row>
       
   128 <row>
       
   129 <entry><p><b>Text edit</b></p></entry>
       
   130 <entry><p>It provides pulse effect when painting the text. Effect is provided
       
   131 with every character while painting the text.</p></entry>
       
   132 </row>
       
   133 <row>
       
   134 <entry><p><b>Blank edit</b></p></entry>
       
   135 <entry><p>It provides pulse effect when painting blank character. By default,
       
   136 it is none.</p></entry>
       
   137 </row>
       
   138 <row>
       
   139 <entry><p><b>Line edit</b></p></entry>
       
   140 <entry><p>It provides pulse effect when painting a line.</p></entry>
       
   141 </row>
       
   142 <row>
       
   143 <entry><p><b>Empty line</b></p></entry>
       
   144 <entry><p>It provides pulse effect when painting an empty line. By default,
       
   145 it is none.</p></entry>
       
   146 </row>
       
   147 <row>
       
   148 <entry><p><b>Check box</b></p></entry>
       
   149 <entry><p>It provides pulse effect when marking/unmarking a check box.</p></entry>
       
   150 </row>
       
   151 <row>
       
   152 <entry><p><b>Multi-touch recognition</b></p></entry>
       
   153 <entry><p>It provides double pulse (sensitive + sensitive) effect when multi-touch
       
   154 is recognized (generally, when second finger is touched down).</p></entry>
       
   155 </row>
       
   156 <row>
       
   157 <entry><p><b>Smooth pinch</b></p></entry>
       
   158 <entry><p>It provides smooth continuous feedback while moving fingers in multi-touch
       
   159 pinch situation.</p></entry>
       
   160 </row>
       
   161 <row>
       
   162 <entry><p><b>Smooth rotate</b></p></entry>
       
   163 <entry><p>It provides smooth continuous feedback  while moving fingers in
       
   164 multi-touch rotate situation.</p></entry>
       
   165 </row>
       
   166 </tbody>
       
   167 </tgroup>
       
   168 </table></p>
       
   169 <section id="GUID-B9A35CA3-B830-4D97-9B0A-E22DC4A3CDA1"><title>Characteristics
       
   170 of haptics related  APIs</title><p>You can use the following APIs to create
       
   171 haptic effects:</p><ul>
       
   172 <li><p><xref href="GUID-8661A7E0-F19A-41F8-9062-FBFAE70CF658.dita">Tactile Feedback
       
   173 Client API</xref></p><ul>
       
   174 <li><p>It is available from S60 5th Edition onwards</p></li>
       
   175 <li><p>It can be used on all S60 5th Edition or later mobile devices. However,
       
   176 the feedback is played only on touch enabled layouts.</p></li>
       
   177 <li><p>It provides simple functions for triggering various predefined tactile
       
   178 feedback (vibration or audio) effects.</p></li>
       
   179 <li><p>It enables a consistent user experience in all applications of the
       
   180 mobile device (an application gives a logical feedback type as an input and
       
   181 the actual physical effect depends on the mobile device configuration and
       
   182 end user settings).</p></li>
       
   183 <li><p>When the area feedback is used, latency is low for the feedback triggering
       
   184 (a tactile feedback can already be triggered at the window server level prior
       
   185 to the corresponding pointer event being delivered to the visible application).</p></li>
       
   186 <li><p>Direct feedback can be easily integrated into <codeph>CCoeControl::HandlePointerEventL()</codeph> . </p></li>
       
   187 <li><p>An application can select the logical tactile feedback from certain
       
   188 types. The produced effect may be different on various mobile devices.</p></li>
       
   189 </ul></li>
       
   190 <li><p><xref href="jar:GUID-558A5A9B-811E-4A87-B3DD-AE734C9AA966.jar!/public_specs/GuidesA/Haptics_API_Specification/Haptics_API_Specification.html" format="application/java-archive">Haptics
       
   191 API</xref></p><ul>
       
   192 <li><p>It is available from S60 5.2 Edition onwards.</p></li>
       
   193 <li><p>It can be used in touch and hybrid mobile devices.</p></li>
       
   194 <li><p>It provides an interface for accessing Haptics player that can control
       
   195 different actuator types.</p></li>
       
   196 <li><p>It enables producing of complex vibrator effects, such as an explosion
       
   197 or machine gun effect in a game, bass boost for a music player, advanced ringing
       
   198 tone vibration, and so on.</p></li>
       
   199 <li><p>It enables simultaneous playing of different kinds of basis effects
       
   200 and modifying them when played. </p></li>
       
   201 <li><p>It allows for designing complex effects (using a separate PC application)
       
   202 that can be loaded on Haptics player for playing.</p></li>
       
   203 <li><p>It may require a special license key  for third-party applications
       
   204 (to be set at runtime) to enable the Haptics player functionality.</p></li>
       
   205 </ul></li>
       
   206 <li><p><xref href="GUID-D53A00E4-CF37-5F11-8D15-C5ECCCE64597.dita">Vibra API</xref></p><ul>
       
   207 <li><p>It available from S60 3.0 onwards</p></li>
       
   208 <li><p>It can be used for running device vibrator with given intensity for
       
   209 a given period of time</p></li>
       
   210 <li><p>It can be used by a privileged client application to play pulse effects,
       
   211 which have a very short duration (as the ones used for tactile feedback)</p></li>
       
   212 </ul></li>
       
   213 </ul></section>
       
   214 <section id="GUID-428F693C-1CA8-4588-9A7D-C4265D2AED91"><title>When to use
       
   215 Tactile Feedback Client API, Haptics API, and Vibra API</title><p>You must
       
   216 use<ul>
       
   217 <li><p>Tactile Feedback Client API for providing tactile feedback in custom
       
   218 controls (grids, lists, and so on) which will comply with the style of Core
       
   219 UI components to ensure a uniform user experience among applications</p></li>
       
   220 <li><p>Haptics API on touch and hybrid mobile devices for producing complex
       
   221 vibration feedback which cannot be achieved with Tactile Framework (games,
       
   222 simulations, demos, and so on.)</p></li>
       
   223 <li><p>Vibra API for producing haptic effects such as ringing tone vibration
       
   224 in those mobile devices where Haptics API is not available or functional</p></li>
       
   225 </ul></p></section>
       
   226 <section id="GUID-8334E102-8F04-4726-9CD2-1D8004A417E1"><title>Using
       
   227 tactile feedback in C++ applications</title><p>The API to use for tactile
       
   228 feedback is the <xref href="GUID-8661A7E0-F19A-41F8-9062-FBFAE70CF658.dita">Tactile
       
   229 feedback client API</xref>.</p><p>The Symbian platform includes a tactile
       
   230 feedback interface to add, modify and remove feedback areas in the registry.
       
   231 There is also an option to trigger direct feedback and bypass the registry.
       
   232  <parmname>MTouchFeedback::Instance()</parmname> is used for acquiring a pointer
       
   233 to a touch feedback instance. When touch feedback is activated, the mobile
       
   234 device users get a slight vibration when the control with the feedback interface
       
   235 is touched. </p><note><p>Tactile feedback can be set and disabled in a client
       
   236 application or a mobile device in some scenarios, for example, during phone
       
   237 calls.</p></note><p>Client applications cannot determine the actual physical
       
   238 feedback that is generated. It depends on device configuration and current
       
   239 settings. In current devices, the user changeable settings include vibration
       
   240 and audio feedback intensity level.</p><p>In your application, you can use
       
   241 the following feedback types, defined in <codeph>TTouchLogicalFeedback</codeph>:</p><table id="GUID-6FF24F72-C352-4027-AA5D-2D34EBFA00F4">
       
   242 <tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/>
       
   243 <tbody>
       
   244 <row>
       
   245 <entry><p><codeph>ETouchFeedbackNone</codeph></p></entry>
       
   246 <entry><p>It is used for disabling feedback in some areas of the application
       
   247 window while using the area registry.</p></entry>
       
   248 </row>
       
   249 <row>
       
   250 <entry><p><codeph>ETouchFeedbackBasic</codeph></p></entry>
       
   251 <entry><p>It is used as a default feedback for stylus touch down events. For
       
   252 example, when the mobile device user taps a button or tab.</p></entry>
       
   253 </row>
       
   254 <row>
       
   255 <entry><p><codeph>ETouchFeedbackSensitive</codeph></p></entry>
       
   256 <entry><p>It provides sensitive feedback in situations when:<ul>
       
   257 <li><p>the triggering action is not very important (for example, change of
       
   258 focus in a list)</p></li>
       
   259 <li><p>there can be a large number of feedback instances within a short time
       
   260 (for example, text selection which gives feedback on every new selected character).</p></li>
       
   261 </ul> It is also used for scrolling and dragging.</p></entry>
       
   262 </row>
       
   263 </tbody>
       
   264 </tgroup>
       
   265 </table><p>To use vibration or audio feedback in your application:</p><ol>
       
   266 <li id="GUID-791E80D6-6935-4202-81E0-BA7392A9E1B3"><p>Include <codeph>touchfeedback.lib</codeph> in
       
   267 your <codeph>.mmp</codeph> file.</p></li>
       
   268 <li id="GUID-A185188F-F37B-440B-8213-214D77CF3B8B"><p>Include <parmname>touchfeedback.h</parmname>.</p></li>
       
   269 <li id="GUID-6455F4C1-AEA6-4C30-8E9B-DF9950558E17"><itemgroup><p>To enable
       
   270 tactile feedback for your application, add the following code.</p><codeblock xml:space="preserve">MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   271 feedback-&gt;SetFeedbackEnabledForThisApp(ETrue); // enabling feedback is optional  </codeblock><p>Do
       
   272 not delete the pointer in the controller destructor.</p></itemgroup></li>
       
   273 <li id="GUID-FC1B810B-99F4-44E5-82DC-46686D6D4198"><itemgroup><p>To use tactile
       
   274 feedback when a mobile device user points at a control, add the following
       
   275 code.</p><codeblock xml:space="preserve">void CMyContainerControl::HandlePointerEventL(const TPointerEvent&amp; aPointerEvent)
       
   276     {
       
   277     // Feedback is always played at pointer down event
       
   278     if(aPointerEvent.iType == TPointerEvent::EButton1Down)
       
   279         {
       
   280         MTouchFeedback* feedback = MTouchFeedback::Instance();  
       
   281         if (feedback) 
       
   282              { 
       
   283              feedback-&gt;InstantFeedback(ETouchFeedbackBasic);  
       
   284              }  
       
   285         }
       
   286    
       
   287     // Your other pointer event handling code here
       
   288 </codeblock></itemgroup></li>
       
   289 <li id="GUID-A26D8717-1839-4132-98C4-5C09086BB361"><itemgroup><p>To enable
       
   290 automatic feedback triggering in a specific area of a UI component, add</p><codeblock xml:space="preserve">feedback-&gt;SetFeedbackArea( this, 
       
   291                            1, // area Id
       
   292                            TRect( 0,0,20,20 ), 
       
   293                            ETouchFeedbackBasic, 
       
   294                            ETouchEventStylusDown );
       
   295 </codeblock></itemgroup></li>
       
   296 </ol><note><p>To use tactile feedback in an application, additional platform
       
   297 security capabilities are not required.</p></note></section>
       
   298 </conbody></concept>