Wireshark for Nokia LCD

Dependencies:   NokiaLCD mbed

Fork of Wireshark by Alvin McNair

Files at this revision

API Documentation at this revision

Comitter:
ichoudhury6
Date:
Fri Mar 01 20:03:47 2013 +0000
Parent:
0:126d1599825c
Commit message:
Working on Wireshark program for Nokia LCD;

Changed in this revision

NokiaLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NokiaLCD.lib	Fri Mar 01 20:03:47 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/NokiaLCD/#2d1b23692cbb
--- a/main.cpp	Fri Mar 01 19:04:18 2013 +0000
+++ b/main.cpp	Fri Mar 01 20:03:47 2013 +0000
@@ -1,5 +1,10 @@
 #include "mbed.h"
 #include <string>
+#include "NokiaLCD.h"
+
+NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
+
+
 DigitalOut myled(LED1);
 
 Ethernet eth;
@@ -44,15 +49,17 @@
     short tot_len,ident;
     string k;
     myled=1;
+    int loc = 1;
     char buf[0x600];
     
     int* length=(int *)(buf+12);
  
     while(1) {
         myled=!myled;
-        number++;
+       
         int size = eth.receive();
         if(size > 0) {
+            loc=1;
             eth.read(buf, size);
             type=(buf[12]<<8|buf[13]);
             ver= buf[14]>>4;
@@ -62,27 +69,57 @@
             ident=(buf[18]<<8|buf[19]);
             prot=buf[23];
             
+            //lcd.fill(2, 51, 128, 10, 0x00FF00);
+            //lcd.fill(50, 1, 10, 128, 0xFF0000);
+    
                     //ip packet starts at 14
                     // the IP address starts at 
             
             if(type==0x800){
-                    printf("Number:%i\r\n",number);
-            printf("Destination:  %02X:%02X:%02X:%02X:%02X:%02X\r\n",
-                    buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
-            printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\r\n",
-                    buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
-            printf("Type %02X\r\n",type);
-                    printf("Length:%i\r\n",size);
-                    k=Protocol(prot);
-            printf("Protocol  %i: %s\r\n",prot,k);
-            printf("IP Source:  %i.%i.%i.%i\r\n",
-                    buf[26], buf[27], buf[28], buf[29]);
-            printf("IP Destination : %i.%i.%i.%i\r\n",
-                    buf[30], buf[31], buf[32], buf[33]);}
+            lcd.background(0x0000FF);
+            lcd.cls();
+            lcd.locate(0,1);
+            lcd.printf("Wireshark on Nokia");
+            loc+=2;
+            lcd.locate(0, loc);
+            number++;
+            lcd.printf("Number:%i",number);
+            loc+=1;
+            lcd.locate(0, loc);
+            lcd.printf("Source:  ");
+            loc++;
+            lcd.locate(0, loc);
+            lcd.printf("%d.%d.%d.%d", buf[26], buf[27], buf[28], buf[29]);
+            loc+=2;
+            lcd.locate(0, loc);
+            lcd.printf("Destination: ");
+            
+            loc++;
+            lcd.locate(0, loc);
+            lcd.printf("%d.%d.%d.%d", buf[30], buf[31], buf[32], buf[33]);
+            loc++;
+            lcd.locate(0, loc);
+             k=Protocol(prot);
+            lcd.printf("Protocol %s",k);
+            loc+=2;
+            lcd.locate(0, loc);
+            lcd.printf("Length:%i",size);
+            
+             
+                    
             
                     
-        }
+              
+            
+            //printf("IP Source:  %i.%i.%i.%i\r\n",
+            //        buf[26], buf[27], buf[28], buf[29]);
+           // printf("IP Destination : %i.%i.%i.%i\r\n",
+             //       buf[30], buf[31], buf[32], buf[33]);}
+            
+                    
+        }else{printf("No Connection\r\n");}
  
         wait(1);
     }
 }
+}
\ No newline at end of file