Reply
Thread Tools
PMaff's Avatar
Posts: 361 | Thanked: 219 times | Joined on Sep 2010
#1
I was looking for this but did not find a thread:
is there some software for N900 which displays ongoing traffic
(either WLAN or 2G to 3.5G) as a bar or similar beside the battery meter?
Maybe similar to the field strength bar for GPRS?

Alternatively something like KTrafficAnalyzer?
 
Posts: 166 | Thanked: 154 times | Joined on Dec 2009
#2
Great idea, I`d like that!
 
Posts: 356 | Thanked: 172 times | Joined on Jan 2010 @ Canada
#3
Yeah that would be handy.

Would be great if it were split into two different colours/bars to show inbound/outbound traffic as well
 

The Following User Says Thank You to Bingley Joe For This Useful Post:
Posts: 48 | Thanked: 26 times | Joined on Feb 2010 @ UT@NL
#4
I've modified the cpumem-applet thingie to include a green and red dot to show me traffic, I've submitted it as a patch but havent heard anything..

Last edited by hsmade; 2010-11-20 at 08:28.
 
PMaff's Avatar
Posts: 361 | Thanked: 219 times | Joined on Sep 2010
#5
Originally Posted by hsmade View Post
I've modified the cpumem-applet thingie to include a green and red dot to show me traffic, I've submitted it as a patch but havent heard anything..
Is there a possibility to install it as *.deb?
 
Posts: 48 | Thanked: 26 times | Joined on Feb 2010 @ UT@NL
#6
sure.. try here: http://hsmade.com/cpumem-applet_0.5-1_armel.deb This is the 0.5-1 version with my added stuff in it. It shows the red and green dot when it see any network traffic on 2/3G or wifi.
 

The Following 2 Users Say Thank You to hsmade For This Useful Post:
PMaff's Avatar
Posts: 361 | Thanked: 219 times | Joined on Sep 2010
#7
Originally Posted by hsmade View Post
sure.. try here: http://hsmade.com/cpumem-applet_0.5-1_armel.deb This is the 0.5-1 version with my added stuff in it. It shows the red and green dot when it see any network traffic on 2/3G or wifi.
Thanks a lot.

It shows a on/off display of traffic on the right side.
On the left CPU/MEM usage afaics.

Only tested it with internet currently and not with WLAN.
What does the red dot mean and what the green one?
Short description somewhere? ("Projekt-Homepage" at
https://garage.maemo.org/projects/cpumem-applet points to a
"The project has not yet uploaded its webpage" ;-) ).

Is that the correct "look and feel" on the N900 with newest OS?
:
Attached Images
 
 
Posts: 48 | Thanked: 26 times | Joined on Feb 2010 @ UT@NL
#8
This is a patch I've written for cpumem applet, which has not been written by me. I had this cpumem applet installed and wanted an indicator for network traffic as well, so I added it.
Red=send, Green=receive.

On your screenshot, we don't see the mem and cpu. It should be right next to them. If your N900 is idle, those bars are empty. Just like the screenshot.

Last edited by hsmade; 2010-11-21 at 17:10.
 
Posts: 48 | Thanked: 26 times | Joined on Feb 2010 @ UT@NL
#9
My patch:

Code:
--- /orig/cpumem-applet/src/cpumem_status_area_item.c	2010-11-21 17:48:13.000000000 +0100
+++ /new/cpumem-applet/src/cpumem_status_area_item.c	2010-09-28 00:22:20.000000000 +0200
@@ -14,7 +14,7 @@
 
 #include "cpumem_status_area_item.h"
 
-#define CPUMEM_ICON_WIDTH  16
+#define CPUMEM_ICON_WIDTH  22
 #define CPUMEM_ICON_HEIGHT 16
 #define CPUMEM_BOX_WIDTH   5
 #define CPUMEM_BOX_HEIGHT  3
@@ -29,9 +29,12 @@
 	gint lastU, lastN, lastIO, lastI;
 	guchar last_mem_level;
 	guchar last_cpu_level;
+	guchar last_net_in;
+	guchar last_net_out;
 	GdkPixbuf *pixbuf;
 	GdkPixbuf *pixbuf_on;
 	GdkPixbuf *pixbuf_red;
+	GdkPixbuf *pixbuf_grn;
 	GdkPixbuf *pixbuf_off;
 	osso_context_t *osso;
 	gboolean red;
@@ -41,6 +44,51 @@
 
 
 /*
+ * Read current network usage and return it
+ */
+static guchar
+check_net_in (CpumemAppletStatusAreaItemPrivate *priv)
+{
+	char read_buffer[32];
+	FILE *fin;
+	int in;
+
+	fin = (FILE*)popen("/bin/cat /proc/net/dev|/usr/bin/awk '/wlan|wmaster|gprs/{ IN=IN+$2; } END{print IN}'", "r");
+	if (fin == NULL) {
+		g_warning("Can't open network stats\n");
+		return TRUE;
+	}
+	while (fgets(read_buffer, 32, fin) != NULL) {
+		sscanf(read_buffer, "%d", &in); 
+	}
+	pclose(fin);
+	return in;
+}
+
+
+/*
+ * Read current network usage and return it
+ */
+static guchar
+check_net_out (CpumemAppletStatusAreaItemPrivate *priv)
+{
+	char read_buffer[32];
+	FILE *fin;
+	int out;
+
+	fin = (FILE*)popen("/bin/cat /proc/net/dev|/usr/bin/awk '/wlan|wmaster|gprs/{ OUT=OUT+$2; } END{print OUT}'", "r");
+	if (fin == NULL) {
+		g_warning("Can't open network stats\n");
+		return TRUE;
+	}
+	while (fgets(read_buffer, 32, fin) != NULL) {
+		sscanf(read_buffer, "%d", &out); 
+	}
+	pclose(fin);
+	return out;
+}
+
+/*
  * Read current MEM usage and return indicator between 5 and 1 - how many bars are "full"
  */
 static guchar
@@ -150,10 +198,31 @@
 
 
 /*
+ * Compose and blit the current status of network dots
+ */
+static void
+blit_net_bars (const guchar in, const guchar out, CpumemAppletStatusAreaItemPrivate *priv)
+{
+	guint x, y;
+	
+	gdk_pixbuf_fill(priv->pixbuf, 0x00000000);
+
+	x = 16;
+	y = 1;
+	if (in > 0)
+		gdk_pixbuf_composite(priv->pixbuf_grn, priv->pixbuf, x, y, 
+			CPUMEM_BOX_WIDTH, CPUMEM_BOX_WIDTH, x, y, 1, 1, GDK_INTERP_NEAREST, 255);
+	y = 10;
+	if (out > 0)
+		gdk_pixbuf_composite(priv->pixbuf_red, priv->pixbuf, x, y, 
+			CPUMEM_BOX_WIDTH, CPUMEM_BOX_WIDTH, x, y, 1, 1, GDK_INTERP_NEAREST, 255);
+}
+
+/*
  * Compose and blit the current status of memory bars
  */
 static void
-blit_mem_barsconst guchar level, CpumemAppletStatusAreaItemPrivate *priv)
+blit_mem_bars (const guchar level, CpumemAppletStatusAreaItemPrivate *priv)
 {
 	guint x, y;
 	
@@ -230,22 +299,29 @@
 {
 	guchar current_cpu_level;
 	guchar current_mem_level;
+	guchar current_net_in;
+	guchar current_net_out;
 	CpumemAppletStatusAreaItem *item = (CpumemAppletStatusAreaItem*)data;
 	CpumemAppletStatusAreaItemPrivate *priv = (CpumemAppletStatusAreaItemPrivate*)item->priv;
    
 	current_cpu_level = check_cpu(priv); 
 	current_mem_level = check_mem(priv);
+	current_net_in = check_net_in(priv);
+	current_net_out = check_net_out(priv);
 	//g_debug(g_strdup_printf("LOADAPLET - UPDATED CPU %d MEM %d", current_cpu_level, current_mem_level));
 	
 	//Update and blit only if data changed!
-	if ((current_mem_level != priv->last_mem_level) || (current_cpu_level != priv->last_cpu_level)) {
+	if ((current_mem_level != priv->last_mem_level) || (current_cpu_level != priv->last_cpu_level) || (current_net_in != priv->last_net_in) || (current_net_out != priv->last_net_out)) {
 		blit_mem_bars (current_mem_level, priv);
 		blit_cpu_bars (current_cpu_level, priv);
+		blit_net_bars (current_net_in - priv->last_net_in, current_net_out - priv->last_net_out, priv);
 		if (current_cpu_level == CPUMEM_CPU_MAX)
 			priv->red = FALSE;
 		hd_status_plugin_item_set_status_area_icon (HD_STATUS_PLUGIN_ITEM(data), priv->pixbuf);
 		priv->last_mem_level = current_mem_level;
 		priv->last_cpu_level = current_cpu_level;
+		priv->last_net_in = current_net_in;
+		priv->last_net_out = current_net_out;
 	} else if (current_cpu_level == CPUMEM_CPU_MAX) {
 		//Pulsate max CPU load icon also when CPU load stays at max
 		blit_cpu_bars (current_cpu_level, priv);
@@ -275,7 +351,7 @@
 		}
     } else {
 		//Suspend the updates - screen is off
-		if (item->priv->timeout_id) != 0) {
+		if (item->priv->timeout_id != 0) {
 			g_source_remove(item->priv->timeout_id);
 			item->priv->timeout_id = 0;
 		}
@@ -339,6 +415,8 @@
 	
 	item->priv->last_mem_level = -1;
 	item->priv->last_cpu_level = -1;
+	item->priv->last_net_in = -1;
+	item->priv->last_net_out = -1;
 	item->priv->timeout_id = -1;
 	item->priv->red = FALSE;
 	item->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, CPUMEM_ICON_WIDTH, CPUMEM_ICON_HEIGHT);
@@ -347,6 +425,8 @@
 	gdk_pixbuf_fill(item->priv->pixbuf_on, 0xffffffff);
 	item->priv->pixbuf_red = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, CPUMEM_BOX_WIDTH, CPUMEM_BOX_HEIGHT);
 	gdk_pixbuf_fill(item->priv->pixbuf_red, 0xff0000ff);	
+	item->priv->pixbuf_grn = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, CPUMEM_BOX_WIDTH, CPUMEM_BOX_HEIGHT);
+	gdk_pixbuf_fill(item->priv->pixbuf_grn, 0x00ff00ff);	
 	item->priv->pixbuf_off = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, CPUMEM_BOX_WIDTH, CPUMEM_BOX_HEIGHT);
 	gdk_pixbuf_fill(item->priv->pixbuf_off, 0x777777ff);
 	cpumem_applet_status_area_item_set_area_icon(item);

Last edited by hsmade; 2010-11-21 at 17:21.
 

The Following 2 Users Say Thank You to hsmade For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 14:51.