#include <stdlib.h>
#include <memory.h>
#include <unistd.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <sys/types.h>
#include <fcntl.h>
#include <vconf.h>
-#include <sys/stat.h>
-#include <errno.h>
#include <gio/gio.h>
-#include <mm_types.h>
#include <mm_error.h>
-#include <mm_message.h>
#include <mm_debug.h>
#include <mm_sound.h>
-#include <mm_sound_private.h>
#include "include/mm_sound_common.h"
static const char* convert_volume_type_to_role(int volume_type)
{
- debug_warning ("volume_type(%d)", volume_type);
+ debug_log("volume_type(%d)", volume_type);
switch(volume_type) {
case VOLUME_TYPE_MEDIA:
return "media";
return "alarm";
case VOLUME_TYPE_VOICE:
return "voice";
+ case VOLUME_TYPE_RINGTONE:
+ return "ringtone-call";
default:
debug_warning ("not supported type(%d), we change it SYSTEM type forcibly" );
return "system";
static const char* convert_volume_gain_type_to_string(int volume_gain_type)
{
- debug_warning ("volume_gain_type(0x%x)", volume_gain_type);
+ debug_log("volume_gain_type(0x%x)", volume_gain_type);
switch(volume_gain_type) {
case VOLUME_GAIN_DEFAULT:
- return NULL;
+ return "";
case VOLUME_GAIN_DIALER:
return "dialer";
case VOLUME_GAIN_TOUCH:
case VOLUME_GAIN_TTS:
return "tts";
default:
- return NULL;
+ return "";
}
}
EXPORT_API
int mm_sound_play_keysound(const char *filename, int volume_config)
{
- return _mm_sound_play_keysound(filename, volume_config, IPC_TYPE_DBUS);
+ return _mm_sound_play_keysound(filename, volume_config, IPC_TYPE_PIPE);
}
static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_type_t ipc_type)
/* Check whether file exists */
fd = open(filename, O_RDONLY);
if (fd == -1) {
- debug_error("file open failed with [%s][%d]\n", strerror(errno), errno);
+ char str_error[256];
+ strerror_r(errno, str_error, sizeof(str_error));
+ debug_error("file open failed with [%s][%d]\n", str_error, errno);
switch (errno) {
case ENOENT:
return MM_ERROR_SOUND_FILE_NOT_FOUND;
/* Write to PIPE */
res = write(fd, &data, size);
if (res < 0) {
- debug_error("Fail to write data: [%s][%d]\n", strerror(errno), errno);
- close(fd);
+ char str_error[256];
+ strerror_r(errno, str_error, sizeof(str_error));
+ debug_error("Fail to write data: [%s][%d]\n", str_error, errno);
ret = MM_ERROR_SOUND_INTERNAL;
}
/* Close PIPE */