| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -13,6 +13,7 @@ import android.content.Context;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import android.Manifest;
 | 
					 | 
					 | 
					 | 
					import android.Manifest;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import android.annotation.SuppressLint;
 | 
					 | 
					 | 
					 | 
					import android.annotation.SuppressLint;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import android.content.Intent;
 | 
					 | 
					 | 
					 | 
					import android.content.Intent;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import android.graphics.Bitmap;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import android.graphics.BitmapFactory;
 | 
					 | 
					 | 
					 | 
					import android.graphics.BitmapFactory;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import android.location.Location;
 | 
					 | 
					 | 
					 | 
					import android.location.Location;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import android.nfc.Tag;
 | 
					 | 
					 | 
					 | 
					import android.nfc.Tag;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -108,10 +109,11 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //private ActivityResultLauncher<Intent> launcher;
 | 
					 | 
					 | 
					 | 
					    //private ActivityResultLauncher<Intent> launcher;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ////////////////////////////可修改部分/////////////////////////////
 | 
					 | 
					 | 
					 | 
					    ////////////////////////////可修改部分/////////////////////////////
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private final LatLng Monitorlatlng = new LatLng(28.258348849051746,113.04552182879037);
 | 
					 | 
					 | 
					 | 
					    private final LatLng Monitorlatlng = new LatLng(28.257553,113.0417);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private final static String Recieve_IP = "192.168.39.46";
 | 
					 | 
					 | 
					 | 
					    private final static String Recieve_IP = "192.168.39.46";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private final static int RECEIVE_PORT = 9987;
 | 
					 | 
					 | 
					 | 
					    private final static int RECEIVE_PORT = 9975;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private final static String SEND_to_IP = "192.168.39.47";
 | 
					 | 
					 | 
					 | 
					    private final static String SEND_to_IP = "192.168.39.195";
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private final static int SEND_PORT = 8888;
 | 
					 | 
					 | 
					 | 
					    private final static int SEND_PORT = 8888;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /////////////////////////////////////////////////////////////////
 | 
					 | 
					 | 
					 | 
					    /////////////////////////////////////////////////////////////////
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private InetAddress serverAddr;
 | 
					 | 
					 | 
					 | 
					    private InetAddress serverAddr;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -126,6 +128,7 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    protected void onCreate(Bundle savedInstanceState) {
 | 
					 | 
					 | 
					 | 
					    protected void onCreate(Bundle savedInstanceState) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        super.onCreate(savedInstanceState);
 | 
					 | 
					 | 
					 | 
					        super.onCreate(savedInstanceState);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        setContentView(R.layout.activity_main);
 | 
					 | 
					 | 
					 | 
					        setContentView(R.layout.activity_main);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (savedInstanceState != null) {
 | 
					 | 
					 | 
					 | 
					        if (savedInstanceState != null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 从保存的状态数据中恢复状态
 | 
					 | 
					 | 
					 | 
					            // 从保存的状态数据中恢复状态
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            value = savedInstanceState.getString("key");
 | 
					 | 
					 | 
					 | 
					            value = savedInstanceState.getString("key");
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -145,9 +148,10 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //检查安卓版本
 | 
					 | 
					 | 
					 | 
					        //检查安卓版本
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        checkingAndroidVersion();
 | 
					 | 
					 | 
					 | 
					        checkingAndroidVersion();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        udpReceiveThread = new UdpReceiveThread();
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        udpReceiveThread.startListening();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        addSensorMarker(Monitorlatlng);
 | 
					 | 
					 | 
					 | 
					        addSensorMarker(Monitorlatlng);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /**
 | 
					 | 
					 | 
					 | 
					    /**
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 检查Android版本
 | 
					 | 
					 | 
					 | 
					     * 检查Android版本
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -248,7 +252,7 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
 | 
					 | 
					 | 
					 | 
					        // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        aMap.setMyLocationEnabled(true);
 | 
					 | 
					 | 
					 | 
					        aMap.setMyLocationEnabled(true);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //设置最小缩放等级为16 ,缩放级别范围为[3, 20]
 | 
					 | 
					 | 
					 | 
					        //设置最小缩放等级为16 ,缩放级别范围为[3, 20]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        aMap.setMinZoomLevel(18);
 | 
					 | 
					 | 
					 | 
					        aMap.setMinZoomLevel(14);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //设置地图标志点击事件
 | 
					 | 
					 | 
					 | 
					        //设置地图标志点击事件
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        aMap.setOnMarkerClickListener(this);
 | 
					 | 
					 | 
					 | 
					        aMap.setOnMarkerClickListener(this);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //设置地图标志拖拽事件
 | 
					 | 
					 | 
					 | 
					        //设置地图标志拖拽事件
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -302,7 +306,10 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                city = aMapLocation.getCity();
 | 
					 | 
					 | 
					 | 
					                city = aMapLocation.getCity();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //当前位置经纬度坐标
 | 
					 | 
					 | 
					 | 
					                //当前位置经纬度坐标
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Current_latlng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
 | 
					 | 
					 | 
					 | 
					                Current_latlng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                MonitorDistance = AMapUtils.calculateLineDistance(Current_latlng,Monitorlatlng);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                Log.i(TAG, String.valueOf(Current_latlng.longitude));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                Log.i(TAG, String.valueOf(Current_latlng.latitude));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //获取纬度
 | 
					 | 
					 | 
					 | 
					                //获取纬度
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                double latitude = aMapLocation.getLatitude();
 | 
					 | 
					 | 
					 | 
					                double latitude = aMapLocation.getLatitude();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //获取经度
 | 
					 | 
					 | 
					 | 
					                //获取经度
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -310,6 +317,8 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Log.d("MainActivity", aMapLocation.getCity());
 | 
					 | 
					 | 
					 | 
					                Log.d("MainActivity", aMapLocation.getCity());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                showMsg(address);
 | 
					 | 
					 | 
					 | 
					                showMsg(address);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                udpReceiveThread = new UdpReceiveThread();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                udpReceiveThread.startListening();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //停止定位后,本地定位服务并不会被销毁
 | 
					 | 
					 | 
					 | 
					                //停止定位后,本地定位服务并不会被销毁
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                mLocationClient.stopLocation();
 | 
					 | 
					 | 
					 | 
					                mLocationClient.stopLocation();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (mListener != null) {
 | 
					 | 
					 | 
					 | 
					                if (mListener != null) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -391,7 +400,7 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .draggable(true)
 | 
					 | 
					 | 
					 | 
					                .draggable(true)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //标点图标
 | 
					 | 
					 | 
					 | 
					                //标点图标
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .icon(BitmapDescriptorFactory.
 | 
					 | 
					 | 
					 | 
					                .icon(BitmapDescriptorFactory.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        fromBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.img)))
 | 
					 | 
					 | 
					 | 
					                        fromBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.weizhi)))
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //备注
 | 
					 | 
					 | 
					 | 
					                //备注
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .title("路径点")
 | 
					 | 
					 | 
					 | 
					                .title("路径点")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .snippet("距离:")
 | 
					 | 
					 | 
					 | 
					                .snippet("距离:")
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -435,7 +444,7 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.drone)))
 | 
					 | 
					 | 
					 | 
					                        fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.drone)))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 备注
 | 
					 | 
					 | 
					 | 
					                // 备注
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .title("无人机")
 | 
					 | 
					 | 
					 | 
					                .title("无人机")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .snippet("距离:")
 | 
					 | 
					 | 
					 | 
					                
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        );
 | 
					 | 
					 | 
					 | 
					        );
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        droneMarker.showInfoWindow();
 | 
					 | 
					 | 
					 | 
					        droneMarker.showInfoWindow();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -631,14 +640,32 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    class ReceiveHandler extends Handler{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        @Override
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        public void handleMessage(Message msg) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (msg.what == 1) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                runOnUiThread(new Runnable() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    @Override
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    public void run() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        Context context = MainActivity.this;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        showAlert(context,"传感器报警");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        addDroneMarker();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        moveDrone();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public class UdpReceiveThread extends Thread {
 | 
					 | 
					 | 
					 | 
					    public class UdpReceiveThread extends Thread {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private static final String TAG = "UdpReceiveThread";
 | 
					 | 
					 | 
					 | 
					        private static final String TAG = "UdpReceiveThread";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private static final int mRECEIVE_PORT = RECEIVE_PORT;
 | 
					 | 
					 | 
					 | 
					        private static final int mRECEIVE_PORT = RECEIVE_PORT;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private boolean mRunning;
 | 
					 | 
					 | 
					 | 
					        private boolean mRunning = true;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private String mReceiveIp = Recieve_IP;
 | 
					 | 
					 | 
					 | 
					        private String mReceiveIp = Recieve_IP;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private String mExpectedData = "Motion detected!";
 | 
					 | 
					 | 
					 | 
					        private String mExpectedData = "Motion detected!";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private float udpMonitorDistance = MonitorDistance;
 | 
					 | 
					 | 
					 | 
					        private float udpMonitorDistance = MonitorDistance;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private String udpMonitorAngle = MonitorAngle;
 | 
					 | 
					 | 
					 | 
					        private String udpMonitorAngle = MonitorAngle;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private Handler receiveHandler = new ReceiveHandler();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        @Override
 | 
					 | 
					 | 
					 | 
					        @Override
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        public void run() {
 | 
					 | 
					 | 
					 | 
					        public void run() {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -654,11 +681,9 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    Log.d(TAG, "Received data: " + receivedString);
 | 
					 | 
					 | 
					 | 
					                    Log.d(TAG, "Received data: " + receivedString);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    if (receivedString.equals(mExpectedData)) {
 | 
					 | 
					 | 
					 | 
					                    if (receivedString.equals(mExpectedData)) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        Log.i(TAG, "run: 222222222222222222222222222");
 | 
					 | 
					 | 
					 | 
					                        Log.i(TAG, "run: 222222222222222222222222222");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        receiveHandler.sendEmptyMessage(1);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        sendCommand("WARNING "+String.valueOf(udpMonitorDistance)+" "+udpMonitorAngle);
 | 
					 | 
					 | 
					 | 
					                        sendCommand("WARNING "+String.valueOf(udpMonitorDistance)+" "+udpMonitorAngle);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        Context context = MainActivity.this;
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        showAlert(context,"传感器报警");
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        addDroneMarker();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        moveDrone();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        mRunning = false;
 | 
					 | 
					 | 
					 | 
					                        mRunning = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -672,17 +697,6 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                e.printStackTrace();
 | 
					 | 
					 | 
					 | 
					                e.printStackTrace();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        public void showAlert(Context context, String message) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            AlertDialog.Builder builder = new AlertDialog.Builder(context);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            builder.setTitle("警告");
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            builder.setMessage(message);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            builder.setIcon(R.drawable.warning);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            builder.setPositiveButton("确定", null);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            AlertDialog dialog = builder.create();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            dialog.show();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        public void startListening() {
 | 
					 | 
					 | 
					 | 
					        public void startListening() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            mRunning = true;
 | 
					 | 
					 | 
					 | 
					            mRunning = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            start();
 | 
					 | 
					 | 
					 | 
					            start();
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -693,6 +707,17 @@ public  class MainActivity extends AppCompatActivity implements AMapLocationList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public void showAlert(Context context, String message) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        AlertDialog.Builder builder = new AlertDialog.Builder(context);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        builder.setTitle("警告");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        builder.setMessage(message);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        builder.setIcon(R.drawable.warning);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        builder.setPositiveButton("确定", null);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        AlertDialog dialog = builder.create();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        dialog.show();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //以北为0度
 | 
					 | 
					 | 
					 | 
					    //以北为0度
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public static String calcAngle(Double centerLat, Double centerLon, Double anotherLat, Double anotherLon) {
 | 
					 | 
					 | 
					 | 
					    public static String calcAngle(Double centerLat, Double centerLon, Double anotherLat, Double anotherLon) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //差值
 | 
					 | 
					 | 
					 | 
					        //差值
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |