---
 cli/mmcli-bearer.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c
index 5829e60..fe54810 100644
--- a/cli/mmcli-bearer.c
+++ b/cli/mmcli-bearer.c
@@ -135,10 +135,12 @@ print_bearer_info (MMBearer *bearer)
     MMBearerIpConfig *ipv4_config;
     MMBearerIpConfig *ipv6_config;
     MMBearerProperties *properties;
+    MMBearerStats *stats;

     ipv4_config = mm_bearer_get_ipv4_config (bearer);
     ipv6_config = mm_bearer_get_ipv6_config (bearer);
     properties = mm_bearer_get_properties (bearer);
+    stats = mm_bearer_get_stats (bearer);

     /* Not the best thing to do, as we may be doing _get() calls twice, but
      * easiest to maintain */
@@ -253,6 +255,26 @@ print_bearer_info (MMBearer *bearer)
             g_print ("                     |      MTU: '%u'\n", mtu);
     }

+    if (stats) {
+        guint64 val;
+
+        g_print ("  -------------------------\n"
+                 "  Stats              |          Duration: '%u'\n", 
mm_bearer_stats_get_duration (stats));
+
+        val = mm_bearer_stats_get_rx_bytes (stats);
+        if (val > 0)
+            g_print ("                     |    Bytes received: '%" 
G_GUINT64_FORMAT "'\n", val);
+        else
+            g_print ("                     |    Bytes received: 'N/A'\n");
+
+        val = mm_bearer_stats_get_tx_bytes (stats);
+        if (val > 0)
+            g_print ("                     | Bytes transmitted: '%" 
G_GUINT64_FORMAT "'\n", val);
+        else
+            g_print ("                     | Bytes transmitted: 'N/A'\n");
+    }
+
+    g_clear_object (&stats);
     g_clear_object (&properties);
     g_clear_object (&ipv4_config);
     g_clear_object (&ipv6_config);
--
2.6.2
_______________________________________________
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to