diff --git a/doc/软件设计约束.doc b/doc/软件设计约束.doc new file mode 100644 index 0000000..4043a13 Binary files /dev/null and b/doc/软件设计约束.doc differ diff --git a/model/Android终端类图.vsdx b/model/Android终端类图.vsdx new file mode 100644 index 0000000..62e0cec Binary files /dev/null and b/model/Android终端类图.vsdx differ diff --git a/model/无人机系统类图.vsdx b/model/无人机系统类图.vsdx new file mode 100644 index 0000000..589a768 Binary files /dev/null and b/model/无人机系统类图.vsdx differ diff --git a/model/用例图.vsdx b/model/用例图.vsdx new file mode 100644 index 0000000..43c21f3 Binary files /dev/null and b/model/用例图.vsdx differ diff --git a/model/用户界面类间关系.vsdx b/model/用户界面类间关系.vsdx new file mode 100644 index 0000000..768219a Binary files /dev/null and b/model/用户界面类间关系.vsdx differ diff --git a/model/部署图.vsdx b/model/部署图.vsdx new file mode 100644 index 0000000..8b24169 Binary files /dev/null and b/model/部署图.vsdx differ diff --git a/src/sixaunyi/.idea/sonarlint/issuestore/7/1/71fd1993763df2214bbdad8cfee650733993fe44 b/src/sixaunyi/.idea/sonarlint/issuestore/7/1/71fd1993763df2214bbdad8cfee650733993fe44 index 4e64334..344e932 100644 --- a/src/sixaunyi/.idea/sonarlint/issuestore/7/1/71fd1993763df2214bbdad8cfee650733993fe44 +++ b/src/sixaunyi/.idea/sonarlint/issuestore/7/1/71fd1993763df2214bbdad8cfee650733993fe44 @@ -1,30 +1,32 @@ C -java:S1604:"(Make this anonymous inner class a lambda( -= -java:S1604A"(Make this anonymous inner class a lambda(ډ -o java:S115!"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.( +java:S1604;"(Make this anonymous inner class a lambda( +> +java:S1604D"(Make this anonymous inner class a lambda( +o java:S115!"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.( +t java:S115""ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(Ӂ +t java:S1160"ZRename this field "Trans_to_Detect" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.( +y +java:S14500"^Remove the "Trans_to_Detect" field and declare it as a local variable in the relevant methods.( m -java:S14501"RRemove the "btn" field and declare it as a local variable in the relevant methods.(ȧ -m -java:S1450/"RRemove the "trs" field and declare it as a local variable in the relevant methods.(ܔ -` -java:S1124 "EReorder the modifiers to comply with the Java Language Specification.(Ժ +java:S14502"RRemove the "btn" field and declare it as a local variable in the relevant methods.(ȧ [ -java:S1124!"EReorder the modifiers to comply with the Java Language Specification.( +java:S1124!"EReorder the modifiers to comply with the Java Language Specification.( +` +java:S1124""EReorder the modifiers to comply with the Java Language Specification.(Ӂ [ -java:S1124""EReorder the modifiers to comply with the Java Language Specification.(ß +java:S1124#"EReorder the modifiers to comply with the Java Language Specification.(ß [ -java:S1124#"EReorder the modifiers to comply with the Java Language Specification.(Ӿ +java:S1124$"EReorder the modifiers to comply with the Java Language Specification.(Ӿ +V java:S125>"Use isEmpty() to check whether the collection is empty or not.(8㡌0 +java:S1155">Use isEmpty() to check whether the collection is empty or not.(8С0 +N +java:S1172"+Remove this unused method parameter "view".(ɑ80 \ -java:S1117"9Rename "query" which hides the field declared at line 67.(8㡌0 -^ java:S125" -java:S10689"(Remove this unused "city" private field.( +java:S1068;"(Remove this unused "city" private field.( ? -java:S1068C")Remove this unused "query" private field.( +java:S1068E")Remove this unused "query" private field.( H -java:S1068E"-Remove this unused "poiSearch" private field.( +java:S1068G"-Remove this unused "poiSearch" private field.( B -java:S1068G",Remove this unused "cityCode" private field.( \ No newline at end of file +java:S1068I",Remove this unused "cityCode" private field.( \ No newline at end of file diff --git a/src/sixaunyi/.idea/sonarlint/issuestore/9/6/9668392b13e33166876f2a7d3f10eb5405e757ad b/src/sixaunyi/.idea/sonarlint/issuestore/9/6/9668392b13e33166876f2a7d3f10eb5405e757ad new file mode 100644 index 0000000..c0f8e8b --- /dev/null +++ b/src/sixaunyi/.idea/sonarlint/issuestore/9/6/9668392b13e33166876f2a7d3f10eb5405e757ad @@ -0,0 +1,33 @@ + +o +java:S2293Z"YReplace the type specification in this constructor call with the diamond operator ("<>").(ռ +K +java:S1066"/Merge this if statement with the enclosing one.(܈ +K +java:S1066"/Merge this if statement with the enclosing one.( +> +java:S1604"(Make this anonymous inner class a lambda( +i +java:S1104%"SMake TV_show a static final constant or non-public and provide accessors if needed.( +> +java:S2189""Add an end condition to this loop.( +> +java:S2189""Add an end condition to this loop.( +k java:S116!"VRename this field "receive_Msg" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.( +g java:S116%"RRename this field "TV_show" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.( +^ +java:S1659#"CDeclare "total1" and all following declarations on a separate line.(Ƒ +c java:S100<"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(͚ +h +java:S3776~"RRefactor this method to reduce its Cognitive Complexity from 50 to the 15 allowed.( +u +java:S2142"^Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.( +W java:S125"Use isEmpty() to check whether the collection is empty or not.( +u +java:S2142"^Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.(䠹 +O java:S106"9Replace this use of System.out or System.err by a logger.( +A +java:S1068$"+Remove this unused "button0" private field.( \ No newline at end of file diff --git a/src/sixaunyi/.idea/sonarlint/issuestore/index.pb b/src/sixaunyi/.idea/sonarlint/issuestore/index.pb index 3ca498c..52ca20f 100644 --- a/src/sixaunyi/.idea/sonarlint/issuestore/index.pb +++ b/src/sixaunyi/.idea/sonarlint/issuestore/index.pb @@ -15,11 +15,13 @@ j :app/src/main/java/com/example/sixaunyi/SecondFragment.java,1\2\12963d86ac5c2888cc2a9ae459de5665bc06b01f ? settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233 -i -9app/src/main/java/com/example/sixaunyi/VideoActivity.java,7\1\71fd1993763df2214bbdad8cfee650733993fe44 P app/src/main/AndroidManifest.xml,8\c\8c55c3ccc257e5907959013f99656e4c8ec3903e @ app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164 h -8app/src/main/java/com/example/sixaunyi/MainActivity.java,7\c\7c120b7216f76ce98d1573d90803ab36f481640c \ No newline at end of file +8app/src/main/java/com/example/sixaunyi/MainActivity.java,7\c\7c120b7216f76ce98d1573d90803ab36f481640c +i +9app/src/main/java/com/example/sixaunyi/VideoActivity.java,7\1\71fd1993763df2214bbdad8cfee650733993fe44 +j +:app/src/main/java/com/example/sixaunyi/DetectActivity.java,9\6\9668392b13e33166876f2a7d3f10eb5405e757ad \ No newline at end of file diff --git a/src/sixaunyi/app/src/main/java/com/example/sixaunyi/DetectActivity.java b/src/sixaunyi/app/src/main/java/com/example/sixaunyi/DetectActivity.java index 14bc149..9f61cd3 100644 --- a/src/sixaunyi/app/src/main/java/com/example/sixaunyi/DetectActivity.java +++ b/src/sixaunyi/app/src/main/java/com/example/sixaunyi/DetectActivity.java @@ -27,7 +27,7 @@ import java.util.ArrayList; public class DetectActivity extends AppCompatActivity { /*接收发送定义的常量*/ - private String mIp= "192.168.0.11"; //这里是NodeMCU的IP Address,我们可以通过打开Arduino的串口监视器获取IP Address + private String mIp= "192.168.79.46"; //这里是NodeMCU的IP Address,我们可以通过打开Arduino的串口监视器获取IP Address private int mPort = 80; //WiFiServer server(80);建立网络服务器对象,监听端口(80)这里的80是自定义的,只要与Android中的socket一致就好。 private SendThread sendthread; String receive_Msg; diff --git a/src/sixaunyi/app/src/main/java/com/example/sixaunyi/MainActivity.java b/src/sixaunyi/app/src/main/java/com/example/sixaunyi/MainActivity.java index 68caf0d..7ae8a7f 100644 --- a/src/sixaunyi/app/src/main/java/com/example/sixaunyi/MainActivity.java +++ b/src/sixaunyi/app/src/main/java/com/example/sixaunyi/MainActivity.java @@ -6,6 +6,8 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.Manifest; +import android.annotation.SuppressLint; +import android.content.Intent; import android.graphics.BitmapFactory; import android.nfc.Tag; import android.os.Build; @@ -73,6 +75,8 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe private FloatingActionButton fabPOI; //浮动按钮 清空地图标点 private FloatingActionButton ClearMarker_btn; + //浮动按钮 更换活动 + private FloatingActionButton ChangeAct_btn; //标点列表 private List markerList = new ArrayList<>(); //标识参数类 @@ -82,12 +86,15 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe + @SuppressLint("MissingInflatedId") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fabPOI = findViewById(R.id.fab_poi); ClearMarker_btn = findViewById(R.id.clearMarker_btn); + ChangeAct_btn = findViewById(R.id.change_btn); + ChangeAct_btn.show(); //tvContent = findViewById(R.id.tv_content); /*初始化定位,需要在检查版本之前 *因为配置好之后才能启动定位,否则会报错 @@ -344,6 +351,12 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe ClearMarker_btn.hide(); } + public void changeAct(View view) { + Intent intent = new Intent(MainActivity.this, VideoActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); + startActivity(intent); + + } /* * * 通过坐标获取地址 * * * * diff --git a/src/sixaunyi/app/src/main/java/com/example/sixaunyi/VideoActivity.java b/src/sixaunyi/app/src/main/java/com/example/sixaunyi/VideoActivity.java index 22c2218..edd2898 100644 --- a/src/sixaunyi/app/src/main/java/com/example/sixaunyi/VideoActivity.java +++ b/src/sixaunyi/app/src/main/java/com/example/sixaunyi/VideoActivity.java @@ -23,14 +23,15 @@ import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; +import java.net.*; import android.os.Bundle; public class VideoActivity extends AppCompatActivity { - private final static String SEND_IP = "192.168.43.206"; //填写接收方IP - private final static String Fasong_mudi_IP = "192.168.43.41"; + private final static String SEND_to_IP = "192.168.10.2"; //填写接收方IP + private final static String Recieve_IP = "192.168.10.2";//填服务器IP private final static int SEND_PORT = 8888; //发送端口号 private final static int RECEIVE_PORT = 9999; //接收端口号 @@ -44,7 +45,7 @@ public class VideoActivity extends AppCompatActivity { private InetAddress serverAddr; private SendHandler sendHandler = new SendHandler(); private ReceiveHandler receiveHandler = new ReceiveHandler(); - private Button trs; + private Button Trans_to_Detect; private ImageView imgShow; private Button btn; @@ -54,15 +55,17 @@ public class VideoActivity extends AppCompatActivity { setContentView(R.layout.activity_video); imgShow = findViewById(R.id.img_show); btn = findViewById(R.id.btn_send); - trs = findViewById(R.id.transfer_to_detect); + Trans_to_Detect = findViewById(R.id.transfer_to_detect); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - new UdpSendThread().start(); - new UdpReceiveThread().start();//会导致闪退 + //new UdpSendThread().start(); + + new UdpReceiveThread().start(); + Log.i(TAG, "onClick: 2222222222222222222222222"); } }); - trs.setOnClickListener(new View.OnClickListener() { + Trans_to_Detect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(VideoActivity.this, DetectActivity.class); @@ -107,7 +110,7 @@ public class VideoActivity extends AppCompatActivity { try { reveSocket = new DatagramSocket(RECEIVE_PORT); - serverAddr = InetAddress.getByName(Fasong_mudi_IP); + serverAddr = InetAddress.getByName(Recieve_IP); //ByteArrayOutputStream out = new ByteArrayOutputStream(); while(listenStatus) { @@ -148,13 +151,14 @@ public class VideoActivity extends AppCompatActivity { // 创建DatagramSocket对象,使用端口8888 sendSocket = new DatagramSocket(8888); - serverAddr = InetAddress.getByName(Fasong_mudi_IP); + serverAddr = InetAddress.getByName(SEND_to_IP); DatagramPacket outPacket = new DatagramPacket(buf, buf.length, serverAddr, SEND_PORT); sendSocket.send(outPacket); sendSocket.close(); sendHandler.sendEmptyMessage(1); + Log.i(TAG, "run: 111111111111111111111111111111111111111111111111"); } catch (Exception e) { @@ -163,6 +167,81 @@ public class VideoActivity extends AppCompatActivity { } } + + + //************************************************************************************************* + + /*public class TelloControlDemo { + + private DatagramSocket socket; + private InetAddress telloAddress; + private int port = 8889; + + public void main(String[] args) throws IOException { + TelloControlDemo demo = new TelloControlDemo(); + demo.start(); + } + + public void start() throws IOException { + // Create a UDP socket + socket = new DatagramSocket(9000); + + telloAddress = InetAddress.getByName("192.168.10.1"); + + // Start the receiver thread + Thread receiverThread = new Thread(new Receiver()); + receiverThread.start(); + + System.out.println("\r\n\r\nTello Java Demo.\r\n"); + System.out.println("Tello: command takeoff land flip forward back left right \r\n" + + " up down cw ccw speed speed?\r\n"); + System.out.println("end -- quit demo.\r\n"); + + while (true) { + try { + // Read user input from console + byte[] buffer = new byte[1024]; + System.in.read(buffer); + String message = new String(buffer).trim(); + + if (message.equalsIgnoreCase("end")) { + System.out.println("..."); + socket.close(); + break; + } + + // Send command to Tello drone + byte[] sendData = message.getBytes(); + DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, telloAddress, port); + socket.send(sendPacket); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private class Receiver implements Runnable { + + @Override + public void run() { + byte[] receiveData = new byte[1024]; + DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); + + while (true) { + try { + // Receive data from Tello drone + socket.receive(receivePacket); + String message = new String(receivePacket.getData(), 0, receivePacket.getLength()); + System.out.println(message); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + }*/ + + } diff --git a/src/sixaunyi/app/src/main/res/layout/activity_detect.xml b/src/sixaunyi/app/src/main/res/layout/activity_detect.xml index 133346f..f47b233 100644 --- a/src/sixaunyi/app/src/main/res/layout/activity_detect.xml +++ b/src/sixaunyi/app/src/main/res/layout/activity_detect.xml @@ -11,7 +11,7 @@ android:gravity="center_horizontal" android:orientation="vertical" android:layout_height="match_parent" - android:background="@color/design_default_color_primary"> + android:background="@color/white"> + +