aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mm-base-bearer.c8
-rw-r--r--src/mm-base-call.c90
-rw-r--r--src/mm-base-manager.c33
-rw-r--r--src/mm-base-sim.c112
-rw-r--r--src/mm-base-sms.c41
-rw-r--r--src/mm-error-helpers.c46
-rw-r--r--src/mm-error-helpers.h16
-rw-r--r--src/mm-iface-modem-3gpp-profile-manager.c37
-rw-r--r--src/mm-iface-modem-3gpp-ussd.c27
-rw-r--r--src/mm-iface-modem-3gpp.c113
-rw-r--r--src/mm-iface-modem-cdma.c100
-rw-r--r--src/mm-iface-modem-firmware.c23
-rw-r--r--src/mm-iface-modem-location.c84
-rw-r--r--src/mm-iface-modem-messaging.c29
-rw-r--r--src/mm-iface-modem-oma.c97
-rw-r--r--src/mm-iface-modem-sar.c29
-rw-r--r--src/mm-iface-modem-signal.c13
-rw-r--r--src/mm-iface-modem-simple.c70
-rw-r--r--src/mm-iface-modem-time.c19
-rw-r--r--src/mm-iface-modem-voice.c113
-rw-r--r--src/mm-iface-modem.c130
21 files changed, 535 insertions, 695 deletions
diff --git a/src/mm-base-bearer.c b/src/mm-base-bearer.c
index c93c0504..3f39ffb6 100644
--- a/src/mm-base-bearer.c
+++ b/src/mm-base-bearer.c
@@ -1127,7 +1127,7 @@ handle_connect_ready (MMBaseBearer *self,
GError *error = NULL;
if (!mm_base_bearer_connect_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_bearer_complete_connect (MM_GDBUS_BEARER (self), ctx->invocation);
@@ -1142,7 +1142,7 @@ handle_connect_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_connect_context_free (ctx);
return;
}
@@ -1319,7 +1319,7 @@ handle_disconnect_ready (MMBaseBearer *self,
GError *error = NULL;
if (!mm_base_bearer_disconnect_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_bearer_complete_disconnect (MM_GDBUS_BEARER (self), ctx->invocation);
@@ -1334,7 +1334,7 @@ handle_disconnect_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_disconnect_context_free (ctx);
return;
}
diff --git a/src/mm-base-call.c b/src/mm-base-call.c
index 69ce8985..8037c102 100644
--- a/src/mm-base-call.c
+++ b/src/mm-base-call.c
@@ -182,7 +182,7 @@ handle_start_ready (MMBaseCall *self,
else
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_start_context_free (ctx);
return;
}
@@ -212,7 +212,7 @@ handle_start_auth_ready (MMBaseModem *modem,
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_base_call_change_state (ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_start_context_free (ctx);
return;
}
@@ -221,10 +221,8 @@ handle_start_auth_ready (MMBaseModem *modem,
state = mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self));
if (state != MM_CALL_STATE_UNKNOWN) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This call was not in unknown state, cannot start it");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This call was not in unknown state, cannot start it");
handle_start_context_free (ctx);
return;
}
@@ -234,7 +232,7 @@ handle_start_auth_ready (MMBaseModem *modem,
/* Disallow non-emergency calls when in emergency-only state */
if (!mm_iface_modem_voice_authorize_outgoing_call (MM_IFACE_MODEM_VOICE (modem), ctx->self, &error)) {
mm_base_call_change_state (ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_start_context_free (ctx);
return;
}
@@ -243,10 +241,8 @@ handle_start_auth_ready (MMBaseModem *modem,
if (!MM_BASE_CALL_GET_CLASS (ctx->self)->start ||
!MM_BASE_CALL_GET_CLASS (ctx->self)->start_finish) {
mm_base_call_change_state (ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Starting call is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Starting call is not supported by this modem");
handle_start_context_free (ctx);
return;
}
@@ -311,7 +307,7 @@ handle_accept_ready (MMBaseCall *self,
if (!MM_BASE_CALL_GET_CLASS (self)->accept_finish (self, res, &error)) {
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_accept_context_free (ctx);
return;
}
@@ -336,7 +332,7 @@ handle_accept_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_accept_context_free (ctx);
return;
}
@@ -345,10 +341,8 @@ handle_accept_auth_ready (MMBaseModem *modem,
/* We can only accept incoming call in ringing state */
if (state != MM_CALL_STATE_RINGING_IN) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This call was not ringing, cannot accept");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This call was not ringing, cannot accept");
handle_accept_context_free (ctx);
return;
}
@@ -358,10 +352,8 @@ handle_accept_auth_ready (MMBaseModem *modem,
/* Check if we do support doing it */
if (!MM_BASE_CALL_GET_CLASS (ctx->self)->accept ||
!MM_BASE_CALL_GET_CLASS (ctx->self)->accept_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Accepting call is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Accepting call is not supported by this modem");
handle_accept_context_free (ctx);
return;
}
@@ -421,7 +413,7 @@ handle_deflect_ready (MMBaseCall *self,
if (!MM_BASE_CALL_GET_CLASS (self)->deflect_finish (self, res, &error)) {
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_deflect_context_free (ctx);
return;
}
@@ -441,7 +433,7 @@ handle_deflect_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_deflect_context_free (ctx);
return;
}
@@ -450,10 +442,8 @@ handle_deflect_auth_ready (MMBaseModem *modem,
/* We can only deflect incoming call in ringing or waiting state */
if (state != MM_CALL_STATE_RINGING_IN && state != MM_CALL_STATE_WAITING) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This call was not ringing/waiting, cannot deflect");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This call was not ringing/waiting, cannot deflect");
handle_deflect_context_free (ctx);
return;
}
@@ -463,10 +453,8 @@ handle_deflect_auth_ready (MMBaseModem *modem,
/* Check if we do support doing it */
if (!MM_BASE_CALL_GET_CLASS (ctx->self)->deflect ||
!MM_BASE_CALL_GET_CLASS (ctx->self)->deflect_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Deflecting call is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Deflecting call is not supported by this modem");
handle_deflect_context_free (ctx);
return;
}
@@ -526,7 +514,7 @@ modem_voice_join_multiparty_ready (MMIfaceModemVoice *modem,
GError *error = NULL;
if (!mm_iface_modem_voice_join_multiparty_finish (modem, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_call_complete_join_multiparty (MM_GDBUS_CALL (ctx->self), ctx->invocation);
handle_join_multiparty_context_free (ctx);
@@ -540,7 +528,7 @@ handle_join_multiparty_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_join_multiparty_context_free (ctx);
return;
}
@@ -601,7 +589,7 @@ modem_voice_leave_multiparty_ready (MMIfaceModemVoice *modem,
GError *error = NULL;
if (!mm_iface_modem_voice_leave_multiparty_finish (modem, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_call_complete_leave_multiparty (MM_GDBUS_CALL (ctx->self), ctx->invocation);
@@ -616,7 +604,7 @@ handle_leave_multiparty_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_leave_multiparty_context_free (ctx);
return;
}
@@ -680,7 +668,7 @@ handle_hangup_ready (MMBaseCall *self,
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
if (!MM_BASE_CALL_GET_CLASS (self)->hangup_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
/* note: timeouts are already removed when setting state as TERMINATED */
mm_gdbus_call_complete_hangup (MM_GDBUS_CALL (ctx->self), ctx->invocation);
@@ -698,7 +686,7 @@ handle_hangup_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hangup_context_free (ctx);
return;
}
@@ -707,10 +695,8 @@ handle_hangup_auth_ready (MMBaseModem *modem,
/* We can only hangup call in a valid state */
if (state == MM_CALL_STATE_TERMINATED || state == MM_CALL_STATE_UNKNOWN) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This call was not active, cannot hangup");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This call was not active, cannot hangup");
handle_hangup_context_free (ctx);
return;
}
@@ -720,10 +706,8 @@ handle_hangup_auth_ready (MMBaseModem *modem,
/* Check if we do support doing it */
if (!MM_BASE_CALL_GET_CLASS (ctx->self)->hangup ||
!MM_BASE_CALL_GET_CLASS (ctx->self)->hangup_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Hanging up call is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Hanging up call is not supported by this modem");
handle_hangup_context_free (ctx);
return;
}
@@ -782,7 +766,7 @@ handle_send_dtmf_ready (MMBaseCall *self,
GError *error = NULL;
if (!MM_BASE_CALL_GET_CLASS (self)->send_dtmf_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_gdbus_call_complete_send_dtmf (MM_GDBUS_CALL (ctx->self), ctx->invocation);
}
@@ -799,7 +783,7 @@ handle_send_dtmf_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_dtmf_context_free (ctx);
return;
}
@@ -809,20 +793,16 @@ handle_send_dtmf_auth_ready (MMBaseModem *modem,
/* Check if we do support doing it */
if (!MM_BASE_CALL_GET_CLASS (ctx->self)->send_dtmf ||
!MM_BASE_CALL_GET_CLASS (ctx->self)->send_dtmf_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Sending dtmf is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Sending dtmf is not supported by this modem");
handle_send_dtmf_context_free (ctx);
return;
}
/* We can only send_dtmf when call is in ACTIVE state */
if (state != MM_CALL_STATE_ACTIVE ){
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This call was not active, cannot send dtmf");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This call was not active, cannot send dtmf");
handle_send_dtmf_context_free (ctx);
return;
}
diff --git a/src/mm-base-manager.c b/src/mm-base-manager.c
index dbea02f6..e2cebccb 100644
--- a/src/mm-base-manager.c
+++ b/src/mm-base-manager.c
@@ -40,6 +40,8 @@
#include <ModemManager-tags.h>
#include <mm-errors-types.h>
+#include "mm-error-helpers.h"
+
#include <mm-gdbus-manager.h>
#if defined WITH_TESTS
# include <mm-gdbus-test.h>
@@ -807,9 +809,9 @@ set_logging_auth_ready (MMAuthProvider *authp,
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else if (!mm_log_set_level (ctx->level, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
mm_obj_msg (ctx->self, "logging: level '%s'", ctx->level);
mm_gdbus_org_freedesktop_modem_manager1_complete_set_logging (
@@ -865,7 +867,7 @@ scan_devices_auth_ready (MMAuthProvider *authp,
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
#if defined WITH_UDEV
if (!mm_context_get_test_no_udev ()) {
@@ -876,9 +878,8 @@ scan_devices_auth_ready (MMAuthProvider *authp,
ctx->invocation);
} else
#endif
- g_dbus_method_invocation_return_error_literal (
- ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Cannot request manual scan of devices: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot request manual scan of devices: unsupported");
}
scan_devices_context_free (ctx);
@@ -949,7 +950,7 @@ report_kernel_event_auth_ready (MMAuthProvider *authp,
out:
if (error) {
mm_obj_warn (ctx->self, "couldn't handle kernel event: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else
mm_gdbus_org_freedesktop_modem_manager1_complete_report_kernel_event (
MM_GDBUS_ORG_FREEDESKTOP_MODEM_MANAGER1 (ctx->self),
@@ -1226,7 +1227,7 @@ device_inhibit_ready (MMDevice *device,
GError *error = NULL;
if (!mm_device_inhibit_finish (device, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
inhibit_device_context_free (ctx);
return;
}
@@ -1266,15 +1267,15 @@ base_manager_inhibit_device (InhibitDeviceContext *ctx)
device = find_device_by_physdev_uid (ctx->self, ctx->uid);
if (!device) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
- "No device found with uid '%s'", ctx->uid);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
+ "No device found with uid '%s'", ctx->uid);
inhibit_device_context_free (ctx);
return;
}
if (mm_device_get_inhibited (device)) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS,
- "Device '%s' is already inhibited", ctx->uid);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS,
+ "Device '%s' is already inhibited", ctx->uid);
inhibit_device_context_free (ctx);
return;
}
@@ -1295,8 +1296,8 @@ base_manager_uninhibit_device (InhibitDeviceContext *ctx)
sender = g_dbus_method_invocation_get_sender (ctx->invocation);
info = find_inhibited_device_info_by_physdev_uid (ctx->self, ctx->uid);
if (!info || (g_strcmp0 (info->sender, sender) != 0)) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
- "No inhibition found for uid '%s'", ctx->uid);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
+ "No inhibition found for uid '%s'", ctx->uid);
inhibit_device_context_free (ctx);
return;
}
@@ -1319,7 +1320,7 @@ inhibit_device_auth_ready (MMAuthProvider *authp,
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
inhibit_device_context_free (ctx);
return;
}
@@ -1412,7 +1413,7 @@ out:
if (error) {
mm_device_remove_modem (device);
g_hash_table_remove (self->priv->devices, mm_device_get_uid (device));
- g_dbus_method_invocation_return_gerror (invocation, error);
+ mm_dbus_method_invocation_return_gerror (invocation, error);
g_error_free (error);
} else
mm_gdbus_test_complete_set_profile (skeleton, invocation);
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c
index 698c1537..63b1173f 100644
--- a/src/mm-base-sim.c
+++ b/src/mm-base-sim.c
@@ -33,6 +33,7 @@
#include "mm-base-modem.h"
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
+#include "mm-error-helpers.h"
static void async_initable_iface_init (GAsyncInitableIface *iface);
static void log_object_iface_init (MMLogObjectInterface *iface);
@@ -205,7 +206,7 @@ after_change_update_lock_info_ready (MMIfaceModem *modem,
mm_iface_modem_update_lock_info_finish (modem, res, NULL);
if (ctx->save_error) {
- g_dbus_method_invocation_return_gerror (ctx->invocation, ctx->save_error);
+ mm_dbus_method_invocation_return_gerror (ctx->invocation, ctx->save_error);
reprobe_if_puk_discovered (ctx->self, ctx->save_error);
g_clear_error (&ctx->save_error);
} else {
@@ -244,7 +245,7 @@ handle_change_pin_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_change_pin_context_free (ctx);
return;
}
@@ -252,31 +253,22 @@ handle_change_pin_auth_ready (MMBaseModem *modem,
/* If changing PIN is not implemented, report an error */
if (!MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin ||
!MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot change PIN: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot change PIN: operation not supported");
handle_change_pin_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot change PIN: "
- "SIM not currently active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot change PIN: SIM not currently active");
handle_change_pin_context_free (ctx);
return;
}
if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot change PIN: "
- "eSIM without profiles");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot change PIN: eSIM without profiles");
handle_change_pin_context_free (ctx);
return;
}
@@ -394,7 +386,7 @@ after_enable_update_lock_info_ready (MMIfaceModem *modem,
mm_iface_modem_update_lock_info_finish (modem, res, NULL);
if (ctx->save_error) {
- g_dbus_method_invocation_return_gerror (ctx->invocation, ctx->save_error);
+ mm_dbus_method_invocation_return_gerror (ctx->invocation, ctx->save_error);
reprobe_if_puk_discovered (ctx->self, ctx->save_error);
g_clear_error (&ctx->save_error);
} else {
@@ -435,7 +427,7 @@ handle_enable_pin_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_enable_pin_context_free (ctx);
return;
}
@@ -443,31 +435,22 @@ handle_enable_pin_auth_ready (MMBaseModem *modem,
/* If changing PIN is not implemented, report an error */
if (!MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin ||
!MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot enable/disable PIN: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot enable/disable PIN: operation not supported");
handle_enable_pin_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot enable/disable PIN: "
- "SIM not currently active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot enable/disable PIN: SIM not currently active");
handle_enable_pin_context_free (ctx);
return;
}
if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot enable/disable PIN: "
- "eSIM without profiles");
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot enable/disable PIN: eSIM without profiles");
handle_enable_pin_context_free (ctx);
return;
}
@@ -849,7 +832,7 @@ handle_send_pin_ready (MMBaseSim *self,
GError *error = NULL;
if (!mm_base_sim_send_pin_finish (self, res, &error)) {
- g_dbus_method_invocation_return_gerror (ctx->invocation, error);
+ mm_dbus_method_invocation_return_gerror (ctx->invocation, error);
reprobe_if_puk_discovered (self, error);
g_clear_error (&error);
} else
@@ -866,27 +849,21 @@ handle_send_pin_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_pin_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot send PIN: "
- "SIM not currently active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot send PIN: SIM not currently active");
handle_send_pin_context_free (ctx);
return;
}
if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot send PIN: "
- "eSIM without profiles");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot send PIN: eSIM without profiles");
handle_send_pin_context_free (ctx);
return;
}
@@ -955,7 +932,7 @@ handle_send_puk_ready (MMBaseSim *self,
g_error_matches (error,
MM_MOBILE_EQUIPMENT_ERROR,
MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else
mm_gdbus_sim_complete_send_puk (MM_GDBUS_SIM (self), ctx->invocation);
@@ -975,27 +952,21 @@ handle_send_puk_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_puk_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot send PUK: "
- "SIM not currently active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot send PUK: SIM not currently active");
handle_send_puk_context_free (ctx);
return;
}
if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot send PUK: "
- "eSIM without profiles");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot send PUK: eSIM without profiles");
handle_send_puk_context_free (ctx);
return;
}
@@ -1519,7 +1490,7 @@ handle_set_preferred_networks_ready (MMBaseSim *self,
MM_BASE_SIM_GET_CLASS (self)->set_preferred_networks_finish (self, res, &error);
if (error) {
mm_obj_warn (self, "couldn't set preferred networks: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, g_steal_pointer (&error));
+ mm_dbus_method_invocation_take_error (ctx->invocation, g_steal_pointer (&error));
} else {
mm_gdbus_sim_set_preferred_networks (MM_GDBUS_SIM (self), ctx->networks);
mm_gdbus_sim_complete_set_preferred_networks (MM_GDBUS_SIM (self), ctx->invocation);
@@ -1536,38 +1507,29 @@ handle_set_preferred_networks_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_preferred_networks_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set preferred networks: "
- "SIM not currently active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set preferred networks: SIM not currently active");
handle_set_preferred_networks_context_free (ctx);
return;
}
if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set preferred networks: "
- "eSIM without profiles");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set preferred networks: eSIM without profiles");
handle_set_preferred_networks_context_free (ctx);
return;
}
if (!MM_BASE_SIM_GET_CLASS (ctx->self)->set_preferred_networks ||
!MM_BASE_SIM_GET_CLASS (ctx->self)->set_preferred_networks_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set preferred networks: "
- "not implemented");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set preferred networks: not implemented");
handle_set_preferred_networks_context_free (ctx);
return;
}
diff --git a/src/mm-base-sms.c b/src/mm-base-sms.c
index 6c95d3da..c8e84c21 100644
--- a/src/mm-base-sms.c
+++ b/src/mm-base-sms.c
@@ -35,6 +35,7 @@
#include "mm-base-modem.h"
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
+#include "mm-error-helpers.h"
static void log_object_iface_init (MMLogObjectInterface *iface);
@@ -346,7 +347,7 @@ handle_store_ready (MMBaseSms *self,
if (!MM_BASE_SMS_GET_CLASS (self)->store_finish (self, res, &error)) {
mm_obj_warn (self, "failed storing SMS message: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_store_context_free (ctx);
return;
}
@@ -412,7 +413,7 @@ handle_store_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_store_context_free (ctx);
return;
}
@@ -434,7 +435,7 @@ handle_store_auth_ready (MMBaseModem *modem,
mm_sms_storage_get_string (mm_base_sms_get_storage (ctx->self)),
mm_sms_storage_get_string (ctx->storage));
mm_obj_warn (ctx->self, "failed storing SMS message: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
}
handle_store_context_free (ctx);
return;
@@ -445,7 +446,7 @@ handle_store_auth_ready (MMBaseModem *modem,
ctx->storage,
&error)) {
mm_obj_warn (ctx->self, "failed storing SMS message: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_store_context_free (ctx);
return;
}
@@ -453,7 +454,7 @@ handle_store_auth_ready (MMBaseModem *modem,
/* Prepare the SMS to be stored, creating the PDU list if required */
if (!prepare_sms_to_be_stored (ctx->self, &error)) {
mm_obj_warn (ctx->self, "failed preparing SMS message to be stored: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_store_context_free (ctx);
return;
}
@@ -462,10 +463,8 @@ handle_store_auth_ready (MMBaseModem *modem,
if (!MM_BASE_SMS_GET_CLASS (ctx->self)->store ||
!MM_BASE_SMS_GET_CLASS (ctx->self)->store_finish) {
mm_obj_warn (ctx->self, "failed storing SMS message: unsupported");
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Storing SMS is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Storing SMS is not supported by this modem");
handle_store_context_free (ctx);
return;
}
@@ -534,7 +533,7 @@ handle_send_ready (MMBaseSms *self,
if (!MM_BASE_SMS_GET_CLASS (self)->send_finish (self, res, &error)) {
mm_obj_warn (self, "failed sending SMS message: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_context_free (ctx);
return;
}
@@ -595,7 +594,7 @@ handle_send_auth_ready (MMBaseModem *modem,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_context_free (ctx);
return;
}
@@ -603,20 +602,16 @@ handle_send_auth_ready (MMBaseModem *modem,
/* We can only send SMS created by the user */
state = mm_gdbus_sms_get_state (MM_GDBUS_SMS (ctx->self));
if (state == MM_SMS_STATE_RECEIVED || state == MM_SMS_STATE_RECEIVING) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This SMS was received, cannot send it");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This SMS was received, cannot send it");
handle_send_context_free (ctx);
return;
}
/* Don't allow sending the same SMS multiple times, we would lose the message reference */
if (state == MM_SMS_STATE_SENT) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "This SMS was already sent, cannot send it again");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "This SMS was already sent, cannot send it again");
handle_send_context_free (ctx);
return;
}
@@ -626,7 +621,7 @@ handle_send_auth_ready (MMBaseModem *modem,
/* Prepare the SMS to be sent, creating the PDU list if required */
if (!prepare_sms_to_be_sent (ctx->self, &error)) {
mm_obj_warn (ctx->self, "failed preparing SMS message to be sent: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_context_free (ctx);
return;
}
@@ -635,10 +630,8 @@ handle_send_auth_ready (MMBaseModem *modem,
if (!MM_BASE_SMS_GET_CLASS (ctx->self)->send ||
!MM_BASE_SMS_GET_CLASS (ctx->self)->send_finish) {
mm_obj_warn (ctx->self, "failed sending SMS message: unsupported");
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Sending SMS is not supported by this modem");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Sending SMS is not supported by this modem");
handle_send_context_free (ctx);
return;
}
diff --git a/src/mm-error-helpers.c b/src/mm-error-helpers.c
index a5c96e67..b1efab21 100644
--- a/src/mm-error-helpers.c
+++ b/src/mm-error-helpers.c
@@ -712,3 +712,49 @@ mm_normalize_error (const GError *error)
/* Normalize mapped errors */
return normalize_mapped_error (error);
}
+
+/******************************************************************************/
+
+void
+mm_dbus_method_invocation_take_error (GDBusMethodInvocation *invocation,
+ GError *error)
+{
+ g_autoptr(GError) taken = error;
+
+ mm_dbus_method_invocation_return_gerror (invocation, taken);
+}
+
+void
+mm_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *message)
+{
+ g_autoptr(GError) error = NULL;
+
+ error = g_error_new_literal (domain, code, message);
+ mm_dbus_method_invocation_return_gerror (invocation, error);
+}
+
+void
+mm_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ ...)
+{
+ va_list var_args;
+ g_autoptr(GError) error = NULL;
+
+ va_start (var_args, format);
+ error = g_error_new_valist (domain, code, format, var_args);
+ mm_dbus_method_invocation_return_gerror (invocation, error);
+ va_end (var_args);
+}
+
+void
+mm_dbus_method_invocation_return_gerror (GDBusMethodInvocation *invocation,
+ const GError *error)
+{
+ g_dbus_method_invocation_take_error (invocation, mm_normalize_error (error));
+}
diff --git a/src/mm-error-helpers.h b/src/mm-error-helpers.h
index ec1c2c6b..c0e70e1f 100644
--- a/src/mm-error-helpers.h
+++ b/src/mm-error-helpers.h
@@ -34,4 +34,20 @@ void mm_register_error_mapping (GQuark input_erro
GQuark output_error_domain,
gint output_error_code);
+/* Replacements for the dbus method invocation completions but with our error normalization
+ * procedure in place, so that we only report back MM-specific errors. */
+void mm_dbus_method_invocation_take_error (GDBusMethodInvocation *invocation,
+ GError *error);
+void mm_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *message);
+void mm_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF(4, 5);;
+void mm_dbus_method_invocation_return_gerror (GDBusMethodInvocation *invocation,
+ const GError *error);
+
#endif /* MM_ERROR_HELPERS_H */
diff --git a/src/mm-iface-modem-3gpp-profile-manager.c b/src/mm-iface-modem-3gpp-profile-manager.c
index 8f3c91c5..94130794 100644
--- a/src/mm-iface-modem-3gpp-profile-manager.c
+++ b/src/mm-iface-modem-3gpp-profile-manager.c
@@ -26,6 +26,7 @@
#include "mm-iface-modem-3gpp-profile-manager.h"
#include "mm-base-modem.h"
#include "mm-log-object.h"
+#include "mm-error-helpers.h"
#include "mm-log-helpers.h"
#define SUPPORT_CHECKED_TAG "3gpp-profile-manager-support-checked-tag"
@@ -1011,7 +1012,7 @@ list_profiles_ready (MMIfaceModem3gppProfileManager *self,
if (!mm_iface_modem_3gpp_profile_manager_list_profiles_finish (self, res, &profiles, &error)) {
mm_obj_warn (self, "failed listing 3GPP profiles: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
}
@@ -1031,7 +1032,7 @@ handle_list_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
}
@@ -1104,7 +1105,7 @@ set_profile_ready (MMIfaceModem3gppProfileManager *self,
profile_stored = mm_iface_modem_3gpp_profile_manager_set_profile_finish (self, res, &error);
if (!profile_stored) {
mm_obj_warn (self, "failed setting 3GPP profile: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_context_free (ctx);
return;
}
@@ -1127,7 +1128,7 @@ handle_set_auth_ready (MMBaseModem *self,
g_autoptr(MM3gppProfile) profile_requested = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_context_free (ctx);
return;
}
@@ -1140,7 +1141,7 @@ handle_set_auth_ready (MMBaseModem *self,
}
if (!ctx->requested_dictionary) {
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"Missing requested profile settings");
handle_set_context_free (ctx);
return;
@@ -1148,7 +1149,7 @@ handle_set_auth_ready (MMBaseModem *self,
profile_requested = mm_3gpp_profile_new_from_dictionary (ctx->requested_dictionary, &error);
if (!profile_requested) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_context_free (ctx);
return;
}
@@ -1219,7 +1220,7 @@ delete_profile_ready (MMIfaceModem3gppProfileManager *self,
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile_finish (self, res, &error)) {
mm_obj_warn (self, "failed deleting 3GPP profile: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "3GPP profile deleted");
mm_gdbus_modem3gpp_profile_manager_complete_delete (ctx->skeleton, ctx->invocation);
@@ -1239,7 +1240,7 @@ handle_delete_auth_ready (MMBaseModem *self,
MMBearerApnType apn_type = MM_BEARER_APN_TYPE_NONE;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_context_free (ctx);
return;
}
@@ -1253,22 +1254,22 @@ handle_delete_auth_ready (MMBaseModem *self,
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile ||
!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile_finish) {
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Deleting profiles is not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Deleting profiles is not supported");
handle_delete_context_free (ctx);
return;
}
if (!ctx->dictionary) {
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Missing profile settings");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Missing profile settings");
handle_delete_context_free (ctx);
return;
}
profile = mm_3gpp_profile_new_from_dictionary (ctx->dictionary, &error);
if (!profile) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_context_free (ctx);
return;
}
@@ -1277,16 +1278,16 @@ handle_delete_auth_ready (MMBaseModem *self,
if (g_strcmp0 (index_field, "profile-id") == 0) {
profile_id = mm_3gpp_profile_get_profile_id (profile);
if (profile_id == MM_3GPP_PROFILE_ID_UNKNOWN) {
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Missing index field ('profile-id') in profile settings");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Missing index field ('profile-id') in profile settings");
handle_delete_context_free (ctx);
return;
}
} else if (g_strcmp0 (index_field, "apn-type") == 0) {
apn_type = mm_3gpp_profile_get_apn_type (profile);
if (apn_type == MM_BEARER_APN_TYPE_NONE) {
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Missing index field ('apn-type') in profile settings");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Missing index field ('apn-type') in profile settings");
handle_delete_context_free (ctx);
return;
}
@@ -1298,7 +1299,7 @@ handle_delete_auth_ready (MMBaseModem *self,
profile_id,
apn_type,
&error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-3gpp-ussd.c b/src/mm-iface-modem-3gpp-ussd.c
index 33f49f0e..520065ee 100644
--- a/src/mm-iface-modem-3gpp-ussd.c
+++ b/src/mm-iface-modem-3gpp-ussd.c
@@ -26,6 +26,7 @@
#include "mm-iface-modem-3gpp-ussd.h"
#include "mm-base-modem.h"
#include "mm-modem-helpers.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "3gpp-ussd-support-checked-tag"
@@ -68,7 +69,7 @@ handle_cancel_ready (MMIfaceModem3gppUssd *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->cancel_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem3gpp_ussd_complete_cancel (ctx->skeleton, ctx->invocation);
@@ -83,7 +84,7 @@ handle_cancel_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_cancel_context_free (ctx);
return;
}
@@ -153,7 +154,7 @@ handle_respond_ready (MMIfaceModem3gppUssd *self,
reply = MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->send_finish (self, res, &error);
if (!reply)
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
mm_gdbus_modem3gpp_ussd_complete_respond (ctx->skeleton,
ctx->invocation,
@@ -171,7 +172,7 @@ handle_respond_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_respond_context_free (ctx);
return;
}
@@ -189,11 +190,8 @@ handle_respond_auth_ready (MMBaseModem *self,
switch (mm_gdbus_modem3gpp_ussd_get_state (ctx->skeleton)) {
case MM_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE:
case MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot respond USSD: "
- "no active session");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot respond USSD: no active session");
break;
case MM_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE:
@@ -265,7 +263,7 @@ handle_initiate_ready (MMIfaceModem3gppUssd *self,
reply = MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->send_finish (self, res, &error);
if (!reply)
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
mm_gdbus_modem3gpp_ussd_complete_initiate (ctx->skeleton,
ctx->invocation,
@@ -283,7 +281,7 @@ handle_initiate_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_initiate_context_free (ctx);
return;
}
@@ -301,11 +299,8 @@ handle_initiate_auth_ready (MMBaseModem *self,
switch (mm_gdbus_modem3gpp_ussd_get_state (ctx->skeleton)) {
case MM_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE:
case MM_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot initiate USSD: "
- "a session is already active");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot initiate USSD: a session is already active");
break;
case MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE:
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index 0e3cf697..61ebf175 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -825,7 +825,7 @@ handle_register_ready (MMIfaceModem3gpp *self,
mm_obj_warn (self, "failed registering modem in '%s': %s", ctx->operator_id, error->message);
else
mm_obj_warn (self, "failed registering modem: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
if (ctx->operator_id && ctx->operator_id[0])
mm_obj_info (self, "modem registered in '%s'", ctx->operator_id);
@@ -846,7 +846,7 @@ handle_register_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_register_context_free (ctx);
return;
}
@@ -866,8 +866,8 @@ handle_register_auth_ready (MMBaseModem *self,
case MM_MODEM_STATE_DISABLED:
case MM_MODEM_STATE_DISABLING:
case MM_MODEM_STATE_ENABLING:
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
- "Device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Device not yet enabled");
handle_register_context_free (ctx);
return;
@@ -889,8 +889,8 @@ handle_register_auth_ready (MMBaseModem *self,
case MM_MODEM_STATE_DISCONNECTING:
case MM_MODEM_STATE_CONNECTING:
case MM_MODEM_STATE_CONNECTED:
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
- "Operation not allowed while modem is connected");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Operation not allowed while modem is connected");
handle_register_context_free (ctx);
return;
@@ -992,7 +992,7 @@ handle_scan_ready (MMIfaceModem3gpp *self,
info_list = MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->scan_networks_finish (self, res, &error);
if (error) {
mm_obj_warn (self, "failed scanning networks: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_scan_context_free (ctx);
return;
}
@@ -1012,7 +1012,7 @@ handle_scan_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_scan_context_free (ctx);
return;
}
@@ -1020,10 +1020,8 @@ handle_scan_auth_ready (MMBaseModem *self,
/* If scanning is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->scan_networks ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->scan_networks_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot scan networks: operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot scan networks: operation not supported");
handle_scan_context_free (ctx);
return;
}
@@ -1092,7 +1090,7 @@ after_set_load_eps_ue_mode_operation_ready (MMIfaceModem3gpp *
mm_obj_warn (self, "failed reloading EPS UE mode of operation after update to '%s': %s",
mm_modem_3gpp_eps_ue_mode_operation_get_string (ctx->mode),
error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_eps_ue_mode_operation_context_free (ctx);
return;
}
@@ -1101,11 +1099,8 @@ after_set_load_eps_ue_mode_operation_ready (MMIfaceModem3gpp *
mm_obj_info (self, "requested (%s) and reloaded (%s) EPS UE mode of operation don't match",
mm_modem_3gpp_eps_ue_mode_operation_get_string (ctx->mode),
mm_modem_3gpp_eps_ue_mode_operation_get_string (uemode));
- g_dbus_method_invocation_return_error_literal (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
-
- "EPS UE mode of operation wasn't updated");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "EPS UE mode of operation wasn't updated");
handle_set_eps_ue_mode_operation_context_free (ctx);
return;
}
@@ -1126,7 +1121,7 @@ handle_set_eps_ue_mode_operation_ready (MMIfaceModem3gpp *self
mm_obj_warn (self, "failed setting EPS UE mode of operation to '%s': %s",
mm_modem_3gpp_eps_ue_mode_operation_get_string (ctx->mode),
error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_eps_ue_mode_operation_context_free (ctx);
return;
}
@@ -1155,7 +1150,7 @@ handle_set_eps_ue_mode_operation_auth_ready (MMBaseModem
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_eps_ue_mode_operation_context_free (ctx);
return;
}
@@ -1171,10 +1166,8 @@ handle_set_eps_ue_mode_operation_auth_ready (MMBaseModem
/* If UE mode update is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_eps_ue_mode_operation ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_eps_ue_mode_operation_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set UE mode of operation for EPS: operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set UE mode of operation for EPS: operation not supported");
handle_set_eps_ue_mode_operation_context_free (ctx);
return;
}
@@ -1244,7 +1237,7 @@ after_set_load_initial_eps_bearer_settings_ready (MMIfaceModem3gpp
new_config = MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_initial_eps_bearer_settings_finish (self, res, &error);
if (error) {
mm_obj_warn (self, "failed reloading initial EPS bearer settings after update: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_initial_eps_bearer_settings_context_free (ctx);
return;
}
@@ -1253,7 +1246,7 @@ after_set_load_initial_eps_bearer_settings_ready (MMIfaceModem3gpp
mm_obj_warn (self, "requested and reloaded initial EPS bearer settings don't match");
mm_obj_info (self, "reloaded initial EPS bearer settings:");
mm_log_bearer_properties (self, MM_LOG_LEVEL_INFO, " ", new_config);
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Initial EPS bearer settings were not updated");
handle_set_initial_eps_bearer_settings_context_free (ctx);
return;
@@ -1274,7 +1267,7 @@ set_initial_eps_bearer_settings_ready (MMIfaceModem3gpp
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_initial_eps_bearer_settings_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting initial EPS bearer settings: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_initial_eps_bearer_settings_context_free (ctx);
return;
}
@@ -1306,7 +1299,7 @@ set_initial_eps_bearer_settings_auth_ready (MMBaseModem
g_autoptr(MMBearerProperties) old_config = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_initial_eps_bearer_settings_context_free (ctx);
return;
}
@@ -1314,15 +1307,15 @@ set_initial_eps_bearer_settings_auth_ready (MMBaseModem
/* If UE mode update is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_initial_eps_bearer_settings ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_initial_eps_bearer_settings_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_set_initial_eps_bearer_settings_context_free (ctx);
return;
}
ctx->config = mm_bearer_properties_new_from_dictionary (ctx->dictionary, &error);
if (!ctx->config) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_initial_eps_bearer_settings_context_free (ctx);
return;
}
@@ -1406,7 +1399,7 @@ update_lock_info_ready (MMIfaceModem *modem,
mm_iface_modem_update_lock_info_finish (modem, res, &error);
if (error) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_disable_facility_lock_context_free (ctx);
return;
}
@@ -1426,7 +1419,7 @@ handle_disable_facility_lock_ready (MMIfaceModem3gpp *self,
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish (self, res, &error)) {
mm_obj_warn (self, "failed disabling facility lock '%s': %s",
ctx->facility_str, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_disable_facility_lock_context_free (ctx);
return;
}
@@ -1453,7 +1446,7 @@ disable_facility_lock_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_disable_facility_lock_context_free (ctx);
return;
}
@@ -1461,16 +1454,16 @@ disable_facility_lock_auth_ready (MMBaseModem *self,
/* If disable facility locks is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->disable_facility_lock_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_disable_facility_lock_context_free (ctx);
return;
}
/* Parse properties dictionary */
if (!g_variant_is_of_type (ctx->dictionary, G_VARIANT_TYPE ("(us)"))) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Invalid parameters");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Invalid parameters");
handle_disable_facility_lock_context_free (ctx);
return;
}
@@ -1490,8 +1483,8 @@ disable_facility_lock_auth_ready (MMBaseModem *self,
MM_MODEM_3GPP_FACILITY_NET_SUB_PERS |
MM_MODEM_3GPP_FACILITY_PROVIDER_PERS |
MM_MODEM_3GPP_FACILITY_CORP_PERS))) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Invalid type of facility lock to disable or empty key");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Invalid type of facility lock to disable or empty key");
handle_disable_facility_lock_context_free (ctx);
return;
}
@@ -1613,7 +1606,7 @@ internal_set_packet_service_state_ready (MMIfaceModem3gpp *self,
mm_obj_warn (self, "failed setting packet service state to '%s': %s",
mm_modem_3gpp_packet_service_state_get_string (ctx->packet_service_state),
error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "packet service state set to '%s'",
mm_modem_3gpp_packet_service_state_get_string (ctx->packet_service_state));
@@ -1630,7 +1623,7 @@ set_packet_service_state_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_packet_service_state_context_free (ctx);
return;
}
@@ -1644,8 +1637,8 @@ set_packet_service_state_auth_ready (MMBaseModem *self,
if ((ctx->packet_service_state != MM_MODEM_3GPP_PACKET_SERVICE_STATE_ATTACHED) &&
(ctx->packet_service_state != MM_MODEM_3GPP_PACKET_SERVICE_STATE_DETACHED)) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Invalid packet service state requested");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Invalid packet service state requested");
handle_set_packet_service_state_context_free (ctx);
return;
}
@@ -1712,7 +1705,7 @@ after_set_load_nr5g_registration_settings_ready (MMIfaceModem3gpp
new_settings = MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_nr5g_registration_settings_finish (self, res, &error);
if (error) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -1721,8 +1714,8 @@ after_set_load_nr5g_registration_settings_ready (MMIfaceModem3gpp
if (!mm_nr5g_registration_settings_cmp (new_settings, ctx->settings)) {
mm_obj_info (self, "requested and reloaded 5GNR registration settings don't match");
- g_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
- "5GNR registration settings were not updated");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "5GNR registration settings were not updated");
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -1742,7 +1735,7 @@ set_nr5g_registration_settings_ready (MMIfaceModem3gpp *
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_nr5g_registration_settings_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting 5GNR registration settings: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -1774,7 +1767,7 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
MMModem3gppMicoMode new_mico_mode;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -1782,15 +1775,15 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
/* If 5GNR registration settings update is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_nr5g_registration_settings ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_nr5g_registration_settings_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
ctx->settings = mm_nr5g_registration_settings_new_from_dictionary (ctx->dictionary, &error);
if (!ctx->settings) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -1799,7 +1792,7 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
if (new_drx_cycle == MM_MODEM_3GPP_DRX_CYCLE_UNSUPPORTED) {
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, "Invalid value for DRX cycle: %s",
mm_modem_3gpp_drx_cycle_get_string (new_drx_cycle));
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -1808,7 +1801,7 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
if (new_mico_mode == MM_MODEM_3GPP_MICO_MODE_UNSUPPORTED) {
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, "Invalid value for MICO mode: %s",
mm_modem_3gpp_mico_mode_get_string (new_mico_mode));
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_nr5g_registration_settings_context_free (ctx);
return;
}
@@ -3396,7 +3389,7 @@ handle_set_carrier_lock_ready (MMIfaceModem3gpp *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_carrier_lock_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem3gpp_complete_set_carrier_lock (ctx->skeleton, ctx->invocation);
handle_set_carrier_lock_context_free (ctx);
@@ -3412,7 +3405,7 @@ handle_set_carrier_lock_auth_ready (MMBaseModem *self,
gsize data_size;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_carrier_lock_context_free (ctx);
return;
}
@@ -3420,11 +3413,9 @@ handle_set_carrier_lock_auth_ready (MMBaseModem *self,
/* If carrier lock is not implemented, report an error */
if (!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_carrier_lock ||
!MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->set_carrier_lock_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot send set carrier lock request to modem: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot send set carrier lock request to modem: "
+ "operation not supported");
handle_set_carrier_lock_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c
index 877afe4e..adf4a82a 100644
--- a/src/mm-iface-modem-cdma.c
+++ b/src/mm-iface-modem-cdma.c
@@ -23,6 +23,7 @@
#include "mm-iface-modem-cdma.h"
#include "mm-base-modem.h"
#include "mm-modem-helpers.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUBSYSTEM_CDMA1X "cdma1x"
@@ -125,7 +126,7 @@ handle_activate_ready (MMIfaceModemCdma *self,
priv->activation_ongoing = FALSE;
if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_finish (self, res,&error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_cdma_complete_activate (ctx->skeleton, ctx->invocation);
@@ -144,17 +145,15 @@ handle_activate_auth_ready (MMBaseModem *self,
priv = get_private (MM_IFACE_MODEM_CDMA (self));
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_activate_context_free (ctx);
return;
}
/* Fail if we have already an activation ongoing */
if (priv->activation_ongoing) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_IN_PROGRESS,
- "An activation operation is already in progress");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS,
+ "An activation operation is already in progress");
handle_activate_context_free (ctx);
return;
}
@@ -170,22 +169,16 @@ handle_activate_auth_ready (MMBaseModem *self,
/* If activating OTA is not implemented, report an error */
if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate ||
!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot perform OTA activation: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot perform OTA activation: operation not supported");
handle_activate_context_free (ctx);
return;
}
/* Error if carrier code is empty */
if (!ctx->carrier || !ctx->carrier[0]) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_INVALID_ARGS,
- "Cannot perform OTA activation: "
- "invalid empty carrier code");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Cannot perform OTA activation: invalid empty carrier code");
handle_activate_context_free (ctx);
return;
}
@@ -204,11 +197,8 @@ handle_activate_auth_ready (MMBaseModem *self,
break;
case MM_MODEM_STATE_INITIALIZING:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform OTA activation: "
- "device not fully initialized yet");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform OTA activation: device not fully initialized yet");
handle_activate_context_free (ctx);
return;
@@ -224,30 +214,21 @@ handle_activate_auth_ready (MMBaseModem *self,
return;
case MM_MODEM_STATE_DISABLING:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform OTA activation: "
- "currently being disabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform OTA activation: currently being disabled");
break;
case MM_MODEM_STATE_ENABLING:
case MM_MODEM_STATE_DISABLED:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform OTA activation: "
- "not enabled yet");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform OTA activation: not enabled yet");
break;
case MM_MODEM_STATE_DISCONNECTING:
case MM_MODEM_STATE_CONNECTING:
case MM_MODEM_STATE_CONNECTED:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform OTA activation: "
- "modem is connected");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform OTA activation: modem is connected");
break;
default:
@@ -311,7 +292,7 @@ handle_activate_manual_ready (MMIfaceModemCdma *self,
priv->activation_ongoing = FALSE;
if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_manual_finish (self, res,&error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_cdma_complete_activate_manual (ctx->skeleton, ctx->invocation);
@@ -331,17 +312,15 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
priv = get_private (MM_IFACE_MODEM_CDMA (self));
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_activate_manual_context_free (ctx);
return;
}
/* Fail if we have already an activation ongoing */
if (priv->activation_ongoing) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_IN_PROGRESS,
- "An activation operation is already in progress");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS,
+ "An activation operation is already in progress");
handle_activate_manual_context_free (ctx);
return;
}
@@ -357,11 +336,8 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
/* If manual activation is not implemented, report an error */
if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_manual ||
!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_manual_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot perform manual activation: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot perform manual activation: operation not supported");
handle_activate_manual_context_free (ctx);
return;
}
@@ -369,7 +345,7 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
/* Parse input properties */
properties = mm_cdma_manual_activation_properties_new_from_dictionary (ctx->dictionary, &error);
if (!properties) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_activate_manual_context_free (ctx);
return;
}
@@ -388,11 +364,8 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
break;
case MM_MODEM_STATE_INITIALIZING:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform manual activation: "
- "device not fully initialized yet");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform manual activation: device not fully initialized yet");
break;
case MM_MODEM_STATE_ENABLED:
@@ -408,30 +381,21 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
return;
case MM_MODEM_STATE_DISABLING:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform manual activation: "
- "currently being disabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform manual activation: currently being disabled");
break;
case MM_MODEM_STATE_ENABLING:
case MM_MODEM_STATE_DISABLED:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform manual activation: "
- "not enabled yet");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform manual activation: not enabled yet");
break;
case MM_MODEM_STATE_DISCONNECTING:
case MM_MODEM_STATE_CONNECTING:
case MM_MODEM_STATE_CONNECTED:
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot perform manual activation: "
- "modem is connected");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot perform manual activation: modem is connected");
break;
default:
diff --git a/src/mm-iface-modem-firmware.c b/src/mm-iface-modem-firmware.c
index fe1feb1d..34df620a 100644
--- a/src/mm-iface-modem-firmware.c
+++ b/src/mm-iface-modem-firmware.c
@@ -19,6 +19,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-firmware.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#if defined WITH_QMI
@@ -73,7 +74,7 @@ load_current_ready (MMIfaceModemFirmware *self,
if (!ctx->current) {
/* Not found isn't fatal */
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
}
@@ -110,7 +111,7 @@ load_list_ready (MMIfaceModemFirmware *self,
if (!ctx->list) {
/* Not found isn't fatal */
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
}
@@ -131,7 +132,7 @@ list_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
}
@@ -140,10 +141,8 @@ list_auth_ready (MMBaseModem *self,
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list_finish ||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current ||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot list firmware: operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot list firmware: operation not supported");
handle_list_context_free (ctx);
return;
}
@@ -202,7 +201,7 @@ change_current_ready (MMIfaceModemFirmware *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_firmware_complete_select (ctx->skeleton, ctx->invocation);
handle_select_context_free (ctx);
@@ -216,7 +215,7 @@ select_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_select_context_free (ctx);
return;
}
@@ -224,10 +223,8 @@ select_auth_ready (MMBaseModem *self,
if (!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current ||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot select firmware: operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot select firmware: operation not supported");
handle_select_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index da16a6dd..e9d4a11b 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -22,6 +22,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-location.h"
#include "mm-log-object.h"
+#include "mm-error-helpers.h"
#include "mm-modem-helpers.h"
#define MM_LOCATION_GPS_REFRESH_TIME_SECS 30
@@ -913,7 +914,7 @@ setup_gathering_ready (MMIfaceModemLocation *self,
GError *error = NULL;
if (!setup_gathering_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_location_complete_setup (ctx->skeleton, ctx->invocation);
@@ -932,7 +933,7 @@ handle_setup_auth_ready (MMBaseModem *self,
gchar *str;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_setup_context_free (ctx);
return;
}
@@ -942,11 +943,8 @@ handle_setup_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot setup location: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot setup location: device not yet enabled");
handle_setup_context_free (ctx);
return;
}
@@ -955,11 +953,8 @@ handle_setup_auth_ready (MMBaseModem *self,
not_supported = ((mm_gdbus_modem_location_get_capabilities (ctx->skeleton) ^ ctx->sources) & ctx->sources);
if (not_supported != MM_MODEM_LOCATION_SOURCE_NONE) {
str = mm_modem_location_source_build_string_from_mask (not_supported);
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot enable unsupported location sources: '%s'",
- str);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot enable unsupported location sources: '%s'", str);
handle_setup_context_free (ctx);
g_free (str);
return;
@@ -1048,7 +1043,7 @@ set_supl_server_ready (MMIfaceModemLocation *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->set_supl_server_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
mm_gdbus_modem_location_set_supl_server (ctx->skeleton, ctx->supl);
mm_gdbus_modem_location_complete_set_supl_server (ctx->skeleton, ctx->invocation);
@@ -1066,7 +1061,7 @@ handle_set_supl_server_auth_ready (MMBaseModem *self,
MMModemState modem_state;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_supl_server_context_free (ctx);
return;
}
@@ -1076,28 +1071,23 @@ handle_set_supl_server_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot set SUPL server: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot set SUPL server: device not yet enabled");
handle_set_supl_server_context_free (ctx);
return;
}
/* If A-GPS is NOT supported, set error */
if (!(mm_gdbus_modem_location_get_capabilities (ctx->skeleton) & (MM_MODEM_LOCATION_SOURCE_AGPS_MSA | MM_MODEM_LOCATION_SOURCE_AGPS_MSB))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set SUPL server: A-GPS not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set SUPL server: A-GPS not supported");
handle_set_supl_server_context_free (ctx);
return;
}
/* Validate SUPL address string: either FQDN:PORT or IP:PORT */
if (!mm_parse_supl_address (ctx->supl, NULL, NULL, NULL, &error)) {
- g_dbus_method_invocation_return_gerror (ctx->invocation, error);
+ mm_dbus_method_invocation_return_gerror (ctx->invocation, error);
handle_set_supl_server_context_free (ctx);
return;
}
@@ -1105,10 +1095,8 @@ handle_set_supl_server_auth_ready (MMBaseModem *self,
/* Check if plugin implements it */
if (!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->set_supl_server ||
!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->set_supl_server_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set SUPL server: not implemented");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set SUPL server: not implemented");
handle_set_supl_server_context_free (ctx);
return;
}
@@ -1169,7 +1157,7 @@ inject_assistance_data_ready (MMIfaceModemLocation *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->inject_assistance_data_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_location_complete_inject_assistance_data (ctx->skeleton, ctx->invocation);
@@ -1186,17 +1174,15 @@ handle_inject_assistance_data_auth_ready (MMBaseModem *sel
gsize data_size;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_inject_assistance_data_context_free (ctx);
return;
}
/* If the type is NOT supported, set error */
if (mm_gdbus_modem_location_get_supported_assistance_data (ctx->skeleton) == MM_MODEM_LOCATION_ASSISTANCE_DATA_TYPE_NONE) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot inject assistance data: ununsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot inject assistance data: ununsupported");
handle_inject_assistance_data_context_free (ctx);
return;
}
@@ -1204,10 +1190,8 @@ handle_inject_assistance_data_auth_ready (MMBaseModem *sel
/* Check if plugin implements it */
if (!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->inject_assistance_data ||
!MM_IFACE_MODEM_LOCATION_GET_INTERFACE (self)->inject_assistance_data_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot inject assistance data: not implemented");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot inject assistance data: not implemented");
handle_inject_assistance_data_context_free (ctx);
return;
}
@@ -1271,7 +1255,7 @@ handle_set_gps_refresh_rate_auth_ready (MMBaseModem *self,
MMModemState modem_state;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_gps_refresh_rate_context_free (ctx);
return;
}
@@ -1281,11 +1265,8 @@ handle_set_gps_refresh_rate_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot set SUPL server: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot set SUPL server: device not yet enabled");
handle_set_gps_refresh_rate_context_free (ctx);
return;
}
@@ -1293,10 +1274,8 @@ handle_set_gps_refresh_rate_auth_ready (MMBaseModem *self,
/* If GPS is NOT supported, set error */
if (!(mm_gdbus_modem_location_get_capabilities (ctx->skeleton) & ((MM_MODEM_LOCATION_SOURCE_GPS_RAW |
MM_MODEM_LOCATION_SOURCE_GPS_NMEA)))) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set GPS refresh rate: GPS not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set GPS refresh rate: GPS not supported");
handle_set_gps_refresh_rate_context_free (ctx);
return;
}
@@ -1356,7 +1335,7 @@ handle_get_location_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_get_location_context_free (ctx);
return;
}
@@ -1366,11 +1345,8 @@ handle_get_location_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot get location: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot get location: device not yet enabled");
handle_get_location_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c
index 48e05984..e5021058 100644
--- a/src/mm-iface-modem-messaging.c
+++ b/src/mm-iface-modem-messaging.c
@@ -20,6 +20,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-messaging.h"
#include "mm-sms-list.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "messaging-support-checked-tag"
@@ -168,7 +169,7 @@ handle_delete_ready (MMSmsList *list,
if (!mm_sms_list_delete_sms_finish (list, res, &error)) {
mm_obj_warn (ctx->self, "failed deleting SMS message '%s': %s", ctx->path, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (ctx->self, "deleted SMS message '%s'", ctx->path);
mm_gdbus_modem_messaging_complete_delete (ctx->skeleton, ctx->invocation);
@@ -185,7 +186,7 @@ handle_delete_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_context_free (ctx);
return;
}
@@ -206,10 +207,8 @@ handle_delete_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_MESSAGING_SMS_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot delete SMS: missing SMS list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot delete SMS: missing SMS list");
handle_delete_context_free (ctx);
return;
}
@@ -273,7 +272,7 @@ handle_create_auth_ready (MMBaseModem *self,
g_autoptr(MMBaseSms) sms = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_context_free (ctx);
return;
}
@@ -288,14 +287,14 @@ handle_create_auth_ready (MMBaseModem *self,
/* Parse input properties */
properties = mm_sms_properties_new_from_dictionary (ctx->dictionary, &error);
if (!properties) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_context_free (ctx);
return;
}
sms = mm_base_sms_new_from_properties (MM_BASE_MODEM (self), properties, &error);
if (!sms) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_context_free (ctx);
return;
}
@@ -304,10 +303,8 @@ handle_create_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_MESSAGING_SMS_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot create SMS: missing SMS list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot create SMS: missing SMS list");
handle_create_context_free (ctx);
return;
}
@@ -362,10 +359,8 @@ handle_list (MmGdbusModemMessaging *skeleton,
MM_IFACE_MODEM_MESSAGING_SMS_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot list SMS: missing SMS list");
+ mm_dbus_method_invocation_return_error_literal (invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot list SMS: missing SMS list");
return TRUE;
}
diff --git a/src/mm-iface-modem-oma.c b/src/mm-iface-modem-oma.c
index e27ee22f..9d30997c 100644
--- a/src/mm-iface-modem-oma.c
+++ b/src/mm-iface-modem-oma.c
@@ -19,6 +19,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-oma.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "oma-support-checked-tag"
@@ -168,7 +169,7 @@ setup_ready (MMIfaceModemOma *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->setup_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
/* Update current features in the interface */
mm_gdbus_modem_oma_set_features (ctx->skeleton, ctx->features);
@@ -188,7 +189,7 @@ handle_setup_auth_ready (MMBaseModem *self,
gchar *str;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_setup_context_free (ctx);
return;
}
@@ -198,22 +199,16 @@ handle_setup_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot setup OMA: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot setup OMA: device not yet enabled");
handle_setup_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->setup ||
!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->setup_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot setup OMA: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot setup OMA: operation not supported");
handle_setup_context_free (ctx);
return;
}
@@ -278,7 +273,7 @@ start_client_initiated_session_ready (MMIfaceModemOma *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->start_client_initiated_session_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
/* Update interface info */
mm_gdbus_modem_oma_set_session_type (ctx->skeleton, ctx->session_type);
@@ -298,7 +293,7 @@ handle_start_client_initiated_session_auth_ready (MMBaseModem *self,
MMModemState modem_state;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_start_client_initiated_session_context_free (ctx);
return;
}
@@ -308,22 +303,18 @@ handle_start_client_initiated_session_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot start client-initiated OMA session: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot start client-initiated OMA session: "
+ "device not yet enabled");
handle_start_client_initiated_session_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->start_client_initiated_session ||
!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->start_client_initiated_session_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot start client-initiated OMA session: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot start client-initiated OMA session: "
+ "operation not supported");
handle_start_client_initiated_session_context_free (ctx);
return;
}
@@ -331,12 +322,10 @@ handle_start_client_initiated_session_auth_ready (MMBaseModem *self,
if (ctx->session_type != MM_OMA_SESSION_TYPE_CLIENT_INITIATED_DEVICE_CONFIGURE &&
ctx->session_type != MM_OMA_SESSION_TYPE_CLIENT_INITIATED_PRL_UPDATE &&
ctx->session_type != MM_OMA_SESSION_TYPE_CLIENT_INITIATED_HANDS_FREE_ACTIVATION) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot start client-initiated OMA session: "
- "invalid session type specified (%s)",
- mm_oma_session_type_get_string (ctx->session_type));
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot start client-initiated OMA session: "
+ "invalid session type specified (%s)",
+ mm_oma_session_type_get_string (ctx->session_type));
handle_start_client_initiated_session_context_free (ctx);
return;
}
@@ -401,7 +390,7 @@ accept_network_initiated_session_ready (MMIfaceModemOma *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->accept_network_initiated_session_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
/* If accepted or rejected, remove from pending */
add_or_remove_pending_network_initiated_session (self, FALSE, ctx->session_type, ctx->session_id);
@@ -458,7 +447,7 @@ handle_accept_network_initiated_session_auth_ready (MMBaseModem *self,
MMModemState modem_state;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_accept_network_initiated_session_context_free (ctx);
return;
}
@@ -468,34 +457,28 @@ handle_accept_network_initiated_session_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot accept network-initiated OMA session: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot accept network-initiated OMA session: "
+ "device not yet enabled");
handle_accept_network_initiated_session_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->accept_network_initiated_session ||
!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->accept_network_initiated_session_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot accept network-initiated OMA session: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot accept network-initiated OMA session: "
+ "operation not supported");
handle_accept_network_initiated_session_context_free (ctx);
return;
}
ctx->session_type = get_pending_network_initiated_session_type (ctx->self, ctx->session_id);
if (ctx->session_type == MM_OMA_SESSION_TYPE_UNKNOWN) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot accept network-initiated OMA session: "
- "unknown session id (%u)",
- ctx->session_id);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot accept network-initiated OMA session: "
+ "unknown session id (%u)",
+ ctx->session_id);
handle_accept_network_initiated_session_context_free (ctx);
return;
}
@@ -563,7 +546,7 @@ cancel_session_ready (MMIfaceModemOma *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->cancel_session_finish (self, res, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else {
/* Clear interface info when cancelled */
mm_gdbus_modem_oma_set_session_type (ctx->skeleton, MM_OMA_SESSION_TYPE_UNKNOWN);
@@ -584,7 +567,7 @@ handle_cancel_session_auth_ready (MMBaseModem *self,
MMModemState modem_state;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_cancel_session_context_free (ctx);
return;
}
@@ -594,22 +577,16 @@ handle_cancel_session_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot cancel OMA session: "
- "device not yet enabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot cancel OMA session: device not yet enabled");
handle_cancel_session_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->cancel_session ||
!MM_IFACE_MODEM_OMA_GET_INTERFACE (ctx->self)->cancel_session_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot cancel OMA session: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot cancel OMA session: operation not supported");
handle_cancel_session_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-sar.c b/src/mm-iface-modem-sar.c
index 3d193e7a..693efbd2 100644
--- a/src/mm-iface-modem-sar.c
+++ b/src/mm-iface-modem-sar.c
@@ -19,6 +19,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-sar.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "sar-support-checked-tag"
@@ -82,7 +83,7 @@ enable_ready (MMIfaceModemSar *self,
if (!MM_IFACE_MODEM_SAR_GET_INTERFACE (ctx->self)->enable_finish (self, res, &power_level, &error)) {
mm_obj_warn (self, "failed %s SAR: %s", ctx->enable ? "enabling" : "disabling", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "%s SAR", ctx->enable ? "enabled" : "disabled");
mm_gdbus_modem_sar_set_state (ctx->skeleton, ctx->enable);
@@ -102,18 +103,15 @@ handle_enable_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_enable_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_SAR_GET_INTERFACE (ctx->self)->enable ||
!MM_IFACE_MODEM_SAR_GET_INTERFACE (ctx->self)->enable_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot setup SAR: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot setup SAR: operation not supported");
handle_enable_context_free (ctx);
return;
}
@@ -181,7 +179,7 @@ set_power_level_ready (MMIfaceModemSar *self,
if (!MM_IFACE_MODEM_SAR_GET_INTERFACE (ctx->self)->set_power_level_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting SAR power level to %u: %s", ctx->power_level, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "SAR power level set to %u", ctx->power_level);
mm_gdbus_modem_sar_set_power_level (ctx->skeleton, ctx->power_level);
@@ -199,27 +197,22 @@ handle_set_power_level_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_power_level_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_SAR_GET_INTERFACE (ctx->self)->set_power_level ||
!MM_IFACE_MODEM_SAR_GET_INTERFACE (ctx->self)->set_power_level_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot set SAR power level: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot set SAR power level: operation not supported");
handle_set_power_level_context_free (ctx);
return;
}
if (!mm_gdbus_modem_sar_get_state (ctx->skeleton)) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot set SAR power level: SAR is disabled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot set SAR power level: SAR is disabled");
handle_set_power_level_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-signal.c b/src/mm-iface-modem-signal.c
index fe7d0c7a..68c45ec6 100644
--- a/src/mm-iface-modem-signal.c
+++ b/src/mm-iface-modem-signal.c
@@ -20,6 +20,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-signal.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "signal-support-checked-tag"
@@ -380,7 +381,7 @@ handle_setup_auth_ready (MMBaseModem *_self,
Private *priv;
if (!mm_base_modem_authorize_finish (_self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_setup_context_free (ctx);
return;
}
@@ -455,7 +456,7 @@ setup_thresholds_restart_ready (MMIfaceModemSignal *self,
if (!thresholds_restart_finish (self, res, &error)) {
priv->rssi_threshold = ctx->previous_rssi_threshold;
priv->error_rate_threshold = ctx->previous_error_rate_threshold;
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
check_interface_reset (self);
mm_gdbus_modem_signal_set_rssi_threshold (ctx->skeleton, priv->rssi_threshold);
@@ -481,15 +482,15 @@ handle_setup_thresholds_auth_ready (MMBaseModem *_self,
priv = get_private (self);
if (!mm_base_modem_authorize_finish (_self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_setup_thresholds_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_SIGNAL_GET_INTERFACE (self)->setup_thresholds ||
!MM_IFACE_MODEM_SIGNAL_GET_INTERFACE (self)->setup_thresholds_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Cannot setup thresholds: operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot setup thresholds: operation not supported");
handle_setup_thresholds_context_free (ctx);
return;
}
@@ -503,7 +504,7 @@ handle_setup_thresholds_auth_ready (MMBaseModem *_self,
properties = mm_signal_threshold_properties_new_from_dictionary (ctx->settings, &error);
if (!properties) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_setup_thresholds_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c
index 2427773c..194c5c0b 100644
--- a/src/mm-iface-modem-simple.c
+++ b/src/mm-iface-modem-simple.c
@@ -469,7 +469,7 @@ connect_bearer_ready (MMBaseBearer *bearer,
if (!mm_base_bearer_connect_finish (bearer, res, &error)) {
mm_obj_warn (ctx->self, "couldn't connect bearer: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -489,7 +489,7 @@ create_bearer_ready (MMIfaceModem *self,
ctx->bearer = mm_iface_modem_create_bearer_finish (self, res, &error);
if (!ctx->bearer) {
mm_obj_warn (ctx->self, "couldn't create bearer: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -507,7 +507,7 @@ packet_service_attach_in_3gpp_network_ready (MMIfaceModemSimple *self,
if (!packet_service_attach_in_3gpp_network_finish (self, res, &error)) {
mm_obj_warn (ctx->self, "packet service attach in 3GPP network failed: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -525,7 +525,7 @@ register_in_3gpp_or_cdma_network_ready (MMIfaceModemSimple *self,
if (!register_in_3gpp_or_cdma_network_finish (self, res, &error)) {
mm_obj_warn (ctx->self, "registration in network failed: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -554,19 +554,16 @@ wait_for_enabled_ready (MMIfaceModem *self,
state = mm_iface_modem_wait_for_final_state_finish (self, res, &error);
if (error) {
mm_obj_warn (ctx->self, "failed waiting for final state: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
if (state < MM_MODEM_STATE_ENABLED) {
mm_obj_warn (ctx->self, "failed waiting for enabled state: %s", mm_modem_state_get_string (state));
- g_dbus_method_invocation_return_error (
- ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Couldn't wait for 'enabled': new state is '%s'",
- mm_modem_state_get_string (state));
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Couldn't wait for 'enabled': new state is '%s'",
+ mm_modem_state_get_string (state));
connection_context_free (ctx);
return;
}
@@ -584,7 +581,7 @@ enable_ready (MMBaseModem *self,
if (!mm_base_modem_enable_finish (MM_BASE_MODEM (self), res, &error)) {
mm_obj_warn (ctx->self, "failed enabling modem: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -603,7 +600,7 @@ wait_for_initialized_ready (MMIfaceModem *self,
mm_iface_modem_wait_for_final_state_finish (self, res, &error);
if (error) {
mm_obj_warn (ctx->self, "failed waiting for final state: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -621,7 +618,7 @@ send_pin_ready (MMBaseSim *sim,
if (!mm_base_sim_send_pin_finish (sim, res, &error)) {
mm_obj_warn (ctx->self, "failed sending SIM PIN: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -642,7 +639,7 @@ update_lock_info_ready (MMIfaceModem *self,
lock = mm_iface_modem_update_lock_info_finish (self, res, &error);
if (error) {
mm_obj_warn (ctx->self, "failed updating lock info: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -663,12 +660,9 @@ update_lock_info_ready (MMIfaceModem *self,
!mm_simple_connect_properties_get_pin (ctx->properties)) {
mm_obj_warn (ctx->self, "modem is locked with '%s'",
mm_modem_lock_get_string (lock));
- g_dbus_method_invocation_return_error (
- ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNAUTHORIZED,
- "Modem is locked with '%s' code; cannot unlock it",
- mm_modem_lock_get_string (lock));
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNAUTHORIZED,
+ "Modem is locked with '%s' code; cannot unlock it",
+ mm_modem_lock_get_string (lock));
connection_context_free (ctx);
return;
}
@@ -679,11 +673,8 @@ update_lock_info_ready (MMIfaceModem *self,
NULL);
if (!sim) {
mm_obj_warn (ctx->self, "SIM is not accessible");
- g_dbus_method_invocation_return_error (
- ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Cannot unlock modem, couldn't get access to the SIM");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Cannot unlock modem, couldn't get access to the SIM");
connection_context_free (ctx);
return;
}
@@ -703,9 +694,8 @@ completed_if_cancelled (ConnectionContext *ctx)
/* Otherwise cancellable is valid and it's cancelled */
mm_obj_warn (ctx->self, "connection attempt cancelled");
- g_dbus_method_invocation_return_error (
- ctx->invocation, G_IO_ERROR, G_IO_ERROR_CANCELLED,
- "Connection attempt cancelled");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, G_IO_ERROR, G_IO_ERROR_CANCELLED,
+ "Connection attempt cancelled");
connection_context_free (ctx);
return TRUE;
}
@@ -896,14 +886,14 @@ connect_auth_ready (MMBaseModem *self,
MMModemState current = MM_MODEM_STATE_UNKNOWN;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
ctx->properties = mm_simple_connect_properties_new_from_dictionary (ctx->dictionary, &error);
if (!ctx->properties) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -912,7 +902,7 @@ connect_auth_ready (MMBaseModem *self,
mm_log_simple_connect_properties (self, MM_LOG_LEVEL_INFO, " ", ctx->properties);
if (!setup_cancellation (ctx, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
connection_context_free (ctx);
return;
}
@@ -923,9 +913,8 @@ connect_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_BEARER_LIST, &ctx->bearer_list,
NULL);
if (!ctx->bearer_list) {
- g_dbus_method_invocation_return_error (
- ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
- "Couldn't get the bearer list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Couldn't get the bearer list");
connection_context_free (ctx);
return;
}
@@ -1024,7 +1013,7 @@ bearer_list_disconnect_bearers_ready (MMBearerList *bearer_list,
if (!mm_bearer_list_disconnect_bearers_finish (bearer_list, res, &error)) {
mm_obj_warn (ctx->self, "failed to disconnect bearers: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (ctx->self, "all requested bearers disconnected");
mm_gdbus_modem_simple_complete_disconnect (ctx->skeleton, ctx->invocation);
@@ -1041,7 +1030,7 @@ disconnect_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
disconnection_context_free (ctx);
return;
}
@@ -1055,11 +1044,8 @@ disconnect_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_BEARER_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (
- ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Couldn't get the bearer list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Couldn't get the bearer list");
disconnection_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-time.c b/src/mm-iface-modem-time.c
index af631bcc..ac7b1d2a 100644
--- a/src/mm-iface-modem-time.c
+++ b/src/mm-iface-modem-time.c
@@ -19,6 +19,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-time.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define SUPPORT_CHECKED_TAG "time-support-checked-tag"
@@ -64,7 +65,7 @@ load_network_time_ready (MMIfaceModemTime *self,
time_str = MM_IFACE_MODEM_TIME_GET_INTERFACE (self)->load_network_time_finish (self, res, &error);
if (error)
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_time_complete_get_network_time (ctx->skeleton, ctx->invocation, time_str);
g_free (time_str);
@@ -80,7 +81,7 @@ handle_get_network_time_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_get_network_time_context_free (ctx);
return;
}
@@ -91,22 +92,16 @@ handle_get_network_time_auth_ready (MMBaseModem *self,
NULL);
/* If we're not yet registered, we cannot get the network time */
if (state < MM_MODEM_STATE_REGISTERED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot load network time: "
- "not registered yet");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot load network time: not registered yet");
handle_get_network_time_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_TIME_GET_INTERFACE (self)->load_network_time ||
!MM_IFACE_MODEM_TIME_GET_INTERFACE (self)->load_network_time_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot load network time: "
- "operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot load network time: operation not supported");
handle_get_network_time_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c
index 4f3b30fc..47215ed4 100644
--- a/src/mm-iface-modem-voice.c
+++ b/src/mm-iface-modem-voice.c
@@ -21,6 +21,7 @@
#include "mm-iface-modem.h"
#include "mm-iface-modem-voice.h"
#include "mm-call-list.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#define CALL_LIST_POLLING_CONTEXT_TAG "voice-call-list-polling-context-tag"
@@ -597,7 +598,7 @@ handle_delete_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_context_free (ctx);
return;
}
@@ -606,16 +607,14 @@ handle_delete_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot delete call: missing call list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot delete call: missing call list");
handle_delete_context_free (ctx);
return;
}
if (!mm_call_list_delete_call (list, ctx->path, &error))
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
else
mm_gdbus_modem_voice_complete_delete_call (ctx->skeleton, ctx->invocation);
@@ -675,7 +674,7 @@ handle_create_auth_ready (MMBaseModem *self,
MMBaseCall *call;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_context_free (ctx);
return;
}
@@ -683,7 +682,7 @@ handle_create_auth_ready (MMBaseModem *self,
/* Parse input properties */
properties = mm_call_properties_new_from_dictionary (ctx->dictionary, &error);
if (!properties) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_context_free (ctx);
return;
}
@@ -691,7 +690,7 @@ handle_create_auth_ready (MMBaseModem *self,
call = create_outgoing_call_from_properties (MM_IFACE_MODEM_VOICE (self), properties, &error);
if (!call) {
g_object_unref (properties);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_context_free (ctx);
return;
}
@@ -702,10 +701,8 @@ handle_create_auth_ready (MMBaseModem *self,
if (!list) {
g_object_unref (properties);
g_object_unref (call);
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot create CALL: missing CALL list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot create call: missing call list");
handle_create_context_free (ctx);
return;
}
@@ -762,10 +759,8 @@ handle_list (MmGdbusModemVoice *skeleton,
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot list CALL: missing CALL list");
+ mm_dbus_method_invocation_return_error_literal (invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot list call: missing call list");
return TRUE;
}
@@ -808,7 +803,7 @@ hold_and_accept_ready (MMIfaceModemVoice *self,
GList *l;
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hold_and_accept_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hold_and_accept_context_free (ctx);
return;
}
@@ -857,17 +852,15 @@ handle_hold_and_accept_auth_ready (MMBaseModem *self,
MMCallList *list = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hold_and_accept_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hold_and_accept ||
!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hold_and_accept_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot hold and accept: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot hold and accept: unsupported");
handle_hold_and_accept_context_free (ctx);
return;
}
@@ -876,10 +869,8 @@ handle_hold_and_accept_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot hold and accept: missing call list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot hold and accept: missing call list");
handle_hold_and_accept_context_free (ctx);
return;
}
@@ -941,7 +932,7 @@ hangup_and_accept_ready (MMIfaceModemVoice *self,
GList *l;
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hangup_and_accept_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hangup_and_accept_context_free (ctx);
return;
}
@@ -990,17 +981,15 @@ handle_hangup_and_accept_auth_ready (MMBaseModem *self,
MMCallList *list = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hangup_and_accept_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hangup_and_accept ||
!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hangup_and_accept_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot hangup and accept: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot hangup and accept: unsupported");
handle_hangup_and_accept_context_free (ctx);
return;
}
@@ -1009,10 +998,8 @@ handle_hangup_and_accept_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot hangup and accept: missing call list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot hangup and accept: missing call list");
handle_hangup_and_accept_context_free (ctx);
return;
}
@@ -1072,7 +1059,7 @@ hangup_all_ready (MMIfaceModemVoice *self,
GList *l;
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hangup_all_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hangup_all_context_free (ctx);
return;
}
@@ -1133,17 +1120,15 @@ handle_hangup_all_auth_ready (MMBaseModem *self,
MMCallList *list = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_hangup_all_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hangup_all ||
!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->hangup_all_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot hangup all: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot hangup all: unsupported");
handle_hangup_all_context_free (ctx);
return;
}
@@ -1152,10 +1137,8 @@ handle_hangup_all_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot hangup all: missing call list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot hangup all: missing call list");
handle_hangup_all_context_free (ctx);
return;
}
@@ -1215,7 +1198,7 @@ transfer_ready (MMIfaceModemVoice *self,
GList *l;
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->transfer_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_transfer_context_free (ctx);
return;
}
@@ -1256,17 +1239,15 @@ handle_transfer_auth_ready (MMBaseModem *self,
MMCallList *list = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_transfer_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->transfer ||
!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->transfer_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot transfer: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot transfer: unsupported");
handle_transfer_context_free (ctx);
return;
}
@@ -1275,10 +1256,8 @@ handle_transfer_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_VOICE_CALL_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Cannot transfer: missing call list");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Cannot transfer: missing call list");
handle_transfer_context_free (ctx);
return;
}
@@ -1336,7 +1315,7 @@ call_waiting_setup_ready (MMIfaceModemVoice *self,
GError *error = NULL;
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->call_waiting_setup_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_call_waiting_setup_context_free (ctx);
return;
}
@@ -1353,17 +1332,15 @@ handle_call_waiting_setup_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_call_waiting_setup_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->call_waiting_setup ||
!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->call_waiting_setup_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot setup call waiting: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot setup call waiting: unsupported");
handle_call_waiting_setup_context_free (ctx);
return;
}
@@ -1423,7 +1400,7 @@ call_waiting_query_ready (MMIfaceModemVoice *self,
gboolean status = FALSE;
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->call_waiting_query_finish (self, res, &status, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_call_waiting_query_context_free (ctx);
return;
}
@@ -1440,17 +1417,15 @@ handle_call_waiting_query_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_call_waiting_query_context_free (ctx);
return;
}
if (!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->call_waiting_query ||
!MM_IFACE_MODEM_VOICE_GET_INTERFACE (self)->call_waiting_query_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot query call waiting: unsupported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot query call waiting: unsupported");
handle_call_waiting_query_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index cf79fd10..fb8fb9c5 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -29,6 +29,7 @@
#include "mm-base-sim.h"
#include "mm-bearer-list.h"
#include "mm-private-boxed-types.h"
+#include "mm-error-helpers.h"
#include "mm-log-object.h"
#include "mm-log-helpers.h"
#include "mm-context.h"
@@ -550,11 +551,8 @@ mm_iface_modem_abort_invocation_if_state_not_reached (MMIfaceModem *sel
if (state >= minimum_required)
return FALSE;
- g_dbus_method_invocation_return_error (invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "modem in %s state",
- mm_modem_state_get_string (state));
+ mm_dbus_method_invocation_return_error (invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "modem in %s state", mm_modem_state_get_string (state));
return TRUE;
}
@@ -957,7 +955,7 @@ handle_create_bearer_ready (MMIfaceModem *self,
bearer = mm_iface_modem_create_bearer_finish (self, res, &error);
if (!bearer) {
mm_obj_warn (self, "failed creating bearer: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "created bearer: %s", mm_base_bearer_get_path (bearer));
mm_gdbus_modem_complete_create_bearer (ctx->skeleton, ctx->invocation, mm_base_bearer_get_path (bearer));
@@ -975,7 +973,7 @@ handle_create_bearer_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_bearer_context_free (ctx);
return;
}
@@ -987,7 +985,7 @@ handle_create_bearer_auth_ready (MMBaseModem *self,
properties = mm_bearer_properties_new_from_dictionary (ctx->dictionary, &error);
if (!properties) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_create_bearer_context_free (ctx);
return;
}
@@ -1055,7 +1053,7 @@ command_ready (MMIfaceModem *self,
result = MM_IFACE_MODEM_GET_INTERFACE (self)->command_finish (self, res, &error);
if (error) {
mm_obj_dbg (self, "failed running AT command '%s': %s", ctx->cmd, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_dbg (self, "AT command '%s' run: %s", ctx->cmd, result);
mm_gdbus_modem_complete_command (ctx->skeleton, ctx->invocation, result);
@@ -1072,7 +1070,7 @@ handle_command_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_command_context_free (ctx);
return;
}
@@ -1080,8 +1078,8 @@ handle_command_auth_ready (MMBaseModem *self,
#if ! defined WITH_AT_COMMAND_VIA_DBUS
/* If we are not in Debug mode, report an error */
if (!mm_context_get_debug ()) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNAUTHORIZED,
- "Operation only allowed in debug mode");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNAUTHORIZED,
+ "Operation only allowed in debug mode");
handle_command_context_free (ctx);
return;
}
@@ -1089,8 +1087,8 @@ handle_command_auth_ready (MMBaseModem *self,
/* If command is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->command || !MM_IFACE_MODEM_GET_INTERFACE (self)->command_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_command_context_free (ctx);
return;
}
@@ -1159,14 +1157,14 @@ delete_bearer_disconnect_ready (MMBaseBearer *bearer,
if (!mm_base_bearer_disconnect_finish (bearer, res, &error)) {
mm_obj_warn (ctx->self, "failed disconnecting bearer '%s' before deleting: %s", ctx->bearer_path, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_bearer_context_free (ctx);
return;
}
if (!mm_bearer_list_delete_bearer (ctx->list, ctx->bearer_path, &error)) {
mm_obj_warn (ctx->self, "failed deleting bearer '%s': %s", ctx->bearer_path, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (ctx->self, "deleted bearer '%s'", ctx->bearer_path);
mm_gdbus_modem_complete_delete_bearer (ctx->skeleton, ctx->invocation);
@@ -1182,7 +1180,7 @@ handle_delete_bearer_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_delete_bearer_context_free (ctx);
return;
}
@@ -1193,16 +1191,16 @@ handle_delete_bearer_auth_ready (MMBaseModem *self,
}
if (!g_str_has_prefix (ctx->bearer_path, MM_DBUS_BEARER_PREFIX)) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Invalid path '%s'", ctx->bearer_path);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Invalid path '%s'", ctx->bearer_path);
handle_delete_bearer_context_free (ctx);
return;
}
ctx->bearer = mm_bearer_list_find_by_path (ctx->list, ctx->bearer_path);
if (!ctx->bearer) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "No bearer found with path '%s'", ctx->bearer_path);
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "No bearer found with path '%s'", ctx->bearer_path);
handle_delete_bearer_context_free (ctx);
return;
}
@@ -1255,8 +1253,8 @@ handle_list_bearers (MmGdbusModem *skeleton,
MM_IFACE_MODEM_BEARER_LIST, &list,
NULL);
if (!list) {
- g_dbus_method_invocation_return_error (invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
- "Bearer list not found");
+ mm_dbus_method_invocation_return_error_literal (invocation, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Bearer list not found");
return TRUE;
}
@@ -1295,7 +1293,7 @@ set_primary_sim_slot_ready (MMIfaceModem *self,
* so we can safely return a success on the operation and skip the reprobing */
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_EXISTS)) {
mm_obj_warn (self, "failed setting primary SIM slot '%u': %s", ctx->requested_sim_slot, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, g_steal_pointer (&error));
+ mm_dbus_method_invocation_take_error (ctx->invocation, g_steal_pointer (&error));
handle_set_primary_sim_slot_context_free (ctx);
return;
}
@@ -1321,7 +1319,7 @@ handle_set_primary_sim_slot_auth_ready (MMBaseModem *self,
const gchar *const *sim_slot_paths;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_primary_sim_slot_context_free (ctx);
return;
}
@@ -1329,8 +1327,8 @@ handle_set_primary_sim_slot_auth_ready (MMBaseModem *self,
/* If SIM switching is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_primary_sim_slot ||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_primary_sim_slot_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_set_primary_sim_slot_context_free (ctx);
return;
}
@@ -1338,8 +1336,8 @@ handle_set_primary_sim_slot_auth_ready (MMBaseModem *self,
/* Validate SIM slot number */
sim_slot_paths = mm_gdbus_modem_get_sim_slots (ctx->skeleton);
if (!sim_slot_paths || (ctx->requested_sim_slot > g_strv_length ((gchar **)sim_slot_paths))) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Requested SIM slot number is out of bounds");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Requested SIM slot number is out of bounds");
handle_set_primary_sim_slot_context_free (ctx);
return;
}
@@ -1419,7 +1417,7 @@ get_cell_info_ready (MMIfaceModem *self,
info_list = MM_IFACE_MODEM_GET_INTERFACE (self)->get_cell_info_finish (self, res, &error);
if (error) {
mm_obj_dbg (self, "failed retrieving cell info: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
g_autoptr(GVariant) dict_array = NULL;
@@ -1440,7 +1438,7 @@ handle_get_cell_info_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_get_cell_info_context_free (ctx);
return;
}
@@ -1448,8 +1446,8 @@ handle_get_cell_info_auth_ready (MMBaseModem *self,
/* If getting cell info is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->get_cell_info ||
!MM_IFACE_MODEM_GET_INTERFACE (self)->get_cell_info_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Cannot get cell info: operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot get cell info: operation not supported");
handle_get_cell_info_context_free (ctx);
return;
}
@@ -2216,7 +2214,7 @@ enable_ready (MMBaseModem *self,
if (ctx->enable) {
if (!mm_base_modem_enable_finish (self, res, &error)) {
mm_obj_warn (self, "failed enabling modem: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "enabled modem");
mm_gdbus_modem_complete_enable (ctx->skeleton, ctx->invocation);
@@ -2224,7 +2222,7 @@ enable_ready (MMBaseModem *self,
} else {
if (!mm_base_modem_disable_finish (self, res, &error)) {
mm_obj_warn (self, "failed disabling modem: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "disabled modem");
mm_gdbus_modem_complete_enable (ctx->skeleton, ctx->invocation);
@@ -2242,7 +2240,7 @@ handle_enable_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_enable_context_free (ctx);
return;
}
@@ -2314,7 +2312,7 @@ set_power_state_ready (MMIfaceModem *self,
if (!mm_iface_modem_set_power_state_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting power state '%s': %s", mm_modem_power_state_get_string (ctx->power_state), error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "set power state '%s'", mm_modem_power_state_get_string (ctx->power_state));
mm_gdbus_modem_complete_set_power_state (ctx->skeleton, ctx->invocation);
@@ -2331,7 +2329,7 @@ handle_set_power_state_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_power_state_context_free (ctx);
return;
}
@@ -2340,9 +2338,9 @@ handle_set_power_state_auth_ready (MMBaseModem *self,
if (ctx->power_state != MM_MODEM_POWER_STATE_LOW &&
ctx->power_state != MM_MODEM_POWER_STATE_ON &&
ctx->power_state != MM_MODEM_POWER_STATE_OFF) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
- "Unknown power state: '%s'",
- mm_modem_power_state_get_string (ctx->power_state));
+ mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
+ "Unknown power state: '%s'",
+ mm_modem_power_state_get_string (ctx->power_state));
handle_set_power_state_context_free (ctx);
return;
}
@@ -2356,8 +2354,8 @@ handle_set_power_state_auth_ready (MMBaseModem *self,
if ((ctx->power_state == MM_MODEM_POWER_STATE_LOW || ctx->power_state == MM_MODEM_POWER_STATE_ON) &&
modem_state != MM_MODEM_STATE_FAILED &&
modem_state != MM_MODEM_STATE_DISABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
- "Must be in disabled or failed state");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Must be in disabled or failed state");
handle_set_power_state_context_free (ctx);
return;
}
@@ -2367,10 +2365,8 @@ handle_set_power_state_auth_ready (MMBaseModem *self,
modem_state != MM_MODEM_STATE_FAILED &&
modem_state != MM_MODEM_STATE_LOCKED &&
modem_state != MM_MODEM_STATE_DISABLED) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_WRONG_STATE,
- "Modem either enabled or initializing");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
+ "Modem either enabled or initializing");
handle_set_power_state_context_free (ctx);
return;
}
@@ -2430,7 +2426,7 @@ handle_reset_ready (MMIfaceModem *self,
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish (self, res, &error)) {
mm_obj_warn (self, "failed requesting modem reset: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "modem reset requested");
mm_gdbus_modem_complete_reset (ctx->skeleton, ctx->invocation);
@@ -2447,15 +2443,15 @@ handle_reset_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_reset_context_free (ctx);
return;
}
/* If reseting is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset || !MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_reset_context_free (ctx);
return;
}
@@ -2515,7 +2511,7 @@ handle_factory_reset_ready (MMIfaceModem *self,
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->factory_reset_finish (self, res, &error)) {
mm_obj_warn (self, "failed requesting modem factory reset: %s", error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
mm_obj_info (self, "modem factory reset requested");
mm_gdbus_modem_complete_factory_reset (ctx->skeleton, ctx->invocation);
@@ -2532,15 +2528,15 @@ handle_factory_reset_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_factory_reset_context_free (ctx);
return;
}
/* If reseting is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->factory_reset || !MM_IFACE_MODEM_GET_INTERFACE (self)->factory_reset_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Operation not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_factory_reset_context_free (ctx);
return;
}
@@ -2610,7 +2606,7 @@ set_current_capabilities_ready (MMIfaceModem *self,
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_capabilities_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting current capabilities to '%s': %s", ctx->capabilities_str, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
/* Capabilities updated: explicitly refresh signal and access technology */
mm_iface_modem_refresh_signal (self);
@@ -2632,7 +2628,7 @@ handle_set_current_capabilities_auth_ready (MMBaseModem
guint i;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_current_capabilities_context_free (ctx);
return;
}
@@ -2647,8 +2643,8 @@ handle_set_current_capabilities_auth_ready (MMBaseModem
/* If setting current capabilities is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_capabilities ||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_capabilities_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Setting current capabilities not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Setting current capabilities not supported");
handle_set_current_capabilities_context_free (ctx);
return;
}
@@ -2658,8 +2654,8 @@ handle_set_current_capabilities_auth_ready (MMBaseModem
/* Don't allow capability switching if only one item given in the supported list */
if (supported->len == 1) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "Cannot change capabilities: only one combination supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot change capabilities: only one combination supported");
handle_set_current_capabilities_context_free (ctx);
return;
}
@@ -2673,8 +2669,8 @@ handle_set_current_capabilities_auth_ready (MMBaseModem
matched = TRUE;
}
if (!matched) {
- g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
- "The given combination of capabilities is not supported");
+ mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "The given combination of capabilities is not supported");
handle_set_current_capabilities_context_free (ctx);
return;
}
@@ -3093,7 +3089,7 @@ handle_set_current_bands_ready (MMIfaceModem *self,
if (!mm_iface_modem_set_current_bands_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting current bands to '%s': %s", ctx->bands_str, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
/* Bands updated: explicitly refresh signal and access technology */
mm_iface_modem_refresh_signal (self);
@@ -3113,7 +3109,7 @@ handle_set_current_bands_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_current_bands_context_free (ctx);
return;
}
@@ -3491,7 +3487,7 @@ handle_set_current_modes_ready (MMIfaceModem *self,
if (!mm_iface_modem_set_current_modes_finish (self, res, &error)) {
mm_obj_warn (self, "failed setting current modes to '%s' (preferred '%s'): %s",
ctx->allowed_str, ctx->preferred_str, error->message);
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
} else {
/* Modes updated: explicitly refresh signal and access technology */
mm_iface_modem_refresh_signal (self);
@@ -3511,7 +3507,7 @@ handle_set_current_modes_auth_ready (MMBaseModem *self,
GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
+ mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_current_modes_context_free (ctx);
return;
}