diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2024-05-06 10:54:16 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2024-05-06 13:45:39 +0000 |
commit | 1c919890c62efc64e844a184e6e20b34c422b3d5 (patch) | |
tree | d5573e40bbffa5349411487e18399987239b8699 | |
parent | 92a89efd0282adb0c4cd86063671ebd3d8b5d0f3 (diff) |
iface-modem-cdma: use G_DECLARE|DEFINE_INTERFACE() macros
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 4 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 6 | ||||
-rw-r--r-- | src/mm-iface-modem-cdma.c | 280 | ||||
-rw-r--r-- | src/mm-iface-modem-cdma.h | 15 | ||||
-rw-r--r-- | src/plugins/anydata/mm-broadband-modem-anydata.c | 6 | ||||
-rw-r--r-- | src/plugins/huawei/mm-broadband-modem-huawei.c | 6 | ||||
-rw-r--r-- | src/plugins/novatel/mm-broadband-modem-novatel.c | 4 | ||||
-rw-r--r-- | src/plugins/sierra/mm-broadband-modem-sierra.c | 8 | ||||
-rw-r--r-- | src/plugins/via/mm-broadband-modem-via.c | 6 |
9 files changed, 154 insertions, 181 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index b002d9b3..2520d471 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -58,7 +58,7 @@ static void iface_modem_3gpp_init (MMIfaceModem3gppInterface static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface); static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssdInterface *iface); static void iface_modem_voice_init (MMIfaceModemVoiceInterface *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); static void iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface); static void iface_modem_location_init (MMIfaceModemLocationInterface *iface); static void iface_modem_oma_init (MMIfaceModemOmaInterface *iface); @@ -14047,7 +14047,7 @@ iface_modem_voice_init (MMIfaceModemVoiceInterface *iface) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { iface->load_meid = modem_cdma_load_meid; iface->load_meid_finish = modem_cdma_load_meid_finish; diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 2cc01a76..41906c2e 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -65,7 +65,7 @@ static void iface_modem_init (MMIfaceModemInterface 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 (MMIfaceModem3gppUssdInterface *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); static void iface_modem_simple_init (MMIfaceModemSimpleInterface *iface); static void iface_modem_location_init (MMIfaceModemLocationInterface *iface); static void iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface); @@ -9781,7 +9781,7 @@ setup_registration_checks_results_new (MMBroadbandModem *self, results->skip_qcdm_hdr_step = TRUE; } - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state == + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state == modem_cdma_get_detailed_registration_state) { /* Skip CDMA1x Serving System check if we have Sprint specific * commands AND if the default detailed registration checker @@ -13633,7 +13633,7 @@ iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssdInterface *iface) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { /* Initialization steps */ iface->load_esn = modem_cdma_load_esn; diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c index adf4a82a..14d1ae9a 100644 --- a/src/mm-iface-modem-cdma.c +++ b/src/mm-iface-modem-cdma.c @@ -29,6 +29,8 @@ #define SUBSYSTEM_CDMA1X "cdma1x" #define SUBSYSTEM_EVDO "evdo" +G_DEFINE_INTERFACE (MMIfaceModemCdma, mm_iface_modem_cdma, MM_TYPE_IFACE_MODEM) + /*****************************************************************************/ /* Private data context */ @@ -125,7 +127,7 @@ handle_activate_ready (MMIfaceModemCdma *self, priv = get_private (self); priv->activation_ongoing = FALSE; - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_finish (self, res,&error)) + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate_finish (self, res,&error)) mm_dbus_method_invocation_take_error (ctx->invocation, error); else mm_gdbus_modem_cdma_complete_activate (ctx->skeleton, ctx->invocation); @@ -167,8 +169,8 @@ 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) { + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate || + !MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate_finish) { 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); @@ -206,7 +208,7 @@ handle_activate_auth_ready (MMBaseModem *self, case MM_MODEM_STATE_SEARCHING: case MM_MODEM_STATE_REGISTERED: priv->activation_ongoing = TRUE; - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate ( MM_IFACE_MODEM_CDMA (self), ctx->carrier, (GAsyncReadyCallback)handle_activate_ready, @@ -291,7 +293,7 @@ handle_activate_manual_ready (MMIfaceModemCdma *self, priv = get_private (self); priv->activation_ongoing = FALSE; - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_manual_finish (self, res,&error)) + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate_manual_finish (self, res,&error)) mm_dbus_method_invocation_take_error (ctx->invocation, error); else mm_gdbus_modem_cdma_complete_activate_manual (ctx->skeleton, ctx->invocation); @@ -334,8 +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) { + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate_manual || + !MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate_manual_finish) { 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); @@ -372,7 +374,7 @@ handle_activate_manual_auth_ready (MMBaseModem *self, case MM_MODEM_STATE_SEARCHING: case MM_MODEM_STATE_REGISTERED: priv->activation_ongoing = TRUE; - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->activate_manual ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->activate_manual ( MM_IFACE_MODEM_CDMA (self), properties, (GAsyncReadyCallback)handle_activate_manual_ready, @@ -450,7 +452,7 @@ register_in_network_ready (MMIfaceModemCdma *self, { GError *error = NULL; - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network_finish (self, res, &error)) + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->register_in_network_finish (self, res, &error)) g_task_return_error (task, error); else g_task_return_boolean (task, TRUE); @@ -467,7 +469,7 @@ mm_iface_modem_cdma_register_in_network (MMIfaceModemCdma *self, task = g_task_new (self, NULL, callback, user_data); - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->register_in_network ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->register_in_network ( self, max_registration_time, (GAsyncReadyCallback)register_in_network_ready, @@ -545,7 +547,7 @@ setup_registration_checks_ready (MMIfaceModemCdma *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_registration_checks_finish ( + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_registration_checks_finish ( self, res, &ctx->skip_qcdm_call_manager_step, @@ -575,7 +577,7 @@ get_call_manager_state_ready (MMIfaceModemCdma *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_call_manager_state_finish ( + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_call_manager_state_finish ( self, res, &ctx->call_manager_system_mode, @@ -611,7 +613,7 @@ get_hdr_state_ready (MMIfaceModemCdma *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_hdr_state_finish ( + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_hdr_state_finish ( self, res, &ctx->hdr_hybrid_mode, @@ -687,10 +689,11 @@ get_service_status_ready (MMIfaceModemCdma *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_service_status_finish (self, - res, - &has_service, - &error)) { + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_service_status_finish ( + self, + res, + &has_service, + &error)) { mm_obj_warn (self, "could not get service status: %s", error->message); g_task_return_error (task, error); g_object_unref (task); @@ -720,7 +723,7 @@ get_cdma1x_serving_system_ready (MMIfaceModemCdma *self, /* Note: used for *both* AT and QCDM serving system checks */ - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system_finish ( + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system_finish ( self, res, &ctx->cdma1x_class, @@ -786,7 +789,7 @@ get_detailed_registration_state_ready (MMIfaceModemCdma *self, ctx = g_task_get_task_data (task); - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state_finish ( + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state_finish ( self, res, &detailed_cdma1x_state, @@ -824,9 +827,9 @@ registration_check_step (GTask *task) * to specify which of the next steps will be completely skipped. Useful * when implementations have a best get_detailed_registration_state() * so that they just need that to be run. */ - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_registration_checks && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_registration_checks_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_registration_checks ( + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_registration_checks && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_registration_checks_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_registration_checks ( self, (GAsyncReadyCallback)setup_registration_checks_ready, task); @@ -838,10 +841,10 @@ registration_check_step (GTask *task) case REGISTRATION_CHECK_STEP_QCDM_CALL_MANAGER_STATE: mm_obj_dbg (self, "starting QCDM-based registration checks..."); if (!ctx->skip_qcdm_call_manager_step && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_call_manager_state && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_call_manager_state_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_call_manager_state && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_call_manager_state_finish) { /* Start by trying to get the call manager state. */ - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_call_manager_state ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_call_manager_state ( self, (GAsyncReadyCallback)get_call_manager_state_ready, task); @@ -856,10 +859,10 @@ registration_check_step (GTask *task) case REGISTRATION_CHECK_STEP_QCDM_HDR_STATE: if (ctx->evdo_supported && !ctx->skip_qcdm_hdr_step && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_hdr_state && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_hdr_state_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_hdr_state && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_hdr_state_finish) { /* Get HDR (EVDO) state. */ - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_hdr_state ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_hdr_state ( self, (GAsyncReadyCallback)get_hdr_state_ready, task); @@ -873,9 +876,9 @@ registration_check_step (GTask *task) /* We only care about SID/NID here; nothing to do with registration * state. */ - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system ( + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system ( self, (GAsyncReadyCallback)get_cdma1x_serving_system_ready, task); @@ -895,9 +898,9 @@ registration_check_step (GTask *task) /* If we don't have means to get service status, just assume we do have * CDMA service and keep on */ if (!ctx->skip_at_cdma_service_status_step && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_service_status && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_service_status_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_service_status ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_service_status && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_service_status_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_service_status ( self, (GAsyncReadyCallback)get_service_status_ready, task); @@ -919,9 +922,9 @@ registration_check_step (GTask *task) * themselves; if they do, they'll set these callbacks to NULL.. */ if (!ctx->skip_at_cdma1x_serving_system_step && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system ( self, (GAsyncReadyCallback)get_cdma1x_serving_system_ready, task); @@ -941,13 +944,13 @@ registration_check_step (GTask *task) /* We let classes implementing this interface to look for more detailed * registration info. */ if (!ctx->skip_detailed_registration_state && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state_finish) { /* We pass the CDMA1x/EVDO registration states we got up to now. * If the implementation can't improve the detail, it must either * return the values it already got as input, or issue an error, * and we'll assume it couldn't get any better value. */ - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state ( self, ctx->cdma1x_state, ctx->evdo_state, @@ -987,7 +990,7 @@ custom_run_registration_checks_ready (MMIfaceModemCdma *self, { GError *error = NULL; - if (!MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->run_registration_checks_finish (self, res, &error)) + if (!MM_IFACE_MODEM_CDMA_GET_IFACE (self)->run_registration_checks_finish (self, res, &error)) g_task_return_error (task, error); else g_task_return_boolean (task, TRUE); @@ -1014,24 +1017,24 @@ mm_iface_modem_cdma_run_registration_checks (MMIfaceModemCdma *self, cdma1x_supported ? "yes" : "no", evdo_supported ? "yes" : "no"); - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->run_registration_checks && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->run_registration_checks_finish) { + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->run_registration_checks && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->run_registration_checks_finish) { /* Plugins implementing full custom registration checks shouldn't implement * sub-steps of the generic registration check sequence */ - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_registration_checks != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_registration_checks_finish != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_call_manager_state != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_call_manager_state_finish != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_hdr_state != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_hdr_state_finish != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_service_status != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_service_status_finish != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_cdma1x_serving_system_finish != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state != NULL); - g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->get_detailed_registration_state_finish != NULL); - - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->run_registration_checks ( + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_registration_checks != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_registration_checks_finish != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_call_manager_state != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_call_manager_state_finish != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_hdr_state != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_hdr_state_finish != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_service_status != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_service_status_finish != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_cdma1x_serving_system_finish != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state != NULL); + g_warn_if_fail (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->get_detailed_registration_state_finish != NULL); + + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->run_registration_checks ( self, cdma1x_supported, evdo_supported, @@ -1371,7 +1374,7 @@ disable_unsolicited_events_ready (MMIfaceModemCdma *self, DisablingContext *ctx; GError *error = NULL; - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->disable_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->disable_unsolicited_events_finish (self, res, &error); if (error) { mm_obj_dbg (self, "couldn't disable unsolicited events: %s", error->message); g_error_free (error); @@ -1391,7 +1394,7 @@ cleanup_unsolicited_events_ready (MMIfaceModemCdma *self, DisablingContext *ctx; GError *error = NULL; - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->cleanup_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->cleanup_unsolicited_events_finish (self, res, &error); if (error) { mm_obj_dbg (self, "couldn't cleanup unsolicited events: %s", error->message); g_error_free (error); @@ -1423,9 +1426,9 @@ interface_disabling_step (GTask *task) /* fall through */ case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->disable_unsolicited_events && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->disable_unsolicited_events_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->disable_unsolicited_events ( + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->disable_unsolicited_events && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->disable_unsolicited_events_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->disable_unsolicited_events ( self, (GAsyncReadyCallback)disable_unsolicited_events_ready, task); @@ -1435,9 +1438,9 @@ interface_disabling_step (GTask *task) /* fall through */ case DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->cleanup_unsolicited_events && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->cleanup_unsolicited_events_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->cleanup_unsolicited_events ( + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->cleanup_unsolicited_events && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->cleanup_unsolicited_events_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->cleanup_unsolicited_events ( self, (GAsyncReadyCallback)cleanup_unsolicited_events_ready, task); @@ -1531,7 +1534,7 @@ setup_unsolicited_events_ready (MMIfaceModemCdma *self, EnablingContext *ctx; GError *error = NULL; - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_unsolicited_events_finish (self, res, &error); if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "setting up unsolicited events failed: %s", error->message); @@ -1552,7 +1555,7 @@ enable_unsolicited_events_ready (MMIfaceModemCdma *self, EnablingContext *ctx; GError *error = NULL; - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error); + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->enable_unsolicited_events_finish (self, res, &error); if (error) { /* This error shouldn't be treated as critical */ mm_obj_dbg (self, "enabling unsolicited events failed: %s", error->message); @@ -1586,9 +1589,9 @@ interface_enabling_step (GTask *task) /* fall through */ case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_unsolicited_events && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_unsolicited_events_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->setup_unsolicited_events ( + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_unsolicited_events && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_unsolicited_events_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->setup_unsolicited_events ( self, (GAsyncReadyCallback)setup_unsolicited_events_ready, task); @@ -1598,9 +1601,9 @@ interface_enabling_step (GTask *task) /* fall through */ case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS: - if (MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->enable_unsolicited_events && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->enable_unsolicited_events_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->enable_unsolicited_events ( + if (MM_IFACE_MODEM_CDMA_GET_IFACE (self)->enable_unsolicited_events && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->enable_unsolicited_events_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->enable_unsolicited_events ( self, (GAsyncReadyCallback)enable_unsolicited_events_ready, task); @@ -1695,7 +1698,7 @@ initialization_context_free (InitializationContext *ctx) \ ctx = g_task_get_task_data (task); \ \ - val = MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_##NAME##_finish (self, res, &error); \ + val = MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_##NAME##_finish (self, res, &error); \ mm_gdbus_modem_cdma_set_##NAME (ctx->skeleton, val); \ g_free (val); \ \ @@ -1723,7 +1726,7 @@ load_activation_state_ready (MMIfaceModemCdma *self, ctx = g_task_get_task_data (task); - state = MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_activation_state_finish (self, res, &error); + state = MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_activation_state_finish (self, res, &error); mm_gdbus_modem_cdma_set_activation_state (ctx->skeleton, state); if (error) { @@ -1761,9 +1764,9 @@ interface_initialization_step (GTask *task) * lifetime of the modem. Therefore, if we already have it loaded, * don't try to load it again. */ if (!mm_gdbus_modem_cdma_get_meid (ctx->skeleton) && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_meid && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_meid_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_meid ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_meid && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_meid_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_meid ( self, (GAsyncReadyCallback)load_meid_ready, task); @@ -1777,9 +1780,9 @@ interface_initialization_step (GTask *task) * lifetime of the modem. Therefore, if we already have it loaded, * don't try to load it again. */ if (!mm_gdbus_modem_cdma_get_esn (ctx->skeleton) && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_esn && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_esn_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_esn ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_esn && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_esn_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_esn ( self, (GAsyncReadyCallback)load_esn_ready, task); @@ -1793,9 +1796,9 @@ interface_initialization_step (GTask *task) * whole lifetime of the modem. Therefore, if we already have it loaded, * don't try to load it again. */ if (mm_gdbus_modem_cdma_get_activation_state (ctx->skeleton) == MM_MODEM_CDMA_ACTIVATION_STATE_UNKNOWN && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_activation_state && - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_activation_state_finish) { - MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_activation_state ( + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_activation_state && + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_activation_state_finish) { + MM_IFACE_MODEM_CDMA_GET_IFACE (self)->load_activation_state ( self, (GAsyncReadyCallback)load_activation_state_ready, task); @@ -1910,78 +1913,55 @@ mm_iface_modem_cdma_shutdown (MMIfaceModemCdma *self) /*****************************************************************************/ static void -iface_modem_cdma_init (gpointer g_iface) +mm_iface_modem_cdma_default_init (MMIfaceModemCdmaInterface *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_CDMA_DBUS_SKELETON, - "CDMA DBus skeleton", - "DBus skeleton for the CDMA interface", - MM_GDBUS_TYPE_MODEM_CDMA_SKELETON, + g_object_interface_install_property ( + iface, + g_param_spec_object (MM_IFACE_MODEM_CDMA_DBUS_SKELETON, + "CDMA DBus skeleton", + "DBus skeleton for the CDMA interface", + MM_GDBUS_TYPE_MODEM_CDMA_SKELETON, + G_PARAM_READWRITE)); + + g_object_interface_install_property ( + iface, + g_param_spec_enum (MM_IFACE_MODEM_CDMA_CDMA1X_REGISTRATION_STATE, + "CDMA1x Registration State", + "Registration state of the modem in the CDMA1x network", + MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, + MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, + G_PARAM_READWRITE)); + + g_object_interface_install_property ( + iface, + g_param_spec_enum (MM_IFACE_MODEM_CDMA_EVDO_REGISTRATION_STATE, + "EV-DO Registration State", + "Registration state of the modem in the EV-DO network", + MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, + MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, + G_PARAM_READWRITE)); + + g_object_interface_install_property ( + iface, + g_param_spec_boolean (MM_IFACE_MODEM_CDMA_CDMA1X_NETWORK_SUPPORTED, + "CDMA1x network supported", + "Whether the modem works in the CDMA1x network", + TRUE, G_PARAM_READWRITE)); - g_object_interface_install_property - (g_iface, - g_param_spec_enum (MM_IFACE_MODEM_CDMA_CDMA1X_REGISTRATION_STATE, - "CDMA1x Registration State", - "Registration state of the modem in the CDMA1x network", - MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, - MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, - G_PARAM_READWRITE)); - - - g_object_interface_install_property - (g_iface, - g_param_spec_enum (MM_IFACE_MODEM_CDMA_EVDO_REGISTRATION_STATE, - "EV-DO Registration State", - "Registration state of the modem in the EV-DO network", - MM_TYPE_MODEM_CDMA_REGISTRATION_STATE, - MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN, - G_PARAM_READWRITE)); - - g_object_interface_install_property - (g_iface, - g_param_spec_boolean (MM_IFACE_MODEM_CDMA_CDMA1X_NETWORK_SUPPORTED, - "CDMA1x network supported", - "Whether the modem works in the CDMA1x network", - TRUE, - G_PARAM_READWRITE)); - - g_object_interface_install_property - (g_iface, - g_param_spec_boolean (MM_IFACE_MODEM_CDMA_EVDO_NETWORK_SUPPORTED, - "EV-DO network supported", - "Whether the modem works in the EV-DO network", - TRUE, - G_PARAM_READWRITE)); - initialized = TRUE; -} - -GType -mm_iface_modem_cdma_get_type (void) -{ - static GType iface_modem_cdma_type = 0; - - if (!G_UNLIKELY (iface_modem_cdma_type)) { - static const GTypeInfo info = { - sizeof (MMIfaceModemCdma), /* class_size */ - iface_modem_cdma_init, /* base_init */ - NULL, /* base_finalize */ - }; - - iface_modem_cdma_type = g_type_register_static (G_TYPE_INTERFACE, - "MMIfaceModemCdma", - &info, - 0); - - g_type_interface_add_prerequisite (iface_modem_cdma_type, MM_TYPE_IFACE_MODEM); - } + g_object_interface_install_property ( + iface, + g_param_spec_boolean (MM_IFACE_MODEM_CDMA_EVDO_NETWORK_SUPPORTED, + "EV-DO network supported", + "Whether the modem works in the EV-DO network", + TRUE, + G_PARAM_READWRITE)); - return iface_modem_cdma_type; + g_once_init_leave (&initialized, 1); } diff --git a/src/mm-iface-modem-cdma.h b/src/mm-iface-modem-cdma.h index 7501d897..8f7e311e 100644 --- a/src/mm-iface-modem-cdma.h +++ b/src/mm-iface-modem-cdma.h @@ -22,12 +22,10 @@ #define _LIBMM_INSIDE_MM #include <libmm-glib.h> -#include "mm-port-serial-at.h" +#include "mm-iface-modem.h" -#define MM_TYPE_IFACE_MODEM_CDMA (mm_iface_modem_cdma_get_type ()) -#define MM_IFACE_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_CDMA, MMIfaceModemCdma)) -#define MM_IS_IFACE_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_CDMA)) -#define MM_IFACE_MODEM_CDMA_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_IFACE_MODEM_CDMA, MMIfaceModemCdma)) +#define MM_TYPE_IFACE_MODEM_CDMA mm_iface_modem_cdma_get_type () +G_DECLARE_INTERFACE (MMIfaceModemCdma, mm_iface_modem_cdma, MM, IFACE_MODEM_CDMA, MMIfaceModem) #define MM_IFACE_MODEM_CDMA_DBUS_SKELETON "iface-modem-cdma-dbus-skeleton" #define MM_IFACE_MODEM_CDMA_CDMA1X_REGISTRATION_STATE "iface-modem-cdma-cdma1x-registration-state" @@ -47,9 +45,7 @@ #define MM_IFACE_MODEM_CDMA_ALL_CDMA1X_ACCESS_TECHNOLOGIES_MASK \ (MM_MODEM_ACCESS_TECHNOLOGY_1XRTT) -typedef struct _MMIfaceModemCdma MMIfaceModemCdma; - -struct _MMIfaceModemCdma { +struct _MMIfaceModemCdmaInterface { GTypeInterface g_iface; /* Loading of the MEID property */ @@ -228,9 +224,6 @@ struct _MMIfaceModemCdma { GError **error); }; -GType mm_iface_modem_cdma_get_type (void); -G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMIfaceModemCdma, g_object_unref) - /* Initialize CDMA interface (async) */ void mm_iface_modem_cdma_initialize (MMIfaceModemCdma *self, GCancellable *cancellable, diff --git a/src/plugins/anydata/mm-broadband-modem-anydata.c b/src/plugins/anydata/mm-broadband-modem-anydata.c index ea2c2268..ffc081db 100644 --- a/src/plugins/anydata/mm-broadband-modem-anydata.c +++ b/src/plugins/anydata/mm-broadband-modem-anydata.c @@ -33,8 +33,8 @@ #include "mm-iface-modem.h" #include "mm-iface-modem-cdma.h" -static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_init (MMIfaceModemInterface *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); G_DEFINE_TYPE_EXTENDED (MMBroadbandModemAnydata, mm_broadband_modem_anydata, MM_TYPE_BROADBAND_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) @@ -340,7 +340,7 @@ iface_modem_init (MMIfaceModemInterface *iface) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { iface->get_cdma1x_serving_system = NULL; iface->get_cdma1x_serving_system_finish = NULL; diff --git a/src/plugins/huawei/mm-broadband-modem-huawei.c b/src/plugins/huawei/mm-broadband-modem-huawei.c index 673f3f3d..ea664ca1 100644 --- a/src/plugins/huawei/mm-broadband-modem-huawei.c +++ b/src/plugins/huawei/mm-broadband-modem-huawei.c @@ -54,7 +54,7 @@ static void iface_modem_init (MMIfaceModemInterface *iface); static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface); static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssdInterface *iface); static void iface_modem_location_init (MMIfaceModemLocationInterface *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); static void iface_modem_time_init (MMIfaceModemTimeInterface *iface); static void iface_modem_voice_init (MMIfaceModemVoiceInterface *iface); static void iface_modem_signal_init (MMIfaceModemSignalInterface *iface); @@ -62,7 +62,7 @@ static void iface_modem_signal_init (MMIfaceModemSignalInterface *iface); static MMIfaceModemInterface *iface_modem_parent; static MMIfaceModem3gppInterface *iface_modem_3gpp_parent; static MMIfaceModemLocationInterface *iface_modem_location_parent; -static MMIfaceModemCdma *iface_modem_cdma_parent; +static MMIfaceModemCdmaInterface *iface_modem_cdma_parent; static MMIfaceModemVoiceInterface *iface_modem_voice_parent; G_DEFINE_TYPE_EXTENDED (MMBroadbandModemHuawei, mm_broadband_modem_huawei, MM_TYPE_BROADBAND_MODEM, 0, @@ -5046,7 +5046,7 @@ iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssdInterface *iface) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { iface_modem_cdma_parent = g_type_interface_peek_parent (iface); diff --git a/src/plugins/novatel/mm-broadband-modem-novatel.c b/src/plugins/novatel/mm-broadband-modem-novatel.c index eb7b4c89..7f972bb9 100644 --- a/src/plugins/novatel/mm-broadband-modem-novatel.c +++ b/src/plugins/novatel/mm-broadband-modem-novatel.c @@ -40,7 +40,7 @@ static void iface_modem_init (MMIfaceModemInterface *iface); static void iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); static void iface_modem_time_init (MMIfaceModemTimeInterface *iface); static MMIfaceModemInterface *iface_modem_parent; @@ -1584,7 +1584,7 @@ iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { iface->get_detailed_registration_state = modem_cdma_get_detailed_registration_state; iface->get_detailed_registration_state_finish = modem_cdma_get_detailed_registration_state_finish; diff --git a/src/plugins/sierra/mm-broadband-modem-sierra.c b/src/plugins/sierra/mm-broadband-modem-sierra.c index 3afd3b12..781ebaa6 100644 --- a/src/plugins/sierra/mm-broadband-modem-sierra.c +++ b/src/plugins/sierra/mm-broadband-modem-sierra.c @@ -38,11 +38,11 @@ #include "mm-broadband-bearer-sierra.h" static void iface_modem_init (MMIfaceModemInterface *iface); -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); static void iface_modem_time_init (MMIfaceModemTimeInterface *iface); -static MMIfaceModemInterface *iface_modem_parent; -static MMIfaceModemCdma *iface_modem_cdma_parent; +static MMIfaceModemInterface *iface_modem_parent; +static MMIfaceModemCdmaInterface *iface_modem_cdma_parent; G_DEFINE_TYPE_EXTENDED (MMBroadbandModemSierra, mm_broadband_modem_sierra, MM_TYPE_BROADBAND_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) @@ -1904,7 +1904,7 @@ iface_modem_init (MMIfaceModemInterface *iface) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { iface_modem_cdma_parent = g_type_interface_peek_parent (iface); diff --git a/src/plugins/via/mm-broadband-modem-via.c b/src/plugins/via/mm-broadband-modem-via.c index 424698ff..e7749314 100644 --- a/src/plugins/via/mm-broadband-modem-via.c +++ b/src/plugins/via/mm-broadband-modem-via.c @@ -32,9 +32,9 @@ #include "mm-iface-modem-cdma.h" #include "mm-iface-modem.h" -static void iface_modem_cdma_init (MMIfaceModemCdma *iface); +static void iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface); -static MMIfaceModemCdma *iface_modem_cdma_parent; +static MMIfaceModemCdmaInterface *iface_modem_cdma_parent; G_DEFINE_TYPE_EXTENDED (MMBroadbandModemVia, mm_broadband_modem_via, MM_TYPE_BROADBAND_MODEM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_CDMA, iface_modem_cdma_init)) @@ -518,7 +518,7 @@ finalize (GObject *object) } static void -iface_modem_cdma_init (MMIfaceModemCdma *iface) +iface_modem_cdma_init (MMIfaceModemCdmaInterface *iface) { iface_modem_cdma_parent = g_type_interface_peek_parent (iface); |