diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2024-04-18 11:31:57 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2024-05-06 13:27:04 +0000 |
commit | f033a0a9f292601e0e4ffc627617d0df01e699b2 (patch) | |
tree | ebc08f84945390cb737976b001e5009f582a9a03 /src | |
parent | ab6e4bf391cf3d05dc7758b4bf8844e3ac1e7da7 (diff) |
iface-modem-3gpp-profile-manager: use G_DECLARE|DEFINE_INTERFACE() macros
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem-mbim.c | 20 | ||||
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 28 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 30 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp-profile-manager.c | 145 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp-profile-manager.h | 15 | ||||
-rw-r--r-- | src/plugins/fibocom/mm-broadband-modem-fibocom.c | 16 | ||||
-rw-r--r-- | src/plugins/icera/mm-broadband-modem-icera.c | 16 | ||||
-rw-r--r-- | src/plugins/quectel/mm-broadband-modem-qmi-quectel.c | 20 |
8 files changed, 133 insertions, 157 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c index 374d0a63..b77bffcb 100644 --- a/src/mm-broadband-modem-mbim.c +++ b/src/mm-broadband-modem-mbim.c @@ -51,16 +51,16 @@ # include "mm-shared-qmi.h" #endif -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); -static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface); -static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface); -static void iface_modem_location_init (MMIfaceModemLocation *iface); -static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); -static void iface_modem_signal_init (MMIfaceModemSignal *iface); -static void iface_modem_sar_init (MMIfaceModemSar *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); +static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); +static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface); +static void iface_modem_location_init (MMIfaceModemLocation *iface); +static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); +static void iface_modem_signal_init (MMIfaceModemSignal *iface); +static void iface_modem_sar_init (MMIfaceModemSar *iface); #if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED -static void shared_qmi_init (MMSharedQmi *iface); +static void shared_qmi_init (MMSharedQmi *iface); #endif #if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED @@ -10205,7 +10205,7 @@ iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface) } static void -iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface) +iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface) { /* Initialization steps */ iface->check_support = modem_3gpp_profile_manager_check_support; diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index e3359e83..8140e7c8 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -53,19 +53,19 @@ #include "mm-call-qmi.h" #include "mm-call-list.h" -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); -static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface); -static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface); -static void iface_modem_voice_init (MMIfaceModemVoice *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); -static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); -static void iface_modem_location_init (MMIfaceModemLocation *iface); -static void iface_modem_oma_init (MMIfaceModemOma *iface); -static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); -static void iface_modem_sar_init (MMIfaceModemSar *iface); -static void iface_modem_signal_init (MMIfaceModemSignal *iface); -static void shared_qmi_init (MMSharedQmi *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); +static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); +static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface); +static void iface_modem_voice_init (MMIfaceModemVoice *iface); +static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); +static void iface_modem_location_init (MMIfaceModemLocation *iface); +static void iface_modem_oma_init (MMIfaceModemOma *iface); +static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); +static void iface_modem_sar_init (MMIfaceModemSar *iface); +static void iface_modem_signal_init (MMIfaceModemSignal *iface); +static void shared_qmi_init (MMSharedQmi *iface); static MMIfaceModemLocation *iface_modem_location_parent; static MMIfaceModemMessaging *iface_modem_messaging_parent; @@ -13952,7 +13952,7 @@ iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface) } static void -iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface) +iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface) { /* No explicit check support for the profile management feature, just * rely on the generic way to check for support */ diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 4e33fbcb..4bf00b39 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -61,20 +61,20 @@ #include "libqcdm/src/log-items.h" #include "mm-helper-enums-types.h" -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); -static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface); -static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); -static void iface_modem_simple_init (MMIfaceModemSimple *iface); -static void iface_modem_location_init (MMIfaceModemLocation *iface); -static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); -static void iface_modem_voice_init (MMIfaceModemVoice *iface); -static void iface_modem_time_init (MMIfaceModemTime *iface); -static void iface_modem_signal_init (MMIfaceModemSignal *iface); -static void iface_modem_oma_init (MMIfaceModemOma *iface); -static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); -static void iface_modem_sar_init (MMIfaceModemSar *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); +static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); +static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface); +static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_simple_init (MMIfaceModemSimple *iface); +static void iface_modem_location_init (MMIfaceModemLocation *iface); +static void iface_modem_messaging_init (MMIfaceModemMessaging *iface); +static void iface_modem_voice_init (MMIfaceModemVoice *iface); +static void iface_modem_time_init (MMIfaceModemTime *iface); +static void iface_modem_signal_init (MMIfaceModemSignal *iface); +static void iface_modem_oma_init (MMIfaceModemOma *iface); +static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); +static void iface_modem_sar_init (MMIfaceModemSar *iface); G_DEFINE_TYPE_EXTENDED (MMBroadbandModem, mm_broadband_modem, MM_TYPE_BASE_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) @@ -13583,7 +13583,7 @@ iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface) } static void -iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface) +iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface) { /* Initialization steps */ iface->check_support = modem_3gpp_profile_manager_check_support; diff --git a/src/mm-iface-modem-3gpp-profile-manager.c b/src/mm-iface-modem-3gpp-profile-manager.c index 8a2ba22e..45a12bb0 100644 --- a/src/mm-iface-modem-3gpp-profile-manager.c +++ b/src/mm-iface-modem-3gpp-profile-manager.c @@ -35,6 +35,8 @@ static GQuark support_checked_quark; static GQuark supported_quark; +G_DEFINE_INTERFACE (MMIfaceModem3gppProfileManager, mm_iface_modem_3gpp_profile_manager, MM_TYPE_IFACE_MODEM_3GPP) + /*****************************************************************************/ /* Private data context */ @@ -305,7 +307,7 @@ profile_manager_store_profile_ready (MMIfaceModem3gppProfileManager *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->store_profile_finish (self, res, &profile_id, &apn_type, &error)) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->store_profile_finish (self, res, &profile_id, &apn_type, &error)) { g_task_return_error (task, error); g_object_unref (task); return; @@ -339,7 +341,7 @@ set_profile_step_store_profile (GTask *task) g_assert (!ctx->stored); - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->store_profile ( + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->store_profile ( self, ctx->requested, ctx->index_field, @@ -358,7 +360,7 @@ profile_manager_deactivate_profile_ready (MMIfaceModem3gppProfileManager *self, ctx = g_task_get_task_data (task); /* profile deactivation errors aren't fatal per se */ - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->deactivate_profile_finish (self, res, &error)) + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->deactivate_profile_finish (self, res, &error)) mm_obj_dbg (self, "couldn't deactivate profile '%s': %s", ctx->index_field_value_str, error->message); else mm_obj_dbg (self, "deactivated profile '%s'", ctx->index_field_value_str); @@ -376,8 +378,8 @@ set_profile_step_deactivate_profile (GTask *task) self = g_task_get_source_object (task); ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->deactivate_profile || - !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->deactivate_profile_finish) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->deactivate_profile || + !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->deactivate_profile_finish) { mm_obj_dbg (self, "skipping profile deactivation"); ctx->step++; set_profile_step (task); @@ -389,7 +391,7 @@ set_profile_step_deactivate_profile (GTask *task) * bearer tracked. This covers e.g. a clean recovery of a previous daemon * crash, and is now defined as a supported step in the core logic, instead * of doing it differently in the different plugins and protocols. */ - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->deactivate_profile ( + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->deactivate_profile ( self, ctx->requested, (GAsyncReadyCallback) profile_manager_deactivate_profile_ready, @@ -407,7 +409,7 @@ profile_manager_check_activated_profile_ready (MMIfaceModem3gppProfileManager *s ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile_finish (self, res, &activated, &error)) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_activated_profile_finish (self, res, &activated, &error)) { if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) { mm_obj_dbg (self, "profile '%s' is not activated: %s", ctx->index_field_value_str, error->message); ctx->step = SET_PROFILE_STEP_STORE_PROFILE; @@ -491,8 +493,8 @@ set_profile_step_check_activated_profile (GTask *task) return; } - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile || - !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile_finish) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_activated_profile || + !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_activated_profile_finish) { ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE; set_profile_step (task); return; @@ -500,7 +502,7 @@ set_profile_step_check_activated_profile (GTask *task) /* Second, an actual query to the modem, in order to trigger the profile * deactivation before we attempt to activate it again */ - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile ( + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_activated_profile ( self, ctx->requested, (GAsyncReadyCallback) profile_manager_check_activated_profile_ready, @@ -658,7 +660,7 @@ set_profile_check_format_ready (MMIfaceModem3gppProfileManager *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_format_finish ( + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_format_finish ( self, res, &ctx->new_id, &ctx->min_profile_id, @@ -687,7 +689,7 @@ set_profile_step_check_format (GTask *task) self = g_task_get_source_object (task); ctx = g_task_get_task_data (task); - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_format ( + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_format ( self, mm_3gpp_profile_get_ip_type (ctx->requested), (GAsyncReadyCallback)set_profile_check_format_ready, @@ -897,7 +899,7 @@ get_profile_list_ready (MMIfaceModem3gppProfileManager *self, profile_id = GPOINTER_TO_INT (g_task_get_task_data (task)); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->list_profiles_finish (self, res, &profiles, &error)) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->list_profiles_finish (self, res, &profiles, &error)) { g_task_return_error (task, error); g_object_unref (task); return; @@ -924,7 +926,7 @@ get_profile_single_ready (MMIfaceModem3gppProfileManager *self, GError *error = NULL; MM3gppProfile *profile; - profile = MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->get_profile_finish (self, res, &error); + profile = MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->get_profile_finish (self, res, &error); if (!profile) g_task_return_error (task, error); else @@ -942,12 +944,13 @@ mm_iface_modem_3gpp_profile_manager_get_profile (MMIfaceModem3gppProfileManager task = g_task_new (self, NULL, callback, user_data); - if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->get_profile && - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->get_profile_finish) { - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->get_profile (self, - profile_id, - (GAsyncReadyCallback)get_profile_single_ready, - task); + if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->get_profile && + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->get_profile_finish) { + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->get_profile ( + self, + profile_id, + (GAsyncReadyCallback)get_profile_single_ready, + task); return; } @@ -1000,7 +1003,7 @@ internal_list_profiles_ready (MMIfaceModem3gppProfileManager *self, ctx = g_slice_new0 (ListProfilesContext); g_task_set_task_data (task, ctx, (GDestroyNotify) list_profiles_context_free); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->list_profiles_finish (self, res, &ctx->profiles, &error)) + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->list_profiles_finish (self, res, &ctx->profiles, &error)) g_task_return_error (task, error); else g_task_return_boolean (task, TRUE); @@ -1019,15 +1022,15 @@ mm_iface_modem_3gpp_profile_manager_list_profiles (MMIfaceModem3gppProfileManage /* Internal calls to the list profile logic may be performed even if the 3GPP Profile Manager * interface is not exposed in DBus, therefore, make sure this logic exits cleanly if there * is no support for listing profiles */ - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->list_profiles || - !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->list_profiles_finish) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->list_profiles || + !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->list_profiles_finish) { g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED, "Listing profiles is unsupported"); g_object_unref (task); return; } - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->list_profiles ( + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->list_profiles ( MM_IFACE_MODEM_3GPP_PROFILE_MANAGER (self), (GAsyncReadyCallback)internal_list_profiles_ready, task); @@ -1301,7 +1304,7 @@ delete_profile_ready (MMIfaceModem3gppProfileManager *self, { GError *error = NULL; - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile_finish (self, res, &error)) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->delete_profile_finish (self, res, &error)) { mm_obj_warn (self, "failed deleting 3GPP profile: %s", error->message); /* process profile manager updates right away on error */ mm_iface_modem_3gpp_profile_manager_update_ignore_stop (self); @@ -1339,8 +1342,8 @@ handle_delete_auth_ready (MMBaseModem *self, return; } - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile || - !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile_finish) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->delete_profile || + !MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->delete_profile_finish) { 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); @@ -1397,7 +1400,7 @@ handle_delete_auth_ready (MMBaseModem *self, /* Start ignoring our own indications */ mm_iface_modem_3gpp_profile_manager_update_ignore_start (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER (self)); - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->delete_profile ( + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->delete_profile ( MM_IFACE_MODEM_3GPP_PROFILE_MANAGER (self), profile, index_field, @@ -1467,7 +1470,7 @@ disable_unsolicited_events_ready (MMIfaceModem3gppProfileManager *self, DisablingContext *ctx; g_autoptr(GError) error = NULL; - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->disable_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->disable_unsolicited_events_finish (self, res, &error); if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "couldn't disable unsolicited profile management events: %s", error->message); @@ -1487,7 +1490,7 @@ cleanup_unsolicited_events_ready (MMIfaceModem3gppProfileManager *self, DisablingContext *ctx; g_autoptr(GError) error = NULL; - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->cleanup_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->cleanup_unsolicited_events_finish (self, res, &error); if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "couldn't cleanup unsolicited profile management events: %s", error->message); @@ -1514,9 +1517,9 @@ interface_disabling_step (GTask *task) /* fall through */ case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->disable_unsolicited_events && - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->disable_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->disable_unsolicited_events ( + if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->disable_unsolicited_events && + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->disable_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->disable_unsolicited_events ( self, (GAsyncReadyCallback)disable_unsolicited_events_ready, task); @@ -1526,9 +1529,9 @@ interface_disabling_step (GTask *task) /* fall through */ case DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->cleanup_unsolicited_events && - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->cleanup_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->cleanup_unsolicited_events ( + if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->cleanup_unsolicited_events && + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->cleanup_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->cleanup_unsolicited_events ( self, (GAsyncReadyCallback)cleanup_unsolicited_events_ready, task); @@ -1617,7 +1620,7 @@ setup_unsolicited_events_ready (MMIfaceModem3gppProfileManager *self, EnablingContext *ctx; g_autoptr(GError) error = NULL; - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->setup_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->setup_unsolicited_events_finish (self, res, &error); if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "couldn't setup unsolicited profile management events: %s", error->message); @@ -1637,7 +1640,7 @@ enable_unsolicited_events_ready (MMIfaceModem3gppProfileManager *self, EnablingContext *ctx; g_autoptr(GError) error = NULL; - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->enable_unsolicited_events_finish (self, res, &error); if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "couldn't enable unsolicited profile management events: %s", error->message); @@ -1664,9 +1667,9 @@ interface_enabling_step (GTask *task) /* fall through */ case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->setup_unsolicited_events && - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->setup_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->setup_unsolicited_events ( + if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->setup_unsolicited_events && + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->setup_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->setup_unsolicited_events ( self, (GAsyncReadyCallback)setup_unsolicited_events_ready, task); @@ -1676,9 +1679,9 @@ interface_enabling_step (GTask *task) /* fall through */ case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->enable_unsolicited_events && - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->enable_unsolicited_events_finish) { - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->enable_unsolicited_events ( + if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->enable_unsolicited_events && + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->enable_unsolicited_events_finish) { + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->enable_unsolicited_events ( self, (GAsyncReadyCallback)enable_unsolicited_events_ready, task); @@ -1770,7 +1773,7 @@ check_support_ready (MMIfaceModem3gppProfileManager *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_support_finish (self, res, &index_field, &error)) { + if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_support_finish (self, res, &index_field, &error)) { if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "profile management support check failed: %s", error->message); @@ -1835,9 +1838,9 @@ interface_initialization_step (GTask *task) g_object_set_qdata (G_OBJECT (self), support_checked_quark, GUINT_TO_POINTER (TRUE)); /* Initially, assume we don't support it */ g_object_set_qdata (G_OBJECT (self), supported_quark, GUINT_TO_POINTER (FALSE)); - if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_support && - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_support_finish) { - MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_support ( + if (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_support && + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_support_finish) { + MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_IFACE (self)->check_support ( self, (GAsyncReadyCallback)check_support_ready, task); @@ -1938,43 +1941,21 @@ mm_iface_modem_3gpp_profile_manager_shutdown (MMIfaceModem3gppProfileManager *se /*****************************************************************************/ static void -iface_modem_3gpp_profile_manager_init (gpointer g_iface) +mm_iface_modem_3gpp_profile_manager_default_init (MMIfaceModem3gppProfileManagerInterface *iface) { - static gboolean initialized = FALSE; + static gsize initialized = 0; - if (initialized) + if (!g_once_init_enter (&initialized)) return; /* Properties */ - g_object_interface_install_property - (g_iface, - g_param_spec_object (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_DBUS_SKELETON, - "3GPP Profile Manager DBus skeleton", - "DBus skeleton for the 3GPP Profile Manager interface", - MM_GDBUS_TYPE_MODEM3GPP_PROFILE_MANAGER_SKELETON, - G_PARAM_READWRITE)); - - initialized = TRUE; -} - -GType -mm_iface_modem_3gpp_profile_manager_get_type (void) -{ - static GType iface_modem_3gpp_profile_manager_type = 0; - - if (!G_UNLIKELY (iface_modem_3gpp_profile_manager_type)) { - static const GTypeInfo info = { - sizeof (MMIfaceModem3gppProfileManager), /* class_size */ - iface_modem_3gpp_profile_manager_init, /* base_init */ - NULL, /* base_finalize */ - }; - - iface_modem_3gpp_profile_manager_type = g_type_register_static (G_TYPE_INTERFACE, - "MMIfaceModem3gppProfileManager", - &info, 0); - - g_type_interface_add_prerequisite (iface_modem_3gpp_profile_manager_type, MM_TYPE_IFACE_MODEM_3GPP); - } - - return iface_modem_3gpp_profile_manager_type; + g_object_interface_install_property ( + iface, + g_param_spec_object (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_DBUS_SKELETON, + "3GPP Profile Manager DBus skeleton", + "DBus skeleton for the 3GPP Profile Manager interface", + MM_GDBUS_TYPE_MODEM3GPP_PROFILE_MANAGER_SKELETON, + G_PARAM_READWRITE)); + + g_once_init_leave (&initialized, 1); } diff --git a/src/mm-iface-modem-3gpp-profile-manager.h b/src/mm-iface-modem-3gpp-profile-manager.h index e127697d..7dfdc816 100644 --- a/src/mm-iface-modem-3gpp-profile-manager.h +++ b/src/mm-iface-modem-3gpp-profile-manager.h @@ -23,16 +23,14 @@ #define _LIBMM_INSIDE_MM #include <libmm-glib.h> -#define MM_TYPE_IFACE_MODEM_3GPP_PROFILE_MANAGER (mm_iface_modem_3gpp_profile_manager_get_type ()) -#define MM_IFACE_MODEM_3GPP_PROFILE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_3GPP_PROFILE_MANAGER, MMIfaceModem3gppProfileManager)) -#define MM_IS_IFACE_MODEM_3GPP_PROFILE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_3GPP_PROFILE_MANAGER)) -#define MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_IFACE_MODEM_3GPP_PROFILE_MANAGER, MMIfaceModem3gppProfileManager)) +#include "mm-iface-modem-3gpp.h" -#define MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_DBUS_SKELETON "iface-modem-3gpp-profile-manager-dbus-skeleton" +#define MM_TYPE_IFACE_MODEM_3GPP_PROFILE_MANAGER mm_iface_modem_3gpp_profile_manager_get_type () +G_DECLARE_INTERFACE (MMIfaceModem3gppProfileManager, mm_iface_modem_3gpp_profile_manager, MM, IFACE_MODEM_3GPP_PROFILE_MANAGER, MMIfaceModem3gpp) -typedef struct _MMIfaceModem3gppProfileManager MMIfaceModem3gppProfileManager; +#define MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_DBUS_SKELETON "iface-modem-3gpp-profile-manager-dbus-skeleton" -struct _MMIfaceModem3gppProfileManager { +struct _MMIfaceModem3gppProfileManagerInterface { GTypeInterface g_iface; /* Check for profile management support (async) */ @@ -188,9 +186,6 @@ struct _MMIfaceModem3gppProfileManager { GError **error); }; -GType mm_iface_modem_3gpp_profile_manager_get_type (void); -G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMIfaceModem3gppProfileManager, g_object_unref) - /* Initialize profile manager interface (async) */ void mm_iface_modem_3gpp_profile_manager_initialize (MMIfaceModem3gppProfileManager *self, GAsyncReadyCallback callback, diff --git a/src/plugins/fibocom/mm-broadband-modem-fibocom.c b/src/plugins/fibocom/mm-broadband-modem-fibocom.c index c98b95db..9505fa2e 100644 --- a/src/plugins/fibocom/mm-broadband-modem-fibocom.c +++ b/src/plugins/fibocom/mm-broadband-modem-fibocom.c @@ -25,14 +25,14 @@ #include "mm-log.h" #include "mm-shared-fibocom.h" -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); -static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface); -static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); -static void shared_fibocom_init (MMSharedFibocom *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); +static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); +static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); +static void shared_fibocom_init (MMSharedFibocom *iface); -static MMIfaceModem3gppInterface *iface_modem_3gpp_parent; -static MMIfaceModem3gppProfileManager *iface_modem_3gpp_profile_manager_parent; +static MMIfaceModem3gppInterface *iface_modem_3gpp_parent; +static MMIfaceModem3gppProfileManagerInterface *iface_modem_3gpp_profile_manager_parent; G_DEFINE_TYPE_EXTENDED (MMBroadbandModemFibocom, mm_broadband_modem_fibocom, MM_TYPE_BROADBAND_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) @@ -720,7 +720,7 @@ iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface) } static void -iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface) +iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface) { iface_modem_3gpp_profile_manager_parent = g_type_interface_peek_parent (iface); diff --git a/src/plugins/icera/mm-broadband-modem-icera.c b/src/plugins/icera/mm-broadband-modem-icera.c index 4228024a..ed2a6030 100644 --- a/src/plugins/icera/mm-broadband-modem-icera.c +++ b/src/plugins/icera/mm-broadband-modem-icera.c @@ -39,14 +39,14 @@ #include "mm-broadband-modem-icera.h" #include "mm-modem-helpers-icera.h" -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); -static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface); -static void iface_modem_time_init (MMIfaceModemTime *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); +static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); +static void iface_modem_time_init (MMIfaceModemTime *iface); -static MMIfaceModem *iface_modem_parent; -static MMIfaceModem3gppInterface *iface_modem_3gpp_parent; -static MMIfaceModem3gppProfileManager *iface_modem_3gpp_profile_manager_parent; +static MMIfaceModem *iface_modem_parent; +static MMIfaceModem3gppInterface *iface_modem_3gpp_parent; +static MMIfaceModem3gppProfileManagerInterface *iface_modem_3gpp_profile_manager_parent; G_DEFINE_TYPE_EXTENDED (MMBroadbandModemIcera, mm_broadband_modem_icera, MM_TYPE_BROADBAND_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) @@ -2325,7 +2325,7 @@ iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface) } static void -iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface) +iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface) { iface_modem_3gpp_profile_manager_parent = g_type_interface_peek_parent (iface); diff --git a/src/plugins/quectel/mm-broadband-modem-qmi-quectel.c b/src/plugins/quectel/mm-broadband-modem-qmi-quectel.c index e30d4cc3..777d6158 100644 --- a/src/plugins/quectel/mm-broadband-modem-qmi-quectel.c +++ b/src/plugins/quectel/mm-broadband-modem-qmi-quectel.c @@ -25,16 +25,16 @@ #include "mm-modem-helpers-quectel.h" #include "mm-shared-quectel.h" -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); -static void iface_modem_location_init (MMIfaceModemLocation *iface); -static void iface_modem_time_init (MMIfaceModemTime *iface); -static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface); -static void shared_quectel_init (MMSharedQuectel *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); +static void iface_modem_location_init (MMIfaceModemLocation *iface); +static void iface_modem_time_init (MMIfaceModemTime *iface); +static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); +static void shared_quectel_init (MMSharedQuectel *iface); -static MMIfaceModemInterface *iface_modem_parent; -static MMIfaceModemLocation *iface_modem_location_parent; -static MMIfaceModem3gppProfileManager *iface_modem_3gpp_profile_manager_parent; +static MMIfaceModemInterface *iface_modem_parent; +static MMIfaceModemLocation *iface_modem_location_parent; +static MMIfaceModem3gppProfileManagerInterface *iface_modem_3gpp_profile_manager_parent; G_DEFINE_TYPE_EXTENDED (MMBroadbandModemQmiQuectel, mm_broadband_modem_qmi_quectel, MM_TYPE_BROADBAND_MODEM_QMI, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) @@ -208,7 +208,7 @@ peek_parent_modem_location_interface (MMSharedQuectel *self) } static void -iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManager *iface) +iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface) { iface_modem_3gpp_profile_manager_parent = g_type_interface_peek_parent (iface); |