1 #ifndef DALI_FEEDBACK_PLAYER_H
2 #define DALI_FEEDBACK_PLAYER_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/dali-adaptor-common.h>
30 namespace Internal DALI_INTERNAL
39 * @brief Plays feedback effects.
41 class DALI_ADAPTOR_API FeedbackPlayer : public BaseHandle
46 * @brief Create an uninitialized handle.
48 * This can be initialized by calling FeedbackPlayer::Get().
53 * @brief Create an initialized handle to the FeedbackPlayer.
55 * @return A handle to a newly allocated Dali resource.
57 static FeedbackPlayer Get();
62 * This is non-virtual since derived Handle types must not contain data or virtual methods.
67 * @brief Plays a monotone vibration.
68 * @param[in] duration The duration of the vibration.
70 void PlayMonotone(unsigned int duration);
73 * @brief Plays vibration in predefined patterns.
74 * @param[in] filePath Path to the file containing the effect.
76 void PlayFile(const std::string filePath);
79 * @brief Stops the currently playing vibration effects.
85 * @param[in] fileName Path to the sound file to play.
86 * @return A handle which can be used to stop the sound playback.
88 int PlaySound( const std::string& fileName );
91 * Stops a currently playing sound.
92 * @param[in] handle A handle to the currently playing sound.
94 void StopSound( int handle );
97 * Plays a feedback pattern.
98 * @param[in] type The type of feedback.
99 * @param[in] pattern The ID of the pattern to play.
101 void PlayFeedbackPattern( int type, int pattern );
104 * Loads a file into data
105 * @param[in] filename The filename.
106 * @param[in] data The data in the file.
107 * @return True if the file data could be loaded
109 bool LoadFile(const std::string& filename, std::string& data);
111 public: // Not intended for application developers
114 * @brief This constructor is used by FeedbackPlayer::Get().
115 * @param[in] feedbackPlayer A pointer to the feedback player.
117 explicit DALI_INTERNAL FeedbackPlayer( Internal::Adaptor::FeedbackPlayer* feedbackPlayer );
122 #endif // DALI_FEEDBACK_PLAYER_H