Merge "Set proper locale to harfbuzz" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / devel-api / adaptor-framework / feedback-player.h
1 #ifndef __DALI_FEEDBACK_PLAYER_H__
2 #define __DALI_FEEDBACK_PLAYER_H__
3
4 /*
5  * Copyright (c) 2015 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/object/base-handle.h>
23
24 namespace Dali
25 {
26
27 namespace Internal DALI_INTERNAL
28 {
29 namespace Adaptor
30 {
31 class FeedbackPlayer;
32 }
33 }
34
35 /**
36  * @brief Plays feedback effects.
37  */
38 class DALI_IMPORT_API FeedbackPlayer : public BaseHandle
39 {
40 public:
41
42   /**
43    * @brief Create an uninitialized handle.
44    *
45    * This can be initialized by calling FeedbackPlayer::Get().
46    */
47   FeedbackPlayer();
48
49   /**
50    * @brief Create an initialized handle to the FeedbackPlayer.
51    *
52    * @return A handle to a newly allocated Dali resource.
53    */
54   static FeedbackPlayer Get();
55
56   /**
57    * @brief Destructor
58    *
59    * This is non-virtual since derived Handle types must not contain data or virtual methods.
60    */
61   ~FeedbackPlayer();
62
63   /**
64    * @brief Plays a monotone vibration.
65    * @param[in]  duration  The duration of the vibration.
66    */
67   void PlayMonotone(unsigned int duration);
68
69   /**
70    * @brief Plays vibration in predefined patterns.
71    * @param[in] filePath Path to the file containing the effect.
72    */
73   void PlayFile(const std::string filePath);
74
75   /**
76    * @brief Stops the currently playing vibration effects.
77    */
78   void Stop();
79
80   /**
81    * Plays a sound file.
82    * @param[in] fileName Path to the sound file to play.
83    * @return A handle which can be used to stop the sound playback.
84    */
85   int PlaySound( const std::string& fileName );
86
87   /**
88    * Stops a currently playing sound.
89    * @param[in] handle A handle to the currently playing sound.
90    */
91   void StopSound( int handle );
92
93   /**
94    * Plays a feedback pattern.
95    * @param[in] type The type of feedback.
96    * @param[in] pattern The ID of the pattern to play.
97    */
98   void PlayFeedbackPattern( int type, int pattern );
99
100   /*
101    * Loads a file into data
102    * @param[in] filename The filename.
103    * @param[in] data The data in the file.
104    * @return True if the file data could be loaded
105    */
106   bool LoadFile(const std::string& filename, std::string& data);
107
108 public: // Not intended for application developers
109
110   /**
111    * @brief This constructor is used by FeedbackPlayer::Get().
112    * @param[in] feedbackPlayer A pointer to the feedback player.
113    */
114   explicit DALI_INTERNAL FeedbackPlayer( Internal::Adaptor::FeedbackPlayer* feedbackPlayer );
115 };
116
117 } // namespace Dali
118
119 #endif // __DALI_FEEDBACK_PLAYER_H__