// Path: android/src/net/blanu/sneakermesh/LANProbeService.java
// public class LANProbeService extends Service implements Logger
// {
// 	private static final String TAG = "LANProbe";	
// 	static Sneakermesh mesh=null;
// 	static SyncServer probe=null;
// 	static UDPBroadcastTask broadcast=null;
// 	static SyncerTask syncer=null;
// 
// 	static public String BROADCAST_ACTION;
// 	static Intent intent;
//     private final IBinder mBinder = new LocalBinder();
//     
//     List<String> lines=new ArrayList<String>();
//     
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 		BROADCAST_ACTION=this.getPackageName()+".log";
//     	intent = new Intent(BROADCAST_ACTION);	
//     	
// 		Message.setLogger(this);
// 		net.blanu.sneakermesh.Util.setLogger(this);    	
// 	}
// 
//     @Override
//     public int onStartCommand(Intent intent, int flags, int startId) {
//     	if(mesh==null)
//     	{
//     		if(checkStorage())
//     		{
//     			mesh=new AndroidSneakermesh(this);
// 
//     			Timer timer = new Timer();    			
//     			
//     			broadcast=new UDPBroadcastTask(this);    			
//     			timer.scheduleAtFixedRate(broadcast, 1, 30*1000);
//     			
//     			syncer=new SyncerTask(mesh);    			
//     			timer.scheduleAtFixedRate(syncer, 1, 30*1000);
//     			
//     			try {
// 					probe=new SyncServer(mesh, UDPUtil.getBroadcastAddress(this));
// 				} catch (IOException e) {
// 					e.printStackTrace();
// 				}
//     		}
//     	}
//     	
//     	return START_STICKY;
//     }  
//     
//     public Sneakermesh getMesh()
//     {
//     	return mesh;
//     }
//     
//     public class LocalBinder extends Binder {
//         public LANProbeService getService() {
//             return LANProbeService.this;
//         }
//     }    
//     
// 	@Override
// 	public IBinder onBind(Intent intent) {
// 		return mBinder;
// 	}
// 
// 	@Override
// 	public void onDestroy() {		
// 		super.onDestroy();
// 	}	    
// 	
// 	public void forceSync()
// 	{
// 		syncer.run();
// 	}
// 	
// 	public void forceBroadcast()
// 	{
// 		broadcast.run();
// 	}	
//     
//     public void log(String s)
//     {
//     	Log.e(TAG, s);
//     	
//     	lines.add(s);
//     	if(lines.size()>30)
//     	{
//     		lines.remove(0);
//     	}
// 
//     	intent.putExtra("logline", net.blanu.sneakermesh.Util.join((String[])lines.toArray(new String[0]), "\n"));
//     	sendBroadcast(intent);    	    	
//     }
//                    
//     public boolean checkStorage()
//     {
//     	boolean mExternalStorageAvailable = false;
//     	boolean mExternalStorageWriteable = false;
//     	String state = Environment.getExternalStorageState();
// 
//     	if (Environment.MEDIA_MOUNTED.equals(state)) {
//     	    // We can read and write the media
//     	    mExternalStorageAvailable = mExternalStorageWriteable = true;
//     	} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
//     	    // We can only read the media
//     	    mExternalStorageAvailable = true;
//     	    mExternalStorageWriteable = false;
//     	} else {
//     	    // Something else is wrong. It may be one of many other states, but all we need
//     	    //  to know is we can neither read nor write
//     	    mExternalStorageAvailable = mExternalStorageWriteable = false;
//     	}
//     	
//     	return mExternalStorageAvailable && mExternalStorageWriteable;
//     }    
// }
// 
// Path: shared/src/net/blanu/sneakermesh/Logger.java
// public interface Logger {
// 	public void log(String s);
// }
// 
// Path: android/src/net/blanu/sneakermesh/LANProbeService.java
// public class LocalBinder extends Binder {
//     public LANProbeService getService() {
//         return LANProbeService.this;
//     }
// }    


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.blanu.sneakermesh.LANProbeService;
import net.blanu.sneakermesh.Logger;
import net.blanu.sneakermesh.R;
import net.blanu.sneakermesh.LANProbeService.LocalBinder;
import net.blanu.sneakermesh.R.id;
import net.blanu.sneakermesh.R.menu;
import android.app.Activity;
import android.app.ListActivity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
package net.blanu.sneakermesh.ui;




abstract public class SneakermeshListActivity extends ListActivity implements Logger
{
	private static final String TAG="SneakermeshListActivity";
	Intent serviceIntent;
	String REFRESH_ACTION;
	ArrayAdapter<String> adapter;
    LANProbeService probe;
    boolean isBound=false;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        REFRESH_ACTION=this.getPackageName()+".refresh";        
        
// Path: android/src/net/blanu/sneakermesh/LANProbeService.java
// public class LANProbeService extends Service implements Logger
// {
// 	private static final String TAG = "LANProbe";	
// 	static Sneakermesh mesh=null;
// 	static SyncServer probe=null;
// 	static UDPBroadcastTask broadcast=null;
// 	static SyncerTask syncer=null;
// 
// 	static public String BROADCAST_ACTION;
// 	static Intent intent;
//     private final IBinder mBinder = new LocalBinder();
//     
//     List<String> lines=new ArrayList<String>();
//     
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 		BROADCAST_ACTION=this.getPackageName()+".log";
//     	intent = new Intent(BROADCAST_ACTION);	
//     	
// 		Message.setLogger(this);
// 		net.blanu.sneakermesh.Util.setLogger(this);    	
// 	}
// 
//     @Override
//     public int onStartCommand(Intent intent, int flags, int startId) {
//     	if(mesh==null)
//     	{
//     		if(checkStorage())
//     		{
//     			mesh=new AndroidSneakermesh(this);
// 
//     			Timer timer = new Timer();    			
//     			
//     			broadcast=new UDPBroadcastTask(this);    			
//     			timer.scheduleAtFixedRate(broadcast, 1, 30*1000);
//     			
//     			syncer=new SyncerTask(mesh);    			
//     			timer.scheduleAtFixedRate(syncer, 1, 30*1000);
//     			
//     			try {
// 					probe=new SyncServer(mesh, UDPUtil.getBroadcastAddress(this));
// 				} catch (IOException e) {
// 					e.printStackTrace();
// 				}
//     		}
//     	}
//     	
//     	return START_STICKY;
//     }  
//     
//     public Sneakermesh getMesh()
//     {
//     	return mesh;
//     }
//     
//     public class LocalBinder extends Binder {
//         public LANProbeService getService() {
//             return LANProbeService.this;
//         }
//     }    
//     
// 	@Override
// 	public IBinder onBind(Intent intent) {
// 		return mBinder;
// 	}
// 
// 	@Override
// 	public void onDestroy() {		
// 		super.onDestroy();
// 	}	    
// 	
// 	public void forceSync()
// 	{
// 		syncer.run();
// 	}
// 	
// 	public void forceBroadcast()
// 	{
// 		broadcast.run();
// 	}	
//     
//     public void log(String s)
//     {
//     	Log.e(TAG, s);
//     	
//     	lines.add(s);
//     	if(lines.size()>30)
//     	{
//     		lines.remove(0);
//     	}
// 
//     	intent.putExtra("logline", net.blanu.sneakermesh.Util.join((String[])lines.toArray(new String[0]), "\n"));
//     	sendBroadcast(intent);    	    	
//     }
//                    
//     public boolean checkStorage()
//     {
//     	boolean mExternalStorageAvailable = false;
//     	boolean mExternalStorageWriteable = false;
//     	String state = Environment.getExternalStorageState();
// 
//     	if (Environment.MEDIA_MOUNTED.equals(state)) {
//     	    // We can read and write the media
//     	    mExternalStorageAvailable = mExternalStorageWriteable = true;
//     	} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
//     	    // We can only read the media
//     	    mExternalStorageAvailable = true;
//     	    mExternalStorageWriteable = false;
//     	} else {
//     	    // Something else is wrong. It may be one of many other states, but all we need
//     	    //  to know is we can neither read nor write
//     	    mExternalStorageAvailable = mExternalStorageWriteable = false;
//     	}
//     	
//     	return mExternalStorageAvailable && mExternalStorageWriteable;
//     }    
// }
// 
// Path: shared/src/net/blanu/sneakermesh/Logger.java
// public interface Logger {
// 	public void log(String s);
// }
// 
// Path: android/src/net/blanu/sneakermesh/LANProbeService.java
// public class LocalBinder extends Binder {
//     public LANProbeService getService() {
//         return LANProbeService.this;
//     }
// }    


// Path: android/src/net/blanu/sneakermesh/ui/SneakermeshListActivity.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.blanu.sneakermesh.LANProbeService;
import net.blanu.sneakermesh.Logger;
import net.blanu.sneakermesh.R;
import net.blanu.sneakermesh.LANProbeService.LocalBinder;
import net.blanu.sneakermesh.R.id;
import net.blanu.sneakermesh.R.menu;
import android.app.Activity;
import android.app.ListActivity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

package net.blanu.sneakermesh.ui;




abstract public class SneakermeshListActivity extends ListActivity implements Logger
{
	private static final String TAG="SneakermeshListActivity";
	Intent serviceIntent;
	String REFRESH_ACTION;
	ArrayAdapter<String> adapter;
    LANProbeService probe;
    boolean isBound=false;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        REFRESH_ACTION=this.getPackageName()+".refresh";        
        
        serviceIntent=new Intent(this, LANProbeService.class);        