when initialised prompts for current location
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 8 Dec 2010 22:05:48 +0000 (22:05 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 8 Dec 2010 22:05:48 +0000 (22:05 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@268 01035d8c-6547-0410-b346-abe4f91aad63

dilimesh/README.txt
dilimesh/dilimesh/dilimesh.html

index 9a057bd67c7f8183f4daa3609794daa88e4afe10..5dba91d1f43486b52a2e7e7e99c105e9682a1a8a 100644 (file)
@@ -27,18 +27,42 @@ for link debugging techniques in the Dili Village Telco.
 
 * Loosely coupled design: Can work without any additional software on
   each mesh mode, just needs a Visualisation server somewhere in the
-  mesh.
+  mesh.  Doesn't affct Mesh Potato operation, or the operation of
+  other software on the mesh.
+
+
+Using Dilimesh
+--------------
+
+1/ Point your browser at http://server/dilimesh/dilimesh/html
+
+2/ Set "Visualisation Server IP" on RHS and reload page.
+
+3/ Dilimesh will find new nodes automatically.  Drag bouncing nodes
+   to the correct position on map.
+
+4/ Mouse over or click on a node to get IP and packet loss.  If nodes
+   are running signal strength daemon signal strengths of adjacent
+   nodes will also be displayed.
+
+5/ Click on links to get "Distance" stats on lower right hand side.
+
+5/ Node colours:
+     * blue  - packet loss < 10%
+     * red   - packet loss between 10% and 90%
+     * black - packet loss > 90%
+
+5/ "Update Enable" will update packet loss, network links and signal
+    strength automatically.
 
 
 Status
 ------
 
 * Alpha
-* Tested on Firefox 3.5.3 with Apache2 server
+* Tested on Firefox 3.5.3 with Apache2 servers running Ubuntu 9 & 10.
 * Tested on small 5 node mesh network, might needs tweaks (e.g. fping
   arguments) for larger networks
-* Displays nodes, link paths, node IP and packet loss
-* Signal strength per link feature under development
 
 
 Implementation Notes
@@ -104,18 +128,30 @@ You need:
    may already be running on your supernode.  Batman on each node should
    be configured for the vis server (e.g. -s 10.130.1.1)
 
-4/ A route from the web server PC to the mesh network.
+4/ A route from the web server PC to the mesh network.  On the Ubuntu
+   machine I use as a server I put this script in the file
+   /etc/network/if-up.d/potato:
+
+     !/bin/sh
+     # Add interface and routes to connect to potato mesh network
+
+     ifconfig eth0 10.30.1.3 netmask 255.255.255.0
+     route add -net 10.130.1.0/24 gw 10.30.1.1
 
+   This file runs when the machine boots and connects to the Supernode
+   via Ethernet.
 
 Installation
 ------------
 
 1/ Server PC
 
-  # sudo mkdir /var/www/dilimesh
-  # sudo chmod 777 /var/www/dilimesh
-  # cp dilimesh/* /var/www/dilimesh
-  # cp cgi-bin/* /usr/lib/cgi-bin
+  $ svn co https://freetel.svn.sourceforge.net/svnroot/freetel/dilimesh
+  $ cd dilimesh
+  $ sudo mkdir /var/www/dilimesh
+  $ sudo chmod 777 /var/www/dilimesh
+  $ cp dilimesh/* /var/www/dilimesh
+  $ sudo cp cgi-bin/* /usr/lib/cgi-bin
 
 2/ Supernode
 
@@ -163,7 +199,7 @@ Installation
 
     $ ssh root@10.130.1.36 '/etc/rc.d/S99sigstr'
 
-  Test if deamon is running
+  Test if daemon is running
 
    $ telnet 10.130.1.36 4950
 
@@ -197,9 +233,9 @@ Tests
 
 5/ Test CGIs:
  
-    Point your browser at: 
+   Point your browser at: 
 
-      http://localhost/cgi-bin/fpingnodes.cgi?ip=10.130.1.1
+     http://localhost/cgi-bin/fpingnodes.cgi?ip=10.130.1.1
 
 6/ Test reading and writing nodes.txt database with your browser:
 
@@ -224,31 +260,6 @@ Tests
    -64 -90 -75
 
 
-Using Dilimesh
---------------
-
-1/ Point your browser at http://server/dilimesh/dilimesh/html
-
-2/ Set "Visualisation Server IP" on RHS and reload page.
-
-3/ Dilimesh will find new nodes automatically.  Drag bouncing nodes
-   to the correct position on map.
-
-4/ Mouse over or click on a node to get IP and packet loss.  If nodes
-   are running signal strength daemon signal strengths of adjacent
-   nodes will also be displayed.
-
-5/ Click on links to get "Distance" stats on lower right hand side.
-
-5/ Node colours:
-     * blue  - packet loss < 10%
-     * red   - packet loss between 10% and 90%
-     * black - packet loss > 90%
-
-5/ "Update Enable" will update packet loss, network links and signal
-    strength automatically.
-
-
 Debugging
 ---------
 
@@ -256,7 +267,7 @@ Debugging
 
   $ tail -f /var/log/apache2/access.log
 
-2/ Use Firebug on Firefox.
+2/ Use Firebug on Firefox to single step, set breakpoints etc.
 
 3/ Check nodes.txt database, each line is (lat, lng, IP):
 
@@ -267,3 +278,13 @@ Debugging
   -34.87893842193011,138.55278968811035,10.130.1.23
   -34.882511765792316,138.55210304260254,10.130.1.14
   -34.880364257566484,138.5518455505371,10.130.1.36
+
+4/ The "dilimesh" cookie stores a lot of our state. On Firefox 3.5 you
+   can remove the dilimesh cookie using Edit-Preferences-Privacy, then
+   click on "remove individual cookies".
+
+5/ To reset to defaults:
+   
+   * move to another page (cookie is svaed when we exit page)
+   * rm -f /var/www/dilimesh/nodes.txt
+   * Delete cookie using setp (4) above
index 0abf1c3374ce781fe7832eb261cf85f9ef3ef562..662ca242028805273ed45619e6139a1f0fcff05f 100644 (file)
@@ -42,6 +42,7 @@
   var update_enable = 0;
   var update_time = 5;
   var debug_enable  = 0;  
+  var known_location = true;
 
   // state variables we use while dragging
 
@@ -78,6 +79,8 @@
     }
     map = new google.maps.Map(document.getElementById("main-map"), myOptions);
 
+    // we don't want manual placement of nodes, use vis server to pop
+    // them up
     //google.maps.event.addListener(map, 'click', function(event) {
     //  placeMarker(event.latLng);
     //});
       }
     }
 
-    // initial map display
+    // initial map display, only if we have a sensible map location.  Otherwise
+    // new nodes will be placed in middle of current default location
  
-    poll();       
+    if (known_location)
+      poll();       
 
     // kick off timer process that periodically fires off vis and fping CGIs
 
       // delete node from text file
 
       var url;
-      url = "/cgi-bin/delnode.cgi?" + "lat=" + this.position.ya + "&" + "lng=" +
-             this.position.za;
+      url = "/cgi-bin/delnode.cgi?" + "lat=" + this.position.lat() + "&" + "lng=" +
+             this.position.lng();
       downloadUrl(url, function(doc) { });
     });
 
       // add node to text file
 
       var url;
-      url = "/cgi-bin/addnode.cgi?" + "lat=" +  this.position.ya + "&" + "lng=" +
-            this.position.za + "&" + "ip=" + dragIp;
+      url = "/cgi-bin/addnode.cgi?" + "lat=" +  this.position.lat() + "&" + "lng=" +
+            this.position.lng() + "&" + "ip=" + dragIp;
       downloadUrl(url, function(doc) { });
 
       drawPathesBetweenNodes();
   }
 
 
-  // save state 9config info) to our cookie
+  // save state (config info) to our cookie
 
   function setCookie() {
     var cookietext = cookiename;
   // Grab a bunch of config info from our cookie
 
   function getCookie() {
-    if (document.cookie.length>0) {
+
+    if (document.cookie.length > 0) {
       cookieStart = document.cookie.indexOf(cookiename + "=");
+
+      // lets see if our cookie exists
+
       if (cookieStart!=-1) {
         cookieStart += cookiename.length+1; 
         cookieEnd=document.cookie.indexOf(";",cookieStart);
         update_time = parseInt(bits[4]);
         update_enable = parseInt(bits[5]);
         debug_enable = parseInt(bits[6]);
-      } 
+      }
+    } 
+    else {
+      known_location = false; // don't detect and display new nodes
+      alert("Move to your " +
+            "current location then refresh to detect nodes.");              
+
     }
+
   }
 
 
       isNewNode = false;
     }
 
-    addNewNode(location.ya, location.za, ip, isNewNode);
+    addNewNode(location.lat(), location.lng(), ip, isNewNode);
 
     // save to marker file by calling a CGI
 
     var url;
-    url = "/cgi-bin/addnode.cgi?" + "lat=" + location.ya + "&" + "lng=" + location.za + "&" + "ip=" + ip;
+    url = "/cgi-bin/addnode.cgi?" + "lat=" + location.lat() + "&" + "lng=" + location.lng() + "&" + "ip=" + ip;
     downloadUrl(url, function(doc) { });
   }
   
 
   <div id="side">
 
+    <h3>Help</h3>
+      <table>
+        <tr><td width="5%"></td><td><a href="https://freetel.svn.sourceforge.net/svnroot/freetel/dilimesh/README.txt">DiliMesh README</a></td></tr>
+      </table>
+
     <div id="stats" style="width: 100%;">
       <h3>Network Stats</h3>
         <table>
-         <tr><td width="5%"></td><td>Time</td><td><div id="time"></div></td><tr>
-         <tr><td></td><td>Nodes Reachable</td><td><div id="nodes_reachable"></div></td><tr>
-         <tr><td></td><td>Nodes Poor Packet Loss</td><td><div id="nodes_poor_packet_loss"></div></td><tr>
-         <tr><td></td><td>Nodes Total</td><td><div id="nodes_total"></div></td><tr>
+         <tr><td width="5%"></td><td>Time</td><td><div id="time"></div></td></tr>
+         <tr><td></td><td>Nodes Reachable</td><td><div id="nodes_reachable"></div></td></tr>
+         <tr><td></td><td>Nodes Poor Packet Loss</td><td><div id="nodes_poor_packet_loss"></div></td></tr>
+         <tr><td></td><td>Nodes Total</td><td><div id="nodes_total"></div></td></tr>
         </table>
     </div>