#include <accessibility-adaptor-impl.h>
#include <events/gesture-manager.h>
#include <events/event-handler.h>
-#include <feedback/feedback-controller.h>
-#include <feedback/feedback-plugin-proxy.h>
#include <gl/gl-proxy-implementation.h>
#include <gl/gl-implementation.h>
#include <gl/egl-sync-implementation.h>
mUpdateRenderController = new UpdateRenderController( *this, *mEnvironmentOptions );
- mDaliFeedbackPlugin = new FeedbackPluginProxy( FeedbackPluginProxy::DEFAULT_OBJECT_NAME );
-
// Should be called after Core creation
if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
{
delete mCore;
delete mEglFactory;
- // Delete feedback controller before feedback plugin & style monitor dependencies
- delete mFeedbackController;
- delete mDaliFeedbackPlugin;
delete mGLES;
delete mGestureManager;
delete mPlatformAbstraction;
ProcessCoreEvents(); // Ensure any startup messages are processed.
- if ( !mFeedbackController )
- {
- // Start sound & haptic feedback
- mFeedbackController = new FeedbackController( *mDaliFeedbackPlugin );
- }
-
for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
{
(*iter)->OnStart();
mNotificationOnIdleInstalled( false ),
mNotificationTrigger(NULL),
mGestureManager(NULL),
- mDaliFeedbackPlugin(NULL),
- mFeedbackController(NULL),
mObservers(),
mDragAndDropDetector(),
mDeferredRotationObserver(NULL),
*/
// CLASS HEADER
-#include <haptic-player-impl.h>
+#include <feedback-player-impl.h>
// EXTERNAL INCLUDES
+#include <fstream>
#include <dali/public-api/object/type-registry.h>
// INTERNAL INCLUDES
// Type Registration
Dali::BaseHandle Create()
{
- return HapticPlayer::Get();
+ return FeedbackPlayer::Get();
}
-Dali::TypeRegistration HAPTIC_PLAYER_TYPE( typeid(Dali::HapticPlayer), typeid(Dali::BaseHandle), Create );
+Dali::TypeRegistration FEEDBACK_PLAYER_TYPE( typeid(Dali::FeedbackPlayer), typeid(Dali::BaseHandle), Create );
} // unnamed namespace
-Dali::HapticPlayer HapticPlayer::New()
+Dali::FeedbackPlayer FeedbackPlayer::New()
{
- Dali::HapticPlayer player = Dali::HapticPlayer( new HapticPlayer() );
+ Dali::FeedbackPlayer player = Dali::FeedbackPlayer( new FeedbackPlayer() );
return player;
}
-Dali::HapticPlayer HapticPlayer::Get()
+Dali::FeedbackPlayer FeedbackPlayer::Get()
{
- Dali::HapticPlayer player;
+ Dali::FeedbackPlayer player;
Dali::SingletonService service( SingletonService::Get() );
if ( service )
{
// Check whether the singleton is already created
- Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::HapticPlayer ) );
+ Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::FeedbackPlayer ) );
if ( handle )
{
// If so, downcast the handle
- player = Dali::HapticPlayer( dynamic_cast< HapticPlayer* >( handle.GetObjectPtr() ) );
+ player = Dali::FeedbackPlayer( dynamic_cast< FeedbackPlayer* >( handle.GetObjectPtr() ) );
}
else
{
- player = Dali::HapticPlayer( New() );
+ player = Dali::FeedbackPlayer( New() );
service.Register( typeid( player ), player );
}
}
return player;
}
-void HapticPlayer::PlayMonotone( unsigned int duration )
+void FeedbackPlayer::PlayMonotone( unsigned int duration )
{
mPlugin.PlayHapticMonotone( duration );
}
-void HapticPlayer::PlayFile( const std::string& filePath )
+void FeedbackPlayer::PlayFile( const std::string& filePath )
{
mPlugin.PlayHaptic( filePath );
}
-void HapticPlayer::Stop()
+void FeedbackPlayer::Stop()
{
mPlugin.StopHaptic();
}
-HapticPlayer::HapticPlayer()
+int FeedbackPlayer::PlaySound( const std::string& filename )
+{
+ return mPlugin.PlaySound(filename);
+}
+
+void FeedbackPlayer::StopSound( int handle )
+{
+ mPlugin.StopSound(handle);
+}
+
+void FeedbackPlayer::PlayFeedbackPattern( int type, int pattern )
+{
+ mPlugin.PlayFeedbackPattern(type, pattern);
+}
+
+bool FeedbackPlayer::LoadFile(const std::string& filename, std::string& data)
+{
+ bool loaded = false;
+
+ std::ifstream stream(filename.c_str());
+
+ if( stream.is_open() )
+ {
+ data.assign((std::istreambuf_iterator<char>(stream)),
+ std::istreambuf_iterator<char>());
+ loaded = true;
+ }
+
+ return loaded;
+}
+
+FeedbackPlayer::FeedbackPlayer()
: mPlugin( FeedbackPluginProxy::DEFAULT_OBJECT_NAME )
{
}
-HapticPlayer::~HapticPlayer()
+FeedbackPlayer::~FeedbackPlayer()
{
}
--- /dev/null
+#ifndef __DALI_INTERNAL_FEEDBACK_PLAYER_H__
+#define __DALI_INTERNAL_FEEDBACK_PLAYER_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <feedback-player.h>
+#include <feedback/feedback-plugin-proxy.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class FeedbackPluginProxy;
+
+/**
+ * Plays haptic effects.
+ */
+class FeedbackPlayer : public Dali::BaseObject
+{
+
+public:
+
+ /**
+ * Create a FeedbackPlayer.
+ * This should only be called once by the Adaptor class.
+ * @return A newly created FeedbackPlayer.
+ */
+ static Dali::FeedbackPlayer New();
+
+ /**
+ * Retrieve a handle to the FeedbackPlayer. This creates an instance if none has been created.
+ * @return A handle to the FeedbackPlayer.
+ */
+ static Dali::FeedbackPlayer Get();
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::PlayMonotone()
+ */
+ void PlayMonotone(unsigned int duration);
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::PlayFile()
+ */
+ void PlayFile( const std::string& filePath );
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::Stop()
+ */
+ void Stop();
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::PlaySound()
+ */
+ int PlaySound( const std::string& fileName );
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::StopSound()
+ */
+ void StopSound( int handle );
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::PlayFeedbackPattern()
+ */
+ void PlayFeedbackPattern( int type, int pattern );
+
+ /**
+ * @copydoc Dali::FeedbackPlayer::LoadFile()
+ */
+ bool LoadFile(const std::string& filename, std::string& data);
+
+private:
+
+ /**
+ * Private Constructor; see also FeedbackPlayer::New()
+ */
+ FeedbackPlayer();
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~FeedbackPlayer();
+
+ // Undefined
+ FeedbackPlayer(const FeedbackPlayer&);
+
+ // Undefined
+ FeedbackPlayer& operator=(FeedbackPlayer&);
+
+private:
+
+ FeedbackPluginProxy mPlugin;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Adaptor::FeedbackPlayer& GetImplementation(Dali::FeedbackPlayer& player)
+{
+ DALI_ASSERT_ALWAYS( player && "FeedbackPlayer handle is empty" );
+
+ BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::FeedbackPlayer&>(handle);
+}
+
+inline const Internal::Adaptor::FeedbackPlayer& GetImplementation(const Dali::FeedbackPlayer& player)
+{
+ DALI_ASSERT_ALWAYS( player && "FeedbackPlayer handle is empty" );
+
+ const BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::FeedbackPlayer&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_FEEDBACK_PLAYER_H__
+++ /dev/null
-//******************************************************************************
-//
-// Default feedback theme for dali-toolkit
-//
-//******************************************************************************
-{
- "style":
- {
- "PushButton":
- {
- "signals":
- [
- {
- "type": "clicked",
- "sound-feedback-pattern": "FEEDBACK_PATTERN_TAP"
- }
- ]
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <feedback/feedback-controller.h>
-
-// EXTERNAL INCLUDES
-#include <sstream>
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/json_parser.hpp>
-#include <dali/integration-api/debug.h>
-#include <dali/public-api/common/stage.h>
-#include <dali/public-api/object/object-registry.h>
-
-// INTERNAL INCLUDES
-#include <feedback/feedback-ids.h>
-#include <feedback/feedback-plugin-proxy.h>
-
-using std::string;
-using boost::property_tree::ptree;
-
-namespace // unnamed namespace
-{
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::General, false, "LOG_FEEDBACK_CONTROLLER");
-#endif
-
-const char* DEFAULT_FEEDBACK_THEME_PATH = DALI_FEEDBACK_THEME_DIR"default-feedback-theme.json";
-
-string LoadFile(const string& filename)
-{
- DALI_ASSERT_DEBUG( 0 != filename.length());
-
- string contents;
-
- std::filebuf buf;
- buf.open(filename.c_str(), std::ios::in);
- if( buf.is_open() )
- {
- std::istream stream(&buf);
-
- // determine data length
- stream.seekg(0, std::ios_base::end);
- unsigned int length = static_cast<unsigned int>( stream.tellg() );
- stream.seekg(0, std::ios_base::beg);
-
- // allocate a buffer
- contents.resize(length);
- // read data into buffer
- stream.read(&contents[0], length);
-
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceLoader::LoadFile(%s) - loaded %d bytes\n", filename.c_str(), length );
- }
- else
- {
- DALI_LOG_ERROR("ResourceLoader::LoadFile(%s) - failed to load\n", filename.c_str());
- }
-
- return contents;
-}
-
-static string FindFilename( const ptree& child )
-{
- boost::optional<string> filename = child.get_optional<string>( "filename" );
- DALI_ASSERT_ALWAYS( filename && "Filename definiton must have 'filename'" );
-
- struct stat buf;
-
- if( 0 == stat( (*filename).c_str(), &buf) )
- {
- return *filename;
- }
-
- // else not found
- return "";
-}
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-struct SignalFeedbackInfo
-{
- /**
- * Default constructor.
- */
- SignalFeedbackInfo()
- :mHasHapticFeedbackInfo(false),
- mHasSoundFeedbackInfo(false)
- {
- }
-
- string mSignalName;
- bool mHasHapticFeedbackInfo;
- bool mHasSoundFeedbackInfo;
- string mHapticFeedbackPattern;
- string mSoundFeedbackPattern;
- string mHapticFeedbackFile;
- string mSoundFeedbackFile;
-};
-
-typedef std::vector<SignalFeedbackInfo> SignalFeedbackInfoContainer;
-typedef SignalFeedbackInfoContainer::const_iterator SignalFeedbackInfoConstIter;
-
-struct FeedbackStyleInfo
-{
- /**
- * Default constructor.
- */
- FeedbackStyleInfo()
- {
- }
-
- string mTypeName;
- std::vector<SignalFeedbackInfo> mSignalFeedbackInfoList;
-};
-
-static const FeedbackStyleInfo DEFAULT_FEEDBACK_STYLE_INFO;
-
-FeedbackController::FeedbackController( FeedbackPluginProxy& plugin )
-: mPlugin( plugin ),
- mConnections( this )
-{
- string defaultTheme = LoadFile( DEFAULT_FEEDBACK_THEME_PATH );
- LoadTheme( defaultTheme );
-
- Dali::ObjectRegistry registry = Dali::Stage::GetCurrent().GetObjectRegistry();
-
- registry.ObjectCreatedSignal().Connect( mConnections, &FeedbackController::ObjectCreatedCallback );
-
- Dali::StyleMonitor styleMonitor( Dali::StyleMonitor::Get() );
- DALI_ASSERT_DEBUG( styleMonitor && "StyleMonitor not available" );
- styleMonitor.StyleChangeSignal().Connect( mConnections, &FeedbackController::StyleChangedCallback );
-}
-
-FeedbackController::~FeedbackController()
-{
-}
-
-struct PlayFeedbackFromSignal
-{
- PlayFeedbackFromSignal( FeedbackController& controller, const string& typeName, const string& signalName )
- : mController( controller ),
- mTypeName( typeName ),
- mSignalName( signalName )
- {
- }
-
- void operator()()
- {
- mController.PlayFeedback( mTypeName, mSignalName );
- }
-
- FeedbackController& mController;
- string mTypeName;
- string mSignalName;
-};
-
-void FeedbackController::ObjectCreatedCallback( BaseHandle handle )
-{
- if( handle )
- {
- string type = handle.GetTypeName();
-
- const FeedbackStyleInfo styleInfo = GetStyleInfo( type );
-
- for( SignalFeedbackInfoConstIter iter = styleInfo.mSignalFeedbackInfoList.begin(); iter != styleInfo.mSignalFeedbackInfoList.end(); ++iter )
- {
- const SignalFeedbackInfo& info = *iter;
-
- if( info.mHasHapticFeedbackInfo || info.mHasSoundFeedbackInfo )
- {
- if( !info.mHapticFeedbackPattern.empty() || !info.mHapticFeedbackFile.empty() ||
- !info.mSoundFeedbackPattern.empty() || !info.mSoundFeedbackFile.empty() )
- {
- handle.ConnectSignal( this,
- info.mSignalName,
- PlayFeedbackFromSignal( *this, type, info.mSignalName ) );
-
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FeedbackController::ObjectCreatedCallback found Haptic pattern %s for Object type: %s, Signal Type: %s\n",
- info.mHapticFeedbackPattern.c_str(), type.c_str(), info.mSignalName.c_str() );
- }
- else
- {
- DALI_LOG_ERROR("FeedbackController::ObjectCreatedCallback() Warning Inconsistent data in theme file!\n");
- }
- }
- }
- }
-}
-
-const FeedbackStyleInfo& FeedbackController::GetStyleInfo( const string& type ) const
-{
- std::map<const string, FeedbackStyleInfo>::const_iterator iter( mStyleInfoLut.find( type ) );
- if( iter != mStyleInfoLut.end() )
- {
- return iter->second;
- }
- else
- {
- return DEFAULT_FEEDBACK_STYLE_INFO;
- }
-}
-
-void FeedbackController::StyleChangedCallback( Dali::StyleMonitor styleMonitor, Dali::StyleChange::Type styleChange )
-{
- if( StyleChange::THEME_CHANGE )
- {
- const string& userDefinedThemePath = styleMonitor.GetTheme();
- const string& userDefinedTheme = LoadFile( userDefinedThemePath );
-
- if( !LoadTheme( userDefinedTheme ) )
- {
- DALI_LOG_ERROR("FeedbackController::StyleChangedCallback() User defined theme failed to load! \n");
-
- //If there is any problem is using the user defined theme, then fall back to default theme
- if( !LoadTheme( DEFAULT_FEEDBACK_THEME_PATH ) )
- {
- //If the default theme fails, Then No luck!
- DALI_LOG_ERROR("FeedbackController::StyleChangedCallback() Default theme failed to load! \n");
- }
- }
- }
-}
-
-bool FeedbackController::LoadTheme( const string& data )
-{
- bool result = false;
-
- try
- {
- LoadFromString( data );
-
- result = true;
- }
- catch(...)
- {
- //Problem in user set theme, So fallback to use default theme.
- DALI_LOG_ERROR( "FeedbackController::LoadTheme() Failed to load theme\n" );
- }
-
- return result;
-}
-
-void FeedbackController::LoadFromString( const string& data )
-{
- std::stringstream jsonData( data );
-
- ptree node;
-
- try
- {
- // tree root is cleared each read_json
- boost::property_tree::json_parser::read_json( jsonData, node );
- }
- catch( boost::property_tree::json_parser::json_parser_error& error )
- {
- DALI_LOG_WARNING( "JSON Parse Error:'%s'\n", error.message().c_str() );
- DALI_LOG_WARNING( "JSON Parse File :'%s'\n", error.filename().c_str() );
- DALI_LOG_WARNING( "JSON Parse Line :'%d'\n", error.line() );
- throw;
- }
- catch(...)
- {
- throw;
- }
-
- // Clear previously loaded style
-
- mSoundFilesLut.clear();
- mHapticFilesLut.clear();
- mStyleInfoLut.clear();
-
- // Parse filenames
-
- if ( node.get_child_optional("sounds") )
- {
- const ptree& soundsNode = node.get_child( "sounds" );
- const ptree::const_iterator endSoundsIter = soundsNode.end();
- for( ptree::const_iterator iter = soundsNode.begin(); endSoundsIter != iter; ++iter )
- {
- const ptree::value_type& keyChild = *iter;
-
- string key( keyChild.first );
-
- boost::optional<string> name( keyChild.second.get_optional<string>("filename") );
- if( name )
- {
- string fileName( FindFilename( keyChild.second ) );
-
- mSoundFilesLut.insert( std::pair<const string, const string>(key, fileName) );
- }
- else
- {
- DALI_LOG_WARNING("Invalid sound file\n");
- }
- }
- }
-
- if ( node.get_child_optional("haptic") )
- {
- const ptree& hapticNode = node.get_child( "haptic" );
- const ptree::const_iterator endHapticIter = hapticNode.end();
- for( ptree::const_iterator iter = hapticNode.begin(); endHapticIter != iter; ++iter )
- {
- const ptree::value_type& keyChild = *iter;
-
- string key( keyChild.first );
-
- boost::optional<string> name( keyChild.second.get_optional<string>("filename") );
- if( name )
- {
- string fileName( FindFilename( keyChild.second ) );
-
- mHapticFilesLut.insert( std::pair<const string, const string>(key, fileName) );
- }
- else
- {
- DALI_LOG_WARNING("Invalid haptic file\n");
- }
- }
- }
-
- // Parse style
-
- const ptree& styleNode = node.get_child( "style" );
- const ptree::const_iterator endIter = styleNode.end();
- for( ptree::const_iterator iter = styleNode.begin(); endIter != iter; ++iter )
- {
- const ptree::value_type& keyChild = *iter;
-
- string key( keyChild.first );
- FeedbackStyleInfo themeInfo;
- themeInfo.mTypeName = key;
-
- const ptree& signalsNode = keyChild.second.get_child( "signals" );
- const ptree::const_iterator endIter = signalsNode.end();
- for( ptree::const_iterator iter = signalsNode.begin(); endIter != iter; ++iter )
- {
- const ptree::value_type& signal_child = *iter;
-
- SignalFeedbackInfo signalFeedbackInfo;
-
- boost::optional<string> type( signal_child.second.get_optional<string>( "type" ) );
- DALI_ASSERT_ALWAYS( type && "Signal must have a type" );
-
- signalFeedbackInfo.mSignalName = *type;
-
- boost::optional<string> hapticFeedbackPattern( signal_child.second.get_optional<string>( "haptic-feedback-pattern" ) );
- if( hapticFeedbackPattern )
- {
- signalFeedbackInfo.mHasHapticFeedbackInfo = true;
- signalFeedbackInfo.mHapticFeedbackPattern = *hapticFeedbackPattern;
- }
-
- boost::optional<string> hapticFeedbackFile( signal_child.second.get_optional<string>( "haptic-feedback-file" ) );
- if( hapticFeedbackFile )
- {
- signalFeedbackInfo.mHasHapticFeedbackInfo = true;
- signalFeedbackInfo.mHapticFeedbackFile = GetHapticPath( *hapticFeedbackFile );
- }
-
- boost::optional<string> soundFeedbackPattern( signal_child.second.get_optional<string>( "sound-feedback-pattern" ) );
- if( soundFeedbackPattern )
- {
- signalFeedbackInfo.mHasSoundFeedbackInfo = true;
- signalFeedbackInfo.mSoundFeedbackPattern = *soundFeedbackPattern;
- }
-
- boost::optional<string> soundFeedbackFile( signal_child.second.get_optional<string>( "sound-feedback-file" ) );
- if( soundFeedbackFile )
- {
- signalFeedbackInfo.mHasSoundFeedbackInfo = true;
- signalFeedbackInfo.mSoundFeedbackFile = GetSoundPath( *soundFeedbackFile );
- }
-
- if( signalFeedbackInfo.mHasHapticFeedbackInfo || signalFeedbackInfo.mHasSoundFeedbackInfo )
- {
- AddSignalInfo( themeInfo, signalFeedbackInfo );
- }
- }
-
- mStyleInfoLut[key] = themeInfo;
- }
-}
-
-void FeedbackController::AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo signalInfo )
-{
- bool updated = false;
- std::vector<SignalFeedbackInfo>::iterator iter;
-
- // If info exists for the signal then update it, else add new
- for( iter = styleInfo.mSignalFeedbackInfoList.begin(); iter != styleInfo.mSignalFeedbackInfoList.end(); ++iter )
- {
- if( (*iter).mSignalName == signalInfo.mSignalName )
- {
- (*iter).mHasHapticFeedbackInfo = signalInfo.mHasHapticFeedbackInfo;
- (*iter).mHapticFeedbackPattern = signalInfo.mHapticFeedbackPattern;
- (*iter).mHapticFeedbackFile = signalInfo.mHapticFeedbackFile;
- (*iter).mHasSoundFeedbackInfo = signalInfo.mHasSoundFeedbackInfo;
- (*iter).mSoundFeedbackPattern = signalInfo.mSoundFeedbackPattern;
- (*iter).mSoundFeedbackFile = signalInfo.mSoundFeedbackFile;
-
- updated = true;
- break;
- }
- }
-
- if( !updated )
- {
- styleInfo.mSignalFeedbackInfoList.push_back( signalInfo );
- }
-}
-
-string FeedbackController::GetSoundPath( const string& key ) const
-{
- std::map<const string, const string>::const_iterator iter( mSoundFilesLut.find( key ) );
- string path;
- if( iter != mSoundFilesLut.end() )
- {
- path = iter->second;
- }
- else
- {
- DALI_LOG_WARNING( "Request for sound file '%s' failed\n", key.c_str() );
- DALI_ASSERT_ALWAYS( !"Sound file does not exist" );
- }
- return path;
-}
-
-string FeedbackController::GetHapticPath( const string& key ) const
-{
- std::map<const string, const string>::const_iterator iter( mHapticFilesLut.find( key ) );
- string path;
- if( iter != mHapticFilesLut.end() )
- {
- path = iter->second;
- }
- else
- {
- DALI_LOG_WARNING( "Request for haptic file '%s' failed\n", key.c_str() );
- DALI_ASSERT_ALWAYS( !"Haptic file does not exist" );
- }
- return path;
-}
-
-void FeedbackController::PlayFeedback(const string& type, const string& signalName)
-{
- const FeedbackStyleInfo styleInfo = GetStyleInfo(type);
- SignalFeedbackInfoConstIter iter;
-
- for(iter = styleInfo.mSignalFeedbackInfoList.begin(); iter != styleInfo.mSignalFeedbackInfoList.end(); ++iter)
- {
- const SignalFeedbackInfo& info = *iter;
-
- if(info.mSignalName == signalName)
- {
- if(info.mHasHapticFeedbackInfo)
- {
- if(!info.mHapticFeedbackPattern.empty())
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FeedbackController::PlayFeedback Playing Haptic effect: Object type: %s, Signal type: %s, pattern type: %s\n",
- type.c_str(), signalName.c_str(), info.mHapticFeedbackPattern.c_str());
-
- mPlugin.PlayFeedbackPattern( FEEDBACK_TYPE_VIBRATION, GetFeedbackPattern(info.mHapticFeedbackPattern) );
- }
- else if(!info.mHapticFeedbackFile.empty())
- {
- mPlugin.PlayHaptic( info.mHapticFeedbackFile );
- }
- }
-
- if(info.mHasSoundFeedbackInfo)
- {
- if(!info.mSoundFeedbackPattern.empty())
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FeedbackController::PlayFeedback Playing Sound effect: Object type: %s, Signal type: %s, pattern type: %s\n",
- type.c_str(), signalName.c_str(), info.mHapticFeedbackPattern.c_str());
-
- mPlugin.PlayFeedbackPattern( FEEDBACK_TYPE_SOUND, GetFeedbackPattern(info.mSoundFeedbackPattern) );
- }
- else if(!info.mSoundFeedbackFile.empty())
- {
- mPlugin.PlaySound( info.mSoundFeedbackFile );
- }
- }
-
- break;
- }
- }
-}
-
-FeedbackPattern FeedbackController::GetFeedbackPattern( const string &pattern )
-{
- if( 0 == mFeedbackPatternLut.size() )
- {
- mFeedbackPatternLut["FEEDBACK_PATTERN_NONE"] = Dali::FEEDBACK_PATTERN_NONE;
- mFeedbackPatternLut["FEEDBACK_PATTERN_TAP"] = Dali::FEEDBACK_PATTERN_TAP;
- mFeedbackPatternLut["FEEDBACK_PATTERN_SIP"] = Dali::FEEDBACK_PATTERN_SIP;
- mFeedbackPatternLut["FEEDBACK_PATTERN_SIP_BACKSPACE"] = Dali::FEEDBACK_PATTERN_SIP_BACKSPACE;
- mFeedbackPatternLut["FEEDBACK_PATTERN_MAX_CHARACTER"] = Dali::FEEDBACK_PATTERN_MAX_CHARACTER;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY0"] = Dali::FEEDBACK_PATTERN_KEY0;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY1"] = Dali::FEEDBACK_PATTERN_KEY1;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY2"] = Dali::FEEDBACK_PATTERN_KEY2;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY3"] = Dali::FEEDBACK_PATTERN_KEY3;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY4"] = Dali::FEEDBACK_PATTERN_KEY4;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY5"] = Dali::FEEDBACK_PATTERN_KEY5;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY6"] = Dali::FEEDBACK_PATTERN_KEY6;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY7"] = Dali::FEEDBACK_PATTERN_KEY7;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY8"] = Dali::FEEDBACK_PATTERN_KEY8;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY9"] = Dali::FEEDBACK_PATTERN_KEY9;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY_STAR"] = Dali::FEEDBACK_PATTERN_KEY_STAR;
- mFeedbackPatternLut["FEEDBACK_PATTERN_KEY_SHARP"] = Dali::FEEDBACK_PATTERN_KEY_SHARP;
- mFeedbackPatternLut["FEEDBACK_PATTERN_HOLD"] = Dali::FEEDBACK_PATTERN_HOLD;
- mFeedbackPatternLut["FEEDBACK_PATTERN_MULTI_TAP"] = Dali::FEEDBACK_PATTERN_MULTI_TAP;
- mFeedbackPatternLut["FEEDBACK_PATTERN_HW_TAP"] = Dali::FEEDBACK_PATTERN_HW_TAP;
- mFeedbackPatternLut["FEEDBACK_PATTERN_HW_HOLD"] = Dali::FEEDBACK_PATTERN_HW_HOLD;
- mFeedbackPatternLut["FEEDBACK_PATTERN_MESSAGE"] = Dali::FEEDBACK_PATTERN_MESSAGE;
- mFeedbackPatternLut["FEEDBACK_PATTERN_MESSAGE_ON_CALL"] = Dali::FEEDBACK_PATTERN_MESSAGE_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_EMAIL"] = Dali::FEEDBACK_PATTERN_EMAIL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_EMAIL_ON_CALL"] = Dali::FEEDBACK_PATTERN_EMAIL_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_WAKEUP"] = Dali::FEEDBACK_PATTERN_WAKEUP;
- mFeedbackPatternLut["FEEDBACK_PATTERN_WAKEUP_ON_CALL"] = Dali::FEEDBACK_PATTERN_WAKEUP_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_SCHEDULE"] = Dali::FEEDBACK_PATTERN_SCHEDULE;
- mFeedbackPatternLut["FEEDBACK_PATTERN_SCHEDULE_ON_CALL"] = Dali::FEEDBACK_PATTERN_SCHEDULE_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_TIMER"] = Dali::FEEDBACK_PATTERN_TIMER;
- mFeedbackPatternLut["FEEDBACK_PATTERN_TIMER_ON_CALL"] = Dali::FEEDBACK_PATTERN_TIMER_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_GENERAL"] = Dali::FEEDBACK_PATTERN_GENERAL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_GENERAL_ON_CALL"] = Dali::FEEDBACK_PATTERN_GENERAL_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_POWERON"] = Dali::FEEDBACK_PATTERN_POWERON;
- mFeedbackPatternLut["FEEDBACK_PATTERN_POWEROFF"] = Dali::FEEDBACK_PATTERN_POWEROFF;
- mFeedbackPatternLut["FEEDBACK_PATTERN_CHARGERCONN"] = Dali::FEEDBACK_PATTERN_CHARGERCONN;
- mFeedbackPatternLut["FEEDBACK_PATTERN_CHARGERCONN_ON_CALL"] = Dali::FEEDBACK_PATTERN_CHARGERCONN_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_FULLCHARGED"] = Dali::FEEDBACK_PATTERN_FULLCHARGED;
- mFeedbackPatternLut["FEEDBACK_PATTERN_FULLCHARGED_ON_CALL"] = Dali::FEEDBACK_PATTERN_FULLCHARGED_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_LOWBATT"] = Dali::FEEDBACK_PATTERN_LOWBATT;
- mFeedbackPatternLut["FEEDBACK_PATTERN_LOWBATT_ON_CALL"] = Dali::FEEDBACK_PATTERN_LOWBATT_ON_CALL;
- mFeedbackPatternLut["FEEDBACK_PATTERN_LOCK"] = Dali::FEEDBACK_PATTERN_LOCK;
- mFeedbackPatternLut["FEEDBACK_PATTERN_UNLOCK"] = Dali::FEEDBACK_PATTERN_UNLOCK;
- mFeedbackPatternLut["FEEDBACK_PATTERN_CALLCONNECT"] = Dali::FEEDBACK_PATTERN_CALLCONNECT;
- mFeedbackPatternLut["FEEDBACK_PATTERN_DISCALLCONNECT"] = Dali::FEEDBACK_PATTERN_DISCALLCONNECT;
- mFeedbackPatternLut["FEEDBACK_PATTERN_MINUTEMINDER"] = Dali::FEEDBACK_PATTERN_MINUTEMINDER;
- mFeedbackPatternLut["FEEDBACK_PATTERN_VIBRATION"] = Dali::FEEDBACK_PATTERN_VIBRATION;
- mFeedbackPatternLut["FEEDBACK_PATTERN_SHUTTER"] = Dali::FEEDBACK_PATTERN_SHUTTER;
- mFeedbackPatternLut["FEEDBACK_PATTERN_LIST_REORDER"] = Dali::FEEDBACK_PATTERN_LIST_REORDER;
- mFeedbackPatternLut["FEEDBACK_PATTERN_SLIDER_SWEEP"] = Dali::FEEDBACK_PATTERN_SLIDER_SWEEP;
- }
-
- std::map<const string, FeedbackPattern>::const_iterator iter( mFeedbackPatternLut.find( pattern ) );
-
- if( iter != mFeedbackPatternLut.end() )
- {
- return iter->second;
- }
- else
- {
- DALI_LOG_ERROR( "Unknown feedback pattern type: %s, So Defaulting to FEEDBACK_PATTERN_NONE!\n" );
- return Dali::FEEDBACK_PATTERN_NONE;
- }
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_FEEDBACK_CONTROLLER_H__
-#define __DALI_INTERNAL_FEEDBACK_CONTROLLER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <map>
-#include <dali/public-api/object/base-handle.h>
-#include <style-monitor.h>
-
-// INTERNAL INCLUDES
-#include <feedback-plugin.h>
-#include <feedback/feedback-ids.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-struct FeedbackStyleInfo;
-struct SignalFeedbackInfo;
-
-class FeedbackPluginProxy;
-
-/**
- * Plays feedback effects for Dali-Toolkit UI Controls.
- */
-class FeedbackController : public ConnectionTracker
-{
-public:
-
- /**
- * Constructor.
- */
- FeedbackController( FeedbackPluginProxy& plugin );
-
- /**
- * The destructor
- */
- ~FeedbackController();
-
- /**
- * Called to start playing feedback effects.
- */
- void Start();
-
- /**
- * Called to stop playing feedback effects.
- */
- void Stop();
-
- /**
- * Callback function to play a feedback effect when a signal is emitted for an object
- * Plays feedback effect.
- * @param [in] type The Object type
- * @param [in] signalName The name of the signal
- */
- void PlayFeedback(const std::string& type, const std::string& signalName);
-
-private:
-
- /**
- * UI string data format
- */
- enum UIFormat
- {
- JSON, ///< String is JSON
- };
-
- /**
- * Callback function for Dali::ObjectRegistry::SignalObjectCreated signal
- * @param [in] object Handle to the newly created object
- */
- void ObjectCreatedCallback( BaseHandle object );
-
- /**
- * Helper to retrieve styleInfo from mStyleInfoLut
- * @param type A string described a type of object
- * @return The style information for the given object
- */
- const FeedbackStyleInfo& GetStyleInfo( const std::string& type) const;
-
- /**
- * Callback function for Dali::ObjectRegistry::SignalObjectCreated signal
- * @param [in] object Handle to the newly created object
- */
- void StyleChangedCallback(Dali::StyleMonitor styleMonitor, StyleChange::Type styleChange);
-
- /**
- * Callback function for Dali::Toolkit::PushButton::SignalPressed signal
- * Plays feedback effect.
- * @param [in] effect The feedback effect to play
- */
- bool LoadTheme(const std::string& data);
-
- /**
- * Loads a string representation the theme.
- * @param [in] data A string represenation of the theme.
- * @param [in] format The string representation format ie JSON.
- */
- void LoadFromString( const std::string& data );
-
- /**
- * Helper to store signal information.
- * @param [in] styleInfo The information will be stored here.
- * @param [in] signalInfo The information to add.
- */
- void AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo signalInfo );
-
- /**
- * Helper to retrieve the path to a sound file.
- * @param[in] key A string which identifies the path.
- * @return The path.
- */
- std::string GetSoundPath( const std::string& key ) const;
-
- /**
- * Helper to retrieve the path to a haptic file.
- * @param[in] key A string which identifies the path.
- * @return The path.
- */
- std::string GetHapticPath( const std::string& key ) const;
-
- /**
- * Map a pattern string to feedback pattern ID.
- * @param [in] pattern The pattern string.
- * @return A feedback pattern ID.
- */
- FeedbackPattern GetFeedbackPattern( const std::string& pattern );
-
- /**
- * Plays a feedback effect
- * @param [in] type The feedback type haptic or sound
- * @param [in] effect The feedback effect to play
- */
- void PlayEffect(FeedbackType type, FeedbackPattern effect);
-
- /**
- * Plays a haptic or sound effect file
- * @param [in] type The feedback type haptic or sound
- * @param [in] file The path to the file containing the effect
- */
- void PlayFile(FeedbackType type, const std::string& file);
-
-private:
-
- FeedbackPluginProxy& mPlugin;
-
- std::map<const std::string, FeedbackPattern> mFeedbackPatternLut; ///< Used to convert feedback pattern strings into enumerated values
- std::map<const std::string, const std::string> mSoundFilesLut; ///< Converts key strings into sound file paths
- std::map<const std::string, const std::string> mHapticFilesLut; ///< Converts key strings into haptic file paths
- std::map<const std::string, FeedbackStyleInfo> mStyleInfoLut; ///< Converts key strings into style information
-
- SlotDelegate< FeedbackController > mConnections; ///< Maintains the connections to the Object registry.
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_FEEDBACK_CONTROLLER_H__
+++ /dev/null
-#ifndef __DALI_FEEDBACK_IDS_H__
-#define __DALI_FEEDBACK_IDS_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Dali
-{
-
-/**
- * Enumerations for the types of feedback
- * Note: These are based on feedback_type_e in libsvi
- */
-enum FeedbackType
-{
- FEEDBACK_TYPE_NONE,
-
- FEEDBACK_TYPE_SOUND,
- FEEDBACK_TYPE_VIBRATION,
- FEEDBACK_TYPE_LED,
-
- FEEDBACK_TYPE_END
-};
-
-/**
- * The pattern list for feedback effects.
- * Note: These are based on feedback_pattern_e in libsvi
- */
-enum FeedbackPattern
-{
- FEEDBACK_PATTERN_NONE = -1,
-
- FEEDBACK_PATTERN_TAP = 0, /**< feedback pattern when general touch */
- FEEDBACK_PATTERN_SIP, /**< feedback pattern when touch text key */
- FEEDBACK_PATTERN_SIP_BACKSPACE, /**< feedback pattern when touch backspace key */
- FEEDBACK_PATTERN_MAX_CHARACTER, /**< feedback pattern when max character */
- FEEDBACK_PATTERN_KEY0, /**< feedback pattern when touch numeric 0 key */
- FEEDBACK_PATTERN_KEY1, /**< feedback pattern when touch numeric 1 key */
- FEEDBACK_PATTERN_KEY2, /**< feedback pattern when touch numeric 2 key */
- FEEDBACK_PATTERN_KEY3, /**< feedback pattern when touch numeric 3 key */
- FEEDBACK_PATTERN_KEY4, /**< feedback pattern when touch numeric 4 key */
- FEEDBACK_PATTERN_KEY5, /**< feedback pattern when touch numeric 5 key */
- FEEDBACK_PATTERN_KEY6, /**< feedback pattern when touch numeric 6 key */
- FEEDBACK_PATTERN_KEY7, /**< feedback pattern when touch numeric 7 key */
- FEEDBACK_PATTERN_KEY8, /**< feedback pattern when touch numeric 8 key */
- FEEDBACK_PATTERN_KEY9, /**< feedback pattern when touch numeric 9 key */
- FEEDBACK_PATTERN_KEY_STAR, /**< feedback pattern when touch star key */
- FEEDBACK_PATTERN_KEY_SHARP, /**< feedback pattern when touch sharp key */
- FEEDBACK_PATTERN_HOLD, /**< feedback pattern when touch hold */
- FEEDBACK_PATTERN_MULTI_TAP, /**< feedback pattern when multi touch */
- FEEDBACK_PATTERN_HW_TAP, /**< feedback pattern when press hardware key */
- FEEDBACK_PATTERN_HW_HOLD, /**< feedback pattern when holding press hardware key */
-
- FEEDBACK_PATTERN_MESSAGE, /**< feedback pattern when incoming a message */
- FEEDBACK_PATTERN_MESSAGE_ON_CALL, /**< feedback pattern when incoming a message on call */
- FEEDBACK_PATTERN_EMAIL, /**< feedback pattern when incoming an email */
- FEEDBACK_PATTERN_EMAIL_ON_CALL, /**< feedback pattern when incoming an email on call */
- FEEDBACK_PATTERN_WAKEUP, /**< feedback pattern when alert wake up call */
- FEEDBACK_PATTERN_WAKEUP_ON_CALL, /**< feedback pattern when alert wake up call on call */
- FEEDBACK_PATTERN_SCHEDULE, /**< feedback pattern when alert schedule alarm */
- FEEDBACK_PATTERN_SCHEDULE_ON_CALL, /**< feedback pattern when alert schedule alarm on call */
- FEEDBACK_PATTERN_TIMER, /**< feedback pattern when alert timer */
- FEEDBACK_PATTERN_TIMER_ON_CALL, /**< feedback pattern when alert timer on call */
- FEEDBACK_PATTERN_GENERAL, /**< feedback pattern when alert general event */
- FEEDBACK_PATTERN_GENERAL_ON_CALL, /**< feedback pattern when alert general event on call */
-
- FEEDBACK_PATTERN_POWERON, /**< feedback pattern when power on */
- FEEDBACK_PATTERN_POWEROFF, /**< feedback pattern when power off */
- FEEDBACK_PATTERN_CHARGERCONN, /**< feedback pattern when connecting charger */
- FEEDBACK_PATTERN_CHARGERCONN_ON_CALL, /**< feedback pattern when connecting charger on call */
- FEEDBACK_PATTERN_FULLCHARGED, /**< feedback pattern when full charged */
- FEEDBACK_PATTERN_FULLCHARGED_ON_CALL, /**< feedback pattern when full charged on call */
- FEEDBACK_PATTERN_LOWBATT, /**< feedback pattern when low battery */
- FEEDBACK_PATTERN_LOWBATT_ON_CALL, /**< feedback pattern when low battery on call */
- FEEDBACK_PATTERN_LOCK, /**< feedback pattern when lock */
- FEEDBACK_PATTERN_UNLOCK, /**< feedback pattern when unlock */
- FEEDBACK_PATTERN_CALLCONNECT, /**< feedback pattern when connecting call */
- FEEDBACK_PATTERN_DISCALLCONNECT, /**< feedback pattern when disconnecting call */
- FEEDBACK_PATTERN_MINUTEMINDER, /**< feedback pattern when minute minder */
- FEEDBACK_PATTERN_VIBRATION, /**< feedback pattern when vibration */
- FEEDBACK_PATTERN_SHUTTER, /**< feedback pattern when screen capture or camera shutter */
- FEEDBACK_PATTERN_LIST_REORDER, /**< feedback pattern when list reorder */
- FEEDBACK_PATTERN_SLIDER_SWEEP, /**< feedback pattern when slider sweep */
-
- FEEDBACK_PATTERN_END,
-};
-
-
-} // namespace Dali
-
-#endif // __DALI_FEEDBACK_IDS_H__
$(adaptor_common_dir)/clipboard-event-notifier-impl.cpp \
$(adaptor_common_dir)/command-line-options.cpp \
$(adaptor_common_dir)/drag-and-drop-detector-impl.cpp \
- $(adaptor_common_dir)/haptic-player-impl.cpp \
+ $(adaptor_common_dir)/feedback-player-impl.cpp \
$(adaptor_common_dir)/indicator-impl.cpp \
$(adaptor_common_dir)/indicator-buffer.cpp \
$(adaptor_common_dir)/kernel-trace.cpp \
$(adaptor_common_dir)/networking/socket-impl.cpp \
$(adaptor_common_dir)/networking/socket-factory.cpp \
\
- $(adaptor_common_dir)/feedback/feedback-controller.cpp \
$(adaptor_common_dir)/feedback/feedback-plugin-proxy.cpp \
\
$(adaptor_common_dir)/gl/egl-factory.cpp \
+++ /dev/null
-#ifndef __DALI_INTERNAL_HAPTIC_PLAYER_H__
-#define __DALI_INTERNAL_HAPTIC_PLAYER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-#include <dali/public-api/object/base-object.h>
-
-// INTERNAL INCLUDES
-#include <haptic-player.h>
-#include <feedback/feedback-plugin-proxy.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class FeedbackPluginProxy;
-
-/**
- * Plays haptic effects.
- */
-class HapticPlayer : public Dali::BaseObject
-{
-
-public:
-
- /**
- * Create a HapticPlayer.
- * This should only be called once by the Adaptor class.
- * @return A newly created HapticPlayer.
- */
- static Dali::HapticPlayer New();
-
- /**
- * Retrieve a handle to the HapticPlayer. This creates an instance if none has been created.
- * @return A handle to the HapticPlayer.
- */
- static Dali::HapticPlayer Get();
-
- /**
- * @copydoc Dali::HapticPlayer::PlayMonotone()
- */
- void PlayMonotone(unsigned int duration);
-
- /**
- * @copydoc Dali::HapticPlayer::PlayFile()
- */
- void PlayFile( const std::string& filePath );
-
- /**
- * @copydoc Dali::HapticPlayer::Stop()
- */
- void Stop();
-
-private:
-
- /**
- * Private Constructor; see also HapticPlayer::New()
- */
- HapticPlayer();
-
- /**
- * Virtual Destructor
- */
- virtual ~HapticPlayer();
-
- // Undefined
- HapticPlayer(const HapticPlayer&);
-
- // Undefined
- HapticPlayer& operator=(HapticPlayer&);
-
-private:
-
- FeedbackPluginProxy mPlugin;
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Internal::Adaptor::HapticPlayer& GetImplementation(Dali::HapticPlayer& player)
-{
- DALI_ASSERT_ALWAYS( player && "HapticPlayer handle is empty" );
-
- BaseObject& handle = player.GetBaseObject();
-
- return static_cast<Internal::Adaptor::HapticPlayer&>(handle);
-}
-
-inline const Internal::Adaptor::HapticPlayer& GetImplementation(const Dali::HapticPlayer& player)
-{
- DALI_ASSERT_ALWAYS( player && "HapticPlayer handle is empty" );
-
- const BaseObject& handle = player.GetBaseObject();
-
- return static_cast<const Internal::Adaptor::HapticPlayer&>(handle);
-}
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_HAPTIC_PLAYER_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <feedback-player.h>
+
+// INTERNAL INCLUDES
+#include <feedback-player-impl.h>
+
+namespace Dali
+{
+
+FeedbackPlayer::FeedbackPlayer()
+{
+}
+
+FeedbackPlayer FeedbackPlayer::Get()
+{
+ return Internal::Adaptor::FeedbackPlayer::Get();
+}
+
+FeedbackPlayer::~FeedbackPlayer()
+{
+}
+
+void FeedbackPlayer::PlayMonotone(unsigned int duration)
+{
+ GetImplementation(*this).PlayMonotone(duration);
+}
+
+void FeedbackPlayer::PlayFile(const std::string filePath)
+{
+ GetImplementation(*this).PlayFile(filePath);
+}
+
+void FeedbackPlayer::Stop()
+{
+ GetImplementation(*this).Stop();
+}
+
+int FeedbackPlayer::PlaySound( const std::string& fileName )
+{
+ return GetImplementation(*this).PlaySound(fileName);
+}
+
+void FeedbackPlayer::StopSound( int handle )
+{
+ GetImplementation(*this).StopSound(handle);
+}
+
+void FeedbackPlayer::PlayFeedbackPattern( int type, int pattern )
+{
+ GetImplementation(*this).PlayFeedbackPattern(type, pattern);
+}
+
+bool FeedbackPlayer::LoadFile(const std::string& filename, std::string& data)
+{
+ return GetImplementation(*this).LoadFile(filename, data);
+}
+
+FeedbackPlayer::FeedbackPlayer( Internal::Adaptor::FeedbackPlayer* player )
+: BaseHandle( player )
+{
+}
+
+} // namespace Dali
-#ifndef __DALI_HAPTIC_PLAYER_H__
-#define __DALI_HAPTIC_PLAYER_H__
+#ifndef __DALI_FEEDBACK_PLAYER_H__
+#define __DALI_FEEDBACK_PLAYER_H__
/*
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
{
namespace Adaptor
{
-class HapticPlayer;
+class FeedbackPlayer;
}
}
/**
- * @brief Plays haptic effects.
+ * @brief Plays feedback effects.
*/
-class DALI_IMPORT_API HapticPlayer : public BaseHandle
+class DALI_IMPORT_API FeedbackPlayer : public BaseHandle
{
public:
/**
* @brief Create an uninitialized handle.
*
- * This can be initialized by calling HapticPlayer::Get().
+ * This can be initialized by calling FeedbackPlayer::Get().
*/
- HapticPlayer();
+ FeedbackPlayer();
/**
- * @brief Create an initialized handle to the HapticPlayer.
+ * @brief Create an initialized handle to the FeedbackPlayer.
*
* @return A handle to a newly allocated Dali resource.
*/
- static HapticPlayer Get();
+ static FeedbackPlayer Get();
/**
* @brief Destructor
*
* This is non-virtual since derived Handle types must not contain data or virtual methods.
*/
- ~HapticPlayer();
+ ~FeedbackPlayer();
/**
* @brief Plays a monotone vibration.
*/
void Stop();
+ /**
+ * Plays a sound file.
+ * @param[in] fileName Path to the sound file to play.
+ * @return A handle which can be used to stop the sound playback.
+ */
+ int PlaySound( const std::string& fileName );
+
+ /**
+ * Stops a currently playing sound.
+ * @param[in] handle A handle to the currently playing sound.
+ */
+ void StopSound( int handle );
+
+ /**
+ * Plays a feedback pattern.
+ * @param[in] type The type of feedback.
+ * @param[in] pattern The ID of the pattern to play.
+ */
+ void PlayFeedbackPattern( int type, int pattern );
+
+ /*
+ * Loads a file into data
+ * @param[in] filename The filename.
+ * @param[in] data The data in the file.
+ * @return True if the file data could be loaded
+ */
+ bool LoadFile(const std::string& filename, std::string& data);
+
public: // Not intended for application developers
/**
- * @brief This constructor is used by HapticPlayer::Get().
- * @param[in] hapticPlayer A pointer to the haptic player.
+ * @brief This constructor is used by FeedbackPlayer::Get().
+ * @param[in] feedbackPlayer A pointer to the feedback player.
*/
- explicit DALI_INTERNAL HapticPlayer( Internal::Adaptor::HapticPlayer* hapticPlayer );
+ explicit DALI_INTERNAL FeedbackPlayer( Internal::Adaptor::FeedbackPlayer* feedbackPlayer );
};
} // namespace Dali
-#endif // __DALI_HAPTIC_PLAYER_H__
+#endif // __DALI_FEEDBACK_PLAYER_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <haptic-player.h>
-
-// INTERNAL INCLUDES
-#include <haptic-player-impl.h>
-
-namespace Dali
-{
-
-HapticPlayer::HapticPlayer()
-{
-}
-
-HapticPlayer HapticPlayer::Get()
-{
- return Internal::Adaptor::HapticPlayer::Get();
-}
-
-HapticPlayer::~HapticPlayer()
-{
-}
-
-void HapticPlayer::PlayMonotone(unsigned int duration)
-{
- GetImplementation(*this).PlayMonotone(duration);
-}
-
-void HapticPlayer::PlayFile(const std::string filePath)
-{
- GetImplementation(*this).PlayFile(filePath);
-}
-
-void HapticPlayer::Stop()
-{
- GetImplementation(*this).Stop();
-}
-
-HapticPlayer::HapticPlayer( Internal::Adaptor::HapticPlayer* player )
-: BaseHandle( player )
-{
-}
-
-} // namespace Dali
$(adaptor_devel_api_dir)/adaptor-framework/color-controller.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/drag-and-drop-detector.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/event-feeder.cpp \
- $(adaptor_devel_api_dir)/adaptor-framework/haptic-player.cpp \
+ $(adaptor_devel_api_dir)/adaptor-framework/feedback-player.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/imf-manager.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/orientation.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/performance-logger.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/drag-and-drop-detector.h \
$(adaptor_devel_api_dir)/adaptor-framework/event-feeder.h \
$(adaptor_devel_api_dir)/adaptor-framework/feedback-plugin.h \
- $(adaptor_devel_api_dir)/adaptor-framework/haptic-player.h \
+ $(adaptor_devel_api_dir)/adaptor-framework/feedback-player.h \
$(adaptor_devel_api_dir)/adaptor-framework/imf-manager.h \
$(adaptor_devel_api_dir)/adaptor-framework/lifecycle-controller.h \
$(adaptor_devel_api_dir)/adaptor-framework/orientation.h \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dali-adaptor-integration.pc
-# Feedback Plugin
-if USE_FEEDBACK
-plugin_themes_dir = ../../../adaptors/common/feedback
-dali_plugin_theme_files = $(plugin_themes_dir)/default-feedback-theme.json
-dalifeedbackthemedir = ${dataReadOnlyDir}/themes/feedback-themes/
-dalifeedbacktheme_DATA = ${dali_plugin_theme_files}
-endif
-
lib_LTLIBRARIES = libdali-adaptor.la
libdali_adaptor_la_SOURCES = \
-DFONT_DOWNLOADED_PATH="\"${fontDownloadedPath}\"" \
-DFONT_APPLICATION_PATH="\"${fontApplicationPath}\"" \
-DFONT_CONFIGURATION_FILE_PATH="\"${fontConfigurationFilePath}\"" \
- -DDALI_FEEDBACK_THEME_DIR="\"${dalifeedbackthemedir}\"" \
-DNON_POWER_OF_TWO_TEXTURES \
-DDALI_COMPILATION -DDALI_ADAPTOR_COMPILATION \
-Werror -Wall -lgcc \