forked from KikiLetGo/CyberController
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 012c07e
Showing
94 changed files
with
4,714 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
### 重要事项 | ||
- 请把自己在HMS上申请的agconnect-services.json文件替换掉本项目的,并把build.gradle中的applicationId改成你自己的 | ||
- 把CyberApplication中配置的apiKey(setApiKey)改成你自己的 | ||
|
||
### 手机设置 | ||
- 使用前先让手机和电脑蓝牙配对和连接 | ||
- 把本App加入到电池白名单(电池优化选项中找到本App,选择不优化),否则息屏一段时间后,系统将断开socket连接,并且早Doze Mode下无法重连,电脑三连翻译快捷键将无法唤醒屏幕 | ||
- 在手机旋转设置中打开“旋转锁屏界面”,否则每次解锁(或点亮屏幕)的横竖屏切换体验不佳 | ||
- 最好关闭手机的锁屏界面,否则每次息屏后要解锁,体验不佳 | ||
|
||
### 关键代码思路提示 | ||
电脑上要执行的功能实际上是本App通过TCP连接注入的,这些功能脚本在`assets/command_scripts`下,比如`key_click.py`是在电脑上执行按键点击的功能脚本模板 | ||
```python | ||
def process(params): | ||
keys = params.split(',') | ||
for key in keys: | ||
key_down(key) | ||
key_up(key) | ||
process(params) | ||
``` | ||
在向电脑发送命令的时候只需要把这段脚本的文本,以及需要传入的`params`,然后发送给电脑就可以了,电脑上的python程序会自动解析并执行。 | ||
|
||
> 也就是说,如果有新的对电脑的控制,不需要修改电脑上的python程序,直接在客户端编写新的脚本发送过去注入执行就好。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#请替换成自己的配置 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.elexlab.cybercontroller" | ||
minSdkVersion 28 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'com.google.android.material:material:1.3.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
implementation 'com.github.mik3y:usb-serial-for-android:3.4.3' | ||
implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300' | ||
// 引入基础SDK | ||
implementation 'com.huawei.hms:ml-computer-translate:3.3.0.306' | ||
// 引入文本翻译算法包 | ||
implementation 'com.huawei.hms:ml-computer-translate-model:3.3.0.306' | ||
|
||
// 引入基础SDK | ||
implementation 'com.huawei.hms:ml-computer-vision-handkeypoint:3.3.0.300' | ||
// 引入手部关键点检测模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-handkeypoint-model:3.3.0.300' | ||
// 引入手势识别模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-gesture-model:3.3.0.300' | ||
|
||
|
||
// Liveness Detection sdk and FULL SDK | ||
implementation 'com.huawei.hms:ml-computer-vision-livenessdetection:2.2.0.300' | ||
|
||
//faceVerification | ||
implementation 'com.huawei.hms:ml-computer-vision-faceverify:2.2.0.300' | ||
implementation 'com.huawei.hms:ml-computer-vision-faceverify-model:2.2.0.300' | ||
|
||
// 引入基础SDK | ||
implementation 'com.huawei.hms:ml-computer-vision-face:3.3.0.300' | ||
// 引入人脸轮廓+关键点检测模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-face-shape-point-model:3.3.0.300' | ||
// 引入表情检测模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-face-emotion-model:3.3.0.300' | ||
// 引入特征检测模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-face-feature-model:3.3.0.300' | ||
// 引入3d检测模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-face-3d-model:3.3.0.300' | ||
|
||
// 引入实时语音识别服务插件 | ||
implementation 'com.huawei.hms:ml-computer-voice-asr-plugin:3.3.0.300' | ||
|
||
// 引入基础SDK | ||
implementation 'com.huawei.hms:ml-computer-vision-ocr:3.3.0.301' | ||
// 引入拉丁语文字识别模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-ocr-latin-model:3.3.0.301' | ||
// 引入日韩语文字识别模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-ocr-jk-model:3.3.0.301' | ||
// 引入中英文文字识别模型包 | ||
implementation 'com.huawei.hms:ml-computer-vision-ocr-cn-model:3.3.0.301' | ||
} | ||
|
||
apply plugin: 'com.huawei.agconnect' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/elexlab/cybercontroller/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.elexlab.cybercontroller; | ||
|
||
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.elexlab.cybercontroller", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.elexlab.cybercontroller"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH"/> | ||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | ||
<uses-permission android:name="android.permission.RECORD_AUDIO"/> | ||
|
||
|
||
<uses-feature android:name="android.hardware.bluetooth" android:required="true"/> | ||
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/> | ||
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/> | ||
|
||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
|
||
<uses-permission android:name="android.permission.CAMERA" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS"/> | ||
<uses-feature android:name="android.hardware.camera" /> | ||
<uses-feature android:name="android.hardware.camera.autofocus" /> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:name=".CyberApplication" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.CyberController"> | ||
|
||
<activity | ||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" | ||
android:screenOrientation="landscape" | ||
android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> | ||
</intent-filter> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" | ||
android:launchMode="singleInstance" | ||
android:name=".ui.activities.LoginActivity"> | ||
|
||
</activity> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def process(params): | ||
keys = params.split(',') | ||
for key in keys: | ||
key_down(key) | ||
key_up(key) | ||
process(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def process(params): | ||
keys = params.split(',') | ||
for key in keys: | ||
key_down(key) | ||
for key in keys: | ||
key_up(key) | ||
process(params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def text_input(params): | ||
pyperclip.copy(params) | ||
key_down("ctrl") | ||
key_down("v") | ||
key_up("v") | ||
key_up("ctrl") | ||
text_input(params) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions
53
app/src/main/java/com/elexlab/cybercontroller/CyberApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.elexlab.cybercontroller; | ||
|
||
import android.app.Application; | ||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.IntentFilter; | ||
|
||
import com.elexlab.cybercontroller.communication.BluetoothClient; | ||
import com.huawei.hms.mlsdk.common.MLApplication; | ||
|
||
public class CyberApplication extends Application { | ||
private static Context context; | ||
|
||
public static Context getContext() { | ||
return context; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
this.context = this; | ||
MLApplication.getInstance().setApiKey("替换成你自己的ApiKey"); | ||
|
||
BluetoothClient.bindContext(this); | ||
|
||
ScreenStatusReceiver mScreenStatusReceiver = new ScreenStatusReceiver(); | ||
|
||
IntentFilter intentFilter = new IntentFilter(); | ||
|
||
intentFilter.addAction(Intent.ACTION_SCREEN_ON); | ||
|
||
intentFilter.addAction(Intent.ACTION_SCREEN_OFF); | ||
|
||
registerReceiver(mScreenStatusReceiver, intentFilter); | ||
} | ||
|
||
@Override | ||
public void onTerminate() { | ||
super.onTerminate(); | ||
} | ||
|
||
private class ScreenStatusReceiver extends BroadcastReceiver{ | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
if ( "android.intent.action.SCREEN_ON".equals(intent.getAction())) { | ||
|
||
BluetoothClient.getInstance().active(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.