base-modem: implement new modem-wide cancellable, and rework AT commands
Instead of the `_in_port()' variants, we'll provide more generic `_full()' methods. These should be used either if we want to send commands to a specific port, or if we want to use a specific user-provided GCancellable. In addition to this user-provided GCancellable, we keep the internal modem-wide one.
This commit is contained in:
@@ -118,18 +118,14 @@ enable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
mm_base_modem_at_command_in_port (
|
||||
MM_BASE_MODEM (self),
|
||||
/* Only primary port is expected in the Cinterion modems */
|
||||
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
|
||||
/* AT=CMER=[<mode>[,<keyp>[,<disp>[,<ind>[,<bfr>]]]]]
|
||||
* but <ind> should be either not set, or equal to 0 or 2.
|
||||
* Enabled with 2.
|
||||
*/
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CMER=3,0,0,2",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -158,7 +154,6 @@ messaging_enable_unsolicited_events (MMIfaceModemMessaging *self,
|
||||
"+CNMI=2,1,2,2,1",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -204,7 +199,6 @@ send_sleep_mode_command (MMBroadbandModemCinterion *self,
|
||||
self->priv->sleep_mode_cmd,
|
||||
5,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)sleep_ready,
|
||||
operation_result);
|
||||
return;
|
||||
@@ -281,7 +275,6 @@ modem_power_down (MMIfaceModem *self,
|
||||
"+CFUN=?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)supported_functionality_status_query_ready,
|
||||
result);
|
||||
}
|
||||
@@ -484,7 +477,6 @@ sind_query_ready (MMBroadbandModemCinterion *self,
|
||||
"^SMONG",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)smong_query_ready,
|
||||
operation_result);
|
||||
}
|
||||
@@ -512,7 +504,6 @@ load_access_technologies (MMIfaceModem *self,
|
||||
"^SIND?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)sind_query_ready,
|
||||
result);
|
||||
return;
|
||||
@@ -523,7 +514,6 @@ load_access_technologies (MMIfaceModem *self,
|
||||
"^SMONG",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)smong_query_ready,
|
||||
result);
|
||||
}
|
||||
@@ -620,7 +610,6 @@ load_supported_modes (MMIfaceModem *self,
|
||||
"+WS46=?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)supported_networks_query_ready,
|
||||
result);
|
||||
}
|
||||
@@ -708,7 +697,6 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
cmd->str,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)allowed_access_technology_update_ready,
|
||||
result);
|
||||
g_string_free (cmd, TRUE);
|
||||
@@ -983,7 +971,6 @@ load_current_bands (MMIfaceModem *self,
|
||||
"AT^SCFG=\"Radio/Band\"",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)((!broadband->priv->only_utran &&
|
||||
!broadband->priv->both_geran_utran) ?
|
||||
get_2g_band_ready :
|
||||
@@ -1082,7 +1069,6 @@ set_bands_3g (MMIfaceModem *self,
|
||||
cmd,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)scfg_set_ready,
|
||||
result);
|
||||
g_free (cmd);
|
||||
@@ -1179,7 +1165,6 @@ set_bands_2g (MMIfaceModem *self,
|
||||
cmd,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)scfg_set_ready,
|
||||
result);
|
||||
|
||||
@@ -1261,7 +1246,6 @@ setup_flow_control (MMIfaceModem *self,
|
||||
"\\Q3",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)setup_flow_control_ready,
|
||||
result);
|
||||
}
|
||||
|
@@ -81,7 +81,6 @@ load_access_technologies (MMIfaceModem *self,
|
||||
"*CNTI=0",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ connect_report_ready (MMBaseModem *modem,
|
||||
}
|
||||
|
||||
/* If we got a proper extended reply, build the new error to be set */
|
||||
result = mm_base_modem_at_command_in_port_finish (modem, res, NULL);
|
||||
result = mm_base_modem_at_command_full_finish (modem, res, NULL);
|
||||
if (result &&
|
||||
g_str_has_prefix (result, "+CEER: ") &&
|
||||
strlen (result) > 7) {
|
||||
@@ -146,10 +146,10 @@ dial_ready (MMBaseModem *modem,
|
||||
/* DO NOT check for cancellable here. If we got here without errors, the
|
||||
* bearer is really connected and therefore we need to reflect that in
|
||||
* the state machine. */
|
||||
mm_base_modem_at_command_in_port_finish (modem, res, &(ctx->saved_error));
|
||||
mm_base_modem_at_command_full_finish (modem, res, &(ctx->saved_error));
|
||||
if (ctx->saved_error) {
|
||||
/* Try to get more information why it failed */
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
modem,
|
||||
ctx->primary,
|
||||
"+CEER",
|
||||
@@ -199,7 +199,7 @@ service_type_ready (MMBaseModem *modem,
|
||||
}
|
||||
|
||||
/* Errors setting the service type will be critical */
|
||||
mm_base_modem_at_command_in_port_finish (modem, res, &error);
|
||||
mm_base_modem_at_command_full_finish (modem, res, &error);
|
||||
if (error) {
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
connect_context_complete_and_free (ctx);
|
||||
@@ -209,7 +209,7 @@ service_type_ready (MMBaseModem *modem,
|
||||
/* We just use the default number to dial in the Iridium network. Also note
|
||||
* that we won't specify a specific port to use; Iridium modems only expose
|
||||
* one. */
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
modem,
|
||||
ctx->primary,
|
||||
"ATDT008816000025",
|
||||
@@ -249,7 +249,7 @@ connect (MMBearer *self,
|
||||
|
||||
/* Bearer service type set to 9600bps (V.110), which behaves better than the
|
||||
* default 9600bps (V.32). */
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
modem,
|
||||
ctx->primary,
|
||||
"+CBST=71,0,1",
|
||||
|
@@ -88,7 +88,6 @@ after_atz_sleep_cb (GSimpleAsyncResult *simple)
|
||||
modem_init_sequence,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)init_sequence_ready,
|
||||
simple);
|
||||
g_object_unref (self);
|
||||
@@ -132,7 +131,6 @@ modem_init (MMIfaceModem *self,
|
||||
"Z",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)atz_ready,
|
||||
result);
|
||||
}
|
||||
@@ -201,7 +199,6 @@ messaging_enable_unsolicited_events (MMIfaceModemMessaging *self,
|
||||
"+CNMI=2,1,0,0,1",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -251,7 +248,6 @@ load_signal_quality (MMIfaceModem *self,
|
||||
"+CSQF",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -308,7 +304,6 @@ setup_flow_control (MMIfaceModem *self,
|
||||
"&K3",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)setup_flow_control_ready,
|
||||
result);
|
||||
}
|
||||
|
@@ -79,7 +79,6 @@ modem_init (MMIfaceModem *self,
|
||||
modem_init_sequence,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
@@ -171,7 +171,6 @@ connect_3gpp_qmistatus (DetailedConnectContext *ctx)
|
||||
"$NWQMISTATUS",
|
||||
3, /* timeout */
|
||||
FALSE, /* allow_cached */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)connect_3gpp_qmistatus_ready, /* callback */
|
||||
ctx); /* user_data */
|
||||
|
||||
@@ -230,7 +229,6 @@ connect_3gpp (MMBroadbandBearer *self,
|
||||
"$NWQMICONNECT=,,,,,,,,,,",
|
||||
10, /* timeout */
|
||||
FALSE, /* allow_cached */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)connect_3gpp_qmiconnect_ready,
|
||||
ctx); /* user_data */
|
||||
}
|
||||
@@ -338,7 +336,6 @@ disconnect_3gpp_check_status (MMBaseModem *modem,
|
||||
"$NWQMISTATUS",
|
||||
3, /* timeout */
|
||||
FALSE, /* allow_cached */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)disconnect_3gpp_status_complete,
|
||||
ctx); /* user_data */
|
||||
}
|
||||
@@ -362,7 +359,6 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
"$NWQMIDISCONNECT",
|
||||
10, /* timeout */
|
||||
FALSE, /* allow_cached */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)disconnect_3gpp_check_status,
|
||||
ctx); /* user_data */
|
||||
}
|
||||
|
@@ -206,7 +206,6 @@ load_supported_modes (MMIfaceModem *self,
|
||||
"+WS46=?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)supported_networks_query_ready,
|
||||
result);
|
||||
}
|
||||
@@ -362,7 +361,6 @@ load_current_bands (MMIfaceModem *self,
|
||||
"$NWBAND?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)load_current_bands_done,
|
||||
result);
|
||||
}
|
||||
@@ -424,7 +422,6 @@ set_bands (MMIfaceModem *self,
|
||||
cmd,
|
||||
3,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)set_bands_done,
|
||||
result);
|
||||
|
||||
|
@@ -306,7 +306,6 @@ load_access_technologies_step (AccessTechnologiesContext *ctx)
|
||||
"_OSSYS?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)ossys_query_ready,
|
||||
ctx);
|
||||
break;
|
||||
@@ -317,7 +316,6 @@ load_access_technologies_step (AccessTechnologiesContext *ctx)
|
||||
"_OCTI?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)octi_query_ready,
|
||||
ctx);
|
||||
return;
|
||||
@@ -331,7 +329,6 @@ load_access_technologies_step (AccessTechnologiesContext *ctx)
|
||||
"_OWCTI?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)owcti_query_ready,
|
||||
ctx);
|
||||
return;
|
||||
|
@@ -70,6 +70,13 @@ abort_async_if_port_unusable (MMBaseModem *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
modem_cancellable_cancelled (GCancellable *modem_cancellable,
|
||||
GCancellable *user_cancellable)
|
||||
{
|
||||
g_cancellable_cancel (user_cancellable);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* AT sequence handling */
|
||||
|
||||
@@ -77,6 +84,9 @@ typedef struct {
|
||||
MMBaseModem *self;
|
||||
MMAtSerialPort *port;
|
||||
GCancellable *cancellable;
|
||||
gulong cancelled_id;
|
||||
GCancellable *modem_cancellable;
|
||||
GCancellable *user_cancellable;
|
||||
const MMBaseModemAtCommand *current;
|
||||
const MMBaseModemAtCommand *sequence;
|
||||
GSimpleAsyncResult *simple;
|
||||
@@ -95,8 +105,15 @@ at_sequence_context_free (AtSequenceContext *ctx)
|
||||
if (ctx->response_processor_context &&
|
||||
ctx->response_processor_context_free)
|
||||
ctx->response_processor_context_free (ctx->response_processor_context);
|
||||
if (ctx->cancellable)
|
||||
|
||||
if (ctx->cancelled_id)
|
||||
g_cancellable_disconnect (ctx->modem_cancellable,
|
||||
ctx->cancelled_id);
|
||||
if (ctx->user_cancellable)
|
||||
g_object_unref (ctx->user_cancellable);
|
||||
g_object_unref (ctx->modem_cancellable);
|
||||
g_object_unref (ctx->cancellable);
|
||||
|
||||
if (ctx->result)
|
||||
g_variant_unref (ctx->result);
|
||||
if (ctx->simple)
|
||||
@@ -105,7 +122,7 @@ at_sequence_context_free (AtSequenceContext *ctx)
|
||||
}
|
||||
|
||||
GVariant *
|
||||
mm_base_modem_at_sequence_in_port_finish (MMBaseModem *self,
|
||||
mm_base_modem_at_sequence_full_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
gpointer *response_processor_context,
|
||||
GError **error)
|
||||
@@ -223,7 +240,7 @@ at_sequence_parse_response (MMAtSerialPort *port,
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_at_sequence_in_port (MMBaseModem *self,
|
||||
mm_base_modem_at_sequence_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
const MMBaseModemAtCommand *sequence,
|
||||
gpointer response_processor_context,
|
||||
@@ -242,17 +259,30 @@ mm_base_modem_at_sequence_in_port (MMBaseModem *self,
|
||||
ctx = g_new0 (AtSequenceContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->port = g_object_ref (port);
|
||||
ctx->cancellable = (cancellable ?
|
||||
g_object_ref (cancellable) :
|
||||
NULL);
|
||||
ctx->simple = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
mm_base_modem_at_sequence_in_port);
|
||||
mm_base_modem_at_sequence_full);
|
||||
ctx->current = ctx->sequence = sequence;
|
||||
ctx->response_processor_context = response_processor_context;
|
||||
ctx->response_processor_context_free = response_processor_context_free;
|
||||
|
||||
/* Setup cancellables */
|
||||
ctx->modem_cancellable = mm_base_modem_get_cancellable (self);
|
||||
ctx->user_cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
if (!ctx->user_cancellable)
|
||||
/* Just the modem-wide one, use it directly */
|
||||
ctx->cancellable = g_object_ref (ctx->modem_cancellable);
|
||||
else {
|
||||
/* Use the user provided one, which will also get cancelled if the modem
|
||||
* wide-one gets cancelled */
|
||||
ctx->cancellable = g_object_ref (ctx->user_cancellable);
|
||||
ctx->cancelled_id = g_cancellable_connect (ctx->modem_cancellable,
|
||||
G_CALLBACK (modem_cancellable_cancelled),
|
||||
ctx->user_cancellable,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Go on with the first one in the sequence */
|
||||
mm_at_serial_port_queue_command (
|
||||
ctx->port,
|
||||
@@ -269,7 +299,7 @@ mm_base_modem_at_sequence_finish (MMBaseModem *self,
|
||||
gpointer *response_processor_context,
|
||||
GError **error)
|
||||
{
|
||||
return (mm_base_modem_at_sequence_in_port_finish (
|
||||
return (mm_base_modem_at_sequence_full_finish (
|
||||
self,
|
||||
res,
|
||||
response_processor_context,
|
||||
@@ -281,7 +311,6 @@ mm_base_modem_at_sequence (MMBaseModem *self,
|
||||
const MMBaseModemAtCommand *sequence,
|
||||
gpointer response_processor_context,
|
||||
GDestroyNotify response_processor_context_free,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -299,13 +328,13 @@ mm_base_modem_at_sequence (MMBaseModem *self,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_base_modem_at_sequence_in_port (
|
||||
mm_base_modem_at_sequence_full (
|
||||
self,
|
||||
port,
|
||||
sequence,
|
||||
response_processor_context,
|
||||
response_processor_context_free,
|
||||
cancellable,
|
||||
NULL,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -375,15 +404,25 @@ typedef struct {
|
||||
MMBaseModem *self;
|
||||
MMAtSerialPort *port;
|
||||
GCancellable *cancellable;
|
||||
gulong cancelled_id;
|
||||
GCancellable *modem_cancellable;
|
||||
GCancellable *user_cancellable;
|
||||
GSimpleAsyncResult *result;
|
||||
} AtCommandContext;
|
||||
|
||||
static void
|
||||
at_command_context_free (AtCommandContext *ctx)
|
||||
{
|
||||
if (ctx->cancellable)
|
||||
g_object_unref (ctx->cancellable);
|
||||
mm_serial_port_close (MM_SERIAL_PORT (ctx->port));
|
||||
|
||||
if (ctx->cancelled_id)
|
||||
g_cancellable_disconnect (ctx->modem_cancellable,
|
||||
ctx->cancelled_id);
|
||||
if (ctx->user_cancellable)
|
||||
g_object_unref (ctx->user_cancellable);
|
||||
g_object_unref (ctx->modem_cancellable);
|
||||
g_object_unref (ctx->cancellable);
|
||||
|
||||
g_object_unref (ctx->port);
|
||||
g_object_unref (ctx->result);
|
||||
g_object_unref (ctx->self);
|
||||
@@ -391,7 +430,7 @@ at_command_context_free (AtCommandContext *ctx)
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mm_base_modem_at_command_in_port_finish (MMBaseModem *self,
|
||||
mm_base_modem_at_command_full_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -433,7 +472,7 @@ at_command_parse_response (MMAtSerialPort *port,
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_at_command_in_port (MMBaseModem *self,
|
||||
mm_base_modem_at_command_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
const gchar *command,
|
||||
guint timeout,
|
||||
@@ -448,16 +487,30 @@ mm_base_modem_at_command_in_port (MMBaseModem *self,
|
||||
if (!abort_async_if_port_unusable (self, port, callback, user_data))
|
||||
return;
|
||||
|
||||
ctx = g_new (AtCommandContext, 1);
|
||||
ctx = g_new0 (AtCommandContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->port = g_object_ref (port);
|
||||
ctx->cancellable = (cancellable ?
|
||||
g_object_ref (cancellable) :
|
||||
NULL);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
mm_base_modem_at_command_in_port);
|
||||
mm_base_modem_at_command_full);
|
||||
|
||||
/* Setup cancellables */
|
||||
ctx->modem_cancellable = mm_base_modem_get_cancellable (self);
|
||||
ctx->user_cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
if (!ctx->user_cancellable)
|
||||
/* Just the modem-wide one, use it directly */
|
||||
ctx->cancellable = g_object_ref (ctx->modem_cancellable);
|
||||
else {
|
||||
/* Use the user provided one, which will also get cancelled if the modem
|
||||
* wide-one gets cancelled */
|
||||
ctx->cancellable = g_object_ref (ctx->user_cancellable);
|
||||
ctx->cancelled_id = g_cancellable_connect (ctx->modem_cancellable,
|
||||
G_CALLBACK (modem_cancellable_cancelled),
|
||||
ctx->user_cancellable,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Go on with the command */
|
||||
if (allow_cached)
|
||||
@@ -483,7 +536,7 @@ mm_base_modem_at_command_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return mm_base_modem_at_command_in_port_finish (self, res, error);
|
||||
return mm_base_modem_at_command_full_finish (self, res, error);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -491,7 +544,6 @@ mm_base_modem_at_command (MMBaseModem *self,
|
||||
const gchar *command,
|
||||
guint timeout,
|
||||
gboolean allow_cached,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -509,49 +561,12 @@ mm_base_modem_at_command (MMBaseModem *self,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_base_modem_at_command_in_port (self,
|
||||
mm_base_modem_at_command_full (self,
|
||||
port,
|
||||
command,
|
||||
timeout,
|
||||
allow_cached,
|
||||
cancellable,
|
||||
NULL,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Single AT command handling, completely ignoring the response */
|
||||
|
||||
void
|
||||
mm_base_modem_at_command_in_port_ignore_reply (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
const gchar *command,
|
||||
guint timeout)
|
||||
{
|
||||
/* Use the async method without callback, so that we ensure port
|
||||
* gets opened and such, if needed */
|
||||
mm_base_modem_at_command_in_port (self,
|
||||
port,
|
||||
command,
|
||||
timeout,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
NULL, /* callback */
|
||||
NULL); /* user_data */
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_at_command_ignore_reply (MMBaseModem *self,
|
||||
const gchar *command,
|
||||
guint timeout)
|
||||
{
|
||||
MMAtSerialPort *port;
|
||||
|
||||
/* No port given, so we'll try to guess which is best */
|
||||
port = mm_base_modem_peek_best_at_port (self, NULL);
|
||||
if (!port)
|
||||
/* No valid port, and we ignore replies, so just exit. */
|
||||
return;
|
||||
|
||||
mm_base_modem_at_command_in_port_ignore_reply (self, port, command, timeout);
|
||||
}
|
||||
|
@@ -63,12 +63,12 @@ typedef struct {
|
||||
MMBaseModemAtResponseProcessor response_processor;
|
||||
} MMBaseModemAtCommand;
|
||||
|
||||
/* AT sequence handling */
|
||||
/* Generic AT sequence handling, using the best AT port available and without
|
||||
* explicit cancellations. */
|
||||
void mm_base_modem_at_sequence (MMBaseModem *self,
|
||||
const MMBaseModemAtCommand *sequence,
|
||||
gpointer response_processor_context,
|
||||
GDestroyNotify response_processor_context_free,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GVariant *mm_base_modem_at_sequence_finish (MMBaseModem *self,
|
||||
@@ -76,7 +76,9 @@ GVariant *mm_base_modem_at_sequence_finish (MMBaseModem *self,
|
||||
gpointer *response_processor_context,
|
||||
GError **error);
|
||||
|
||||
void mm_base_modem_at_sequence_in_port (MMBaseModem *self,
|
||||
/* Fully detailed AT sequence handling, when specific AT port and/or explicit
|
||||
* cancellations need to be used. */
|
||||
void mm_base_modem_at_sequence_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
const MMBaseModemAtCommand *sequence,
|
||||
gpointer response_processor_context,
|
||||
@@ -84,7 +86,7 @@ void mm_base_modem_at_sequence_in_port (MMBaseModem *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GVariant *mm_base_modem_at_sequence_in_port_finish (MMBaseModem *self,
|
||||
GVariant *mm_base_modem_at_sequence_full_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
gpointer *response_processor_context,
|
||||
GError **error);
|
||||
@@ -119,19 +121,21 @@ gboolean mm_base_modem_response_processor_no_result_continue (MMBaseModem *self,
|
||||
GVariant **result,
|
||||
GError **result_error);
|
||||
|
||||
/* Single AT command, returning the whole response string */
|
||||
/* Generic AT command handling, using the best AT port available and without
|
||||
* explicit cancellations. */
|
||||
void mm_base_modem_at_command (MMBaseModem *self,
|
||||
const gchar *command,
|
||||
guint timeout,
|
||||
gboolean allow_cached,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
const gchar *mm_base_modem_at_command_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_base_modem_at_command_in_port (MMBaseModem *self,
|
||||
/* Fully detailed AT command handling, when specific AT port and/or explicit
|
||||
* cancellations need to be used. */
|
||||
void mm_base_modem_at_command_full (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
const gchar *command,
|
||||
guint timeout,
|
||||
@@ -139,17 +143,8 @@ void mm_base_modem_at_command_in_port (MMBaseModem *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
const gchar *mm_base_modem_at_command_in_port_finish (MMBaseModem *self,
|
||||
const gchar *mm_base_modem_at_command_full_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Fire and forget an AT command */
|
||||
void mm_base_modem_at_command_ignore_reply (MMBaseModem *self,
|
||||
const gchar *command,
|
||||
guint timeout);
|
||||
void mm_base_modem_at_command_in_port_ignore_reply (MMBaseModem *self,
|
||||
MMAtSerialPort *port,
|
||||
const gchar *command,
|
||||
guint timeout);
|
||||
|
||||
#endif /* MM_BASE_MODEM_AT_H */
|
||||
|
@@ -387,6 +387,22 @@ mm_base_modem_get_valid (MMBaseModem *self)
|
||||
return self->priv->valid;
|
||||
}
|
||||
|
||||
GCancellable *
|
||||
mm_base_modem_peek_cancellable (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
|
||||
return self->priv->cancellable;
|
||||
}
|
||||
|
||||
GCancellable *
|
||||
mm_base_modem_get_cancellable (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
|
||||
return g_object_ref (self->priv->cancellable);
|
||||
}
|
||||
|
||||
MMAtSerialPort *
|
||||
mm_base_modem_get_port_primary (MMBaseModem *self)
|
||||
{
|
||||
|
@@ -140,6 +140,9 @@ const gchar *mm_base_modem_get_plugin (MMBaseModem *self);
|
||||
guint mm_base_modem_get_vendor_id (MMBaseModem *self);
|
||||
guint mm_base_modem_get_product_id (MMBaseModem *self);
|
||||
|
||||
GCancellable *mm_base_modem_peek_cancellable (MMBaseModem *self);
|
||||
GCancellable *mm_base_modem_get_cancellable (MMBaseModem *self);
|
||||
|
||||
void mm_base_modem_authorize (MMBaseModem *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
|
@@ -272,7 +272,7 @@ dial_cdma_ready (MMBaseModem *modem,
|
||||
/* DO NOT check for cancellable here. If we got here without errors, the
|
||||
* bearer is really connected and therefore we need to reflect that in
|
||||
* the state machine. */
|
||||
mm_base_modem_at_command_finish (modem, res, &error);
|
||||
mm_base_modem_at_command_full_finish (modem, res, &error);
|
||||
if (error) {
|
||||
mm_warn ("Couldn't connect: '%s'", error->message);
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
@@ -296,13 +296,13 @@ cdma_connect_context_dial (DetailedConnectContext *ctx)
|
||||
command = g_strconcat ("DT", ctx->self->priv->number, NULL);
|
||||
else
|
||||
command = g_strdup ("DT#777");
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
90,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
NULL,
|
||||
(GAsyncReadyCallback)dial_cdma_ready,
|
||||
ctx);
|
||||
g_free (command);
|
||||
@@ -319,7 +319,7 @@ set_rm_protocol_ready (MMBaseModem *self,
|
||||
if (detailed_connect_context_complete_and_free_if_cancelled (ctx))
|
||||
return;
|
||||
|
||||
mm_base_modem_at_command_finish (self, res, &error);
|
||||
mm_base_modem_at_command_full_finish (self, res, &error);
|
||||
if (error) {
|
||||
mm_warn ("Couldn't set RM protocol: '%s'", error->message);
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
@@ -345,7 +345,7 @@ current_rm_protocol_ready (MMBaseModem *self,
|
||||
if (detailed_connect_context_complete_and_free_if_cancelled (ctx))
|
||||
return;
|
||||
|
||||
result = mm_base_modem_at_command_finish (self, res, &error);
|
||||
result = mm_base_modem_at_command_full_finish (self, res, &error);
|
||||
if (error) {
|
||||
mm_warn ("Couldn't query current RM protocol: '%s'", error->message);
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
@@ -383,13 +383,12 @@ current_rm_protocol_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
command = g_strdup_printf ("+CRM=%u", new_index);
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
NULL,
|
||||
(GAsyncReadyCallback)set_rm_protocol_ready,
|
||||
ctx);
|
||||
g_free (command);
|
||||
@@ -425,8 +424,7 @@ connect_cdma (MMBroadbandBearer *self,
|
||||
if (self->priv->rm_protocol != MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN) {
|
||||
/* Need to query current RM protocol */
|
||||
mm_dbg ("Querying current RM protocol set...");
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
"+CRM?",
|
||||
3,
|
||||
@@ -535,7 +533,7 @@ extended_error_ready (MMBaseModem *modem,
|
||||
if (dial_3gpp_context_complete_and_free_if_cancelled (ctx))
|
||||
return;
|
||||
|
||||
result = mm_base_modem_at_command_finish (modem, res, NULL);
|
||||
result = mm_base_modem_at_command_full_finish (modem, res, NULL);
|
||||
if (result &&
|
||||
g_str_has_prefix (result, "+CEER: ") &&
|
||||
strlen (result) > 7) {
|
||||
@@ -562,12 +560,11 @@ atd_ready (MMBaseModem *modem,
|
||||
/* DO NOT check for cancellable here. If we got here without errors, the
|
||||
* bearer is really connected and therefore we need to reflect that in
|
||||
* the state machine. */
|
||||
mm_base_modem_at_command_finish (modem, res, &ctx->saved_error);
|
||||
mm_base_modem_at_command_full_finish (modem, res, &ctx->saved_error);
|
||||
|
||||
if (ctx->saved_error) {
|
||||
/* Try to get more information why it failed */
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
"+CEER",
|
||||
3,
|
||||
@@ -604,8 +601,7 @@ dial_3gpp (MMBroadbandBearer *self,
|
||||
|
||||
/* Use default *99 to connect */
|
||||
command = g_strdup_printf ("ATD*99***%d#", cid);
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
60,
|
||||
@@ -664,7 +660,7 @@ initialize_pdp_context_ready (MMBaseModem *self,
|
||||
if (detailed_connect_context_complete_and_free_if_cancelled (ctx))
|
||||
return;
|
||||
|
||||
mm_base_modem_at_command_finish (self, res, &error);
|
||||
mm_base_modem_at_command_full_finish (self, res, &error);
|
||||
if (error) {
|
||||
mm_warn ("Couldn't initialize PDP context with our APN: '%s'",
|
||||
error->message);
|
||||
@@ -691,7 +687,7 @@ find_cid_ready (MMBaseModem *self,
|
||||
gchar *command;
|
||||
GError *error = NULL;
|
||||
|
||||
result = mm_base_modem_at_sequence_finish (self, res, NULL, &error);
|
||||
result = mm_base_modem_at_sequence_full_finish (self, res, NULL, &error);
|
||||
if (!result) {
|
||||
mm_warn ("Couldn't find best CID to use: '%s'", error->message);
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
@@ -710,8 +706,7 @@ find_cid_ready (MMBaseModem *self,
|
||||
command = g_strdup_printf ("+CGDCONT=%u,\"IP\",\"%s\"",
|
||||
ctx->cid,
|
||||
ctx->self->priv->apn);
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
3,
|
||||
@@ -914,8 +909,7 @@ connect_3gpp (MMBroadbandBearer *self,
|
||||
user_data);
|
||||
|
||||
mm_dbg ("Looking for best CID...");
|
||||
mm_base_modem_at_sequence_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_sequence_full (ctx->modem,
|
||||
ctx->primary,
|
||||
find_cid_sequence,
|
||||
ctx, /* also passed as response processor context */
|
||||
@@ -1343,7 +1337,7 @@ cgact_primary_ready (MMBaseModem *modem,
|
||||
GError *error = NULL;
|
||||
|
||||
/* Ignore errors for now */
|
||||
mm_base_modem_at_command_finish (MM_BASE_MODEM (modem), res, &error);
|
||||
mm_base_modem_at_command_full_finish (MM_BASE_MODEM (modem), res, &error);
|
||||
if (error) {
|
||||
mm_dbg ("PDP context deactivation failed (not fatal): %s", error->message);
|
||||
g_error_free (error);
|
||||
@@ -1398,8 +1392,7 @@ primary_flash_3gpp_ready (MMSerialPort *port,
|
||||
/* Port is disconnected; update the state */
|
||||
mm_port_set_connected (ctx->data, FALSE);
|
||||
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
ctx->cgact_command,
|
||||
3,
|
||||
@@ -1416,7 +1409,7 @@ cgact_secondary_ready (MMBaseModem *modem,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
mm_base_modem_at_command_finish (MM_BASE_MODEM (modem), res, &error);
|
||||
mm_base_modem_at_command_full_finish (MM_BASE_MODEM (modem), res, &error);
|
||||
if (!error)
|
||||
ctx->cgact_sent = TRUE;
|
||||
else
|
||||
@@ -1463,8 +1456,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
|
||||
*/
|
||||
if (ctx->secondary &&
|
||||
mm_port_get_connected (MM_PORT (ctx->primary))) {
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->secondary,
|
||||
ctx->cgact_command,
|
||||
3,
|
||||
@@ -1742,7 +1734,7 @@ crm_range_ready (MMBaseModem *modem,
|
||||
GError *error = NULL;
|
||||
const gchar *response;
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
response = mm_base_modem_at_command_full_finish (modem, res, &error);
|
||||
if (error) {
|
||||
/* We should possibly take this error as fatal. If we were told to use a
|
||||
* specific Rm protocol, we must be able to check if it is supported. */
|
||||
@@ -1868,8 +1860,7 @@ interface_initialization_step (InitAsyncContext *ctx)
|
||||
* supported. */
|
||||
if (mm_iface_modem_is_cdma (MM_IFACE_MODEM (ctx->modem)) &&
|
||||
ctx->self->priv->rm_protocol != MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN) {
|
||||
mm_base_modem_at_command_in_port (
|
||||
ctx->modem,
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->port,
|
||||
"+CRM=?",
|
||||
3,
|
||||
|
@@ -484,7 +484,6 @@ modem_load_current_capabilities (MMIfaceModem *self,
|
||||
capabilities,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -526,7 +525,6 @@ modem_load_manufacturer (MMIfaceModem *self,
|
||||
manufacturers,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -568,7 +566,6 @@ modem_load_model (MMIfaceModem *self,
|
||||
models,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -610,7 +607,6 @@ modem_load_revision (MMIfaceModem *self,
|
||||
revisions,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -659,7 +655,6 @@ modem_load_equipment_identifier (MMIfaceModem *self,
|
||||
commands,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -753,7 +748,6 @@ modem_load_device_identifier (MMIfaceModem *self,
|
||||
device_identifier_steps,
|
||||
g_new0 (DeviceIdentifierContext, 1),
|
||||
(GDestroyNotify)device_identifier_context_free,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -785,7 +779,6 @@ modem_load_own_numbers (MMIfaceModem *self,
|
||||
"+CNUM",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -908,7 +901,6 @@ modem_load_unlock_required (MMIfaceModem *self,
|
||||
"+CPIN?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cpin_query_ready,
|
||||
result);
|
||||
}
|
||||
@@ -1019,7 +1011,7 @@ signal_quality_csq_ready (MMBroadbandModem *self,
|
||||
GVariant *result;
|
||||
const gchar *result_str;
|
||||
|
||||
result = mm_base_modem_at_sequence_in_port_finish (MM_BASE_MODEM (self), res, NULL, &error);
|
||||
result = mm_base_modem_at_sequence_full_finish (MM_BASE_MODEM (self), res, NULL, &error);
|
||||
if (error) {
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
signal_quality_context_complete_and_free (ctx);
|
||||
@@ -1072,7 +1064,7 @@ static const MMBaseModemAtCommand signal_quality_csq_sequence[] = {
|
||||
static void
|
||||
signal_quality_csq (SignalQualityContext *ctx)
|
||||
{
|
||||
mm_base_modem_at_sequence_in_port (
|
||||
mm_base_modem_at_sequence_full (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
MM_AT_SERIAL_PORT (ctx->port),
|
||||
signal_quality_csq_sequence,
|
||||
@@ -1149,7 +1141,7 @@ signal_quality_cind_ready (MMBroadbandModem *self,
|
||||
static void
|
||||
signal_quality_cind (SignalQualityContext *ctx)
|
||||
{
|
||||
mm_base_modem_at_command_in_port (MM_BASE_MODEM (ctx->self),
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (ctx->self),
|
||||
MM_AT_SERIAL_PORT (ctx->port),
|
||||
"+CIND?",
|
||||
3,
|
||||
@@ -1372,7 +1364,6 @@ modem_3gpp_setup_indicators (MMIfaceModem3gpp *self,
|
||||
"+CIND=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cind_format_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -1555,7 +1546,7 @@ run_unsolicited_events_setup (UnsolicitedEventsContext *ctx)
|
||||
|
||||
/* Enable unsolicited events in given port */
|
||||
if (port) {
|
||||
mm_base_modem_at_command_in_port (MM_BASE_MODEM (ctx->self),
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (ctx->self),
|
||||
port,
|
||||
ctx->command,
|
||||
3,
|
||||
@@ -1699,7 +1690,6 @@ charset_change_ready (MMBroadbandModem *self,
|
||||
"+CSCS?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)current_charset_query_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -1757,7 +1747,6 @@ modem_setup_charset (MMIfaceModem *self,
|
||||
ctx->charset_commands,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)charset_change_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -1831,7 +1820,6 @@ modem_load_supported_charsets (MMIfaceModem *self,
|
||||
"+CSCS=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cscs_format_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -1856,9 +1844,12 @@ modem_setup_flow_control (MMIfaceModem *self,
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
/* By default, try to set XOFF/XON flow control */
|
||||
mm_base_modem_at_command_ignore_reply (MM_BASE_MODEM (self),
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+IFC=1,1",
|
||||
3);
|
||||
3,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -1894,9 +1885,12 @@ modem_power_up (MMIfaceModem *self,
|
||||
if (mm_iface_modem_is_cdma_only (self))
|
||||
mm_dbg ("Skipping Power-up in CDMA-only modem...");
|
||||
else
|
||||
mm_base_modem_at_command_ignore_reply (MM_BASE_MODEM (self),
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CFUN=1",
|
||||
5);
|
||||
5,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -1930,7 +1924,6 @@ modem_command (MMIfaceModem *self,
|
||||
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self), cmd, timeout,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -1976,7 +1969,6 @@ modem_init (MMIfaceModem *self,
|
||||
modem_init_sequence,
|
||||
NULL, /* response_processor_context */
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -2009,7 +2001,6 @@ modem_3gpp_load_imei (MMIfaceModem3gpp *self,
|
||||
"+CGSN",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -2093,7 +2084,6 @@ get_next_facility_lock_status (LoadEnabledFacilityLocksContext *ctx)
|
||||
cmd,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)clck_single_query_ready,
|
||||
ctx);
|
||||
return;
|
||||
@@ -2158,7 +2148,6 @@ modem_3gpp_load_enabled_facility_locks (MMIfaceModem3gpp *self,
|
||||
"+CLCK=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)clck_test_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -2195,7 +2184,6 @@ modem_3gpp_load_operator_code (MMIfaceModem3gpp *self,
|
||||
"+COPS=3,2;+COPS?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -2232,7 +2220,6 @@ modem_3gpp_load_operator_name (MMIfaceModem3gpp *self,
|
||||
"+COPS=3,0;+COPS?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -2411,7 +2398,6 @@ modem_3gpp_scan_networks (MMIfaceModem3gpp *self,
|
||||
"+COPS=?",
|
||||
120,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -2552,7 +2538,7 @@ register_in_3gpp_network_ready (MMBroadbandModem *self,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||
mm_base_modem_at_command_full_finish (MM_BASE_MODEM (self), res, &error);
|
||||
|
||||
if (error) {
|
||||
/* Propagate error in COPS, if any */
|
||||
@@ -2628,8 +2614,12 @@ modem_3gpp_register_in_network (MMIfaceModem3gpp *self,
|
||||
if (command) {
|
||||
/* Don't setup an additional timeout to handle registration timeouts. We
|
||||
* already do this with the 120s timeout in the AT command: if that times
|
||||
* out, we can consider the registration itself timed out. */
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
* out, we can consider the registration itself timed out.
|
||||
*
|
||||
* NOTE that we provide our own Cancellable here; we want to be able to
|
||||
* cancel the operation at any time. */
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (self),
|
||||
mm_base_modem_peek_best_at_port (MM_BASE_MODEM (self), NULL),
|
||||
command,
|
||||
120,
|
||||
FALSE,
|
||||
@@ -2783,7 +2773,6 @@ modem_3gpp_run_cs_registration_check (MMIfaceModem3gpp *self,
|
||||
"+CREG?",
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)registration_status_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -2805,7 +2794,6 @@ modem_3gpp_run_ps_registration_check (MMIfaceModem3gpp *self,
|
||||
"+CGREG?",
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)registration_status_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -2850,7 +2838,7 @@ cleanup_registration_sequence_ready (MMBroadbandModem *self,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||
mm_base_modem_at_command_full_finish (MM_BASE_MODEM (self), res, &error);
|
||||
if (error) {
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
g_simple_async_result_complete (ctx->result);
|
||||
@@ -2865,7 +2853,7 @@ cleanup_registration_sequence_ready (MMBroadbandModem *self,
|
||||
if (secondary) {
|
||||
/* Now use the same registration setup in secondary port, if any */
|
||||
ctx->secondary_done = TRUE;
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
MM_BASE_MODEM (self),
|
||||
secondary,
|
||||
ctx->command,
|
||||
@@ -2912,7 +2900,7 @@ modem_3gpp_cleanup_cs_registration (MMIfaceModem3gpp *self,
|
||||
modem_3gpp_cleanup_cs_registration);
|
||||
ctx->command = g_strdup ("+CREG=0");
|
||||
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
MM_BASE_MODEM (self),
|
||||
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
|
||||
ctx->command,
|
||||
@@ -2937,7 +2925,7 @@ modem_3gpp_cleanup_ps_registration (MMIfaceModem3gpp *self,
|
||||
modem_3gpp_cleanup_cs_registration);
|
||||
ctx->command = g_strdup ("+CGREG=0");
|
||||
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
MM_BASE_MODEM (self),
|
||||
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
|
||||
ctx->command,
|
||||
@@ -3022,7 +3010,7 @@ setup_registration_sequence_ready (MMBroadbandModem *self,
|
||||
GError *error = NULL;
|
||||
|
||||
if (ctx->secondary_done) {
|
||||
mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||
mm_base_modem_at_command_full_finish (MM_BASE_MODEM (self), res, &error);
|
||||
if (error) {
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
g_simple_async_result_complete (ctx->result);
|
||||
@@ -3047,7 +3035,7 @@ setup_registration_sequence_ready (MMBroadbandModem *self,
|
||||
if (secondary) {
|
||||
/* Now use the same registration setup in secondary port, if any */
|
||||
ctx->secondary_done = TRUE;
|
||||
mm_base_modem_at_command_in_port (
|
||||
mm_base_modem_at_command_full (
|
||||
MM_BASE_MODEM (self),
|
||||
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
|
||||
g_variant_get_string (command, NULL),
|
||||
@@ -3079,7 +3067,7 @@ modem_3gpp_setup_cs_registration (MMIfaceModem3gpp *self,
|
||||
callback,
|
||||
user_data,
|
||||
modem_3gpp_setup_cs_registration);
|
||||
mm_base_modem_at_sequence_in_port (
|
||||
mm_base_modem_at_sequence_full (
|
||||
MM_BASE_MODEM (self),
|
||||
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
|
||||
cs_registration_sequence,
|
||||
@@ -3102,7 +3090,7 @@ modem_3gpp_setup_ps_registration (MMIfaceModem3gpp *self,
|
||||
callback,
|
||||
user_data,
|
||||
modem_3gpp_setup_ps_registration);
|
||||
mm_base_modem_at_sequence_in_port (
|
||||
mm_base_modem_at_sequence_full (
|
||||
MM_BASE_MODEM (self),
|
||||
mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
|
||||
ps_registration_sequence,
|
||||
@@ -3159,7 +3147,6 @@ modem_3gpp_ussd_cancel (MMIfaceModem3gppUssd *self,
|
||||
"+CUSD=2",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cancel_command_ready,
|
||||
result);
|
||||
}
|
||||
@@ -3248,7 +3235,6 @@ modem_3gpp_ussd_send (MMIfaceModem3gppUssd *self,
|
||||
at_command,
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)ussd_send_command_ready,
|
||||
result);
|
||||
g_free (at_command);
|
||||
@@ -3592,7 +3578,6 @@ modem_3gpp_ussd_disable_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
|
||||
"+CUSD=0",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)urc_enable_disable_ready,
|
||||
result);
|
||||
}
|
||||
@@ -3613,7 +3598,6 @@ modem_3gpp_ussd_enable_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
|
||||
"+CUSD=1",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)urc_enable_disable_ready,
|
||||
result);
|
||||
}
|
||||
@@ -3666,7 +3650,6 @@ modem_3gpp_ussd_check_support (MMIfaceModem3gppUssd *self,
|
||||
"+CUSD=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cusd_format_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -3732,7 +3715,6 @@ modem_messaging_check_support (MMIfaceModemMessaging *self,
|
||||
"+CNMI=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cnmi_format_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -3838,7 +3820,6 @@ modem_messaging_load_supported_storages (MMIfaceModemMessaging *self,
|
||||
"+CPMS=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cpms_format_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -3894,7 +3875,6 @@ modem_messaging_set_preferred_storages (MMIfaceModemMessaging *self,
|
||||
cmd,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cpms_set_ready,
|
||||
result);
|
||||
g_free (cmd);
|
||||
@@ -3945,7 +3925,6 @@ set_preferred_sms_format (MMBroadbandModem *self,
|
||||
cmd,
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cmgf_set_ready,
|
||||
result);
|
||||
g_free (cmd);
|
||||
@@ -4012,7 +3991,6 @@ modem_messaging_setup_sms_format (MMIfaceModemMessaging *self,
|
||||
"+CMGF=?",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cmgf_format_check_ready,
|
||||
result);
|
||||
}
|
||||
@@ -4133,7 +4111,6 @@ cmti_received (MMAtSerialPort *port,
|
||||
command,
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)sms_part_ready,
|
||||
ctx);
|
||||
g_free (command);
|
||||
@@ -4218,7 +4195,6 @@ modem_messaging_enable_unsolicited_events (MMIfaceModemMessaging *self,
|
||||
"+CNMI=2,1,2,1,0",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -4524,7 +4500,6 @@ list_parts_storage_ready (MMBroadbandModem *self,
|
||||
"+CMGL=\"ALL\""),
|
||||
20,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback) (MM_BROADBAND_MODEM (self)->priv->modem_messaging_sms_pdu_mode ?
|
||||
sms_pdu_part_list_ready :
|
||||
sms_text_part_list_ready),
|
||||
@@ -4587,7 +4562,6 @@ modem_cdma_load_esn (MMIfaceModemCdma *self,
|
||||
"+GSN",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -5055,7 +5029,6 @@ qcdm_cdma_status_ready (MMQcdmSerialPort *port,
|
||||
"+CSS?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)css_query_ready,
|
||||
ctx);
|
||||
return;
|
||||
@@ -5121,7 +5094,6 @@ modem_cdma_get_cdma1x_serving_system (MMIfaceModemCdma *self,
|
||||
"+CSS?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)css_query_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -5191,7 +5163,6 @@ modem_cdma_get_service_status (MMIfaceModemCdma *self,
|
||||
"+CAD?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)cad_query_ready,
|
||||
result);
|
||||
}
|
||||
@@ -5340,7 +5311,6 @@ spservice_ready (MMIfaceModemCdma *self,
|
||||
"$SPERI?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)speri_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -5386,7 +5356,6 @@ modem_cdma_get_detailed_registration_state (MMIfaceModemCdma *self,
|
||||
"+SPSERVICE?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)spservice_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -5522,7 +5491,6 @@ spservice_check_ready (MMIfaceModemCdma *self,
|
||||
"$SPERI?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)speri_check_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -5558,7 +5526,6 @@ modem_cdma_setup_registration_checks (MMIfaceModemCdma *self,
|
||||
"+SPSERVICE?",
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)spservice_check_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -6516,18 +6483,19 @@ initialize_step (InitializeContext *ctx)
|
||||
}
|
||||
ctx->close_port = TRUE;
|
||||
|
||||
/* TODO: This two commands are the only ones not subclassable; should
|
||||
* change that. */
|
||||
|
||||
/* Try to disable echo */
|
||||
mm_base_modem_at_command_in_port_ignore_reply (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (ctx->self),
|
||||
ctx->port,
|
||||
"E0",
|
||||
3);
|
||||
"E0", 3,
|
||||
FALSE, NULL, NULL, NULL);
|
||||
/* Try to get extended errors */
|
||||
mm_base_modem_at_command_in_port_ignore_reply (
|
||||
MM_BASE_MODEM (ctx->self),
|
||||
mm_base_modem_at_command_full (MM_BASE_MODEM (ctx->self),
|
||||
ctx->port,
|
||||
"+CMEE=1",
|
||||
3);
|
||||
"+CMEE=1", 3,
|
||||
FALSE, NULL, NULL, NULL);
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
}
|
||||
|
@@ -130,7 +130,6 @@ change_pin (MMSim *self,
|
||||
command,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)change_pin_ready,
|
||||
result);
|
||||
g_free (command);
|
||||
@@ -299,7 +298,6 @@ enable_pin (MMSim *self,
|
||||
command,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)enable_pin_ready,
|
||||
result);
|
||||
g_free (command);
|
||||
@@ -470,7 +468,6 @@ common_send_pin_puk (MMSim *self,
|
||||
command,
|
||||
3,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)send_pin_puk_ready,
|
||||
result);
|
||||
g_free (command);
|
||||
@@ -1068,7 +1065,6 @@ load_sim_identifier (MMSim *self,
|
||||
"+CRSM=176,12258,0,0,10",
|
||||
20,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)load_sim_identifier_command_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -1108,7 +1104,6 @@ load_imsi (MMSim *self,
|
||||
"+CIMI",
|
||||
3,
|
||||
TRUE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)load_imsi_command_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -1246,7 +1241,6 @@ load_operator_identifier (MMSim *self,
|
||||
"+CRSM=176,28589,0,0,4",
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)load_operator_identifier_command_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -1358,7 +1352,6 @@ load_operator_name (MMSim *self,
|
||||
"+CRSM=176,28486,0,0,17",
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)load_operator_name_command_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
|
@@ -568,7 +568,6 @@ sms_store (MMSms *self,
|
||||
cmd,
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback) store_ready,
|
||||
ctx);
|
||||
g_free (cmd);
|
||||
@@ -645,7 +644,6 @@ sms_send_generic (SmsSendContext *ctx)
|
||||
cmd,
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)send_generic_ready,
|
||||
ctx);
|
||||
g_free (cmd);
|
||||
@@ -683,7 +681,6 @@ sms_send_from_storage (SmsSendContext *ctx)
|
||||
cmd,
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)send_from_storage_ready,
|
||||
ctx);
|
||||
g_free (cmd);
|
||||
@@ -814,7 +811,6 @@ delete_next_part (SmsDeletePartsContext *ctx)
|
||||
cmd,
|
||||
10,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)delete_part_ready,
|
||||
ctx);
|
||||
g_free (cmd);
|
||||
|
Reference in New Issue
Block a user