#ifdef FEATURE_FEEDBACK_DLOG
#define LOG_TAG "FEEDBACK"
#include <dlog.h>
- #define FEEDBACK_LOG(fmt, args...) SLOGD(fmt, ##args)
- #define FEEDBACK_ERROR(fmt, args...) SLOGE(fmt, ##args)
+ #define _D(fmt, args...) SLOGD(fmt, ##args)
+ #define _W(fmt, args...) SLOGW(fmt, ##args)
+ #define _E(fmt, args...) SLOGE(fmt, ##args)
#else
- #define FEEDBACK_LOG(x, ...)
- #define FEEDBACK_ERROR(x, ...)
+ #define _D(x, ...)
+ #define _W(x, ...)
+ #define _E(x, ...)
#endif
#endif //__LOG_H__
const struct device_ops *dev;
DD_LIST_FOREACH(dev_head, elem, dev) {
- FEEDBACK_LOG("[%s] initialize", str_type[dev->type]);
+ _D("[%s] initialize", str_type[dev->type]);
if (dev->init)
dev->init();
}
const struct device_ops *dev;
DD_LIST_FOREACH(dev_head, elem, dev) {
- FEEDBACK_LOG("[%s] deinitialize", str_type[dev->type]);
+ _D("[%s] deinitialize", str_type[dev->type]);
if (dev->exit)
dev->exit();
}
/* check call status */
if (vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) < 0)
- FEEDBACK_ERROR("vconf_get_int(VCONFKEY_CALL_STATE, &callstatus) ==> FAIL!!");
+ _W("VCONFKEY_CALL_STATE ==> FAIL!!");
/* add watch for status value */
vconf_notify_key_changed(VCONFKEY_CALL_STATE, feedback_callstatus_cb, NULL);
{
/* check initialize */
if (!binit) {
- FEEDBACK_ERROR("Not initialized");
+ _E("Not initialized");
return FEEDBACK_ERROR_NOT_INITIALIZED;
}
if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
- FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+ _E("Invalid parameter : pattern(%d)", pattern);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (pattern == FEEDBACK_PATTERN_NONE) {
- FEEDBACK_LOG("pattern is NONE");
+ _D("pattern is NONE");
return FEEDBACK_ERROR_NONE;
}
/* in case of call connected or connecting */
if (callstatus != VCONFKEY_CALL_OFF) {
pattern = get_alert_on_call_key(pattern);
- FEEDBACK_LOG("Call status is connected or connecting. pattern changed : %s", str_pattern[pattern]);
+ _D("Call status is connected or connecting. pattern changed : %s", str_pattern[pattern]);
}
/* play all device */
/* check initialize */
if (!binit) {
- FEEDBACK_ERROR("Not initialized");
+ _E("Not initialized");
return FEEDBACK_ERROR_NOT_INITIALIZED;
}
if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
- FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+ _E("Invalid parameter : type(%d)", type);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (pattern < FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
- FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+ _E("Invalid parameter : pattern(%d)", pattern);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (pattern == FEEDBACK_PATTERN_NONE) {
- FEEDBACK_LOG("pattern is NONE");
+ _D("pattern is NONE");
return FEEDBACK_ERROR_NONE;
}
/* in case of call connected or connecting */
if (callstatus != VCONFKEY_CALL_OFF) {
pattern = get_alert_on_call_key(pattern);
- FEEDBACK_LOG("Call status is connected or connecting. pattern changed : %s", str_pattern[pattern]);
+ _D("Call status is connected or connecting. pattern changed : %s", str_pattern[pattern]);
}
/* play proper device */
if (dev) {
err = dev->play(pattern);
if (err < 0)
- FEEDBACK_ERROR("fail to play sound");
+ _E("fail to play sound");
}
return FEEDBACK_ERROR_NONE;
int err;
if (path == NULL) {
- FEEDBACK_ERROR("Invalid parameter : path(NULL)");
+ _E("Invalid parameter : path(NULL)");
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
- FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+ _E("Invalid parameter : type(%d)", type);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
- FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+ _E("Invalid parameter : pattern(%d)", pattern);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
int err;
if (path == NULL) {
- FEEDBACK_ERROR("Invalid parameter : path(NULL)");
+ _E("Invalid parameter : path(NULL)");
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (type <= FEEDBACK_TYPE_NONE || type >= FEEDBACK_TYPE_END) {
- FEEDBACK_ERROR("Invalid parameter : type(%d)", type);
+ _E("Invalid parameter : type(%d)", type);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
if (pattern <= FEEDBACK_PATTERN_NONE || pattern >= FEEDBACK_PATTERN_END) {
- FEEDBACK_ERROR("Invalid parameter : pattern(%d)", pattern);
+ _E("Invalid parameter : pattern(%d)", pattern);
return FEEDBACK_ERROR_INVALID_PARAMETER;
}
/* check symbolic link file existence */
if (stat(sym_path, &buf)) {
- FEEDBACK_ERROR("file(%s) is not presents", sym_path);
+ _E("file(%s) is not presents", sym_path);
return -EPERM;
}
if (unlink(sym_path) < 0)
- FEEDBACK_LOG("unlink(%s) : %s", sym_path, strerror(errno));
+ _D("unlink(%s) : %s", sym_path, strerror(errno));
if (symlink(new_path, sym_path) < 0) {
- FEEDBACK_ERROR("symlink(%s) : %s", sym_path, strerror(errno));
+ _E("symlink(%s) : %s", sym_path, strerror(errno));
return -EPERM;
}
cur_path = sound_file[pattern];
/* if there isn't cur_path, it already returns before calling this api */
if (cur_path == NULL || strlen(cur_path) == 0) {
- FEEDBACK_ERROR("Invalid parameter : cur_path(NULL)");
+ _E("Invalid parameter : cur_path(NULL)");
return -EPERM;
}
temp = strcat(default_path, FEEDBACK_ORIGIN_DATA_DIR);
strcat(temp, cur_path+strlen(FEEDBACK_DATA_DIR));
- FEEDBACK_LOG("default_path : %s", default_path);
+ _D("default_path : %s", default_path);
ret = change_symlink(cur_path, default_path);
if (ret < 0) {
- FEEDBACK_ERROR("change_symlink is failed");
+ _E("change_symlink is failed");
return -EPERM;
}
{
/* Sound Init */
if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) < 0)
- FEEDBACK_ERROR("vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) ==> FAIL!!");
+ _W("VCONFKEY_SETAPPL_SOUND_STATUS_BOOL ==> FAIL!!");
if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sndstatus) < 0)
- FEEDBACK_ERROR("vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sndstatus) ==> FAIL!!");
+ _W("VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL ==> FAIL!!");
if (vconf_get_int(VCONFKEY_SOUND_STATUS, &soundon) < 0)
- FEEDBACK_ERROR("vconf_get_int(VCONFKEY_SOUND_STATUS, &soundon) ==> FAIL!!");
+ _W("VCONFKEY_SOUND_STATUS ==> FAIL!!");
/* add watch for status value */
vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, feedback_sndstatus_cb, NULL);
int retry = FEEDBACK_RETRY_CNT, ret;
if (sndstatus == 0 && !get_always_alert_case(pattern)) {
- FEEDBACK_LOG("Sound condition is OFF (sndstatus : %d)", sndstatus);
+ _D("Sound condition is OFF (sndstatus : %d)", sndstatus);
return 0;
}
if (soundon == 1 && pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD) {
- FEEDBACK_LOG("Touch feedback sound doesn't work during playing sound");
+ _D("Touch feedback sound doesn't work during playing sound");
return 0;
}
if (touch_sndstatus == 0 && pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD) {
- FEEDBACK_LOG("Touch Sound condition is OFF and pattern is touch type (touch_sndstatus : %d, pattern : %s)", touch_sndstatus, str_pattern[pattern]);
+ _D("Touch Sound condition is OFF and pattern is touch type (touch_sndstatus : %d, pattern : %s)", touch_sndstatus, str_pattern[pattern]);
return 0;
}
if (sound_file[pattern] == NULL) {
- FEEDBACK_LOG("This case(%s) does not play sound", str_pattern[pattern]);
+ _D("This case(%s) does not play sound", str_pattern[pattern]);
return 0;
}
if (stat(sound_file[pattern], &buf)) {
- FEEDBACK_ERROR("%s is not presents", sound_file[pattern]);
+ _E("%s is not presents", sound_file[pattern]);
ret = restore_default_file(pattern);
if (ret < 0) {
- FEEDBACK_ERROR("restore_default_file(%s) error", str_pattern[pattern]);
+ _E("restore_default_file(%s) error", str_pattern[pattern]);
return -EPERM;
}
- FEEDBACK_LOG("%s is restored", sound_file[pattern]);
+ _D("%s is restored", sound_file[pattern]);
}
do {
ret = mm_sound_play_keysound(sound_file[pattern], get_volume_type(pattern));
if (ret == MM_ERROR_NONE) {
- FEEDBACK_LOG("Play success! SND filename is %s", sound_file[pattern]);
+ _D("Play success! SND filename is %s", sound_file[pattern]);
return 0;
}
- FEEDBACK_ERROR("mm_sound_play_keysound() returned error(%d)", ret);
+ _E("mm_sound_play_keysound() returned error(%d)", ret);
} while(retry--);
return -EPERM;
cur_path = sound_file[pattern];
if (cur_path == NULL) {
- FEEDBACK_ERROR("This pattern(%s) in sound type is not supported to play", str_pattern[pattern]);
+ _E("This pattern(%s) in sound type is not supported to play", str_pattern[pattern]);
snprintf(buf, buflen, "NULL");
return -ENOENT;
}
do {
if(readlink(cur_path, buf, buflen) < 0) {
- FEEDBACK_ERROR("readlink is failed : %s", strerror(errno));
+ _E("readlink is failed : %s", strerror(errno));
return -EPERM;
}
} while(retry--);
assert(path != NULL);
if (access(path, F_OK) != 0) {
- FEEDBACK_ERROR("Invalid parameter : path does not exist");
+ _E("Invalid parameter : path does not exist");
return -ENOENT;
}
cur_path = sound_file[pattern];
if (cur_path == NULL) {
- FEEDBACK_ERROR("This pattern(%s) in sound type is not supported to play", str_pattern[pattern]);
+ _E("This pattern(%s) in sound type is not supported to play", str_pattern[pattern]);
return -ENOENT;
}
ret = change_symlink(cur_path, path);
if (ret < 0) {
- FEEDBACK_ERROR("change_symlink is failed");
+ _E("change_symlink is failed");
return -EPERM;
}
else
level = vib_level;
- FEEDBACK_LOG("Call status : %d, pattern : %s, level : %d", callstatus, str_pattern[pattern], level);
+ _D("Call status : %d, pattern : %s, level : %d", callstatus, str_pattern[pattern], level);
if (callstatus != VCONFKEY_CALL_OFF) {
// if call status is ON, vibration magnitude is 20%
level = (int)(level*0.2f);
level = (level < 1) ? 1 : level;
- FEEDBACK_LOG("level changed : %d", level);
+ _D("level changed : %d", level);
}
level = level * 20;
cur = xml_find(doc, (const xmlChar*)str_pattern[pattern]);
if (cur == NULL) {
- FEEDBACK_ERROR("xml_find fail");
+ _E("xml_find fail");
return -1;
}
retData = xml_parse(doc, cur);
if (retData == NULL) {
- FEEDBACK_ERROR("xml_parse fail");
+ _E("xml_parse fail");
return -1;
}
/* check symbolic link file existence */
if (stat(sym_path, &buf)) {
- FEEDBACK_ERROR("file(%s) is not presents", sym_path);
+ _E("file(%s) is not presents", sym_path);
return -EPERM;
}
if (unlink(sym_path) < 0)
- FEEDBACK_LOG("unlink(%s) : %s", sym_path, strerror(errno));
+ _D("unlink(%s) : %s", sym_path, strerror(errno));
if (symlink(new_path, sym_path) < 0) {
- FEEDBACK_ERROR("symlink(%s) : %s", sym_path, strerror(errno));
+ _E("symlink(%s) : %s", sym_path, strerror(errno));
return -EPERM;
}
cur_path = haptic_file[pattern];
// if there isn't cur_path, it already returns before calling this api
if (cur_path == NULL || strlen(cur_path) == 0) {
- FEEDBACK_ERROR("Invalid parameter : cur_path(NULL)");
+ _E("Invalid parameter : cur_path(NULL)");
return -EPERM;
}
temp = strcat(default_path, FEEDBACK_ORIGIN_DATA_DIR);
strcat(temp, cur_path+strlen(FEEDBACK_DATA_DIR));
- FEEDBACK_LOG("default_path : %s", default_path);
+ _D("default_path : %s", default_path);
ret = change_symlink(cur_path, default_path);
if (ret < 0) {
- FEEDBACK_ERROR("change_symlink is failed");
+ _E("change_symlink is failed");
return -EPERM;
}
/* xml Init */
v_doc = xml_open(VIBRATION_XML);
if (v_doc == NULL) {
- FEEDBACK_ERROR("xml_open(%s) fail", VIBRATION_XML);
+ _E("xml_open(%s) fail", VIBRATION_XML);
return;
}
/* Vibration Init */
ret = haptic_open(HAPTIC_DEVICE_ALL, &v_handle);
if (ret != HAPTIC_ERROR_NONE) {
- FEEDBACK_ERROR("haptic_open(HAPTIC_DEVICE_ALL, &v_handle) ==> FAIL!! : %d", ret);
+ _E("haptic_open ==> FAIL!! : %d", ret);
xml_close(v_doc);
v_doc = NULL;
return;
/* check vibration status */
if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) < 0)
- FEEDBACK_ERROR("vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) ==> FAIL!!");
+ _W("VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL ==> FAIL!!");
/* check vib_level */
if (vconf_get_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, &vib_level) < 0)
- FEEDBACK_ERROR("vconf_get_int(VCONFKEY_FEEDBACK_VIBRATION_LEVEL_INT, &vib_level) ==> FAIL!!");
+ _W("VCONFKEY_FEEDBACK_VIBRATION_LEVEL_INT ==> FAIL!!");
/* check noti_level */
if (vconf_get_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, ¬i_level) < 0)
- FEEDBACK_ERROR("vconf_get_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, ¬i_level) ==> FAIL!!");
+ _W("VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT ==> FAIL!!");
/* add watch for status value */
vconf_notify_key_changed(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, feedback_vibstatus_cb, NULL);
if (v_handle) {
ret = haptic_close(v_handle);
if (ret != HAPTIC_ERROR_NONE)
- FEEDBACK_ERROR("haptic_close is failed : %d", ret);
+ _E("haptic_close is failed : %d", ret);
v_handle = NULL;
}
struct xmlData *data;
if (!v_handle || !v_doc) {
- FEEDBACK_ERROR("Not initialize");
+ _E("Not initialize");
return -EPERM;
}
if (vibstatus == 0 && !get_always_alert_case(pattern)) {
- FEEDBACK_LOG("Vibration condition is OFF (vibstatus : %d)", vibstatus);
+ _D("Vibration condition is OFF (vibstatus : %d)", vibstatus);
return 0;
}
ret = get_xml_data(v_doc, pattern, &data);
if (ret < 0) {
- FEEDBACK_ERROR("feedback_get_vibration_data fail");
+ _E("get_xml_data fail");
return -EPERM;
}
if (data->data == NULL) {
- FEEDBACK_LOG("This case(%s) does not play vibration", str_pattern[pattern]);
+ _D("This case(%s) does not play vibration", str_pattern[pattern]);
release_xml_data(data);
return 0;
}
ret = haptic_vibrate_buffer_with_detail(v_handle, data->data, HAPTIC_ITERATION_ONCE,
get_haptic_level(pattern), get_priority(pattern), NULL);
if (ret != HAPTIC_ERROR_NONE) {
- FEEDBACK_ERROR("haptic_vibrate_buffer_with_detail is failed");
+ _E("haptic_vibrate_buffer_with_detail is failed");
release_xml_data(data);
return -EPERM;
}
cur_path = haptic_file[pattern];
if (cur_path == NULL) {
- FEEDBACK_ERROR("This pattern(%s) in vibrator type is not supported to play", str_pattern[pattern]);
+ _E("This pattern(%s) in vibrator type is not supported to play", str_pattern[pattern]);
snprintf(buf, buflen, "NULL");
return -ENOENT;
}
do {
if(readlink(cur_path, buf, buflen) < 0) {
- FEEDBACK_ERROR("readlink is failed : %s", strerror(errno));
+ _E("readlink is failed : %s", strerror(errno));
return -EPERM;
}
} while(retry--);
assert(path != NULL);
if (access(path, F_OK) != 0) {
- FEEDBACK_ERROR("Invalid parameter : path does not exist");
+ _E("Invalid parameter : path does not exist");
return -ENOENT;
}
cur_path = haptic_file[pattern];
if (cur_path == NULL) {
- FEEDBACK_ERROR("This pattern(%s) in vibrator type is not supported to play", str_pattern[pattern]);
+ _E("This pattern(%s) in vibrator type is not supported to play", str_pattern[pattern]);
return -ENOENT;
}
ret = change_symlink(cur_path, path);
if (ret < 0) {
- FEEDBACK_ERROR("change_symlink is failed");
+ _E("change_symlink is failed");
return -EPERM;
}
doc = xmlReadFile(xml, NULL, 0);
if (doc == NULL) {
- FEEDBACK_ERROR("xmlReadFile fail");
+ _E("xmlReadFile fail");
return NULL;
}
root = xmlDocGetRootElement(doc);
if (root == NULL) {
- FEEDBACK_ERROR("xmlDocGetRootElement fail");
+ _E("xmlDocGetRootElement fail");
return NULL;
}
data = (struct xmlData*)malloc(sizeof(struct xmlData));
if (data == NULL) {
- FEEDBACK_ERROR("out of memory");
+ _E("out of memory");
return NULL;
}
for (node = cur->children; node != NULL; node = node->next) {
if (!xmlStrcmp(node->name, (const xmlChar*)data_str[XML_LABEL])) {
data->label = (char*)xmlNodeListGetString(doc, node->children, 1);
- FEEDBACK_LOG("label : %s", data->label);
+ _D("label : %s", data->label);
} else if (!xmlStrcmp(node->name, (const xmlChar*)data_str[XML_DATA])) {
b64_data = (char *)xmlNodeListGetString(doc, node->children, 1);
if (b64_data != NULL) {
- FEEDBACK_LOG("b64_data : %s", b64_data);
+ _D("b64_data : %s", b64_data);
data->data = g_base64_decode(b64_data, &len);
xmlFree(b64_data);
}
r = xmlSaveFile(path, doc);
if (r < 0) {
- FEEDBACK_ERROR("xmlSaveFile fail");
+ _E("xmlSaveFile fail");
return -1;
}