[Sound] Added logs in methods onEntered and onReturn
authorPiotr Kosko <p.kosko@samsung.com>
Wed, 27 May 2015 12:10:54 +0000 (14:10 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 28 May 2015 11:02:46 +0000 (20:02 +0900)
Change-Id: I3786d4394f365a0b8d466670679c441e944a96ba
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/sound/sound_instance.cc
src/sound/sound_manager.cc
src/sound/sound_manager.h

index 0c7c8bf35bc430cf0be508704db601ceed38e1ae..2d2c1d86a34d18dfc03bdd0af7f2b67ed516c9b1 100644 (file)
@@ -18,6 +18,7 @@ using namespace common;
 using namespace extension::sound;
 
 SoundInstance::SoundInstance(): manager_(*this) {
+  LoggerD("Enter");
   using std::placeholders::_1;
   using std::placeholders::_2;
 
@@ -40,6 +41,7 @@ SoundInstance::SoundInstance(): manager_(*this) {
 }
 
 SoundInstance::~SoundInstance() {
+  LoggerD("Enter");
 }
 
 #define CHECK_EXIST(args, name, out) \
@@ -50,58 +52,75 @@ SoundInstance::~SoundInstance() {
 
 void SoundInstance::SoundManagerGetSoundMode(const picojson::value& args,
                                              picojson::object& out) {
+  LoggerD("Enter");
   std::string sound_mode_type;
   PlatformResult status = manager_.GetSoundMode(&sound_mode_type);
 
-  if (status.IsSuccess())
+  if (status.IsSuccess()) {
     ReportSuccess(picojson::value(sound_mode_type), out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 void SoundInstance::SoundManagerSetVolume(const picojson::value& args,
                                           picojson::object& out) {
+  LoggerD("Enter");
   PlatformResult status = manager_.SetVolume(args.get<picojson::object>());
 
-  if (status.IsSuccess())
+  if (status.IsSuccess()) {
     ReportSuccess(out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 
 void SoundInstance::SoundManagerGetVolume(const picojson::value& args,
                                           picojson::object& out) {
+  LoggerD("Enter");
   double volume;
   PlatformResult status =
       manager_.GetVolume(args.get<picojson::object>(), &volume);
 
-  if (status.IsSuccess())
+  if (status.IsSuccess()) {
     ReportSuccess(picojson::value(volume), out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 void SoundInstance::SoundManagerSetSoundModeChangeListener(const picojson::value& args, picojson::object& out) {
+  LoggerD("Enter");
   PlatformResult status = manager_.SetSoundModeChangeListener(this);
 
-  if (status.IsSuccess())
+  if (status.IsSuccess()) {
     ReportSuccess(out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 void SoundInstance::SoundManagerUnsetSoundModeChangeListener(const picojson::value& args, picojson::object& out) {
   PlatformResult status = manager_.UnsetSoundModeChangeListener();
 
-  if (status.IsSuccess())
+  LoggerD("Enter");
+
+  if (status.IsSuccess()) {
     ReportSuccess(out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 void SoundInstance::OnSoundModeChange(const std::string& newmode)
 {
+  LoggerD("Enter");
   picojson::value event = picojson::value(picojson::object());
   picojson::object& obj = event.get<picojson::object>();
   picojson::value result = picojson::value(newmode);
@@ -114,22 +133,28 @@ void SoundInstance::OnSoundModeChange(const std::string& newmode)
 
 void SoundInstance::SoundManagerSetVolumeChangeListener(
     const picojson::value& args, picojson::object& out) {
+  LoggerD("Enter");
   PlatformResult status = manager_.SetVolumeChangeListener();
 
-  if (status.IsSuccess())
+  if (status.IsSuccess()) {
     ReportSuccess(out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 void SoundInstance::SoundManagerUnsetVolumeChangeListener(
     const picojson::value& args, picojson::object& out) {
+  LoggerD("Enter");
   PlatformResult status = manager_.UnsetVolumeChangeListener();
 
-  if (status.IsSuccess())
+  if (status.IsSuccess()) {
     ReportSuccess(out);
-  else
+  } else {
+    LoggerE("Failed");
     ReportError(status, &out);
+  }
 }
 
 void SoundInstance::SoundManagerGetConnectedDeviceList(
@@ -155,6 +180,7 @@ void SoundInstance::SoundManagerAddDeviceStateChangeListener(
   if (result.IsSuccess()) {
     ReportSuccess(out);
   } else {
+    LoggerE("Failed");
     ReportError(result, &out);
   }
 }
@@ -168,6 +194,7 @@ void SoundInstance::SoundManagerRemoveDeviceStateChangeListener(
   if (result.IsSuccess()) {
     ReportSuccess(out);
   } else {
+    LoggerE("Failed");
     ReportError(result, &out);
   }
 }
index aca72791c3c52c03f7e43ea0959a818f52ec679a..7d57823ec8debc88cb8dcc929013abd266c369f3 100644 (file)
@@ -37,6 +37,7 @@ const std::map<std::string, sound_type_e> SoundManager::platform_enum_map_ = {
 
 PlatformResult SoundManager::StrToPlatformEnum(const std::string& key,
                                                sound_type_e* sound_type) {
+  LoggerD("Enter");
   if (platform_enum_map_.find(key) == platform_enum_map_.end()) {
     std::string message = "Platform enum value not found for key " + key;
     return PlatformResult(ErrorCode::INVALID_VALUES_ERR, message);
@@ -49,6 +50,7 @@ PlatformResult SoundManager::StrToPlatformEnum(const std::string& key,
 
 PlatformResult SoundManager::PlatformEnumToStr(const sound_type_e value,
                                                std::string* sound_type) {
+  LoggerD("Enter");
   for (auto& item : platform_enum_map_) {
     if (item.second == value) {
       *sound_type = item.first;
@@ -64,6 +66,7 @@ PlatformResult SoundManager::PlatformEnumToStr(const sound_type_e value,
 }
 
 std::string SoundManager::SoundDeviceTypeToString(sound_device_type_e type) {
+  LoggerD("Enter");
   switch (type) {
     case SOUND_DEVICE_BUILTIN_SPEAKER:
       return "SPEAKER";
@@ -88,6 +91,7 @@ std::string SoundManager::SoundDeviceTypeToString(sound_device_type_e type) {
 }
 
 std::string SoundManager::SoundIOTypeToString(sound_device_io_direction_e type) {
+  LoggerD("Enter");
   switch (type) {
     case SOUND_DEVICE_IO_DIRECTION_IN:
       return "IN";
@@ -110,6 +114,7 @@ SoundManager::SoundManager(SoundInstance& instance)
 }
 
 SoundManager::~SoundManager() {
+  LoggerD("Enter");
   if (soundModeChangeListening) {
     int status = vconf_ignore_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, SoundManager::soundModeChangedCb);
     if (VCONF_OK != status) {
@@ -135,6 +140,7 @@ SoundManager::~SoundManager() {
 }
 
 void SoundManager::FillMaxVolumeMap() {
+  LoggerD("Enter");
   int max = 100;
   int ret;
 
@@ -153,6 +159,7 @@ void SoundManager::FillMaxVolumeMap() {
 }
 
 PlatformResult SoundManager::GetMaxVolume(sound_type_e type, int* max_volume) {
+  LoggerD("Enter");
   auto it = max_volume_map_.find(type);
   if (it == max_volume_map_.end()) {
     std::string sound_type;
@@ -169,6 +176,7 @@ PlatformResult SoundManager::GetMaxVolume(sound_type_e type, int* max_volume) {
 }
 
 double SoundManager::ConvertToSystemVolume(int max_volume, int volume) {
+  LoggerD("Enter");
   return static_cast<double>(volume) / max_volume;
 }
 
@@ -203,6 +211,7 @@ void SoundManager::VolumeChangeCallback(sound_type_e type, unsigned int value) {
 }
 
 PlatformResult SoundManager::GetSoundMode(std::string* sound_mode_type) {
+  LoggerD("Enter");
   int isEnableSound = 0;
   int isEnableVibrate = 0;
 
@@ -238,6 +247,7 @@ PlatformResult SoundManager::GetSoundMode(std::string* sound_mode_type) {
 }
 
 PlatformResult SoundManager::SetVolume(const picojson::object& args) {
+  LoggerD("Enter");
   const std::string& type = FromJson<std::string>(args, "type");
   double volume = FromJson<double>(args, "volume");
 
@@ -275,6 +285,7 @@ PlatformResult SoundManager::SetVolume(const picojson::object& args) {
 
 PlatformResult SoundManager::GetVolume(const picojson::object& args,
                                        double* volume) {
+  LoggerD("Enter");
   const std::string& type = FromJson<std::string>(args, "type");
   int value;
 
@@ -300,6 +311,7 @@ PlatformResult SoundManager::GetVolume(const picojson::object& args,
 
 void SoundManager::soundModeChangedCb(keynode_t*, void* user_data)
 {
+  LoggerD("Enter");
   if (user_data == nullptr) {
     LoggerE("Invalid callback data!");
     return;
@@ -318,6 +330,7 @@ void SoundManager::soundModeChangedCb(keynode_t*, void* user_data)
 
 PlatformResult SoundManager::SetSoundModeChangeListener(
     SoundManagerSoundModeChangedListener* listener) {
+  LoggerD("Enter");
   soundModeListener = listener;
   if (soundModeChangeListening) return PlatformResult(ErrorCode::NO_ERROR);
 
@@ -334,6 +347,7 @@ PlatformResult SoundManager::SetSoundModeChangeListener(
 }
 
 PlatformResult SoundManager::UnsetSoundModeChangeListener() {
+  LoggerD("Enter");
   soundModeListener = nullptr;
   if (!soundModeChangeListening) {
     return PlatformResult(ErrorCode::NO_ERROR);
@@ -352,6 +366,7 @@ PlatformResult SoundManager::UnsetSoundModeChangeListener() {
 }
 
 PlatformResult SoundManager::SetVolumeChangeListener() {
+  LoggerD("Enter");
   if (!is_volume_change_listener_) {
     int ret = sound_manager_set_volume_changed_cb(
         [](sound_type_e type, unsigned int value, void* ud) {
@@ -373,6 +388,7 @@ PlatformResult SoundManager::SetVolumeChangeListener() {
 }
 
 PlatformResult SoundManager::UnsetVolumeChangeListener() {
+  LoggerD("Enter");
   if (!is_volume_change_listener_) {
     return PlatformResult(ErrorCode::NO_ERROR);
   }
index e66ff5605c51a826a64980bdef7c40674354e60c..0195723178490bb3276558304a5c07ec33b008c5 100644 (file)
@@ -55,7 +55,7 @@ class SoundManager {
                                                   sound_type_e* sound_type);
   static common::PlatformResult PlatformEnumToStr(const sound_type_e value,
                                                   std::string* sound_type);
-                                                  
+
   common::PlatformResult GetDeviceInfo(sound_device_h device,
                                        bool is_connected,
                                        bool check_connection,