core,voice: minor coding style fixes
This commit is contained in:
@@ -84,7 +84,6 @@ handle_start_ready (MMBaseCall *self,
|
|||||||
} else {
|
} else {
|
||||||
/* Transition from Unknown->Dialing */
|
/* Transition from Unknown->Dialing */
|
||||||
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_UNKNOWN ) {
|
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_UNKNOWN ) {
|
||||||
|
|
||||||
/* Update state */
|
/* Update state */
|
||||||
mm_base_call_change_state (self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED);
|
mm_base_call_change_state (self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED);
|
||||||
}
|
}
|
||||||
@@ -158,7 +157,6 @@ handle_start (MMBaseCall *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* Accept call (DBus call handling) */
|
/* Accept call (DBus call handling) */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -188,7 +186,6 @@ handle_accept_ready (MMBaseCall *self,
|
|||||||
} else {
|
} else {
|
||||||
/* Transition from Unknown->Dialing */
|
/* Transition from Unknown->Dialing */
|
||||||
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_RINGING_IN) {
|
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_RINGING_IN) {
|
||||||
|
|
||||||
/* Update state */
|
/* Update state */
|
||||||
mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
||||||
}
|
}
|
||||||
@@ -293,7 +290,6 @@ handle_hangup_ready (MMBaseCall *self,
|
|||||||
/* Transition from Unknown->Dialing */
|
/* Transition from Unknown->Dialing */
|
||||||
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_TERMINATED ||
|
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_TERMINATED ||
|
||||||
mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_UNKNOWN) {
|
mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_UNKNOWN) {
|
||||||
|
|
||||||
/* Update state */
|
/* Update state */
|
||||||
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
|
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
|
||||||
}
|
}
|
||||||
@@ -367,7 +363,6 @@ handle_hangup (MMBaseCall *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* Send tone (DBus call handling) */
|
/* Send tone (DBus call handling) */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -425,7 +420,7 @@ handle_send_tone_auth_ready (MMBaseModem *modem,
|
|||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
MM_CORE_ERROR_UNSUPPORTED,
|
MM_CORE_ERROR_UNSUPPORTED,
|
||||||
"SendToneing call is not supported by this modem");
|
"Sending tone is not supported by this modem");
|
||||||
handle_send_tone_context_free (ctx);
|
handle_send_tone_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -435,12 +430,11 @@ handle_send_tone_auth_ready (MMBaseModem *modem,
|
|||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
MM_CORE_ERROR_FAILED,
|
MM_CORE_ERROR_FAILED,
|
||||||
"This call was not active, cannot send_tone ");
|
"This call was not active, cannot send tone");
|
||||||
handle_send_tone_context_free (ctx);
|
handle_send_tone_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_dbg("[%s:%d] Tone string: '%s'", __func__, __LINE__, ctx->tone);
|
|
||||||
MM_BASE_CALL_GET_CLASS (ctx->self)->send_tone (ctx->self, ctx->tone,
|
MM_BASE_CALL_GET_CLASS (ctx->self)->send_tone (ctx->self, ctx->tone,
|
||||||
(GAsyncReadyCallback)handle_send_tone_ready,
|
(GAsyncReadyCallback)handle_send_tone_ready,
|
||||||
ctx);
|
ctx);
|
||||||
@@ -457,7 +451,6 @@ handle_send_tone (MMBaseCall *self,
|
|||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
ctx->invocation = g_object_ref (invocation);
|
ctx->invocation = g_object_ref (invocation);
|
||||||
|
|
||||||
mm_dbg("[%s:%d] Tone string: '%s'", __func__, __LINE__, tone);
|
|
||||||
ctx->tone = g_strdup(tone);
|
ctx->tone = g_strdup(tone);
|
||||||
g_object_get (self,
|
g_object_get (self,
|
||||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||||
@@ -937,7 +930,6 @@ call_send_tone (MMBaseCall *self,
|
|||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
ctx->modem = g_object_ref (self->priv->modem);
|
ctx->modem = g_object_ref (self->priv->modem);
|
||||||
|
|
||||||
mm_dbg("[%s:%d] Tone string: '%s'", __func__, __LINE__, tone);
|
|
||||||
cmd = g_strdup_printf ("AT+VTS=%c", tone[0]);
|
cmd = g_strdup_printf ("AT+VTS=%c", tone[0]);
|
||||||
mm_base_modem_at_command (ctx->modem,
|
mm_base_modem_at_command (ctx->modem,
|
||||||
cmd,
|
cmd,
|
||||||
|
@@ -100,8 +100,11 @@ MMBaseCall *mm_base_call_new_from_properties (MMBaseModem *modem,
|
|||||||
void mm_base_call_export (MMBaseCall *self);
|
void mm_base_call_export (MMBaseCall *self);
|
||||||
void mm_base_call_unexport (MMBaseCall *self);
|
void mm_base_call_unexport (MMBaseCall *self);
|
||||||
const gchar *mm_base_call_get_path (MMBaseCall *self);
|
const gchar *mm_base_call_get_path (MMBaseCall *self);
|
||||||
void mm_base_call_change_state (MMBaseCall *self, MMCallState new_state, MMCallStateReason reason);
|
void mm_base_call_change_state (MMBaseCall *self,
|
||||||
void mm_base_call_received_dtmf (MMBaseCall *self, gchar *tone);
|
MMCallState new_state,
|
||||||
|
MMCallStateReason reason);
|
||||||
|
void mm_base_call_received_dtmf (MMBaseCall *self,
|
||||||
|
gchar *tone);
|
||||||
|
|
||||||
void mm_base_call_delete (MMBaseCall *self,
|
void mm_base_call_delete (MMBaseCall *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
|
@@ -6212,8 +6212,8 @@ modem_messaging_create_sms (MMIfaceModemMessaging *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* Check if Voice supported (Voice interface) */
|
/* Check if Voice supported (Voice interface) */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
modem_voice_check_support_finish (MMIfaceModemVoice *self,
|
modem_voice_check_support_finish (MMIfaceModemVoice *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -6255,7 +6255,7 @@ modem_voice_check_support (MMIfaceModemVoice *self,
|
|||||||
user_data,
|
user_data,
|
||||||
modem_voice_check_support);
|
modem_voice_check_support);
|
||||||
|
|
||||||
/* We assume that all modems has voice capabilities, but ... */
|
/* We assume that all modems have voice capabilities, but ... */
|
||||||
|
|
||||||
/* Check ATH support */
|
/* Check ATH support */
|
||||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||||
@@ -6282,9 +6282,7 @@ ring_received (MMPortSerialAt *port,
|
|||||||
GMatchInfo *info,
|
GMatchInfo *info,
|
||||||
MMBroadbandModem *self)
|
MMBroadbandModem *self)
|
||||||
{
|
{
|
||||||
//Do not match anything from regex
|
mm_dbg ("Ringing");
|
||||||
(void)info;
|
|
||||||
|
|
||||||
mm_iface_modem_voice_create_incoming_call (MM_IFACE_MODEM_VOICE (self));
|
mm_iface_modem_voice_create_incoming_call (MM_IFACE_MODEM_VOICE (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6294,8 +6292,12 @@ cring_received (MMPortSerialAt *port,
|
|||||||
MMBroadbandModem *self)
|
MMBroadbandModem *self)
|
||||||
{
|
{
|
||||||
/* The match info gives us in which storage the index applies */
|
/* The match info gives us in which storage the index applies */
|
||||||
gchar *str = mm_get_string_unquoted_from_match_info (info, 1);
|
gchar *str;
|
||||||
//TODO: In str you could have "VOICE" or "DATA". Now consider only "VOICE"
|
|
||||||
|
/* We could have "VOICE" or "DATA". Now consider only "VOICE" */
|
||||||
|
|
||||||
|
str = mm_get_string_unquoted_from_match_info (info, 1);
|
||||||
|
mm_dbg ("Ringing (%s)", str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
mm_iface_modem_voice_create_incoming_call (MM_IFACE_MODEM_VOICE (self));
|
mm_iface_modem_voice_create_incoming_call (MM_IFACE_MODEM_VOICE (self));
|
||||||
@@ -6307,7 +6309,9 @@ clip_received (MMPortSerialAt *port,
|
|||||||
MMBroadbandModem *self)
|
MMBroadbandModem *self)
|
||||||
{
|
{
|
||||||
/* The match info gives us in which storage the index applies */
|
/* The match info gives us in which storage the index applies */
|
||||||
gchar *str = mm_get_string_unquoted_from_match_info (info, 1);
|
gchar *str;
|
||||||
|
|
||||||
|
str = mm_get_string_unquoted_from_match_info (info, 1);
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
guint validity = 0;
|
guint validity = 0;
|
||||||
@@ -6316,7 +6320,7 @@ clip_received (MMPortSerialAt *port,
|
|||||||
mm_get_uint_from_match_info (info, 2, &type);
|
mm_get_uint_from_match_info (info, 2, &type);
|
||||||
mm_get_uint_from_match_info (info, 3, &validity);
|
mm_get_uint_from_match_info (info, 3, &validity);
|
||||||
|
|
||||||
mm_dbg ("[%s:%d] CLIP regex => number:'%s', type:'%d', validity:'%d'", __func__, __LINE__, str, type, validity);
|
mm_dbg ("Caller ID received: number '%s', type '%d', validity '%d'", str, type, validity);
|
||||||
|
|
||||||
mm_iface_modem_voice_update_incoming_call_number (MM_IFACE_MODEM_VOICE (self), str, type, validity);
|
mm_iface_modem_voice_update_incoming_call_number (MM_IFACE_MODEM_VOICE (self), str, type, validity);
|
||||||
|
|
||||||
@@ -6329,10 +6333,7 @@ nocarrier_received (MMPortSerialAt *port,
|
|||||||
GMatchInfo *info,
|
GMatchInfo *info,
|
||||||
MMBroadbandModem *self)
|
MMBroadbandModem *self)
|
||||||
{
|
{
|
||||||
//Do not match anything from regex
|
mm_dbg ("No carrier");
|
||||||
(void)info;
|
|
||||||
|
|
||||||
mm_dbg ("[%s:%d]", __func__, __LINE__);
|
|
||||||
mm_iface_modem_voice_network_hangup (MM_IFACE_MODEM_VOICE (self));
|
mm_iface_modem_voice_network_hangup (MM_IFACE_MODEM_VOICE (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6466,7 +6467,6 @@ ring_response_processor (MMBaseModem *self,
|
|||||||
static const MMBaseModemAtCommand ring_sequence[] = {
|
static const MMBaseModemAtCommand ring_sequence[] = {
|
||||||
/* Show caller number on RING. */
|
/* Show caller number on RING. */
|
||||||
{ "+CLIP=1", 3, FALSE, ring_response_processor },
|
{ "+CLIP=1", 3, FALSE, ring_response_processor },
|
||||||
|
|
||||||
/* Show difference between data call and voice call */
|
/* Show difference between data call and voice call */
|
||||||
{ "+CRC=1", 3, FALSE, ring_response_processor },
|
{ "+CRC=1", 3, FALSE, ring_response_processor },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
|
@@ -57,11 +57,10 @@ mm_iface_modem_voice_create_incoming_call (MMIfaceModemVoice *self)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
|
|
||||||
call = mm_call_list_get_new_incoming (list);
|
call = mm_call_list_get_new_incoming (list);
|
||||||
if( !call ) {
|
|
||||||
|
|
||||||
mm_dbg("[%s:%d] Incoming call does not exist; create it", __func__, __LINE__);
|
if (!call) {
|
||||||
|
mm_dbg("Incoming call does not exist; create it");
|
||||||
|
|
||||||
call = mm_base_call_new (MM_BASE_MODEM (self));
|
call = mm_base_call_new (MM_BASE_MODEM (self));
|
||||||
g_object_set (call,
|
g_object_set (call,
|
||||||
@@ -72,13 +71,10 @@ mm_iface_modem_voice_create_incoming_call (MMIfaceModemVoice *self)
|
|||||||
|
|
||||||
/* Only export once properly created */
|
/* Only export once properly created */
|
||||||
mm_base_call_export (call);
|
mm_base_call_export (call);
|
||||||
mm_dbg ("[%s:%d] New call exported to DBUS", __func__, __LINE__);
|
mm_dbg ("New call exported to DBus");
|
||||||
|
|
||||||
mm_call_list_add_call (list, call);
|
mm_call_list_add_call (list, call);
|
||||||
mm_dbg ("[%s:%d] Call added to list", __func__, __LINE__);
|
mm_dbg ("Call added to the list");
|
||||||
|
|
||||||
} else {
|
|
||||||
// mm_dbg("[%s:%d] Incoming call already exist. Do nothing", __func__, __LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (list);
|
g_object_unref (list);
|
||||||
@@ -87,7 +83,11 @@ mm_iface_modem_voice_create_incoming_call (MMIfaceModemVoice *self)
|
|||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoice *self, gchar *number, guint type, guint validity)
|
gboolean
|
||||||
|
mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoice *self,
|
||||||
|
gchar *number,
|
||||||
|
guint type,
|
||||||
|
guint validity)
|
||||||
{
|
{
|
||||||
gboolean updated = FALSE;
|
gboolean updated = FALSE;
|
||||||
MMBaseCall *call = NULL;
|
MMBaseCall *call = NULL;
|
||||||
@@ -98,26 +98,29 @@ gboolean mm_iface_modem_voice_update_incoming_call_number (MMIfaceModemVoice *se
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
|
|
||||||
call = mm_call_list_get_new_incoming (list);
|
call = mm_call_list_get_new_incoming (list);
|
||||||
|
|
||||||
if (call) {
|
if (call) {
|
||||||
g_object_set (call, "number", number, NULL);
|
g_object_set (call, "number", number, NULL);
|
||||||
mm_gdbus_call_set_number (MM_GDBUS_CALL (call), number);
|
mm_gdbus_call_set_number (MM_GDBUS_CALL (call), number);
|
||||||
|
|
||||||
//TODO: Maybe also this parameters should be used
|
/*
|
||||||
(void)type;
|
* TODO: Maybe also this parameters should be used:
|
||||||
(void)validity;
|
* - type
|
||||||
|
* - validity
|
||||||
|
*/
|
||||||
|
|
||||||
updated = TRUE;
|
updated = TRUE;
|
||||||
} else {
|
} else {
|
||||||
mm_dbg("[%s:%d] Incoming call does not exist yet", __func__, __LINE__);
|
mm_dbg ("Incoming call does not exist yet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean mm_iface_modem_voice_call_dialing_to_ringing(MMIfaceModemVoice *self)
|
gboolean
|
||||||
|
mm_iface_modem_voice_call_dialing_to_ringing (MMIfaceModemVoice *self)
|
||||||
{
|
{
|
||||||
gboolean updated = FALSE;
|
gboolean updated = FALSE;
|
||||||
MMBaseCall *call = NULL;
|
MMBaseCall *call = NULL;
|
||||||
@@ -128,21 +131,21 @@ gboolean mm_iface_modem_voice_call_dialing_to_ringing(MMIfaceModemVoice *self)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
|
|
||||||
call = mm_call_list_get_first_outgoing_dialing_call (list);
|
call = mm_call_list_get_first_outgoing_dialing_call (list);
|
||||||
|
|
||||||
if (call) {
|
if (call) {
|
||||||
mm_base_call_change_state (call, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED);
|
mm_base_call_change_state (call, MM_CALL_STATE_RINGING_OUT, MM_CALL_STATE_REASON_OUTGOING_STARTED);
|
||||||
|
|
||||||
updated = TRUE;
|
updated = TRUE;
|
||||||
} else {
|
} else {
|
||||||
mm_dbg("[%s:%d] Outgoing dialing call does not exist", __func__, __LINE__);
|
mm_dbg ("Outgoing dialing call does not exist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean mm_iface_modem_voice_call_ringing_to_active(MMIfaceModemVoice *self)
|
gboolean
|
||||||
|
mm_iface_modem_voice_call_ringing_to_active (MMIfaceModemVoice *self)
|
||||||
{
|
{
|
||||||
gboolean updated = FALSE;
|
gboolean updated = FALSE;
|
||||||
MMBaseCall *call = NULL;
|
MMBaseCall *call = NULL;
|
||||||
@@ -153,21 +156,21 @@ gboolean mm_iface_modem_voice_call_ringing_to_active(MMIfaceModemVoice *self)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
|
|
||||||
call = mm_call_list_get_first_ringing_call (list);
|
call = mm_call_list_get_first_ringing_call (list);
|
||||||
|
|
||||||
if (call) {
|
if (call) {
|
||||||
mm_base_call_change_state (call, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
mm_base_call_change_state (call, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
||||||
|
|
||||||
updated = TRUE;
|
updated = TRUE;
|
||||||
} else {
|
} else {
|
||||||
mm_dbg("[%s:%d] Ringing call does not exist", __func__, __LINE__);
|
mm_dbg ("Ringing call does not exist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
|
gboolean
|
||||||
|
mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
|
||||||
{
|
{
|
||||||
gboolean updated = FALSE;
|
gboolean updated = FALSE;
|
||||||
MMBaseCall *call = NULL;
|
MMBaseCall *call = NULL;
|
||||||
@@ -178,21 +181,22 @@ gboolean mm_iface_modem_voice_network_hangup (MMIfaceModemVoice *self)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
|
|
||||||
call = mm_call_list_get_first_non_terminated_call (list);
|
call = mm_call_list_get_first_non_terminated_call (list);
|
||||||
|
|
||||||
if (call) {
|
if (call) {
|
||||||
mm_base_call_change_state (call, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
|
mm_base_call_change_state (call, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
|
||||||
|
|
||||||
updated = TRUE;
|
updated = TRUE;
|
||||||
} else {
|
} else {
|
||||||
mm_dbg("[%s:%d] No call to hangup", __func__, __LINE__);
|
mm_dbg ("No call to hangup");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean mm_iface_modem_voice_received_dtmf (MMIfaceModemVoice *self, gchar *tone)
|
gboolean
|
||||||
|
mm_iface_modem_voice_received_dtmf (MMIfaceModemVoice *self,
|
||||||
|
gchar *tone)
|
||||||
{
|
{
|
||||||
gboolean updated = FALSE;
|
gboolean updated = FALSE;
|
||||||
MMCallList *list = NULL;
|
MMCallList *list = NULL;
|
||||||
|
Reference in New Issue
Block a user