// Path: java/anyremote/client/android/util/Address.java
// public class Address {
// 	public String name;
// 	public String URL;
// 	public String pass;	
// 	public boolean autoconnect;	
// }
// 
// Path: java/anyremote/client/android/util/ProtocolMessage.java
// public class ProtocolMessage {
// 	public static final int FULL     = 0;
// 	public static final int FIRST    = 1;
// 	public static final int INTERMED = 2;
// 	public static final int LAST     = 3;
// 	
// 	public int id;
// 	public int stage;
// 	public Vector tokens;
// }


import java.io.File;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.TreeMap;
import java.util.Vector;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.widget.Toast;
import anyremote.client.android.util.Address;
import anyremote.client.android.util.ProtocolMessage;
import anyremote.client.android.R;
				
				String alert = res.getString(R.string.connection_failed);
				if (((String) msg.obj).length() > 0) {
					alert += "\n"+(String) msg.obj;
				}
			    Toast.makeText(this, alert, Toast.LENGTH_LONG).show();
			}
			
			protocol.disconnected(true);
			handleEvent(DISCONNECTED);
			break;	
			
		case LOSTFOCUS:
			
			anyRemote._log("handleMessage: LOST FOCUS");
			
			protocol.disconnected(false);
			handleEvent(LOSTFOCUS);
			break;	
			
		case anyRemote.COMMAND:
			
			anyRemote._log("handleMessage: COMMAND");
			protocol.handleCommand((ProtocolMessage) msg.obj);
			break;			

		case anyRemote.DO_CONNECT:
			
			anyRemote._log("handleMessage: DO_CONNECT");
			if (msg.obj != null ) {
// Path: java/anyremote/client/android/util/Address.java
// public class Address {
// 	public String name;
// 	public String URL;
// 	public String pass;	
// 	public boolean autoconnect;	
// }
// 
// Path: java/anyremote/client/android/util/ProtocolMessage.java
// public class ProtocolMessage {
// 	public static final int FULL     = 0;
// 	public static final int FIRST    = 1;
// 	public static final int INTERMED = 2;
// 	public static final int LAST     = 3;
// 	
// 	public int id;
// 	public int stage;
// 	public Vector tokens;
// }


// Path: java/anyremote/client/android/anyRemote.java
import java.io.File;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.TreeMap;
import java.util.Vector;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.widget.Toast;
import anyremote.client.android.util.Address;
import anyremote.client.android.util.ProtocolMessage;
import anyremote.client.android.R;

				
				String alert = res.getString(R.string.connection_failed);
				if (((String) msg.obj).length() > 0) {
					alert += "\n"+(String) msg.obj;
				}
			    Toast.makeText(this, alert, Toast.LENGTH_LONG).show();
			}
			
			protocol.disconnected(true);
			handleEvent(DISCONNECTED);
			break;	
			
		case LOSTFOCUS:
			
			anyRemote._log("handleMessage: LOST FOCUS");
			
			protocol.disconnected(false);
			handleEvent(LOSTFOCUS);
			break;	
			
		case anyRemote.COMMAND:
			
			anyRemote._log("handleMessage: COMMAND");
			protocol.handleCommand((ProtocolMessage) msg.obj);
			break;			

		case anyRemote.DO_CONNECT:
			
			anyRemote._log("handleMessage: DO_CONNECT");
			if (msg.obj != null ) {
				Address conn = (Address) msg.obj;