Skip to content

Commit

Permalink
更新V1.2.1
Browse files Browse the repository at this point in the history
- 修改界面UI
- 更完善,体验更好的物理键盘支持,小窗和全屏均支持物理键盘输入
- 中心服务器支持同步内网ipv4地址,没有ipv6也可以互相发现啦
- 新的图标
- 调整参数设置
- 巴拉巴拉
  • Loading branch information
mingzhixian committed Dec 10, 2023
1 parent 00d38bc commit b76ba2b
Show file tree
Hide file tree
Showing 74 changed files with 778 additions and 797 deletions.
10 changes: 7 additions & 3 deletions HOW_TO_USE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# 易控(Easycontrol)使用说明

## 被控端准备
## 相关文件或链接
1. 视频教程(旧版本教程,新版本以文本说明为准):[B站](https://www.bilibili.com/video/BV1vu411j7rh)
2. 电脑ADB文件:[蓝奏云](https://cloudstar.lanzoue.com/iAWKJ128mnif) 密码:scrcpy
3. 易控软件:新版本不再免费提供安装包,需前往下载群付费下载(10元),或下载源码手动编译,[下载群](https://gitee.com/mingzhixianweb/easycontrol/raw/master/pic/other/qq_download.webp)

## 被控端准备
1. 被控端手机连续点击关于手机-版本号,直至提示打开开发者选项
2. 开发者选项打开USB调试
3. 电脑下载解压ADB文件
4. 被控端手机连接电脑
5. 在ADB所在文件夹按住Shift+右击打开命令行
5. 电脑下载ADB文件并解压:[蓝奏云](https://cloudstar.lanzoue.com/iAWKJ128mnif) 密码:scrcpy
6. 在ADB所在文件夹按住Shift+右击打开命令行
6. 执行以下命令开启无线调试:
``` shell
// root用户(永久):
Expand All @@ -19,7 +24,6 @@ adb tcpip 5555
7. 网络环境拥有防火墙或使用内网穿透的用户,请注意放通被控端ADB端口以及端口号+1端口,例如,上面开启无线调试时设置了ADB端口为5555,则需放行5555端口以及5556端口

## 软件使用

1. 简单使用
- 主控端安装易控,打开软件进行悬浮窗授权,添加设备(地址为被控端地址加ADB端口号),点击添加后的设备,被控端同意永久调试,开始投屏
- 设备地址格式:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gitee和GitHub代码将保持同步,请自行选择。软件发行版本将仅
- 支持小窗显示与全屏显示
- 支持多设备同时连接
- 支持多设备之间剪切板无感同步
- 支持物理键盘输入(不完善,目前仅全屏控制下支持,且需配合QQ输入法等输入中文)
- 支持物理键盘输入(需配合微信输入法或QQ输入法等输入中文)

## 使用说明
[点击此处前往易控使用说明](https://gitee.com/mingzhixianweb/easycontrol/blob/master/HOW_TO_USE.md)<br/>
Expand Down
9 changes: 5 additions & 4 deletions easycontrol/.idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions easycontrol/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 27 additions & 36 deletions easycontrol/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions easycontrol/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "top.saymzx.easycontrol.app"
minSdk 21
targetSdk 34
versionCode 10114
versionName "1.1.14"
versionCode 10201
versionName "1.2.1"
resConfigs "zh"
resConfigs "xhdpi"
ndk {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package top.saymzx.easycontrol.adb;

import android.hardware.usb.UsbDevice;
import android.util.Log;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.Log;
import android.util.Pair;
import android.widget.Toast;

import java.util.UUID;
Expand Down Expand Up @@ -66,7 +62,7 @@ public void onCreate(Bundle savedInstanceState) {
// 启动Center检查服务
CenterHelper.checkCenter(null);
alarmPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_CENTER_SERVICE), PendingIntent.FLAG_IMMUTABLE);
((AlarmManager) getSystemService(Context.ALARM_SERVICE)).setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), AlarmManager.INTERVAL_FIFTEEN_MINUTES, alarmPendingIntent);
((AlarmManager) getSystemService(Context.ALARM_SERVICE)).setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), 1000 * 60 * 5, alarmPendingIntent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Pair;
import android.widget.ArrayAdapter;
import android.widget.Toast;

import java.io.File;

import top.saymzx.easycontrol.adb.AdbKeyPair;
import top.saymzx.easycontrol.app.databinding.ActivitySetBinding;
import top.saymzx.easycontrol.app.entity.AppData;
import top.saymzx.easycontrol.app.entity.Device;
import top.saymzx.easycontrol.app.helper.PublicTools;

public class SetActivity extends Activity {
Expand All @@ -33,21 +30,8 @@ public void onCreate(Bundle savedInstanceState) {

// 设置默认值
private void drawUi() {
ArrayAdapter<String> maxSizeAdapter = new ArrayAdapter<>(this, R.layout.item_spinner_item, PublicTools.maxSizeList);
ArrayAdapter<String> maxFpsAdapter = new ArrayAdapter<>(this, R.layout.item_spinner_item, PublicTools.maxFpsList);
ArrayAdapter<String> videoBitAdapter = new ArrayAdapter<>(this, R.layout.item_spinner_item, PublicTools.videoBitList);
// 默认参数
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "使能音频", new Pair<>(AppData.setting.getDefaultIsAudio(), Device.isAudioDetail), isChecked -> AppData.setting.setDefaultIsAudio(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSpinnerCard(this, "最大大小", maxSizeAdapter, new Pair<>(String.valueOf(AppData.setting.getDefaultMaxSize()), Device.maxSizeDetail), str -> AppData.setting.setDefaultMaxSize(Integer.parseInt(str))).getRoot());
setActivity.setDefault.addView(PublicTools.createSpinnerCard(this, "最大帧率", maxFpsAdapter, new Pair<>(String.valueOf(AppData.setting.getDefaultMaxFps()), Device.maxFpsDetail), str -> AppData.setting.setDefaultMaxFps(Integer.parseInt(str))).getRoot());
setActivity.setDefault.addView(PublicTools.createSpinnerCard(this, "最大码率", videoBitAdapter, new Pair<>(String.valueOf(AppData.setting.getDefaultMaxVideoBit()), Device.maxVideoBitDetail), str -> AppData.setting.setDefaultMaxVideoBit(Integer.parseInt(str))).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "修改分辨率", new Pair<>(AppData.setting.getDefaultSetResolution(), Device.setResolutionDetail), isChecked -> AppData.setting.setDefaultSetResolution(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "优先H265", new Pair<>(AppData.setting.getUseH265(), Device.useH265Detail), isChecked -> AppData.setting.setUseH265(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "优先Opus", new Pair<>(AppData.setting.getUseOpus(), Device.useOpusDetail), isChecked -> AppData.setting.setUseOpus(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "使用隧道传输", new Pair<>(AppData.setting.getUseTunnel(), Device.useTunnelDetail), isChecked -> AppData.setting.setUseTunnel(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "熄屏控制", new Pair<>(AppData.setting.getTurnOffScreen(), Device.turnOffScreenDetail), isChecked -> AppData.setting.setTurnOffScreen(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "自动屏幕控制", new Pair<>(AppData.setting.getAutoControlScreen(), Device.autoControlScreenDetail), isChecked -> AppData.setting.setAutoControlScreen(isChecked)).getRoot());
setActivity.setDefault.addView(PublicTools.createSwitchCard(this, "默认全屏启动", new Pair<>(AppData.setting.getDefaultFull(), Device.defaultFullDetail), isChecked -> AppData.setting.setDefaultFull(isChecked)).getRoot());
PublicTools.createDeviceOptionSet(this, setActivity.setDefault, null);
// 显示
setActivity.setDisplay.addView(PublicTools.createSwitchCard(this, "主控端自动旋转", AppData.setting.getMasterAudoRotation(), isChecked -> AppData.setting.setMasterAudoRotation(isChecked)).getRoot());
setActivity.setDisplay.addView(PublicTools.createSwitchCard(this, "被控端方向跟随", AppData.setting.getSlaveAudoRotation(), isChecked -> AppData.setting.setSlaveAudoRotation(isChecked)).getRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ public void onInputBufferAvailable(MediaCodec mediaCodec, int inIndex) {
@Override
public void onOutputBufferAvailable(@NonNull MediaCodec mediaCodec, int outIndex, @NonNull MediaCodec.BufferInfo bufferInfo) {
audioTrack.write(decodec.getOutputBuffer(outIndex), bufferInfo.size, AudioTrack.WRITE_NON_BLOCKING);
decodec.releaseOutputBuffer(outIndex, false);
try {
decodec.releaseOutputBuffer(outIndex, false);
} catch (IllegalStateException ignored) {
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void startServer(Device device, Pair<String, Integer> address) throws Ex
+ " maxFps=" + device.maxFps
+ " maxVideoBit=" + device.maxVideoBit
+ " turnOffScreen=" + (device.turnOffScreen ? 1 : 0)
+ " autoControlScreen=" + (device.autoControlScreen ? 1 : 0)
+ " autoLockAfterControl=" + (device.autoLockAfterControl ? 1 : 0)
+ " reSize=" + reSize
+ " useH265=" + ((device.useH265 && supportH265) ? 1 : 0)
+ " useOpus=" + ((device.useOpus && supportOpus) ? 1 : 0) + " > /dev/null 2>&1 &", false);
Expand Down Expand Up @@ -144,7 +144,7 @@ private void createSubService() throws IOException, InterruptedException {
if (mainClientStream.readByte() == 1) {
boolean useOpus = mainClientStream.readByte() == 1;
if (mainClientStream.readByte() != AUDIO_EVENT) throw new IOException("启动Client失败:数据错误-应为AUDIO_EVENT");
audioDecode = new AudioDecode(useOpus,mainClientStream.readFrame());
audioDecode = new AudioDecode(useOpus, mainClientStream.readFrame());
}
threads.add(new Thread(this::executeMainStreamIn));
threads.add(new Thread(this::executeVideoStreamIn));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ public void sendTouchEvent(int action, int p, float x, float y, int offsetTime)
}

// 发送按键事件
public void sendKeyEvent(int key) {
ByteBuffer byteBuffer = ByteBuffer.allocate(5);
public void sendKeyEvent(int key, int meta) {
ByteBuffer byteBuffer = ByteBuffer.allocate(9);
// 输入事件
byteBuffer.put((byte) 2);
// 按键类型
byteBuffer.putInt(key);
byteBuffer.putInt(meta);
byteBuffer.flip();
client.write(byteBuffer.array());
}
Expand All @@ -84,23 +85,18 @@ public void sendKeepAlive() {
client.write(new byte[]{4});
}

// 发送按键事件
public void sendPowerEvent() {
client.write(new byte[]{5});
}

// 发送修改分辨率事件
public void sendChangeSizeEvent(float newSize) {
ByteBuffer byteBuffer = ByteBuffer.allocate(5);
byteBuffer.put((byte) 6);
byteBuffer.put((byte) 5);
byteBuffer.putFloat(newSize);
byteBuffer.flip();
client.write(byteBuffer.array());
}

// 发送旋转请求事件
public void sendRotateEvent(boolean isPortrait) {
client.write(new byte[]{7, (byte) (isPortrait ? 0 : 1)});
client.write(new byte[]{6, (byte) (isPortrait ? 0 : 1)});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ public void onInputBufferAvailable(MediaCodec mediaCodec, int inIndex) {

@Override
public void onOutputBufferAvailable(@NonNull MediaCodec mediaCodec, int outIndex, @NonNull MediaCodec.BufferInfo bufferInfo) {
decodec.releaseOutputBuffer(outIndex, bufferInfo.presentationTimeUs);
try {
decodec.releaseOutputBuffer(outIndex, bufferInfo.presentationTimeUs);
} catch (IllegalStateException ignored) {
}
}

@Override
Expand Down
Loading

0 comments on commit b76ba2b

Please sign in to comment.