longcheer: implement access technology loading

This commit is contained in:
Aleksander Morgado
2012-07-11 16:45:56 +02:00
parent 1f9c3ef61e
commit f5d7605def

View File

@@ -27,9 +27,50 @@
#include "mm-log.h" #include "mm-log.h"
#include "mm-errors-types.h" #include "mm-errors-types.h"
#include "mm-base-modem-at.h" #include "mm-base-modem-at.h"
#include "mm-iface-modem.h"
#include "mm-modem-helpers.h"
#include "mm-broadband-modem-longcheer.h" #include "mm-broadband-modem-longcheer.h"
G_DEFINE_TYPE (MMBroadbandModemLongcheer, mm_broadband_modem_longcheer, MM_TYPE_BROADBAND_MODEM); static void iface_modem_init (MMIfaceModem *iface);
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemLongcheer, mm_broadband_modem_longcheer, MM_TYPE_BROADBAND_MODEM, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init));
/*****************************************************************************/
/* Load access technologies (Modem interface) */
static gboolean
load_access_technologies_finish (MMIfaceModem *self,
GAsyncResult *res,
MMModemAccessTechnology *access_technologies,
guint *mask,
GError **error)
{
const gchar *result;
result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
if (!result)
return FALSE;
result = mm_strip_tag (result, "+PSRAT:");
*access_technologies = mm_string_to_access_tech (result);
*mask = MM_MODEM_ACCESS_TECHNOLOGY_ANY;
return TRUE;
}
static void
load_access_technologies (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
mm_dbg ("loading access technology (longcheer)...");
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+PSRAT",
3,
FALSE,
callback,
user_data);
}
/*****************************************************************************/ /*****************************************************************************/
@@ -54,6 +95,13 @@ mm_broadband_modem_longcheer_init (MMBroadbandModemLongcheer *self)
{ {
} }
static void
iface_modem_init (MMIfaceModem *iface)
{
iface->load_access_technologies = load_access_technologies;
iface->load_access_technologies_finish = load_access_technologies_finish;
}
static void static void
mm_broadband_modem_longcheer_class_init (MMBroadbandModemLongcheerClass *klass) mm_broadband_modem_longcheer_class_init (MMBroadbandModemLongcheerClass *klass)
{ {