Merge "Boost removal from performance server" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / common / haptic-player-impl.h
1 #ifndef __DALI_INTERNAL_HAPTIC_PLAYER_H__
2 #define __DALI_INTERNAL_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 // EXTERNAL INCLUDES
22 #include <string>
23 #include <dali/public-api/object/base-object.h>
24
25 // INTERNAL INCLUDES
26 #include <haptic-player.h>
27 #include <feedback/feedback-plugin-proxy.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37
38 class FeedbackPluginProxy;
39
40 /**
41  * Plays haptic effects.
42  */
43 class HapticPlayer : public Dali::BaseObject
44 {
45
46 public:
47
48   /**
49    * Create a HapticPlayer.
50    * This should only be called once by the Adaptor class.
51    * @return A newly created HapticPlayer.
52    */
53   static Dali::HapticPlayer New();
54
55   /**
56    * Retrieve a handle to the HapticPlayer. This creates an instance if none has been created.
57    * @return A handle to the HapticPlayer.
58    */
59   static Dali::HapticPlayer Get();
60
61   /**
62    * @copydoc Dali::HapticPlayer::PlayMonotone()
63    */
64   void PlayMonotone(unsigned int duration);
65
66   /**
67    * @copydoc Dali::HapticPlayer::PlayFile()
68    */
69   void PlayFile( const std::string& filePath );
70
71   /**
72    * @copydoc Dali::HapticPlayer::Stop()
73    */
74   void Stop();
75
76 private:
77
78   /**
79    * Private Constructor; see also HapticPlayer::New()
80    */
81   HapticPlayer();
82
83   /**
84    * Virtual Destructor
85    */
86   virtual ~HapticPlayer();
87
88   // Undefined
89   HapticPlayer(const HapticPlayer&);
90
91   // Undefined
92   HapticPlayer& operator=(HapticPlayer&);
93
94 private:
95
96   FeedbackPluginProxy mPlugin;
97 };
98
99 } // namespace Adaptor
100
101 } // namespace Internal
102
103 // Helpers for public-api forwarding methods
104
105 inline Internal::Adaptor::HapticPlayer& GetImplementation(Dali::HapticPlayer& player)
106 {
107   DALI_ASSERT_ALWAYS( player && "HapticPlayer handle is empty" );
108
109   BaseObject& handle = player.GetBaseObject();
110
111   return static_cast<Internal::Adaptor::HapticPlayer&>(handle);
112 }
113
114 inline const Internal::Adaptor::HapticPlayer& GetImplementation(const Dali::HapticPlayer& player)
115 {
116   DALI_ASSERT_ALWAYS( player && "HapticPlayer handle is empty" );
117
118   const BaseObject& handle = player.GetBaseObject();
119
120   return static_cast<const Internal::Adaptor::HapticPlayer&>(handle);
121 }
122
123 } // namespace Dali
124
125 #endif // __DALI_INTERNAL_HAPTIC_PLAYER_H__