aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem-at.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2024-04-04 11:22:31 +0000
committerAleksander Morgado <aleksander@aleksander.es>2024-04-23 07:25:12 +0000
commit480e12c34e574e6c282f76344eda05dbfaa66515 (patch)
tree399d026f414a6676fd50b2442bf346b3fac4c5a2 /src/mm-base-modem-at.c
parent67a0af35757a60607b925d52232348be2b11f2f1 (diff)
base-modem-at: switch to use the MMIfacePortAt by default
The whole codebase is updated to assume the MMBaseModem AT operations require an object implementing the MMIfacePortAt interface, instead of a MMPortSerialAt object. In the places where we know the port is a MMPortSerialAt, e.g. when we query explicitly for the primary or secondary serial AT port, we will use an explicit MM_IFACE_PORT_AT() cast when calling the AT command method. In the places where we get_best_at_port() we're going to assume that we don't know the port type. This method will be updated in a follow up commit to support the MMIfacePortAt interface as well.
Diffstat (limited to 'src/mm-base-modem-at.c')
-rw-r--r--src/mm-base-modem-at.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mm-base-modem-at.c b/src/mm-base-modem-at.c
index 0c5cda26..db7eaaa7 100644
--- a/src/mm-base-modem-at.c
+++ b/src/mm-base-modem-at.c
@@ -21,7 +21,6 @@
#include "mm-base-modem-at.h"
#include "mm-errors-types.h"
-#include "mm-iface-port-at.h"
/*****************************************************************************/
/* Port setup/teardown logic, to prepare a port to be able to run an
@@ -255,7 +254,7 @@ at_sequence_parse_response (MMIfacePortAt *port,
void
mm_base_modem_at_sequence_full (MMBaseModem *self,
- MMPortSerialAt *port,
+ MMIfacePortAt *port,
const MMBaseModemAtCommand *sequence,
gpointer response_processor_context,
GDestroyNotify response_processor_context_free,
@@ -276,12 +275,12 @@ mm_base_modem_at_sequence_full (MMBaseModem *self,
task = g_task_new (self, task_cancellable, callback, user_data);
/* Ensure that we have the port ready */
- if (!setup_port (MM_IFACE_PORT_AT (port), task))
+ if (!setup_port (port, task))
return;
/* Setup context */
ctx = g_slice_new0 (AtSequenceContext);
- ctx->port = MM_IFACE_PORT_AT (g_object_ref (port));
+ ctx->port = g_object_ref (port);
ctx->current = ctx->sequence = sequence;
ctx->response_processor_context = response_processor_context;
ctx->response_processor_context_free = response_processor_context_free;
@@ -320,11 +319,11 @@ mm_base_modem_at_sequence (MMBaseModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- MMPortSerialAt *port;
- GError *error = NULL;
+ MMIfacePortAt *port;
+ GError *error = NULL;
/* No port given, so we'll try to guess which is best */
- port = mm_base_modem_peek_best_at_port (self, &error);
+ port = MM_IFACE_PORT_AT (mm_base_modem_peek_best_at_port (self, &error));
if (!port) {
g_task_report_error (self, callback, user_data, mm_base_modem_at_sequence, error);
return;
@@ -534,7 +533,7 @@ at_command_ready (MMIfacePortAt *port,
void
mm_base_modem_at_command_full (MMBaseModem *self,
- MMPortSerialAt *port,
+ MMIfacePortAt *port,
const gchar *command,
guint timeout,
gboolean allow_cached,
@@ -556,11 +555,11 @@ mm_base_modem_at_command_full (MMBaseModem *self,
task = g_task_new (self, task_cancellable, callback, user_data);
/* Ensure that we have the port ready */
- if (!setup_port (MM_IFACE_PORT_AT (port), task))
+ if (!setup_port (port, task))
return;
ctx = g_slice_new0 (AtCommandContext);
- ctx->port = MM_IFACE_PORT_AT (g_object_ref (port));
+ ctx->port = g_object_ref (port);
/* Ensure the user-provided cancellable will also get cancelled if the modem
* wide-one gets cancelled */
@@ -596,11 +595,11 @@ mm_base_modem_at_command (MMBaseModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- MMPortSerialAt *port;
- GError *error = NULL;
+ MMIfacePortAt *port;
+ GError *error = NULL;
/* No port given, so we'll try to guess which is best */
- port = mm_base_modem_peek_best_at_port (self, &error);
+ port = MM_IFACE_PORT_AT (mm_base_modem_peek_best_at_port (self, &error));
if (!port) {
g_task_report_error (self, callback, user_data, mm_base_modem_at_command, error);
return;