/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
#include "dali-feedback.h"
// EXTERNAL INCLUDES
-#include <iostream>
-#include <fstream>
#include <feedback.h>
#include <mm_sound.h>
#include <mm_sound_private.h>
+#include <fstream>
+#include <iostream>
#include <dlog.h>
-#define DEBUG_PRINTF(fmt, arg...) LOGD(" " fmt, ##arg)
+#define DEBUG_PRINTF(fmt, arg...) LOGD(" " fmt, ##arg)
using std::string;
using namespace Dali;
namespace Dali
{
-
namespace Plugin
{
-
DaliFeedback::DaliFeedback()
{
feedback_initialize();
feedback_deinitialize();
}
-void DaliFeedback::PlayHaptic( const std::string& filePath )
+void DaliFeedback::PlayHaptic(const std::string& filePath)
{
}
-void DaliFeedback::PlayHapticMonotone( unsigned int duration )
+void DaliFeedback::PlayHapticMonotone(unsigned int duration)
{
}
{
}
-int DaliFeedback::PlaySound( const std::string& fileName )
+int DaliFeedback::PlaySound(const std::string& fileName)
{
- int handle = -1;
- int errorCode = mm_sound_play_keysound( fileName.c_str(), VOLUME_TYPE_SYSTEM & VOLUME_GAIN_TOUCH );
- if( errorCode < 0 )
+ int handle = -1;
+ int errorCode = mm_sound_play_keysound(fileName.c_str(), VOLUME_TYPE_SYSTEM & VOLUME_GAIN_TOUCH);
+ if(errorCode < 0)
{
- DEBUG_PRINTF( "PlaySound() %s failed with error code = %d\n", fileName.c_str(), errorCode );
+ DEBUG_PRINTF("PlaySound() %s failed with error code = %d\n", fileName.c_str(), errorCode);
}
return handle;
}
-void DaliFeedback::StopSound( int handle )
+void DaliFeedback::StopSound(int handle)
{
- int errorCode = mm_sound_stop_keysound( NULL );
- if( errorCode < 0 )
+ int errorCode = mm_sound_stop_keysound(NULL);
+ if(errorCode < 0)
{
- DEBUG_PRINTF( "StopSound() handle = %d failed with error code = %d\n", handle, errorCode);
+ DEBUG_PRINTF("StopSound() handle = %d failed with error code = %d\n", handle, errorCode);
}
else
{
- DEBUG_PRINTF( "stop handle %d success\n", handle );
+ DEBUG_PRINTF("stop handle %d success\n", handle);
}
}
-void DaliFeedback::PlayFeedbackPattern( int type, int pattern )
+void DaliFeedback::PlayFeedbackPattern(int type, int pattern)
{
- int errorCode = feedback_play_type( static_cast<feedback_type_e>(type), static_cast<feedback_pattern_e>(pattern) );
- if( errorCode != 0 )
+ int errorCode = feedback_play_type(static_cast<feedback_type_e>(type), static_cast<feedback_pattern_e>(pattern));
+ if(errorCode != 0)
{
- DEBUG_PRINTF( "DaliFeedback::PlayFeedbackPattern() with type = %d, pattern = %d returned with error = %d\n", (int)type, (int)pattern, errorCode );
+ DEBUG_PRINTF("DaliFeedback::PlayFeedbackPattern() with type = %d, pattern = %d returned with error = %d\n", (int)type, (int)pattern, errorCode);
}
}
} // namespace Plugin
} // namespace Dali
-