if (err) {
BT_ERR("Error = %s", err->message);
g_dbus_error_strip_remote_error(err);
- if (strcmp(err->message, "Operation not supported") == 0)
- ret = BLUETOOTH_ERROR_NOT_IN_OPERATION;
- else if (strcmp(err->message, "Operation not allowed") == 0)
- ret = BLUETOOTH_ERROR_PERMISSION_DEINED;
- else
- ret = BLUETOOTH_ERROR_INTERNAL;
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
return ret;
{
GVariant *reply = NULL;
GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
if (err) {
BT_ERR("Error = %s", err->message);
g_dbus_error_strip_remote_error(err);
- if (strcmp(err->message, "NotConnected") == 0)
- ret = BLUETOOTH_ERROR_NOT_CONNECTED;
- else if (strcmp(err->message, "Operation not allowed") == 0)
- ret = BLUETOOTH_ERROR_IN_PROGRESS;
- else
- ret = BLUETOOTH_ERROR_INTERNAL;
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
return ret;
GVariant *reply = NULL;
GError *err = NULL;
GVariant *param = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
{
GVariant *reply = NULL;
GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
GVariant *reply = NULL;
GError *err = NULL;
GVariant *param = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
GVariant *reply = NULL;
GError *err = NULL;
GVariant *param = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
GVariant *param = NULL;
char buffer[200] = {0,};
char *ptr = buffer;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
{
GVariant *reply = NULL;
GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
{
GVariant *reply = NULL;
GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
{
GVariant *reply = NULL;
GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
{
GVariant *reply = NULL;
GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_ENABLED(return);
BT_ERR("Error returned in method call\n");
if (err) {
BT_ERR("Error = %s", err->message);
+ g_dbus_error_strip_remote_error(err);
+ ret = _bt_get_error_value_from_message(err->message);
g_clear_error(&err);
}
- return BLUETOOTH_ERROR_INTERNAL;
+ return ret;
}
g_variant_unref(reply);
{
GError *error = NULL;
GVariant *reply, *parameters;
+ int ret = BLUETOOTH_TELEPHONY_ERROR_NONE;
FN_START;
g_variant_unref(reply);
+ if (error) {
+ g_dbus_error_strip_remote_error(error);
+ ret = __bt_telephony_get_error(error->message);
+ BT_ERR("Error here %d\n", ret);
+ g_error_free(error);
+ }
+
FN_END;
- return BLUETOOTH_TELEPHONY_ERROR_NONE;
+ return ret;
}
BT_EXPORT_API int bluetooth_telephony_start_voice_recognition(void)
/*Make sure SCO is already connected */
ret = __bluetooth_telephony_send_call_status(
CSD_CALL_STATUS_MO_ALERTING, call_id, NULL);
- if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE) {
+
+ if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE)
BT_ERR("send call status Failed = [%d]", ret);
- return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
- }
+
FN_END;
- return BLUETOOTH_TELEPHONY_ERROR_NONE;
+ return ret;
}
BT_EXPORT_API int bluetooth_telephony_call_answered(unsigned int call_id,
if (bt_audio) {
if (!bluetooth_telephony_is_sco_connected()) {
ret = bluetooth_telephony_audio_open();
- if (ret != 0) {
+ if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE)
BT_ERR("Audio connection call Failed[%d]", ret);
- return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
- }
}
}
ret = __bluetooth_telephony_send_call_status(CSD_CALL_STATUS_MT_RELEASE,
call_id, NULL);
- if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE) {
+ if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE)
BT_ERR("send call status Failed = [%d]", ret);
- return ret;
- }
FN_END;
return ret;
GVariant *param;
GError *err = NULL;
const char *path = telephony_info.call_path;
- int ret;
+ int ret = BLUETOOTH_TELEPHONY_ERROR_NONE;
FN_START;
if (bt_audio) {
if (!bluetooth_telephony_is_sco_connected()) {
ret = bluetooth_telephony_audio_open();
- if (ret != 0) {
+ if (ret != 0)
BT_ERR(" Audio connection Failed = %d", ret);
- return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
- }
}
}
FN_END;
- return BLUETOOTH_TELEPHONY_ERROR_NONE;
+ return ret;
}
BT_EXPORT_API int bluetooth_telephony_indicate_incoming_call(
#define BT_AGENT_INTERFACE "org.bluez.Agent1"
+#define BT_ERROR_INTERNAL "InternalError"
+#define BT_ERROR_NOT_AVAILABLE "NotAvailable"
+#define BT_ERROR_NOT_CONNECTED "NotConnected"
+#define BT_ERROR_NOT_CONNECTION_FAILED "ConnectionFailed"
+#define BT_ERROR_BUSY "InProgress"
+#define BT_ERROR_INVALID_PARAM "InvalidArguments"
+#define BT_ERROR_ALREADY_EXIST "AlreadyExists"
+#define BT_ERROR_ALREADY_CONNECTED "Already Connected"
+#define BT_ERROR_NO_MEMORY "No memory"
+#define BT_ERROR_NO_DATA "No data"
+#define BT_ERROR_I_O_ERROR "I/O error"
+#define BT_ERROR_OPERATION_NOT_AVAILABLE "Operation currently not available"
+#define BT_ERROR_OPERATION_NOT_ALLOWED "Operation not allowed"
+#define BT_ERROR_OPERATION_NOT_SUPPORTED "Operation not supported"
+#define BT_ERROR_INVALID_FILE_DESCRIPTOR "Invalid File Descriptor"
+#define BT_ERROR_ACCESS_DENIED "Rejected send message"
#define BT_MAX_USER_INFO 5
#define RFKILL_EVENT_SIZE 8
void _bluetooth_hid_free_hid_info(void);
+int _bt_get_error_value_from_message(const char *error_message);
#ifdef __cplusplus
}