diff options
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 104 | ||||
-rw-r--r-- | plugins/huawei/mm-call-huawei.c | 42 | ||||
-rw-r--r-- | plugins/huawei/mm-call-huawei.h | 2 |
3 files changed, 77 insertions, 71 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index 5b8cb02fc..2e30c8aea 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -2871,10 +2871,10 @@ huawei_voice_origination (MMPortSerialAt *port, if (!mm_get_uint_from_match_info (match_info, 2, &call_type)) return; - mm_dbg ("[%s:%d][^ORIG] Origination call id '%u' of type '%u'", __func__, __LINE__, call_x, call_type); //Entrambi + mm_dbg ("[^ORIG] Origination call id '%u' of type '%u'", call_x, call_type); - //TODO: Handle multiple calls - //mm_iface_modem_voice_set_call_id(MM_IFACE_MODEM_VOICE(self)); + /* TODO: Handle multiple calls + * mm_iface_modem_voice_set_call_id (MM_IFACE_MODEM_VOICE (self)); */ } static void @@ -2887,9 +2887,9 @@ huawei_voice_ringback_tone (MMPortSerialAt *port, if (!mm_get_uint_from_match_info (match_info, 1, &call_x)) return; - mm_dbg ("[%s:%d][^CONF] Ringback tone from call id '%u'", __func__, __LINE__, call_x); + mm_dbg ("[^CONF] Ringback tone from call id '%u'", call_x); - mm_iface_modem_voice_call_dialing_to_ringing(MM_IFACE_MODEM_VOICE(self)); + mm_iface_modem_voice_call_dialing_to_ringing (MM_IFACE_MODEM_VOICE (self)); } static void @@ -2906,15 +2906,15 @@ huawei_voice_call_connection (MMPortSerialAt *port, if (!mm_get_uint_from_match_info (match_info, 2, &call_type)) return; - mm_dbg ("[%s:%d][^CONN] Call id '%u' of type '%u' connected", __func__, __LINE__, call_x, call_type); + mm_dbg ("[^CONN] Call id '%u' of type '%u' connected", call_x, call_type); - mm_iface_modem_voice_call_ringing_to_active(MM_IFACE_MODEM_VOICE(self)); + mm_iface_modem_voice_call_ringing_to_active (MM_IFACE_MODEM_VOICE (self)); } static void huawei_voice_call_end (MMPortSerialAt *port, - GMatchInfo *match_info, - MMBroadbandModemHuawei *self) + GMatchInfo *match_info, + MMBroadbandModemHuawei *self) { guint call_x = 0; guint duration = 0; @@ -2933,9 +2933,9 @@ huawei_voice_call_end (MMPortSerialAt *port, //This is optional mm_get_uint_from_match_info (match_info, 4, &cc_cause); - mm_dbg ("[%s:%d][^CEND] Call '%u' terminated with status '%u' and cause '%u'. Duration of call '%d'", __func__, __LINE__, call_x, end_status, cc_cause, duration); + mm_dbg ("[^CEND] Call '%u' terminated with status '%u' and cause '%u'. Duration of call '%d'", call_x, end_status, cc_cause, duration); - mm_iface_modem_voice_network_hangup(MM_IFACE_MODEM_VOICE(self)); + mm_iface_modem_voice_network_hangup (MM_IFACE_MODEM_VOICE (self)); } static void @@ -2943,18 +2943,19 @@ huawei_voice_received_dtmf (MMPortSerialAt *port, GMatchInfo *match_info, MMBroadbandModemHuawei *self) { - gchar *key = g_match_info_fetch (match_info, 1); + gchar *key; - if( key ) { - mm_dbg ("[%s:%d][^DDTMF] Received DTMF '%s'", __func__, __LINE__, key); + key = g_match_info_fetch (match_info, 1); - mm_iface_modem_voice_received_dtmf(MM_IFACE_MODEM_VOICE(self), key); + if (key) { + mm_dbg ("[^DDTMF] Received DTMF '%s'", key); + mm_iface_modem_voice_received_dtmf (MM_IFACE_MODEM_VOICE (self), key); } } static void set_voice_unsolicited_events_handlers (MMBroadbandModemHuawei *self, - gboolean enable) + gboolean enable) { GList *ports, *l; @@ -3001,16 +3002,16 @@ set_voice_unsolicited_events_handlers (MMBroadbandModemHuawei *self, static gboolean modem_voice_setup_cleanup_unsolicited_events_finish (MMIfaceModemVoice *self, - GAsyncResult *res, - GError **error) + GAsyncResult *res, + GError **error) { return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); } static void parent_voice_setup_unsolicited_events_ready (MMIfaceModemVoice *self, - GAsyncResult *res, - GSimpleAsyncResult *simple) + GAsyncResult *res, + GSimpleAsyncResult *simple) { GError *error = NULL; @@ -3028,8 +3029,8 @@ parent_voice_setup_unsolicited_events_ready (MMIfaceModemVoice *self, static void modem_voice_setup_unsolicited_events (MMIfaceModemVoice *self, - GAsyncReadyCallback callback, - gpointer user_data) + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *result; @@ -3047,8 +3048,8 @@ modem_voice_setup_unsolicited_events (MMIfaceModemVoice *self, static void parent_voice_cleanup_unsolicited_events_ready (MMIfaceModemVoice *self, - GAsyncResult *res, - GSimpleAsyncResult *simple) + GAsyncResult *res, + GSimpleAsyncResult *simple) { GError *error = NULL; @@ -3062,8 +3063,8 @@ parent_voice_cleanup_unsolicited_events_ready (MMIfaceModemVoice *self, static void modem_voice_cleanup_unsolicited_events (MMIfaceModemVoice *self, - GAsyncReadyCallback callback, - gpointer user_data) + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *result; @@ -3142,8 +3143,8 @@ parent_voice_enable_unsolicited_events_ready (MMIfaceModemVoice *self, static void modem_voice_enable_unsolicited_events (MMIfaceModemVoice *self, - GAsyncReadyCallback callback, - gpointer user_data) + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *result; @@ -3217,12 +3218,10 @@ parent_voice_disable_unsolicited_events_ready (MMIfaceModemVoice *self, simple); } - - static void modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self, - GAsyncReadyCallback callback, - gpointer user_data) + GAsyncReadyCallback callback, + gpointer user_data) { GSimpleAsyncResult *result; @@ -3239,6 +3238,16 @@ modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self, } /*****************************************************************************/ +/* Create call (Voice interface) */ + +static MMBaseCall * +create_call (MMIfaceModemVoice *self) +{ + /* New Huawei Call */ + return mm_call_huawei_new (MM_BASE_MODEM (self)); +} + +/*****************************************************************************/ /* Load network time (Time interface) */ static MMNetworkTimezone * @@ -4318,24 +4327,6 @@ iface_modem_time_init (MMIfaceModemTime *iface) } static void -mm_broadband_modem_huawei_class_init (MMBroadbandModemHuaweiClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - MMBroadbandModemClass *broadband_modem_class = MM_BROADBAND_MODEM_CLASS (klass); - - g_type_class_add_private (object_class, sizeof (MMBroadbandModemHuaweiPrivate)); - - object_class->finalize = finalize; - - broadband_modem_class->setup_ports = setup_ports; -} - -static MMBaseCall *create_call(MMIfaceModemVoice *self) { - /* New Huawei Call*/ - return mm_call_huawei_new(MM_BASE_MODEM (self)); -} - -static void iface_modem_voice_init (MMIfaceModemVoice *iface) { iface_modem_voice_parent = g_type_interface_peek_parent (iface); @@ -4351,3 +4342,16 @@ iface_modem_voice_init (MMIfaceModemVoice *iface) iface->create_call = create_call; } + +static void +mm_broadband_modem_huawei_class_init (MMBroadbandModemHuaweiClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + MMBroadbandModemClass *broadband_modem_class = MM_BROADBAND_MODEM_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (MMBroadbandModemHuaweiPrivate)); + + object_class->finalize = finalize; + + broadband_modem_class->setup_ports = setup_ports; +} diff --git a/plugins/huawei/mm-call-huawei.c b/plugins/huawei/mm-call-huawei.c index 730731a57..ab156aba6 100644 --- a/plugins/huawei/mm-call-huawei.c +++ b/plugins/huawei/mm-call-huawei.c @@ -62,16 +62,15 @@ call_start_ready (MMBaseModem *modem, if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) { /* something is wrong, serial timeout could never occurs */ } - + if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_DIALTONE)) { /* Update state */ mm_base_call_change_state(ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR); } - - if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_BUSY) || - g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_ANSWER) || - g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_CARRIER) ) - { + + if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_BUSY) || + g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_ANSWER) || + g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_CARRIER)) { /* Update state */ mm_base_call_change_state(ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_REFUSED_OR_BUSY); } @@ -81,34 +80,34 @@ call_start_ready (MMBaseModem *modem, call_start_context_complete_and_free (ctx); return; } - + /* check response for error */ - if( response && strlen(response) > 0 ) { - g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + if (response && strlen (response) > 0 ) { + error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Couldn't start the call: " "Modem response '%s'", response); - + /* Update state */ - mm_base_call_change_state(ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_REFUSED_OR_BUSY); + mm_base_call_change_state (ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_REFUSED_OR_BUSY); } else { /* Update state */ - mm_base_call_change_state(ctx->self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED); + mm_base_call_change_state (ctx->self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED); } - + if (error) { g_simple_async_result_take_error (ctx->result, error); call_start_context_complete_and_free (ctx); return; } - + g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); call_start_context_complete_and_free (ctx); } static void call_start (MMBaseCall *self, - GAsyncReadyCallback callback, - gpointer user_data) + GAsyncReadyCallback callback, + gpointer user_data) { CallStartContext *ctx; gchar *cmd; @@ -124,7 +123,7 @@ call_start (MMBaseCall *self, MM_BASE_CALL_MODEM, &ctx->modem, NULL); - cmd = g_strdup_printf ("ATD%s;", mm_gdbus_call_get_number (MM_GDBUS_CALL (self)) ); + cmd = g_strdup_printf ("ATD%s;", mm_gdbus_call_get_number (MM_GDBUS_CALL (self))); mm_base_modem_at_command (ctx->modem, cmd, 3, @@ -133,12 +132,15 @@ call_start (MMBaseCall *self, ctx); g_free (cmd); } + /*****************************************************************************/ -MMBaseCall *mm_call_huawei_new(MMBaseModem *modem) + +MMBaseCall * +mm_call_huawei_new (MMBaseModem *modem) { return MM_BASE_CALL (g_object_new (MM_TYPE_CALL_HUAWEI, - MM_BASE_CALL_MODEM, modem, - NULL)); + MM_BASE_CALL_MODEM, modem, + NULL)); } static void diff --git a/plugins/huawei/mm-call-huawei.h b/plugins/huawei/mm-call-huawei.h index fb1db4967..fe7e66d38 100644 --- a/plugins/huawei/mm-call-huawei.h +++ b/plugins/huawei/mm-call-huawei.h @@ -41,6 +41,6 @@ struct _MMCallHuaweiClass { GType mm_call_huawei_get_type (void); -MMBaseCall *mm_call_huawei_new(MMBaseModem *modem); +MMBaseCall *mm_call_huawei_new (MMBaseModem *modem); #endif /* MM_CALL_HUAWEI_H */ |