Compare commits

...

9 Commits

Author SHA1 Message Date
5de5a70003 refactoring ready 2024-12-08 20:26:05 +01:00
2c2f275d32 ignore changes to secret.h 2024-12-08 15:35:47 +01:00
dde808ed6d removing code 2024-12-08 15:35:26 +01:00
4de8c66a03 refactoring 2024-12-08 15:32:54 +01:00
34cd9075a8 ignore build 2024-12-08 15:32:41 +01:00
c41044def4 code addition 2024-12-08 15:07:48 +01:00
b3ec1a7891 initial implementation 2024-12-07 15:04:50 +01:00
50c6cc3206 add gitignore 2024-12-07 15:04:37 +01:00
c9637ed360 clear branch 2024-12-07 11:59:42 +01:00
56 changed files with 339 additions and 933 deletions

20
.gitignore vendored
View File

@ -1,16 +1,4 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
.idea/
server
.vscode
build
src/secret.h

35
Makefile Normal file
View File

@ -0,0 +1,35 @@
# Compiler and flags
CPPC = g++
CPPC_FLAGS = -s -O3 -lasound -lcryptopp -Wall -Wextra
SRC_PATH := src
OBJ_PATH := build/obj
BIN_PATH := build/bin
SRC_FILES := $(shell find $(SRC_PATH) -name '*.cpp')
# Generate corresponding object file paths by replacing src/ with build/obj/
OBJ_FILES := $(patsubst $(SRC_PATH)/%.cpp,$(OBJ_PATH)/%.o,$(SRC_FILES))
all: make-build-dir $(BIN_PATH)/TabletPcControl-server
make-build-dir:
mkdir -p $(OBJ_PATH)
mkdir -p $(BIN_PATH)
$(BIN_PATH)/TabletPcControl-server: $(OBJ_FILES)
$(CPPC) $(CPPC_FLAGS) $^ -o $@
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.cpp
$(CPPC) $(CPPC_FLAGS) -c $< -o $@
clean:
rm -fr build
.PHONY: all clean

1
app/.gitignore vendored
View File

@ -1 +0,0 @@
/build

View File

@ -1,49 +0,0 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "org.pupes.tabletpccontrol"
compileSdk = 33
defaultConfig {
applicationId = "org.pupes.tabletpccontrol"
minSdk = 16
//noinspection ExpiredTargetSdkVersion
targetSdk = 16
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.github.lukelorusso:VerticalSeekBar:1.2.7")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}

View File

@ -1,21 +0,0 @@
# 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

View File

@ -1,24 +0,0 @@
package org.pupes.tabletpccontrol
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("org.pupes.tabletpccontrol", appContext.packageName)
}
}

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TabletPCControl"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="landscape"
tools:ignore="DiscouragedApi">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

View File

@ -1,21 +0,0 @@
package org.pupes.tabletpccontrol
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.lukelorusso.verticalseekbar.VerticalSeekBar
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val audioVerticalSeekBar = findViewById<VerticalSeekBar>(R.id.AudioVerticalSeekBar)
audioVerticalSeekBar.setOnProgressChangeListener { progress ->
// Handle the progress value here
Log.d("VerticalSeekBar", "Current progress: $progress")
}
}
}

View File

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@ -1,30 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="16.933"
android:viewportHeight="14.393">
<group android:scaleX="0.43"
android:scaleY="0.3655"
android:translateX="4.825905"
android:translateY="4.5661793">
<path
android:pathData="M7.62,13.441L7.62,9.631C7.62,9.104 7.195,8.678 6.668,8.678l-5.715,0c-0.527,0 -0.952,0.425 -0.952,0.952l-0,3.81c-0,0.527 0.425,0.952 0.952,0.952L6.668,14.393C7.195,14.393 7.62,13.968 7.62,13.441ZM0.635,12.171l-0,-1.27l0.317,0l-0,1.27zM1.587,13.838L1.587,9.234L6.668,9.234l-0,4.604z"
android:fillColor="#ff9d1e"/>
<path
android:pathData="m15.346,5.556c0.437,0 0.79,-0.357 0.79,-0.794L16.14,0.794C16.14,0.357 15.782,0 15.346,0L8.996,0C8.559,0 8.202,0.357 8.202,0.794l0,3.969c0,0.437 0.357,0.794 0.794,0.794L7.408,5.556l0,0.794L16.933,6.35L16.933,5.556ZM8.996,0.794L15.346,0.794L15.346,4.762L8.996,4.762Z"
android:fillColor="#ff9d1e"/>
<path
android:pathData="M6.14,5.008 L5.719,5.428 6.095,5.801 7.153,4.743 6.095,3.685 5.721,4.058 6.14,4.479L3.978,4.479C3.687,4.479 3.449,4.717 3.449,5.008l0,2.381l0.529,0l0,-2.381z"
android:fillColor="#ff9d1e"/>
<path
android:pathData="m5.02,3.014c0.004,-0.033 0.007,-0.067 0.007,-0.104 0,-0.035 -0.002,-0.071 -0.008,-0.104L5.243,2.633C5.263,2.617 5.269,2.587 5.256,2.565L5.045,2.199C5.031,2.175 5.004,2.167 4.98,2.175L4.716,2.281C4.661,2.239 4.603,2.204 4.538,2.177L4.498,1.897C4.494,1.871 4.471,1.852 4.445,1.852L4.022,1.852C3.995,1.852 3.974,1.871 3.97,1.897L3.93,2.177C3.865,2.204 3.806,2.24 3.752,2.281L3.488,2.175C3.464,2.166 3.436,2.175 3.423,2.199L3.212,2.565C3.199,2.589 3.204,2.617 3.226,2.633l0.224,0.174C3.444,2.84 3.44,2.876 3.44,2.91c0,0.034 0.002,0.071 0.008,0.104l-0.224,0.174c-0.02,0.015 -0.025,0.045 -0.013,0.067l0.212,0.366c0.013,0.024 0.041,0.032 0.065,0.024l0.263,-0.106c0.055,0.042 0.114,0.077 0.179,0.104l0.04,0.28c0.006,0.026 0.026,0.045 0.053,0.045l0.423,0c0.026,0 0.049,-0.019 0.052,-0.045l0.04,-0.28c0.065,-0.026 0.125,-0.062 0.179,-0.104l0.263,0.106c0.024,0.009 0.052,0 0.065,-0.024l0.212,-0.366c0.013,-0.024 0.008,-0.052 -0.013,-0.067zM4.233,3.307c-0.218,0 -0.397,-0.179 -0.397,-0.397 0,-0.218 0.179,-0.397 0.397,-0.397 0.218,0 0.397,0.179 0.397,0.397 0,0.218 -0.179,0.397 -0.397,0.397z"
android:fillColor="#ff9d1e"/>
<path
android:pathData="m2.778,1.058 l0.265,0.265C3.7,0.665 4.766,0.665 5.424,1.323L5.689,1.058C4.886,0.255 3.582,0.255 2.778,1.058ZM3.307,1.588 L3.572,1.852c0.365,-0.365 0.958,-0.365 1.323,0l0.265,-0.265C4.649,1.077 3.819,1.077 3.307,1.588Z"
android:fillColor="#ff9d1e"/>
<path
android:pathData="m1.901,12.763l0,0.497l1.492,0l0,-0.497zM1.901,9.778l0,0.497l2.487,0L4.389,9.778ZM4.389,13.758l0,-0.497l1.99,0l0,-0.497l-1.99,0l0,-0.497l-0.497,0l0,1.492zM2.896,10.773l0,0.497l-0.995,0l0,0.497l0.995,0l0,0.497l0.497,0l0,-1.492zM6.379,11.768l0,-0.497l-2.487,0l0,0.497zM4.886,10.773l0.497,0L5.384,10.276l0.995,0L6.379,9.778L5.384,9.778L5.384,9.281l-0.497,0z"
android:strokeWidth="0.249"
android:fillColor="#ff9d1e"/>
</group>
</vector>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/switch_thumb_unchecked" android:state_checked="false" />
<item android:drawable="@drawable/switch_thumb_checked" android:state_checked="true" />
</selector>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/OrangeMain" />
<corners android:radius="7dp" />
</shape>
</item>
<item
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp">
<shape android:shape="rectangle">
<solid android:color="@color/white"/>
<corners android:radius="5dp"/>
<size android:height="30dp" android:width="60dp"/>
</shape>
</item>
</layer-list>

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/OrangeLight" />
<corners android:radius="7dp" />
</shape>
</item>
<item
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp">
<shape android:shape="rectangle">
<solid android:color="@color/white"/>
<corners android:radius="5dp"/>
<size android:height="30dp" android:width="60dp"/>
</shape>
</item>
</layer-list>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false">
<shape android:shape="rectangle">
<solid android:color="@color/OrangeLight"/>
<corners android:radius="1dp"/>
</shape>
</item>
<item android:state_checked="true">
<shape android:shape="rectangle">
<solid android:color="@color/OrangeMain"/>
<corners android:radius="1dp"/>
</shape>
</item>
</selector>

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#222"
tools:context=".MainActivity">
<com.lukelorusso.verticalseekbar.VerticalSeekBar
android:id="@+id/AudioVerticalSeekBar"
android:layout_width="100dp"
android:layout_height="546dp"
android:layout_marginStart="72dp"
android:layout_marginLeft="72dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.716"
app:vsb_bar_background="#161718"
app:vsb_bar_progress_gradient_end="@color/OrangeDark"
app:vsb_bar_progress_gradient_start="@color/OrangeMain"
app:vsb_progress="0"
app:vsb_show_thumb="false" />
<!--<com.google.android.material.switchmaterial.SwitchMaterial -->
<Switch
android:id="@+id/MuteSwitch"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="50dp"
android:scaleX="1.5"
android:scaleY="1.5"
app:layout_constraintBottom_toTopOf="@id/AudioVerticalSeekBar"
app:layout_constraintEnd_toEndOf="@id/AudioVerticalSeekBar"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="@id/AudioVerticalSeekBar"
app:track="@drawable/switch_track"
android:thumb="@drawable/switch_thumb"
tools:ignore="UseSwitchCompatOrMaterialXml" />
<TextView
android:id="@+id/VolumeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/master"
android:textSize="24sp"
app:layout_constraintTop_toBottomOf="@id/MuteSwitch"
app:layout_constraintStart_toStartOf="@id/MuteSwitch"
app:layout_constraintEnd_toEndOf="@id/MuteSwitch"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0"
android:layout_marginTop="9dp"
android:textColor="@color/White"/>
<!-- Initial progress -->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,7 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.TabletPCControl" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="OrangeLight">#fcd49f</color>
<color name="OrangeMain">#ff9100</color>
<color name="OrangeDark">#7a4b0f</color>
<color name="White">#ffffff</color>
</resources>

View File

@ -1,4 +0,0 @@
<resources>
<string name="app_name">Tablet PC control</string>
<string name="master">Master</string>
</resources>

View File

@ -1,9 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.TabletPCControl" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.TabletPCControl" parent="Base.Theme.TabletPCControl" />
</resources>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@ -1,17 +0,0 @@
package org.pupes.tabletpccontrol
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@ -1,14 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}
/*
allprojects {
repositories {
google()
mavenCentral()
maven("https://jitpack.io") // Add JitPack repository here
}
}*/

4
build.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
read -p "enter secret password: " SECRET
echo "#define SECRET \"$SECRET\"" > src/secret.h
make -j$(nproc)

View File

@ -1,24 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.injected.testOnly=false

View File

@ -1,26 +0,0 @@
[versions]
agp = "8.7.3"
kotlin = "1.9.24"
coreKtx = "1.15.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.6.1"
material = "1.10.0"
activity = "1.9.3"
constraintlayout = "2.1.4"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

Binary file not shown.

View File

@ -1,6 +0,0 @@
#Thu Dec 05 17:17:40 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored
View File

@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored
View File

@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,25 +0,0 @@
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}
rootProject.name = "Tablet PC control"
include(":app")

115
src/alsa.cpp Normal file
View File

@ -0,0 +1,115 @@
#include "helper_funcs.h"
#include <alsa/asoundlib.h>
#include <arpa/inet.h>
#include <cerrno>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <fcntl.h>
#include <iostream>
#include <netdb.h>
#include <netinet/in.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <unistd.h>
namespace alsa {
int get_volume(const char *selem_name) {
long min, max, volume;
snd_mixer_t *handle;
snd_mixer_selem_id_t *sid;
// Open mixer
snd_mixer_open(&handle, 0);
snd_mixer_attach(handle,
"default"); // Use "default" for the default sound card
snd_mixer_selem_register(handle, NULL, NULL);
snd_mixer_load(handle);
// Allocate and set mixer element ID
snd_mixer_selem_id_alloca(&sid);
snd_mixer_selem_id_set_name(sid, selem_name);
// Find the mixer element
snd_mixer_elem_t *elem = snd_mixer_find_selem(handle, sid);
int volume_percent;
if (elem) {
// Get the playback volume range
snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
// Get the current playback volume for front left channel
snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT,
&volume);
// Calculate the volume percentage
volume_percent = (volume - min) * 100 / (max - min);
} else {
std::cerr << "Mixer element not found\n";
snd_mixer_close(handle);
safe_exit(ENODEV);
}
// Clean up
snd_mixer_close(handle);
return volume_percent;
}
void set_volume(const char *selem_name, long volume_percent) {
long min, max;
snd_mixer_t *handle;
snd_mixer_selem_id_t *sid;
// Open mixer
snd_mixer_open(&handle, 0);
snd_mixer_attach(handle, "default"); // Use "default" instead of hw:0
snd_mixer_selem_register(handle, NULL, NULL);
snd_mixer_load(handle);
// Allocate and set mixer element ID
snd_mixer_selem_id_alloca(&sid);
snd_mixer_selem_id_set_name(sid, selem_name);
// Find the mixer element
snd_mixer_elem_t *elem = snd_mixer_find_selem(handle, sid);
if (elem) {
// Get the playback volume range
snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
// Calculate the new volume value
long volume = min + (volume_percent * (max - min) / 100);
// Set the playback volume
snd_mixer_selem_set_playback_volume_all(elem, volume);
printf("Volume set to %ld%%\n", volume_percent);
} else {
fprintf(stderr, "Mixer element not found\n");
}
// Clean up
snd_mixer_close(handle);
}
int main(int argc, char *argv[]) {
if (argc != 3) {
fprintf(stderr, "Usage: %s <selem_name> <volume_percent>\n", argv[0]);
return 1;
}
const char *selem_name = argv[1];
long volume_percent = atol(argv[2]);
set_volume(selem_name, volume_percent);
return 0;
}
} // namespace alsa

4
src/alsa.h Normal file
View File

@ -0,0 +1,4 @@
namespace alsa {
int get_volume(const char *selem_name);
void set_volume(const char *selem_name, long volume_percent);
} // namespace alsa

38
src/crypt.cpp Normal file
View File

@ -0,0 +1,38 @@
#include <cryptopp/aes.h>
#include <cryptopp/base64.h>
#include <cryptopp/filters.h>
#include <cryptopp/modes.h>
#include <iomanip>
#include <iostream>
#include <string>
int main() {
// Key and IV (Initialization Vector) for AES
CryptoPP::byte key[CryptoPP::AES::DEFAULT_KEYLENGTH] = {
'k', 'e', 'y', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '1', '0', '1', '1'};
CryptoPP::byte iv[CryptoPP::AES::BLOCKSIZE] = {'i', 'v', '1', '2', '3', '4',
'5', '6', '7', '8', '9', '1',
'0', '1', '1', '1'};
// Message to be encrypted
std::string plainText = "Hello, AES!";
std::string cipherText; // Declare cipherText variable
// Encrypt using AES in CBC mode
CryptoPP::CBC_Mode<CryptoPP::AES>::Encryption encryptor(key, sizeof(key), iv);
CryptoPP::StringSource(plainText, true,
new CryptoPP::StreamTransformationFilter(
encryptor, new CryptoPP::StringSink(cipherText)));
// Encode the encrypted message in Base64 format
std::string base64Encoded;
CryptoPP::StringSource(
cipherText, true,
new CryptoPP::Base64Encoder(new CryptoPP::StringSink(base64Encoded)));
// Display the Base64 encoded encrypted message
std::cout << "Encrypted Text (Base64): " << base64Encoded << std::endl;
return 0;
}

12
src/helper_funcs.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "main.h"
#include <iostream>
#include <unistd.h>
void safe_exit(int code) {
try {
std::clog << "Exiting\n";
close(serverSocket);
} catch (...) {
}
exit(code);
}

1
src/helper_funcs.h Normal file
View File

@ -0,0 +1 @@
void safe_exit(int code);

124
src/main.cpp Normal file
View File

@ -0,0 +1,124 @@
#include "alsa.h"
#include "helper_funcs.h"
#include "secret.h"
#include <alsa/asoundlib.h>
#include <arpa/inet.h>
#include <cerrno>
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <fcntl.h>
#include <iostream>
#include <netdb.h>
#include <netinet/in.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <unistd.h>
#define PORT 54321
int serverSocket;
int main(int argc, char *argv[]) {
std::string SecretNumCode_s = "";
for (char ch : SECRET) {
uint num = ch - 'a' + 1; // Convert 'a' to 1, 'b' to 2, etc.
SecretNumCode_s.append(std::to_string(num));
}
const long SecretNumCode = std::stoi(SecretNumCode_s);
// signal handlers
signal(SIGTERM, safe_exit);
signal(SIGINT, safe_exit);
signal(SIGQUIT, safe_exit);
signal(SIGHUP, safe_exit);
// error signal handlers
signal(SIGSEGV, safe_exit);
// creating socket
serverSocket = socket(AF_INET, SOCK_STREAM, 0);
// specifying the address
sockaddr_in serverAddress;
serverAddress.sin_family = AF_INET;
serverAddress.sin_port = htons(PORT);
serverAddress.sin_addr.s_addr = INADDR_ANY;
// binding socket.
while (bind(serverSocket, (struct sockaddr *)&serverAddress,
sizeof(serverAddress)) != 0) {
std::cerr << "error binding socket retring\n";
sleep(2);
}
// listening to the assigned socket
listen(serverSocket, 5);
accept_new_connection:
// accepting connection request
int clientSocket = accept(serverSocket, nullptr, nullptr);
pid_t pid;
pid = fork();
if (pid == -1) {
std::cerr << "Fork failed";
safe_exit(-1);
} else if (pid == 0) {
// child process
signal(SIGUSR1, exit);
char bufferSend[1024];
int volume_percent = INTMAX_MIN;
int volume_percent_old;
while (1) {
volume_percent_old = volume_percent;
volume_percent = alsa::get_volume("Master");
if (volume_percent != volume_percent_old) {
}
usleep(100000);
sprintf(bufferSend, "Volume: %d%%\n", alsa::get_volume("Master"));
if (send(clientSocket, bufferSend, strlen(bufferSend), 0) == -1) {
std::cerr << "send() returned an error code\n";
safe_exit(-1);
}
sleep(1);
}
} else {
// parent process
char bufferRecv[1024];
// recieving data
while (1) {
memset(&bufferRecv, 0, sizeof(bufferRecv));
int RecvRetVal = recv(clientSocket, bufferRecv, sizeof(bufferRecv), 0);
if (RecvRetVal > sizeof(bufferRecv) || RecvRetVal < 0) {
std::cerr << "recv() returned an error code\n";
safe_exit(RecvRetVal);
} else if (RecvRetVal == 0) {
// detect if client disconected
kill(pid, SIGUSR1);
close(clientSocket);
goto accept_new_connection;
}
std::cout << "Message from client: " << bufferRecv << std::endl;
}
// closing the socket.
close(serverSocket);
}
return 0;
}

1
src/main.h Normal file
View File

@ -0,0 +1 @@
extern int serverSocket;

1
src/secret.h Normal file
View File

@ -0,0 +1 @@
#define SECRET ""