Purge underscored header file barriers
[platform/core/uifw/dali-adaptor.git] / dali / internal / haptics / common / feedback-player-impl.h
1 #ifndef DALI_INTERNAL_FEEDBACK_PLAYER_H
2 #define DALI_INTERNAL_FEEDBACK_PLAYER_H
3
4 /*
5  * Copyright (c) 2019 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 <dali/devel-api/adaptor-framework/feedback-player.h>
27 #include <dali/internal/haptics/common/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 FeedbackPlayer : public Dali::BaseObject
44 {
45
46 public:
47
48   /**
49    * Create a FeedbackPlayer.
50    * This should only be called once by the Adaptor class.
51    * @return A newly created FeedbackPlayer.
52    */
53   static Dali::FeedbackPlayer New();
54
55   /**
56    * Retrieve a handle to the FeedbackPlayer. This creates an instance if none has been created.
57    * @return A handle to the FeedbackPlayer.
58    */
59   static Dali::FeedbackPlayer Get();
60
61   /**
62    * @copydoc Dali::FeedbackPlayer::PlayMonotone()
63    */
64   void PlayMonotone(unsigned int duration);
65
66   /**
67    * @copydoc Dali::FeedbackPlayer::PlayFile()
68    */
69   void PlayFile( const std::string& filePath );
70
71   /**
72    * @copydoc Dali::FeedbackPlayer::Stop()
73    */
74   void Stop();
75
76   /**
77    * @copydoc Dali::FeedbackPlayer::PlaySound()
78    */
79   int PlaySound( const std::string& fileName );
80
81   /**
82    * @copydoc Dali::FeedbackPlayer::StopSound()
83    */
84   void StopSound( int handle );
85
86   /**
87    * @copydoc Dali::FeedbackPlayer::PlayFeedbackPattern()
88    */
89   void PlayFeedbackPattern( int type, int pattern );
90
91   /**
92    * @copydoc Dali::FeedbackPlayer::LoadFile()
93    */
94   bool LoadFile(const std::string& filename, std::string& data);
95
96 private:
97
98   /**
99    * Private Constructor; see also FeedbackPlayer::New()
100    */
101   FeedbackPlayer();
102
103   /**
104    * Virtual Destructor
105    */
106   virtual ~FeedbackPlayer();
107
108   // Undefined
109   FeedbackPlayer(const FeedbackPlayer&);
110
111   // Undefined
112   FeedbackPlayer& operator=(FeedbackPlayer&);
113
114 private:
115
116   FeedbackPluginProxy mPlugin;
117 };
118
119 } // namespace Adaptor
120
121 } // namespace Internal
122
123 // Helpers for public-api forwarding methods
124
125 inline Internal::Adaptor::FeedbackPlayer& GetImplementation(Dali::FeedbackPlayer& player)
126 {
127   DALI_ASSERT_ALWAYS( player && "FeedbackPlayer handle is empty" );
128
129   BaseObject& handle = player.GetBaseObject();
130
131   return static_cast<Internal::Adaptor::FeedbackPlayer&>(handle);
132 }
133
134 inline const Internal::Adaptor::FeedbackPlayer& GetImplementation(const Dali::FeedbackPlayer& player)
135 {
136   DALI_ASSERT_ALWAYS( player && "FeedbackPlayer handle is empty" );
137
138   const BaseObject& handle = player.GetBaseObject();
139
140   return static_cast<const Internal::Adaptor::FeedbackPlayer&>(handle);
141 }
142
143 } // namespace Dali
144
145 #endif // DALI_INTERNAL_FEEDBACK_PLAYER_H