Merge "Removed troubleshooting section from README" into tizen
[platform/core/uifw/dali-adaptor.git] / adaptors / public-api / feedback-plugin.h
1 #ifndef __DALI_FEEDBACK_PLUGIN_H__
2 #define __DALI_FEEDBACK_PLUGIN_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 namespace Dali DALI_IMPORT_API
25 {
26
27 /**
28  * FeedbackPlugin is an abstract interface, used by Dali-adaptor to access haptic and audio feedback.
29  * A concrete implementation must be created for each platform and provided as a dynamic library which
30  * will be loaded at run time by the adaptor.
31  */
32 class FeedbackPlugin
33 {
34 public:
35
36   typedef void (*SoundStopCallBack)( void* ptr );
37
38   /**
39    * Destructor.
40    */
41   virtual ~FeedbackPlugin()
42   {
43   }
44
45   /**
46    * Plays vibration in predefined patterns.
47    * @param[in] filePath Path to the file containing the effect.
48    */
49   virtual void PlayHaptic( const std::string& filePath ) = 0;
50
51   /**
52    * Plays a monotone vibration.
53    * @param[in]  duration  The duration of the vibration.
54    */
55   virtual void PlayHapticMonotone( unsigned int duration ) = 0;
56
57   /**
58    * Stops the currently playing vibration effects.
59    */
60   virtual void StopHaptic() = 0;
61
62   /**
63    * Plays a sound file.
64    * @param[in] fileName Path to the sound file to play.
65    * @return A handle which can be used to stop the sound playback.
66    */
67   virtual int PlaySound( const std::string& fileName ) = 0;
68
69   /**
70    * Stops a currently playing sound.
71    * @param[in] handle A handle to the currently playing sound.
72    */
73   virtual void StopSound( int handle ) = 0;
74
75   /**
76    * Plays a feedback pattern.
77    * @param[in] type The type of feedback.
78    * @param[in] pattern The ID of the pattern to play.
79    */
80   virtual void PlayFeedbackPattern( int type, int pattern ) = 0;
81
82   // Types for plugin factories
83
84   /**
85    * Function pointer called in adaptor to create a feedback plugin instance.
86    * @param [in] pluginName name of the plugin to load.
87    * @return Pointer to the newly created plugin object
88    */
89   typedef FeedbackPlugin* CreateFeedbackPlugin( void );
90
91 }; // class FeedbackPlugin
92
93 } // namespace Dali
94
95 #endif // __DALI_FEEDBACK_PLUGIN_H__