Providing tactile feedback for touch events

The Tactile feedback client API provides area registry based feedback and direct feedback to Symbian applications and UI components. You can use the API to add, modify and remove feedback areas, trigger direct feedback and disable feedback for certain UI components or the whole application.

To provide tactile feedback using the using the Tactile feedback client API, follow the steps below:

  1. Include the Tactile Feedback Client library touchfeedback.lib in your .mmp file.
  2. Include the header files touchfeedback.h and touchlogicalfeedback.h.

  3. Use the MTouchFeedback::Instance function for acquiring a pointer to the interface.
  4. Set feedback areas for your UI controls using the SizeChanged function (or in another approriate place).
  5. Update the feedback areas using the PositionChanged function (for non-window-owning controls).
  6. Call RemoveFeedbackForControl in your control's destructor.
  7. If you want to use direct feedback, trigger it in the HandlePointerEventL function with a call to InstantFeedback.

Use cases

Figure 1. Tactile feedback client API use cases

To provide tactile feedback for touch events in your applications, implement the following use cases:

  • Using direct feedback

    • Feedback effect is played according to given logical feedback type.
  • Using area registry based feedback

    • Set feedback area

      • New feedback area is added to area registry.
      • Can also be used for modifying existing feedback area.
    • Change feedback area

      • Change feedback area coordinates, or feedback type for a given area.
    • Remove feedback area

      • Given feedback area is removed from the registry
  • Removing feedback from a control

    • All feedback areas belonging to given control are removed from registry.
    • All cached information about the control is also removed.

The following use cases are optional, allowing you to use additional tactile feedback features:

  • Disabling and enabling feedback

    • Enable or disable feedback for you application

      • Disable feedback for this application at run-time.
      • Enable feedback for this application at run-time.
      • Query whether feedback is currently enabled for this application.
      • Enable only audio- or vibra feedback for this application at run-time.
    • Enable or disable feedback for a control

      • Temporarily disable feedback for given control.
      • Re-enable feedback for given control.
      • Temporarily enable only audio or vibra feedback.
  • Querying if feedback is supported

    • Check if tactile feedback is supported in this device.
  • Managing feedback areas

    • You can sort feedback areas for achieving desired functionality in case of overlapping areas.
  • Optimizing feedback latency

For an overview of using tactile feedback in your application, see Tactile feedback implementation example.

Main implementation files

The implementation files for the Tactile feedback client API are touchfeedback.h and touchlogicalfeedback.h.