huawei,call: remove custom start() method
Totally equivalent to the default one in the MMBaseCall object.
This commit is contained in:

committed by
Dan Williams

parent
638c5b49f1
commit
65ae18118e
@@ -30,93 +30,6 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (MMCallHuawei, mm_call_huawei, MM_TYPE_BASE_CALL)
|
G_DEFINE_TYPE (MMCallHuawei, mm_call_huawei, MM_TYPE_BASE_CALL)
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* Start the CALL */
|
|
||||||
|
|
||||||
static void
|
|
||||||
call_start_ready (MMBaseModem *modem,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GTask *task)
|
|
||||||
{
|
|
||||||
MMBaseCall *self;
|
|
||||||
GError *error = NULL;
|
|
||||||
const gchar *response = NULL;
|
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
|
||||||
|
|
||||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
|
||||||
if (error) {
|
|
||||||
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 (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)) {
|
|
||||||
/* Update state */
|
|
||||||
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_REFUSED_OR_BUSY);
|
|
||||||
}
|
|
||||||
|
|
||||||
mm_dbg ("Couldn't start call : '%s'", error->message);
|
|
||||||
g_task_return_error (task, error);
|
|
||||||
g_object_unref (task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check response for error */
|
|
||||||
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 (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_REFUSED_OR_BUSY);
|
|
||||||
} else {
|
|
||||||
/* Update state */
|
|
||||||
mm_base_call_change_state (self, MM_CALL_STATE_DIALING, MM_CALL_STATE_REASON_OUTGOING_STARTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
g_task_return_error (task, error);
|
|
||||||
g_object_unref (task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
call_start (MMBaseCall *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
MMBaseModem *modem;
|
|
||||||
GTask *task;
|
|
||||||
gchar *cmd;
|
|
||||||
|
|
||||||
g_object_get (self,
|
|
||||||
MM_BASE_CALL_MODEM, &modem,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
task = g_task_new (self, NULL, callback, user_data);
|
|
||||||
g_task_set_task_data (task, modem, g_object_unref);
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("ATD%s;", mm_gdbus_call_get_number (MM_GDBUS_CALL (self)));
|
|
||||||
mm_base_modem_at_command (modem,
|
|
||||||
cmd,
|
|
||||||
3,
|
|
||||||
FALSE,
|
|
||||||
(GAsyncReadyCallback)call_start_ready,
|
|
||||||
task);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
MMBaseCall *
|
MMBaseCall *
|
||||||
@@ -139,7 +52,6 @@ mm_call_huawei_class_init (MMCallHuaweiClass *klass)
|
|||||||
{
|
{
|
||||||
MMBaseCallClass *base_call_class = MM_BASE_CALL_CLASS (klass);
|
MMBaseCallClass *base_call_class = MM_BASE_CALL_CLASS (klass);
|
||||||
|
|
||||||
base_call_class->start = call_start;
|
|
||||||
base_call_class->setup_unsolicited_events = NULL;
|
base_call_class->setup_unsolicited_events = NULL;
|
||||||
base_call_class->cleanup_unsolicited_events = NULL;
|
base_call_class->cleanup_unsolicited_events = NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user