libmm-glib: handle the new 'Signal' interface
This commit is contained in:
@@ -110,6 +110,10 @@
|
||||
<xi:include href="xml/mm-modem-firmware.xml"/>
|
||||
<xi:include href="xml/mm-firmware-properties.xml"/>
|
||||
</section>
|
||||
<section>
|
||||
<title>Extended signal information</title>
|
||||
<xi:include href="xml/mm-modem-signal.xml"/>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
<chapter>
|
||||
@@ -175,6 +179,10 @@
|
||||
<xi:include href="xml/MmGdbusModemFirmwareProxy.xml"/>
|
||||
<xi:include href="xml/MmGdbusModemFirmwareSkeleton.xml"/>
|
||||
|
||||
<xi:include href="xml/MmGdbusModemSignal.xml"/>
|
||||
<xi:include href="xml/MmGdbusModemSignalProxy.xml"/>
|
||||
<xi:include href="xml/MmGdbusModemSignalSkeleton.xml"/>
|
||||
|
||||
<!--xi:include href="xml/MmGdbusModemContacts.xml"/>
|
||||
<xi:include href="xml/MmGdbusModemContactsProxy.xml"/>
|
||||
<xi:include href="xml/MmGdbusModemContactsSkeleton.xml"/-->
|
||||
|
@@ -58,6 +58,8 @@ mm_object_peek_modem_firmware
|
||||
mm_object_get_modem_firmware
|
||||
mm_object_peek_modem_simple
|
||||
mm_object_get_modem_simple
|
||||
mm_object_peek_modem_signal
|
||||
mm_object_get_modem_signal
|
||||
<SUBSECTION Standard>
|
||||
MMObjectClass
|
||||
MM_IS_OBJECT
|
||||
@@ -761,6 +763,42 @@ MM_TYPE_SIMPLE_STATUS
|
||||
mm_simple_status_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>mm-modem-signal</FILE>
|
||||
<TITLE>MMModemSignal</TITLE>
|
||||
MMModemSignal
|
||||
<SUBSECTION Getters>
|
||||
mm_modem_signal_get_path
|
||||
mm_modem_signal_dup_path
|
||||
mm_modem_signal_get_rate
|
||||
mm_modem_signal_get_cdma_rssi
|
||||
mm_modem_signal_get_cdma_ecio
|
||||
mm_modem_signal_get_evdo_rssi
|
||||
mm_modem_signal_get_evdo_ecio
|
||||
mm_modem_signal_get_evdo_sinr
|
||||
mm_modem_signal_get_evdo_io
|
||||
mm_modem_signal_get_gsm_rssi
|
||||
mm_modem_signal_get_umts_rssi
|
||||
mm_modem_signal_get_umts_ecio
|
||||
mm_modem_signal_get_lte_rssi
|
||||
mm_modem_signal_get_lte_rsrq
|
||||
mm_modem_signal_get_lte_rsrp
|
||||
mm_modem_signal_get_lte_snr
|
||||
<SUBSECTION Methods>
|
||||
mm_modem_signal_setup
|
||||
mm_modem_signal_setup_finish
|
||||
mm_modem_signal_setup_sync
|
||||
<SUBSECTION Standard>
|
||||
MMModemSignalClass
|
||||
MM_IS_MODEM_SIGNAL
|
||||
MM_IS_MODEM_SIGNAL_CLASS
|
||||
MM_MODEM_SIGNAL
|
||||
MM_MODEM_SIGNAL_CLASS
|
||||
MM_MODEM_SIGNAL_GET_CLASS
|
||||
MM_TYPE_MODEM_SIGNAL
|
||||
mm_modem_signal_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>mm-bearer</FILE>
|
||||
<TITLE>MMBearer</TITLE>
|
||||
@@ -2087,6 +2125,109 @@ MmGdbusModemSimpleSkeletonPrivate
|
||||
mm_gdbus_modem_simple_skeleton_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>MmGdbusModemSignal</FILE>
|
||||
<TITLE>MmGdbusModemSignal</TITLE>
|
||||
MmGdbusModemSignal
|
||||
MmGdbusModemSignalIface
|
||||
<SUBSECTION Getters>
|
||||
mm_gdbus_modem_signal_get_cdma_ecio
|
||||
mm_gdbus_modem_signal_get_cdma_rssi
|
||||
mm_gdbus_modem_signal_get_evdo_ecio
|
||||
mm_gdbus_modem_signal_get_evdo_io
|
||||
mm_gdbus_modem_signal_get_evdo_rssi
|
||||
mm_gdbus_modem_signal_get_evdo_sinr
|
||||
mm_gdbus_modem_signal_get_gsm_rssi
|
||||
mm_gdbus_modem_signal_get_lte_rsrp
|
||||
mm_gdbus_modem_signal_get_lte_rsrq
|
||||
mm_gdbus_modem_signal_get_lte_rssi
|
||||
mm_gdbus_modem_signal_get_lte_snr
|
||||
mm_gdbus_modem_signal_get_rate
|
||||
mm_gdbus_modem_signal_get_umts_ecio
|
||||
mm_gdbus_modem_signal_get_umts_rssi
|
||||
mm_gdbus_modem_signal_dup_cdma_ecio
|
||||
mm_gdbus_modem_signal_dup_cdma_rssi
|
||||
mm_gdbus_modem_signal_dup_evdo_ecio
|
||||
mm_gdbus_modem_signal_dup_evdo_io
|
||||
mm_gdbus_modem_signal_dup_evdo_rssi
|
||||
mm_gdbus_modem_signal_dup_evdo_sinr
|
||||
mm_gdbus_modem_signal_dup_gsm_rssi
|
||||
mm_gdbus_modem_signal_dup_lte_rsrp
|
||||
mm_gdbus_modem_signal_dup_lte_rsrq
|
||||
mm_gdbus_modem_signal_dup_lte_rssi
|
||||
mm_gdbus_modem_signal_dup_lte_snr
|
||||
mm_gdbus_modem_signal_dup_umts_ecio
|
||||
mm_gdbus_modem_signal_dup_umts_rssi
|
||||
<SUBSECTION Methods>
|
||||
mm_gdbus_modem_signal_call_setup
|
||||
mm_gdbus_modem_signal_call_setup_finish
|
||||
mm_gdbus_modem_signal_call_setup_sync
|
||||
<SUBSECTION Private>
|
||||
mm_gdbus_modem_signal_set_cdma_ecio
|
||||
mm_gdbus_modem_signal_set_cdma_rssi
|
||||
mm_gdbus_modem_signal_set_evdo_ecio
|
||||
mm_gdbus_modem_signal_set_evdo_io
|
||||
mm_gdbus_modem_signal_set_evdo_rssi
|
||||
mm_gdbus_modem_signal_set_evdo_sinr
|
||||
mm_gdbus_modem_signal_set_gsm_rssi
|
||||
mm_gdbus_modem_signal_set_lte_rsrp
|
||||
mm_gdbus_modem_signal_set_lte_rsrq
|
||||
mm_gdbus_modem_signal_set_lte_rssi
|
||||
mm_gdbus_modem_signal_set_lte_snr
|
||||
mm_gdbus_modem_signal_set_rate
|
||||
mm_gdbus_modem_signal_set_umts_ecio
|
||||
mm_gdbus_modem_signal_set_umts_rssi
|
||||
mm_gdbus_modem_signal_complete_setup
|
||||
mm_gdbus_modem_signal_interface_info
|
||||
mm_gdbus_modem_signal_override_properties
|
||||
<SUBSECTION Standard>
|
||||
MM_GDBUS_IS_MODEM_SIGNAL
|
||||
MM_GDBUS_MODEM_SIGNAL
|
||||
MM_GDBUS_MODEM_SIGNAL_GET_IFACE
|
||||
MM_GDBUS_TYPE_MODEM_SIGNAL
|
||||
mm_gdbus_modem_signal_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>MmGdbusModemSignalProxy</FILE>
|
||||
<TITLE>MmGdbusModemSignalProxy</TITLE>
|
||||
MmGdbusModemSignalProxy
|
||||
<SUBSECTION New>
|
||||
mm_gdbus_modem_signal_proxy_new
|
||||
mm_gdbus_modem_signal_proxy_new_finish
|
||||
mm_gdbus_modem_signal_proxy_new_for_bus
|
||||
mm_gdbus_modem_signal_proxy_new_for_bus_finish
|
||||
mm_gdbus_modem_signal_proxy_new_for_bus_sync
|
||||
mm_gdbus_modem_signal_proxy_new_sync
|
||||
<SUBSECTION Standard>
|
||||
MmGdbusModemSignalProxyClass
|
||||
MM_GDBUS_IS_MODEM_SIGNAL_PROXY
|
||||
MM_GDBUS_IS_MODEM_SIGNAL_PROXY_CLASS
|
||||
MM_GDBUS_MODEM_SIGNAL_PROXY
|
||||
MM_GDBUS_MODEM_SIGNAL_PROXY_CLASS
|
||||
MM_GDBUS_MODEM_SIGNAL_PROXY_GET_CLASS
|
||||
MM_GDBUS_TYPE_MODEM_SIGNAL_PROXY
|
||||
MmGdbusModemSignalProxyPrivate
|
||||
mm_gdbus_modem_signal_proxy_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>MmGdbusModemSignalSkeleton</FILE>
|
||||
<TITLE>MmGdbusModemSignalSkeleton</TITLE>
|
||||
MmGdbusModemSignalSkeleton
|
||||
<SUBSECTION New>
|
||||
mm_gdbus_modem_signal_skeleton_new
|
||||
<SUBSECTION Standard>
|
||||
MmGdbusModemSignalSkeletonClass
|
||||
MM_GDBUS_IS_MODEM_SIGNAL_SKELETON
|
||||
MM_GDBUS_IS_MODEM_SIGNAL_SKELETON_CLASS
|
||||
MM_GDBUS_MODEM_SIGNAL_SKELETON
|
||||
MM_GDBUS_MODEM_SIGNAL_SKELETON_CLASS
|
||||
MM_GDBUS_MODEM_SIGNAL_SKELETON_GET_CLASS
|
||||
MM_GDBUS_TYPE_MODEM_SIGNAL_SKELETON
|
||||
MmGdbusModemSignalSkeletonPrivate
|
||||
mm_gdbus_modem_signal_skeleton_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>MmGdbusObject</FILE>
|
||||
@@ -2112,6 +2253,8 @@ mm_gdbus_object_peek_modem_firmware
|
||||
mm_gdbus_object_get_modem_firmware
|
||||
mm_gdbus_object_peek_modem_simple
|
||||
mm_gdbus_object_get_modem_simple
|
||||
mm_gdbus_object_peek_modem_signal
|
||||
mm_gdbus_object_get_modem_signal
|
||||
<SUBSECTION Methods>
|
||||
<SUBSECTION Private>
|
||||
<SUBSECTION Standard>
|
||||
@@ -2156,6 +2299,7 @@ mm_gdbus_object_skeleton_set_modem_location
|
||||
mm_gdbus_object_skeleton_set_modem_messaging
|
||||
mm_gdbus_object_skeleton_set_modem_simple
|
||||
mm_gdbus_object_skeleton_set_modem_time
|
||||
mm_gdbus_object_skeleton_set_modem_signal
|
||||
<SUBSECTION Standard>
|
||||
MmGdbusObjectSkeletonClass
|
||||
MM_GDBUS_IS_OBJECT_SKELETON
|
||||
|
@@ -33,6 +33,9 @@ mm_gdbus_modem_messaging_get_type
|
||||
mm_gdbus_modem_messaging_proxy_get_type
|
||||
mm_gdbus_modem_messaging_skeleton_get_type
|
||||
mm_gdbus_modem_proxy_get_type
|
||||
mm_gdbus_modem_signal_get_type
|
||||
mm_gdbus_modem_signal_proxy_get_type
|
||||
mm_gdbus_modem_signal_skeleton_get_type
|
||||
mm_gdbus_modem_simple_get_type
|
||||
mm_gdbus_modem_simple_proxy_get_type
|
||||
mm_gdbus_modem_simple_skeleton_get_type
|
||||
@@ -83,6 +86,7 @@ mm_modem_messaging_get_type
|
||||
mm_modem_mode_get_type
|
||||
mm_modem_port_type_get_type
|
||||
mm_modem_power_state_get_type
|
||||
mm_modem_signal_get_type
|
||||
mm_modem_simple_get_type
|
||||
mm_modem_state_change_reason_get_type
|
||||
mm_modem_state_failed_reason_get_type
|
||||
|
@@ -27,6 +27,8 @@ libmm_glib_la_SOURCES = \
|
||||
mm-modem-time.c \
|
||||
mm-modem-firmware.h \
|
||||
mm-modem-firmware.c \
|
||||
mm-modem-signal.h \
|
||||
mm-modem-signal.c \
|
||||
mm-sim.h \
|
||||
mm-sim.c \
|
||||
mm-sms.h \
|
||||
|
@@ -43,6 +43,7 @@
|
||||
# include <mm-modem-messaging.h>
|
||||
# include <mm-modem-time.h>
|
||||
# include <mm-modem-firmware.h>
|
||||
# include <mm-modem-signal.h>
|
||||
#endif
|
||||
|
||||
#if defined (_LIBMM_INSIDE_MM) || \
|
||||
|
@@ -70,6 +70,7 @@ get_proxy_type (GDBusObjectManagerClient *manager,
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.Messaging", GSIZE_TO_POINTER (MM_TYPE_MODEM_MESSAGING));
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.Location", GSIZE_TO_POINTER (MM_TYPE_MODEM_LOCATION));
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.Time", GSIZE_TO_POINTER (MM_TYPE_MODEM_TIME));
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.Signal", GSIZE_TO_POINTER (MM_TYPE_MODEM_SIGNAL));
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.Firmware", GSIZE_TO_POINTER (MM_TYPE_MODEM_FIRMWARE));
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.ModemCdma", GSIZE_TO_POINTER (MM_TYPE_MODEM_CDMA));
|
||||
g_hash_table_insert (lookup_hash, "org.freedesktop.ModemManager1.Modem.Modem3gpp", GSIZE_TO_POINTER (MM_TYPE_MODEM_3GPP));
|
||||
|
356
libmm-glib/mm-modem-signal.c
Normal file
356
libmm-glib/mm-modem-signal.c
Normal file
@@ -0,0 +1,356 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* libmm -- Access modem status & information from glib applications
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2012 Google, Inc.
|
||||
* Copyright (C) 2012 Lanedo GmbH <aleksander@lanedo.com>
|
||||
*/
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "mm-helpers.h"
|
||||
#include "mm-errors-types.h"
|
||||
#include "mm-modem-signal.h"
|
||||
|
||||
/**
|
||||
* SECTION: mm-modem-signal
|
||||
* @title: MMModemSignal
|
||||
* @short_description: The extended Signal interface
|
||||
*
|
||||
* The #MMModemSignal is an object providing access to the methods, signals and
|
||||
* properties of the Signal interface.
|
||||
*
|
||||
* The Signal interface is exposed whenever a modem has extended signal retrieval
|
||||
* capabilities.
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (MMModemSignal, mm_modem_signal, MM_GDBUS_TYPE_MODEM_SIGNAL_PROXY)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_signal_get_path:
|
||||
* @self: A #MMModemSignal.
|
||||
*
|
||||
* Gets the DBus path of the #MMObject which implements this interface.
|
||||
*
|
||||
* Returns: (transfer none): The DBus path of the #MMObject object.
|
||||
*/
|
||||
const gchar *
|
||||
mm_modem_signal_get_path (MMModemSignal *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM_SIGNAL (self), NULL);
|
||||
|
||||
RETURN_NON_EMPTY_CONSTANT_STRING (
|
||||
g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)));
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_signal_dup_path:
|
||||
* @self: A #MMModemSignal.
|
||||
*
|
||||
* Gets a copy of the DBus path of the #MMObject object which implements this interface.
|
||||
*
|
||||
* Returns: (transfer full): The DBus path of the #MMObject. The returned value should be freed with g_free().
|
||||
*/
|
||||
gchar *
|
||||
mm_modem_signal_dup_path (MMModemSignal *self)
|
||||
{
|
||||
gchar *value;
|
||||
|
||||
g_return_val_if_fail (MM_IS_MODEM_SIGNAL (self), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (self),
|
||||
"g-object-path", &value,
|
||||
NULL);
|
||||
RETURN_NON_EMPTY_STRING (value);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_signal_setup_finish:
|
||||
* @self: A #MMModemSignal.
|
||||
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_signal_setup().
|
||||
* @error: Return location for error or %NULL.
|
||||
*
|
||||
* Finishes an operation started with mm_modem_signal_setup().
|
||||
*
|
||||
* Returns: %TRUE if the setup was successful, %FALSE if @error is set.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_signal_setup_finish (MMModemSignal *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM_SIGNAL (self), FALSE);
|
||||
|
||||
return mm_gdbus_modem_signal_call_setup_finish (MM_GDBUS_MODEM_SIGNAL (self), res, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_signal_setup:
|
||||
* @self: A #MMModemSignal.
|
||||
* @rate: Rate to use when refreshing signal values.
|
||||
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
||||
* @user_data: User data to pass to @callback.
|
||||
*
|
||||
* Asynchronously setups the extended signal quality retrieval.
|
||||
*
|
||||
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
|
||||
* You can then call mm_modem_signal_setup_finish() to get the result of the operation.
|
||||
*
|
||||
* See mm_modem_signal_setup_sync() for the synchronous, blocking version of this method.
|
||||
*/
|
||||
void
|
||||
mm_modem_signal_setup (MMModemSignal *self,
|
||||
guint rate,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_SIGNAL (self));
|
||||
|
||||
mm_gdbus_modem_signal_call_setup (MM_GDBUS_MODEM_SIGNAL (self), rate, cancellable, callback, user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_signal_setup_sync:
|
||||
* @self: A #MMModemSignal.
|
||||
* @rate: Rate to use when refreshing signal values.
|
||||
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
||||
* @error: Return location for error or %NULL.
|
||||
*
|
||||
* Synchronously setups the extended signal quality retrieval.
|
||||
*
|
||||
* The calling thread is blocked until a reply is received. See mm_modem_signal_setup()
|
||||
* for the asynchronous version of this method.
|
||||
*
|
||||
* Returns: %TRUE if the setup was successful, %FALSE if @error is set.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_signal_setup_sync (MMModemSignal *self,
|
||||
guint rate,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM_SIGNAL (self), FALSE);
|
||||
|
||||
return mm_gdbus_modem_signal_call_setup_sync (MM_GDBUS_MODEM_SIGNAL (self), rate, cancellable, error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_get_rate:
|
||||
* @self: A #MMModemSignal.
|
||||
*
|
||||
* Gets the currently configured refresh rate.
|
||||
*
|
||||
* Returns: the refresh rate, in seconds.
|
||||
*/
|
||||
guint
|
||||
mm_modem_signal_get_rate (MMModemSignal *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM_SIGNAL (self), 0);
|
||||
|
||||
return mm_gdbus_modem_signal_get_rate (MM_GDBUS_MODEM_SIGNAL (self));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define GETTER(VALUE) \
|
||||
gboolean \
|
||||
mm_modem_signal_get_##VALUE (MMModemSignal *self, \
|
||||
gdouble *value) \
|
||||
{ \
|
||||
GVariant *variant; \
|
||||
gboolean is_valid = FALSE; \
|
||||
double val = 0.0; \
|
||||
\
|
||||
g_return_val_if_fail (MM_IS_MODEM_SIGNAL (self), FALSE); \
|
||||
\
|
||||
variant = mm_gdbus_modem_signal_dup_##VALUE (MM_GDBUS_MODEM_SIGNAL (self)); \
|
||||
if (variant) { \
|
||||
g_variant_get (variant, \
|
||||
"(bd)", \
|
||||
&is_valid, \
|
||||
&val); \
|
||||
g_variant_unref (variant); \
|
||||
} \
|
||||
\
|
||||
if (is_valid) \
|
||||
*value = val; \
|
||||
return is_valid; \
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_get_cdma_rssi:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the CDMA1x RSSI (Received Signal Strength Indication), in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(cdma_rssi)
|
||||
|
||||
/**
|
||||
* mm_modem_get_cdma_ecio:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the CDMA1x Ec/Io, in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(cdma_ecio)
|
||||
|
||||
/**
|
||||
* mm_modem_get_evdo_rssi:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the CDMA EV-DO RSSI (Received Signal Strength Indication), in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(evdo_rssi)
|
||||
|
||||
/**
|
||||
* mm_modem_get_evdo_ecio:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the CDMA EV-DO Ec/Io, in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(evdo_ecio)
|
||||
|
||||
/**
|
||||
* mm_modem_get_evdo_sinr:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the CDMA EV-DO SINR level, in dB.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(evdo_sinr)
|
||||
|
||||
/**
|
||||
* mm_modem_get_evdo_io:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the CDMA EV-DO IO, in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(evdo_io)
|
||||
|
||||
/**
|
||||
* mm_modem_get_gsm_rssi:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the GSM RSSI (Received Signal Strength Indication), in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(gsm_rssi)
|
||||
|
||||
/**
|
||||
* mm_modem_get_umts_rssi:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the UMTS (WCDMA) RSSI (Received Signal Strength Indication), in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(umts_rssi)
|
||||
|
||||
/**
|
||||
* mm_modem_get_umts_ecio:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the UMTS (WCDMA) Ec/Io, in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(umts_ecio)
|
||||
|
||||
/**
|
||||
* mm_modem_get_lte_rssi:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the LTE RSSI (Received Signal Strength Indication), in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(lte_rssi)
|
||||
|
||||
/**
|
||||
* mm_modem_get_lte_rsrq:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the LTE RSRQ (Reference Signal Received Quality), in dB.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(lte_rsrq)
|
||||
|
||||
/**
|
||||
* mm_modem_get_lte_rsrp:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the LTE RSRP (Reference Signal Received Power), in dBm.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(lte_rsrp)
|
||||
|
||||
/**
|
||||
* mm_modem_get_lte_snr:
|
||||
* @self: A #MMModemSignal.
|
||||
* @value: (out): Return location for the value.
|
||||
*
|
||||
* Gets the LTE S/R ratio, in dB.
|
||||
*
|
||||
* Returns: %TRUE if @value is valid, %FALSE otherwise.
|
||||
*/
|
||||
GETTER(lte_snr)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_modem_signal_init (MMModemSignal *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_modem_signal_class_init (MMModemSignalClass *modem_class)
|
||||
{
|
||||
}
|
120
libmm-glib/mm-modem-signal.h
Normal file
120
libmm-glib/mm-modem-signal.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* libmm -- Access modem status & information from glib applications
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2013 Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#ifndef _MM_MODEM_SIGNAL_H_
|
||||
#define _MM_MODEM_SIGNAL_H_
|
||||
|
||||
#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION)
|
||||
#error "Only <libmm-glib.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <ModemManager.h>
|
||||
|
||||
#include "mm-gdbus-modem.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define MM_TYPE_MODEM_SIGNAL (mm_modem_signal_get_type ())
|
||||
#define MM_MODEM_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_SIGNAL, MMModemSignal))
|
||||
#define MM_MODEM_SIGNAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MODEM_SIGNAL, MMModemSignalClass))
|
||||
#define MM_IS_MODEM_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_SIGNAL))
|
||||
#define MM_IS_MODEM_SIGNAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MM_TYPE_MODEM_SIGNAL))
|
||||
#define MM_MODEM_SIGNAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MODEM_SIGNAL, MMModemSignalClass))
|
||||
|
||||
typedef struct _MMModemSignal MMModemSignal;
|
||||
typedef struct _MMModemSignalClass MMModemSignalClass;
|
||||
|
||||
/**
|
||||
* MMModemSignal:
|
||||
*
|
||||
* The #MMModemSignal structure contains private data and should only be accessed
|
||||
* using the provided API.
|
||||
*/
|
||||
struct _MMModemSignal {
|
||||
/*< private >*/
|
||||
MmGdbusModemSignalProxy parent;
|
||||
gpointer unused;
|
||||
};
|
||||
|
||||
struct _MMModemSignalClass {
|
||||
/*< private >*/
|
||||
MmGdbusModemSignalProxyClass parent;
|
||||
};
|
||||
|
||||
GType mm_modem_signal_get_type (void);
|
||||
|
||||
const gchar *mm_modem_signal_get_path (MMModemSignal *self);
|
||||
gchar *mm_modem_signal_dup_path (MMModemSignal *self);
|
||||
guint mm_modem_signal_get_rate (MMModemSignal *self);
|
||||
|
||||
void mm_modem_signal_setup (MMModemSignal *self,
|
||||
guint rate,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_modem_signal_setup_finish (MMModemSignal *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
gboolean mm_modem_signal_setup_sync (MMModemSignal *self,
|
||||
guint rate,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
/* CDMA1x */
|
||||
gboolean mm_modem_signal_get_cdma_rssi (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_cdma_ecio (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
|
||||
/* EV-DO */
|
||||
gboolean mm_modem_signal_get_evdo_rssi (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_evdo_ecio (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_evdo_sinr (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_evdo_io (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
|
||||
/* GSM */
|
||||
gboolean mm_modem_signal_get_gsm_rssi (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
|
||||
/* UMTS */
|
||||
gboolean mm_modem_signal_get_umts_rssi (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_umts_ecio (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
|
||||
/* LTE */
|
||||
gboolean mm_modem_signal_get_lte_rssi (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_lte_rsrq (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_lte_rsrp (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
gboolean mm_modem_signal_get_lte_snr (MMModemSignal *self,
|
||||
gdouble *value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _MM_MODEM_SIGNAL_H_ */
|
@@ -412,6 +412,42 @@ mm_object_peek_modem_firmware (MMObject *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_object_get_modem_signal:
|
||||
* @self: A #MMObject.
|
||||
*
|
||||
* Gets the #MMModemSignal instance for the D-Bus interface org.freedesktop.ModemManager1.Modem.Signal on @self, if any.
|
||||
*
|
||||
* Returns: (transfer full): A #MMModemSignal that must be freed with g_object_unref() or %NULL if @self does not implement the interface.
|
||||
*/
|
||||
MMModemSignal *
|
||||
mm_object_get_modem_signal (MMObject *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_OBJECT (MM_GDBUS_OBJECT (self)), NULL);
|
||||
|
||||
return (MMModemSignal *)mm_gdbus_object_get_modem_signal (MM_GDBUS_OBJECT (self));
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_object_peek_modem_signal: (skip)
|
||||
* @self: A #MMObject.
|
||||
*
|
||||
* Like mm_object_get_modem_signal() but doesn't increase the reference count on the returned object.
|
||||
*
|
||||
* <warning>It is not safe to use the returned object if you are on another thread than the one where the #MMManager is running.</warning>
|
||||
*
|
||||
* Returns: (transfer none): A #MMModemSignal or %NULL if @self does not implement the interface. Do not free the returned object, it is owned by @self.
|
||||
*/
|
||||
MMModemSignal *
|
||||
mm_object_peek_modem_signal (MMObject *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_OBJECT (MM_GDBUS_OBJECT (self)), NULL);
|
||||
|
||||
return (MMModemSignal *)mm_gdbus_object_peek_modem_signal (MM_GDBUS_OBJECT (self));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_object_init (MMObject *self)
|
||||
{
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include "mm-modem-messaging.h"
|
||||
#include "mm-modem-time.h"
|
||||
#include "mm-modem-firmware.h"
|
||||
#include "mm-modem-signal.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -84,6 +85,7 @@ MMModemLocation *mm_object_get_modem_location (MMObject *self);
|
||||
MMModemMessaging *mm_object_get_modem_messaging (MMObject *self);
|
||||
MMModemTime *mm_object_get_modem_time (MMObject *self);
|
||||
MMModemFirmware *mm_object_get_modem_firmware (MMObject *self);
|
||||
MMModemSignal *mm_object_get_modem_signal (MMObject *self);
|
||||
|
||||
MMModem *mm_object_peek_modem (MMObject *self);
|
||||
MMModem3gpp *mm_object_peek_modem_3gpp (MMObject *self);
|
||||
@@ -94,6 +96,7 @@ MMModemLocation *mm_object_peek_modem_location (MMObject *self);
|
||||
MMModemMessaging *mm_object_peek_modem_messaging (MMObject *self);
|
||||
MMModemTime *mm_object_peek_modem_time (MMObject *self);
|
||||
MMModemFirmware *mm_object_peek_modem_firmware (MMObject *self);
|
||||
MMModemSignal *mm_object_peek_modem_signal (MMObject *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Reference in New Issue
Block a user