Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions ClientClose.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.example.zhi;

import java.io.IOException;
import java.net.*;
public class ClientClose {


public static void main(String[] args) {
URL url = null;
HttpURLConnection connection = null;
try {
url = new URL("http://192.168.1.199:80/update?button=1");
connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
System.out.println("设置链接成功");
} catch (IOException e) {
e.printStackTrace();
}

try {
connection.setRequestMethod("GET");
System.out.println("方法设置成功");
} catch (ProtocolException e) {
e.printStackTrace();
}
} catch (MalformedURLException e) {
e.printStackTrace();
}


try {
System.out.println("连接中");
connection.connect();
System.out.println("链接成功");
int responseCode = connection.getResponseCode();
System.out.println(responseCode);
} catch (IOException e) {
e.printStackTrace();
}


}
}
43 changes: 43 additions & 0 deletions ClientOpen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.example.zhi;
import java.io.IOException;
import java.net.*;
public class ClientOpen {


public static void main(String[] args) {
URL url = null;
HttpURLConnection connection = null;
try {
url = new URL("http://192.168.1.199:80/update?button=0");
connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
System.out.println("设置链接成功");
} catch (IOException e) {
e.printStackTrace();
}

try {
connection.setRequestMethod("GET");
System.out.println("方法设置成功");
} catch (ProtocolException e) {
e.printStackTrace();
}
} catch (MalformedURLException e) {
e.printStackTrace();
}


try {
System.out.println("连接中");
connection.connect();
System.out.println("链接成功");
int responseCode = connection.getResponseCode();
System.out.println(responseCode);
} catch (IOException e) {
e.printStackTrace();
}


}
}
26 changes: 26 additions & 0 deletions ExampleInstrumentedTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.zhi;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.zhi", appContext.getPackageName());
}
}
57 changes: 0 additions & 57 deletions LightESP.ino

This file was deleted.

38 changes: 38 additions & 0 deletions MD5Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.example.zhi;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Utils {
//md5 加密算法
public static String md5(String text) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("md5");
// 数组 byte[] result -> digest.digest( ); 文本 text.getBytes();
byte[] result = digest.digest(text.getBytes());
//创建StringBuilder对象 然后建议StringBuffer,安全性高
//StringBuilder sb = new StringBuilder();
StringBuffer sb = new StringBuffer();
// result数组,digest.digest ( ); -> text.getBytes();
// for 循环数组byte[] result;
for (byte b : result){
// 0xff 为16进制
int number = b & 0xff;
// number值 转换 字符串 Integer.toHexString( );
String hex = Integer.toHexString(number);
if (hex.length() == 1){
sb.append("0"+hex);
}else {
sb.append(hex);
}
}
//sb StringBuffer sb = new StringBuffer();对象实例化
return sb.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
//发送异常return空字符串
return "";
}
}
}

42 changes: 42 additions & 0 deletions MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.example.zhi;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button1=(Button) findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,xianshishebei.class);
startActivity(intent);
}
});
Button button2=(Button) findViewById(R.id.button2);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this, guanyu.class);
startActivity(intent);
}
});

Button button4=(Button) findViewById(R.id.button4);
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,yijianfankui.class);
startActivity(intent);
}
});
}
}
25 changes: 25 additions & 0 deletions addDevice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.example.zhi;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class addDevice extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_device);
Button btn=(Button) findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(addDevice.this, "连接成功", Toast.LENGTH_SHORT).show();
}
});
}

}
Binary file added dormitory1.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dormitory2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dormitory3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dormitory4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions guanyu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.zhi;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

public class guanyu extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_guanyu);
ImageButton imageButton=(ImageButton) findViewById(R.id.close);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
Binary file added ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading