broadband-modem: implement the Signal interface
Provide a generic +CESQ based implementation for the extended Signal interface, applicable to all AT-based modems. We explicitly disable this check in MBIM modems.
This commit is contained in:
@@ -36,20 +36,23 @@
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-iface-modem-messaging.h"
|
||||
#include "mm-iface-modem-signal.h"
|
||||
#include "mm-sms-part-3gpp.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
# include <libqmi-glib.h>
|
||||
#endif
|
||||
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
|
||||
static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
|
||||
static void iface_modem_signal_init (MMIfaceModemSignal *iface);
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbim, mm_broadband_modem_mbim, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init))
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_SIGNAL, iface_modem_signal_init))
|
||||
|
||||
typedef enum {
|
||||
PROCESS_NOTIFICATION_FLAG_NONE = 0,
|
||||
@@ -3306,6 +3309,15 @@ iface_modem_messaging_init (MMIfaceModemMessaging *iface)
|
||||
iface->create_sms = messaging_create_sms;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_signal_init (MMIfaceModemSignal *iface)
|
||||
{
|
||||
iface->check_support = NULL;
|
||||
iface->check_support_finish = NULL;
|
||||
iface->load_values = NULL;
|
||||
iface->load_values_finish = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_mbim_class_init (MMBroadbandModemMbimClass *klass)
|
||||
{
|
||||
|
@@ -8261,6 +8261,71 @@ modem_time_check_support (MMIfaceModemTime *self,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Check support (Signal interface) */
|
||||
|
||||
static gboolean
|
||||
modem_signal_check_support_finish (MMIfaceModemSignal *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return !!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
modem_signal_check_support (MMIfaceModemSignal *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CESQ=?",
|
||||
3,
|
||||
TRUE,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Load extended signal information (Signal interface) */
|
||||
|
||||
static gboolean
|
||||
modem_signal_load_values_finish (MMIfaceModemSignal *self,
|
||||
GAsyncResult *res,
|
||||
MMSignal **cdma,
|
||||
MMSignal **evdo,
|
||||
MMSignal **gsm,
|
||||
MMSignal **umts,
|
||||
MMSignal **lte,
|
||||
GError **error)
|
||||
{
|
||||
const gchar *response;
|
||||
|
||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
|
||||
if (!response || !mm_3gpp_cesq_response_to_signal_info (response, gsm, umts, lte, error))
|
||||
return FALSE;
|
||||
|
||||
/* No 3GPP2 support */
|
||||
if (cdma)
|
||||
*cdma = NULL;
|
||||
if (evdo)
|
||||
*evdo = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
modem_signal_load_values (MMIfaceModemSignal *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CESQ",
|
||||
3,
|
||||
TRUE,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const gchar *primary_init_sequence[] = {
|
||||
@@ -10830,6 +10895,10 @@ iface_modem_time_init (MMIfaceModemTime *iface)
|
||||
static void
|
||||
iface_modem_signal_init (MMIfaceModemSignal *iface)
|
||||
{
|
||||
iface->check_support = modem_signal_check_support;
|
||||
iface->check_support_finish = modem_signal_check_support_finish;
|
||||
iface->load_values = modem_signal_load_values;
|
||||
iface->load_values_finish = modem_signal_load_values_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user