[+] HarmonyOS -> Android

This commit is contained in:
acgist
2023-03-20 20:51:05 +08:00
parent 409a4a94c3
commit c216d8a611
97 changed files with 740 additions and 529 deletions

7
.gitmodules vendored
View File

@@ -1,12 +1,9 @@
[submodule "taoyao-client-media/mediasoup"]
path = taoyao-client-media/mediasoup
url = https://gitee.com/acgist/mediasoup.git
branch = taoyao
[submodule "taoyao-client-web/mediasoup-client"]
path = taoyao-client-web/mediasoup-client
url = https://gitee.com/acgist/mediasoup-client.git
branch = taoyao
[submodule "taoyao-client-harmony/libmediasoupclient"]
path = taoyao-client-harmony/libmediasoupclient
[submodule "taoyao-client-android/libmediasoupclient"]
path = taoyao-client-android/libmediasoupclient
url = https://gitee.com/acgist/libmediasoupclient.git
branch = taoyao

View File

@@ -21,9 +21,9 @@
|模块|名称|描述|
|:--|:--|:--|
|taoyao-client-web|Web终端|提供前端控制页面|
|taoyao-client-media|媒体服务|提供音视频接入服务|
|taoyao-client-harmony|鸿蒙终端|鸿蒙智能终端接入|
|taoyao-client-web|Web终端|Web终端|
|taoyao-client-media|媒体终端|媒体服务|
|taoyao-client-android|安卓终端|安卓终端|
|taoyao-signal-server|信令服务|终端信令控制|
## 证书

View File

@@ -1,4 +1,4 @@
# 鸿蒙终端
# 安卓终端
## C++终端
@@ -8,6 +8,5 @@
## 学习资料
https://developer.harmonyos.com/cn/develop/
https://developer.harmonyos.com/cn/docs/documentation/doc-guides/start-overview-0000000000029602
https://developer.harmonyos.com/cn/docs/documentation/doc-references/reference-document-outline-0000001115016824
https://developer.android.google.cn/docs?hl=zh-cn
https://developer.android.google.cn/guide?hl=zh-cn

View File

@@ -1,12 +1,7 @@
local.properties
.clangd
.clang-tidy
.clang-format
**/.cxx
**/.idea
**/.gradle
**/build
**/node_modules

View File

@@ -0,0 +1,33 @@
plugins {
id 'com.android.library'
}
android {
namespace 'com.acgist.client.boot'
compileSdk 32
defaultConfig {
minSdk 31
targetSdk 32
versionCode 100
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
testImplementation 'junit:junit:4.13.2'
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@@ -1,4 +1,4 @@
package com.acgist.taoyao.model;
package com.acgist.taoyao.boot.model;
import java.io.Serializable;

View File

@@ -1,10 +1,10 @@
package com.acgist.taoyao.model;
package com.acgist.taoyao.boot.model;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.acgist.taoyao.utils.JSONUtils;
import com.acgist.taoyao.boot.utils.JSONUtils;
import com.fasterxml.jackson.annotation.JsonIncludeProperties;

View File

@@ -1,4 +1,4 @@
package com.acgist.taoyao.utils;
package com.acgist.taoyao.boot.utils;
import java.time.LocalDate;
import java.time.LocalDateTime;

View File

@@ -1,4 +1,4 @@
package com.acgist.taoyao.utils;
package com.acgist.taoyao.boot.utils;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;

View File

@@ -0,0 +1,4 @@
plugins {
id 'com.android.library' version '7.4.2' apply false
id 'com.android.application' version '7.4.2' apply false
}

View File

@@ -0,0 +1,56 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.acgist.taoyao.client'
compileSdk 32
defaultConfig {
minSdk 31
targetSdk 32
versionCode 100
versionName "1.0.0"
applicationId "com.acgist.taoyao.client"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cFlags '-std=c17'
cppFlags '-std=c++17'
// CPU架构x86_64、x86、armeabi-v7a、arm64-v8a
abiFilters 'arm64-v8a'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.22.1'
}
}
}
dependencies {
implementation project(path: ':boot')
implementation fileTree(dir: 'libs', include: ['*.so', '*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@@ -0,0 +1 @@
-optimizationpasses 5

View File

@@ -0,0 +1,20 @@
package com.acgist.taoyao;
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.*;
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.acgist.taoyao", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<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:supportsRtl="true"
android:theme="@style/Theme.Taoyao">
<service
android:name=".client.MediaService"
android:enabled="true"
android:exported="false" />
<activity
android:name=".client.SettingsActivity"
android:exported="false"
android:label="@string/title_activity_settings" />
<activity
android:name=".client.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.22.1)
project(taoyao VERSION 1.0.0 LANGUAGES C CXX)
@@ -7,13 +7,13 @@ project(taoyao VERSION 1.0.0 LANGUAGES C CXX)
# set(CMAKE_BUILD_TYPE Debug)
# C
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -O3")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c17 -O0 -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c17 -O3")
# C++
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17 -O3")
@@ -22,16 +22,23 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17 -O3")
# set(PROJECT_BINARY_DIR ${PROJECT_SOURCE_DIR}/build)
file(
GLOB SOURCE_FILE
"main.hpp"
"include/*.hpp"
"mediasoup/*.hpp"
"main.cpp"
"media/*.cpp"
GLOB SOURCE_FILE
"main.hpp"
"include/*.hpp"
"mediasoup/*.hpp"
"main.cpp"
"media/*.cpp"
)
add_library(taoyao SHARED ${SOURCE_FILE})
target_link_libraries(taoyao libhilog_ndk.z.so)
find_library(
log-lib
log
)
target_link_libraries(
taoyao
${log-lib}
)
#
# cmake -B build

View File

@@ -0,0 +1,10 @@
#include <jni.h>
#include <string>
extern "C" JNIEXPORT jstring JNICALL
Java_com_acgist_taoyao_MainActivity_stringFromJNI(
JNIEnv* env,
jobject /* this */) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -0,0 +1,32 @@
package com.acgist.taoyao.client;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.acgist.taoyao.client.databinding.ActivityMainBinding;
import java.util.List;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
static {
System.loadLibrary("taoyao");
}
private ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
TextView tv = binding.sampleText;
tv.setText(stringFromJNI());
}
public native String stringFromJNI();
}

View File

@@ -0,0 +1,15 @@
package com.acgist.taoyao.client;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
public class MediaService extends Service {
public MediaService() {
}
@Override
public IBinder onBind(Intent intent) {
throw new UnsupportedOperationException("Not yet implemented");
}
}

View File

@@ -0,0 +1,18 @@
package com.acgist.taoyao.client;
import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.acgist.taoyao.client.R;
public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
}
}

View File

@@ -0,0 +1,4 @@
package com.acgist.taoyao.client.media;
public class AudioPublisher {
}

View File

@@ -0,0 +1,4 @@
package com.acgist.taoyao.client.media;
public class MediaRecorder {
}

View File

@@ -0,0 +1,4 @@
package com.acgist.taoyao.client.media;
public class VideoPublisher {
}

View File

@@ -1,9 +1,9 @@
package com.acgist.taoyao.signal;
package com.acgist.taoyao.client.signal;
import com.acgist.taoyao.model.Header;
import com.acgist.taoyao.model.Message;
import com.acgist.taoyao.utils.CloseableUtils;
import com.acgist.taoyao.utils.JSONUtils;
import com.acgist.taoyao.boot.model.Header;
import com.acgist.taoyao.boot.model.Message;
import com.acgist.taoyao.boot.utils.CloseableUtils;
import com.acgist.taoyao.boot.utils.JSONUtils;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@@ -258,10 +258,10 @@ public class Taoyao {
final LocalDateTime time = LocalDateTime.now();
return
100000000000000L * time.getDayOfMonth() +
1000000000000L * time.getHour() +
10000000000L * time.getMinute() +
100000000L * time.getSecond() +
1000000L * this.clientIndex +
1000000000000L * time.getHour() +
10000000000L * time.getMinute() +
100000000L * time.getSecond() +
1000000L * this.clientIndex +
index;
}

View File

@@ -0,0 +1,19 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.acgist.taoyao.client.MainActivity">
<TextView
android:id="@+id/sample_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,5 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Taoyao" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
</style>
</resources>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="reply_entries">
<item>Reply</item>
<item>Reply to all</item>
</string-array>
<string-array name="reply_values">
<item>reply</item>
<item>reply_all</item>
</string-array>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">桃夭</string>
<string name="title_activity_settings">SettingsActivity</string>
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>
<string name="sync_title">Sync email periodically</string>
<string name="attachment_title">Download incoming attachments</string>
<string name="attachment_summary_on">Automatically download attachments for incoming emails</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Taoyao" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
</style>
</resources>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content></full-backup-content>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup></cloud-backup>
</data-extraction-rules>

View File

@@ -0,0 +1,12 @@
package com.acgist.taoyao;
import org.junit.Test;
import static org.junit.Assert.*;
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx512m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.nonTransitiveRClass=true

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Mon Mar 20 09:51:37 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
taoyao-client-android/taoyao/gradlew vendored Normal file
View File

@@ -0,0 +1,185 @@
#!/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" "$@"

View File

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

@@ -0,0 +1,17 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "taoyao"
include ':boot'
include ':client'

View File

@@ -1,41 +0,0 @@
apply plugin: 'com.huawei.ohos.app'
ohos {
signingConfigs {
debug {
storeFile file('C:\\Users\\acgis\\.ohos\\config\\auto_debug_taoyao_com.acgist.taoyao_30086000001511570.p12')
storePassword '0000001BF429DD369062C4630873F17257C6AE37F3B5CCC5BE92C1DE60CEBE94E3592C9A6423F38CA5C88E'
keyAlias = 'debugKey'
keyPassword '0000001B814502DD14E5F3430066B6F451C85FFB36AB7ADB13AC53823EB7A3F644FED4758F5053827B968D'
signAlg = 'SHA256withECDSA'
profile file('C:\\Users\\acgis\\.ohos\\config\\auto_debug_taoyao_com.acgist.taoyao_30086000001511570.p7b')
certpath file('C:\\Users\\acgis\\.ohos\\config\\auto_debug_taoyao_com.acgist.taoyao_30086000001511570.cer')
}
}
compileSdkVersion 7
}
buildscript {
repositories {
maven {
url 'https://repo.huaweicloud.com/repository/maven/'
}
maven {
url 'https://developer.huawei.com/repo/'
}
}
dependencies {
classpath 'com.huawei.ohos:hap:3.1.2.0'
classpath 'com.huawei.ohos:decctest:1.2.7.19'
}
}
allprojects {
repositories {
maven {
url 'https://repo.huaweicloud.com/repository/maven/'
}
maven {
url 'https://developer.huawei.com/repo/'
}
}
}

View File

@@ -1,34 +0,0 @@
apply plugin: 'com.huawei.ohos.hap'
apply plugin: 'com.huawei.ohos.decctest'
ohos {
compileSdkVersion 7
defaultConfig {
compatibleSdkVersion 7
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
externalNativeBuild {
path "src/main/cpp/CMakeLists.txt"
cppFlags ""
arguments ""
abiFilters "arm64-v8a"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.so', '*.jar', '*.har'])
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
testImplementation 'junit:junit:4.13.1'
ohosTestImplementation 'com.huawei.ohos.testkit:runner:2.0.0.400'
}
decc {
supportType = ['xml', 'html']
}

View File

@@ -1,60 +0,0 @@
{
"app": {
"bundleName": "com.acgist.taoyao",
"vendor": "acgist",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"keepAlive": true
}
},
"module": {
"package": "com.acgist.taoyao",
"name": "com.acgist.taoyao.TaoyaoApplication",
"mainAbility": "com.acgist.taoyao.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "client",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"name": "com.acgist.taoyao.MainAbility",
"icon": "$media:icon",
"label": "$string:main_label",
"description": "$string:main_description",
"launchType": "standard",
"orientation": "unspecified",
"visible": true,
"skills": [
{
"actions": [
"action.system.home",
"main",
"setting"
],
"entities": [
"entity.system.home"
]
}
],
"type": "page"
},
{
"name": "com.acgist.taoyao.MediaAbility",
"description": "$string:media_description",
"type": "service",
"backgroundModes": [],
"icon": "$media:icon"
}
]
}
}

View File

@@ -1,16 +0,0 @@
#include <jni.h>
#include <string>
#include <hilog/log.h>
#include "main.hpp"
extern "C" JNIEXPORT jstring JNICALL
Java_com_acgist_taoyao_slice_MainAbilitySlice_stringFromJNI(JNIEnv *env, jobject obj) {
std::string hello = "Hello from JNI C++ codes";
int len = hello.size();
jchar res[len];
for (int i = 0; i < len; i++) {
res[i] = (jchar)hello[i];
}
return env->NewString(res, len);
}

View File

@@ -1,16 +0,0 @@
package com.acgist.taoyao;
import com.acgist.taoyao.slice.MainAbilitySlice;
import com.acgist.taoyao.slice.SettingAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
public class MainAbility extends Ability {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
super.setMainRoute(MainAbilitySlice.class.getName());
super.addActionRoute("main", MainAbilitySlice.class.getName());
super.addActionRoute("setting", SettingAbilitySlice.class.getName());
}
}

View File

@@ -1,43 +0,0 @@
package com.acgist.taoyao;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.rpc.IRemoteObject;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
public class MediaAbility extends Ability {
private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "Media");
@Override
public void onStart(Intent intent) {
HiLog.error(LABEL_LOG, "MediaAbility::onStart");
super.onStart(intent);
}
@Override
public void onBackground() {
super.onBackground();
HiLog.info(LABEL_LOG, "MediaAbility::onBackground");
}
@Override
public void onStop() {
super.onStop();
HiLog.info(LABEL_LOG, "MediaAbility::onStop");
}
@Override
public void onCommand(Intent intent, boolean restart, int startId) {
}
@Override
public IRemoteObject onConnect(Intent intent) {
return null;
}
@Override
public void onDisconnect(Intent intent) {
}
}

View File

@@ -1,16 +0,0 @@
package com.acgist.taoyao;
import ohos.aafwk.ability.AbilityPackage;
public class TaoyaoApplication extends AbilityPackage {
static {
System.loadLibrary("taoyao");
}
@Override
public void onInitialize() {
super.onInitialize();
}
}

View File

@@ -1,4 +0,0 @@
package com.acgist.taoyao.media;
public class AudioPublisher {
}

View File

@@ -1,4 +0,0 @@
package com.acgist.taoyao.media;
public class MediaRecorder {
}

View File

@@ -1,4 +0,0 @@
package com.acgist.taoyao.media;
public class VideoPublisher {
}

View File

@@ -1,65 +0,0 @@
package com.acgist.taoyao.slice;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.AttrHelper;
import ohos.agp.components.Button;
import ohos.agp.components.ComponentContainer.LayoutConfig;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.Text;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;
import ohos.media.player.Player;
import java.io.FileDescriptor;
import java.io.FileInputStream;
public class MainAbilitySlice extends AbilitySlice {
// Load the 'native-lib' library on application startup.
private final DirectionalLayout layout = new DirectionalLayout(this);
@Override
public void onStart(Intent intent) {
super.onStart(intent);
LayoutConfig config = new LayoutConfig(LayoutConfig.MATCH_PARENT, LayoutConfig.MATCH_PARENT);
layout.setLayoutConfig(config);
layout.setAlignment(17);
ShapeElement element = new ShapeElement();
element.setShape(ShapeElement.RECTANGLE);
element.setRgbColor(new RgbColor(255, 255, 255));
layout.setBackground(element);
Text text = new Text(this);
text.setText(stringFromJNI());
text.setTextColor(Color.BLACK);
text.setTextSize(AttrHelper.vp2px(26, this));
layout.addComponent(text);
Button button = new Button(this);
button.setText("设置");
button.setTextSize(AttrHelper.vp2px(26, this));
button.setClickedListener(listener -> super.present(new SettingAbilitySlice(), new Intent()));
layout.addComponent(button);
super.setUIContent(layout);
}
@Override
public void onActive() {
super.onActive();
}
@Override
public void onForeground(Intent intent) {
super.onForeground(intent);
// 打开预览
}
@Override
protected void onBackground() {
super.onBackground();
// 掐断预览
}
public native String stringFromJNI();
}

View File

@@ -1,59 +0,0 @@
package com.acgist.taoyao.slice;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.AttrHelper;
import ohos.agp.components.Button;
import ohos.agp.components.ComponentContainer.LayoutConfig;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.Text;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;
public class SettingAbilitySlice extends AbilitySlice {
// Load the 'native-lib' library on application startup.
private final DirectionalLayout layout = new DirectionalLayout(this);
@Override
public void onStart(Intent intent) {
super.onStart(intent);
LayoutConfig config = new LayoutConfig(LayoutConfig.MATCH_PARENT, LayoutConfig.MATCH_PARENT);
layout.setLayoutConfig(config);
layout.setAlignment(17);
ShapeElement element = new ShapeElement();
element.setShape(ShapeElement.RECTANGLE);
element.setRgbColor(new RgbColor(255, 255, 255));
layout.setBackground(element);
Text text = new Text(this);
text.setText("1234");
text.setTextColor(Color.BLACK);
text.setTextSize(AttrHelper.vp2px(26, this));
layout.addComponent(text);
Button button = new Button(this);
button.setText("保存");
button.setTextSize(AttrHelper.vp2px(26, this));
button.setClickedListener(listener -> super.present(new MainAbilitySlice(), new Intent()));
layout.addComponent(button);
super.setUIContent(layout);
}
@Override
public void onActive() {
super.onActive();
}
@Override
public void onForeground(Intent intent) {
super.onForeground(intent);
// 打开预览
}
@Override
protected void onBackground() {
super.onBackground();
// 掐断预览
}
}

View File

@@ -1,8 +0,0 @@
{
"integer": [
{
"name": "timeout",
"value": 5000
}
]
}

View File

@@ -1,24 +0,0 @@
{
"string": [
{
"name": "main_label",
"value": "桃夭"
},
{
"name": "main_description",
"value": "桃夭鸿蒙终端前台页面"
},
{
"name": "media_description",
"value": "桃夭鸿蒙终端媒体服务"
},
{
"name": "encryptAlgo",
"value": "DES"
},
{
"name": "encryptSecret",
"value": "2SPWy+TF1zM="
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -1,14 +0,0 @@
package com.acgist.taoyao;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ExampleOhosTest {
@Test
public void testBundleName() {
final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
assertEquals("com.acgist.taoyao", actualBundleName);
}
}

View File

@@ -1,9 +0,0 @@
package com.acgist.taoyao;
import org.junit.Test;
public class ExampleTest {
@Test
public void onStart() {
}
}

View File

@@ -1,17 +0,0 @@
package com.acgist.taoyao;
import com.acgist.taoyao.model.Message;
import com.acgist.taoyao.signal.Taoyao;
import ohos.hiviewdfx.HiLog;
import org.junit.Test;
public class TaoyaoTest {
@Test
public void test() throws InterruptedException {
final Taoyao taoyao = new Taoyao(9999, "localhost", "DES", "2SPWy+TF1zM=");
taoyao.connect();
Thread.sleep(Long.MAX_VALUE);
}
}

View File

@@ -1,2 +0,0 @@
#Sun Mar 19 12:32:25 CST 2023
distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-7.3-bin.zip

View File

@@ -1,3 +0,0 @@
{
}

View File

@@ -1,2 +0,0 @@
rootProject.name = 'taoyao'
include ':client'

View File

@@ -1,5 +1,7 @@
package com.acgist.taoyao.boot.config;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -45,15 +47,9 @@ public class MediaProperties {
private MediaAudioProperties audio;
@Schema(title = "视频默认配置", description = "视频默认配置")
private MediaVideoProperties video;
@Schema(title = "4K视频配置", description = "4K视频配置")
private MediaVideoProperties udVideo;
@Schema(title = "2K视频配置", description = "2K视频配置")
private MediaVideoProperties qdVideo;
@Schema(title = "超清视频配置", description = "超清视频配置")
private MediaVideoProperties fdVideo;
@Schema(title = "高清视频配置", description = "高清视频配置")
private MediaVideoProperties hdVideo;
@Schema(title = "标清视频配置", description = "标清视频配置")
private MediaVideoProperties sdVideo;
@Schema(title = "频配置", description = "频配置")
private Map<String, MediaAudioProperties> audios;
@Schema(title = "视频配置", description = "视频配置")
private Map<String, MediaVideoProperties> videos;
}

View File

@@ -85,47 +85,65 @@ taoyao:
# 采样率
min-sample-rate: 8000
max-sample-rate: 48000
# ABR CBR VBR
# 默认音频
audio:
format: OPUS
sample-size: 16
sample-rate: 32000
sample-size: 32
sample-rate: 44100
# 默认视频
video:
format: H264
bitrate: 1200
frame-rate: 24
resolution: 1920*1080
# 4KUD=UHD=4K
ud-video:
format: H264
bitrate: 1600
frame-rate: 45
resolution: 4096*2160
# 2KQD=QHD=2K
qd-video:
format: H264
bitrate: 1600
frame-rate: 30
resolution: 2560*1440
# 超清视频FD=FHD=1080P
fd-video:
format: H264
bitrate: 1200
frame-rate: 24
resolution: 1920*1080
# 高清视频HD=720P
hd-video:
format: H264
bitrate: 1000
frame-rate: 18
resolution: 1280*720
# 标清视频SD=480P
sd-video:
format: H264
bitrate: 800
frame-rate: 15
resolution: 720*480
audios:
# 超清
fd-audio:
format: OPUS
sample-size: 32
sample-rate: 48000
# 高清
hd-audio:
format: OPUS
sample-size: 24
sample-rate: 44100
# 标清
sd-audio:
format: OPUS
sample-size: 24
sample-rate: 32000
videos:
# 4KUD=UHD=4K
ud-video:
format: H264
bitrate: 1600
frame-rate: 45
resolution: 4096*2160
# 2KQD=QHD=2K
qd-video:
format: H264
bitrate: 1600
frame-rate: 30
resolution: 2560*1440
# 超清视频FD=FHD=1080P
fd-video:
format: H264
bitrate: 1200
frame-rate: 24
resolution: 1920*1080
# 高清视频HD=720P
hd-video:
format: H264
bitrate: 1000
frame-rate: 18
resolution: 1280*720
# 标清视频SD=480P
sd-video:
format: H264
bitrate: 800
frame-rate: 15
resolution: 720*480
# Socket信令
socket:
enabled: true