aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-04-13 15:52:30 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-04-17 15:19:40 +0200
commit10f2cdebcb23e608d41d4fceea0abe4e5b74b795 (patch)
tree617f3f1d1870f12ee93de166f692dfa7dcba51f6
parent6b827cc7a306ef2f3719ba7310952305b97fa04c (diff)
broadband-modem-mbim: process signal state indications
-rw-r--r--src/mm-broadband-modem-mbim.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index cad53173..cc55fc2c 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -1360,10 +1360,56 @@ modem_3gpp_load_enabled_facility_locks (MMIfaceModem3gpp *self,
/* Setup/cleanup unsolicited events */
static void
+basic_connect_notification_signal_state (MMBroadbandModemMbim *self,
+ MbimMessage *notification)
+{
+ guint32 rssi;
+
+ if (mbim_message_signal_state_notification_parse (
+ notification,
+ &rssi,
+ NULL, /* error_rate */
+ NULL, /* signal_strength_interval */
+ NULL, /* rssi_threshold */
+ NULL, /* error_rate_threshold */
+ NULL)) {
+ guint32 quality;
+
+ /* Normalize the quality. 99 means unknown, we default it to 0 */
+ quality = CLAMP (rssi == 99 ? 0 : rssi, 0, 31) * 100 / 31;
+
+ mm_dbg ("Signal state indication: %u --> %u%%", rssi, quality);
+ mm_iface_modem_update_signal_quality (MM_IFACE_MODEM (self), quality);
+ }
+}
+
+static void
+basic_connect_notification (MMBroadbandModemMbim *self,
+ MbimMessage *notification)
+{
+ switch (mbim_message_indicate_status_get_cid (notification)) {
+ case MBIM_CID_BASIC_CONNECT_SIGNAL_STATE:
+ basic_connect_notification_signal_state (self, notification);
+ break;
+ default:
+ /* Ignore */
+ break;
+ }
+}
+
+static void
device_notification_cb (MbimDevice *device,
MbimMessage *notification,
MMBroadbandModemMbim *self)
{
+ switch (mbim_message_indicate_status_get_service (notification)) {
+ case MBIM_SERVICE_BASIC_CONNECT:
+ basic_connect_notification (self, notification);
+ break;
+ default:
+ /* Ignore */
+ break;
+ }
}
static gboolean