7f1ce2b683c2b780d88ad54aebc6ad1cd6fc788d
[platform/core/uifw/dali-adaptor.git] / adaptors / public-api / haptic-player.h
1 #ifndef __DALI_HAPTIC_PLAYER_H__
2 #define __DALI_HAPTIC_PLAYER_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 /**
22  * @addtogroup CAPI_DALI_ADAPTOR_MODULE
23  * @{
24  */
25
26 // EXTERNAL INCLUDES
27 #include <dali/public-api/object/base-handle.h>
28
29 namespace Dali DALI_IMPORT_API
30 {
31
32 namespace Internal DALI_INTERNAL
33 {
34 namespace Adaptor
35 {
36 class HapticPlayer;
37 }
38 }
39
40 /**
41  * @brief Plays haptic effects.
42  */
43 class HapticPlayer : public BaseHandle
44 {
45 public:
46
47   /**
48    * @brief Create an uninitialized handle.
49    *
50    * This can be initialized by calling HapticPlayer::Get().
51    */
52   HapticPlayer();
53
54   /**
55    * @brief Create an initialized handle to the HapticPlayer.
56    *
57    * @return A handle to a newly allocated Dali resource.
58    */
59   static HapticPlayer Get();
60
61   /**
62    * @brief Destructor
63    *
64    * This is non-virtual since derived Handle types must not contain data or virtual methods.
65    */
66   ~HapticPlayer();
67
68   /**
69    * @brief Plays a monotone vibration.
70    * @param[in]  duration  The duration of the vibration.
71    */
72   void PlayMonotone(unsigned int duration);
73
74   /**
75    * @brief Plays vibration in predefined patterns.
76    * @param[in] filePath Path to the file containing the effect.
77    */
78   void PlayFile(const std::string filePath);
79
80   /**
81    * @brief Stops the currently playing vibration effects.
82    */
83   void Stop();
84
85 public: // Not intended for application developers
86
87   /**
88    * @brief This constructor is used by HapticPlayer::Get().
89    * @param[in] hapticPlayer A pointer to the haptic player.
90    */
91   HapticPlayer( Internal::Adaptor::HapticPlayer* hapticPlayer );
92 };
93
94 } // namespace Dali
95
96 /**
97  * @}
98  */
99 #endif // __DALI_HAPTIC_PLAYER_H__