package com.example.uhf;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;
import com.WifiCtr.WifiCtr;
import com.friendlyarm.AndroidSDK.HardwareControler;
@SuppressLint({ "DefaultLocale", "HandlerLeak" })
public class MainActivity extends Activity {
TextView commucationView;
private Button stopButton;
private Button find_one;
private Button find_more;
private Button stop_more;
private Button send_button;
private Spinner cmdSpinner;
private ArrayAdapter<String> cmdAdapter;
private int fd = 0;
int cmd_num;//命令编号
String thread = "readThread";
String choosed_serial = "/dev/s3c2410_serial3";
int choosed_buad = 115200;
boolean flag=false;
byte[] buf= new byte[100];
byte[] buf_zl= new byte[20];
byte[] read_one = new byte[]{(byte)0xa5,(byte)0x5a,0x00,0x0a,(byte)0x80,0x00,0x64,(byte)0xee,0x0d,0x0a};
byte[] read_more= new byte[]{(byte)0xa5,(byte)0x5a,0x00,0x0a,(byte)0x82,0x00,0x00,(byte)0x88,0x0d,0x0a};
byte[] stop_read_more= new byte[]{(byte)0xa5,(byte)0x5a,0x00,0x08,(byte)0x8c,(byte)0x84,0x0d,0x0a};
/*发送功率命令数组 */
byte[][] cmd= new byte[][]{
{(byte)0xa5,(byte)0x5a,0x00,(byte)0x0e,0x10,0x00,0x01,0x03,(byte)0xe8,0x03,(byte)0xe8,0x1f,0x0d,0x0a},//发射接收功率均为10
{(byte)0xa5,(byte)0x5a,0x00,(byte)0x0e,0x10,0x00,0x01,0x07,(byte)0xd0,0x07,(byte)0xd0,0x1f,0x0d,0x0a},//发射接收功率均为20
{(byte)0xa5,(byte)0x5a,0x00,(byte)0x0e,0x10,0x00,0x01,0x0b,(byte)0xb8,0x0b,(byte)0xb8,0x1f,0x0d,0x0a},//发射接收功率均为30
{(byte)0xa5,(byte)0x5a,0x00,(byte)0x0e,0x10,0x00,0x01,0x0f,(byte)0xa0,0x0f,(byte)0xa0,0x1f,0x0d,0x0a},//发射接收功率均为40
{(byte)0xa5,(byte)0x5a,0x00,(byte)0x0e,0x10,0x00,0x01,0x13,(byte)0x88,0x13,(byte)0x88,0x1f,0x0d,0x0a},//发