补充脚本。

This commit is contained in:
luocai 2024-11-13 19:25:23 +08:00
parent ea297a427d
commit ab73d23916
9 changed files with 199 additions and 42 deletions

View File

@ -4,12 +4,11 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/Libraries/nng-1.9.0/include",
"/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_86_0/include",
"/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/speexdsp-1.2.1/include",
"/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/rockchip_mpp/include",
"/opt/toolchains/Libraries/opus-1.4/include",
"ThirdParty/libjpegTurbo/inc",
"ThirdParty/libalsa/inc",
"${workspaceFolder}/build/_deps/kylin-src/Universal",
"${workspaceFolder}/build/_deps/kylin-src/HttpProxy"
],

View File

@ -27,19 +27,31 @@ if(CROSS_BUILD)
else()
set(BOOST_ROOT /opt/Libraries/boost_1_86_0)
set(KINESIS_ROOT /opt/Libraries/amazon-kinesis-video-streams-webrtc-sdk-c)
set(MBEDTLS_ROOT /opt/Libraries/mbedtls-3.6.2)
set(NNG_ROOT /opt/Libraries/nng-1.9.0)
endif()
option(Boost_USE_STATIC_LIBS OFF)
set(OPENSSL_LIBRARIES ssl crypto)
set(FFMPEG_LIBRARY avcodec avdevice avfilter avformat avutil postproc swresample swscale)
set(MBEDTLS_INCLUDE_DIR ${MBEDTLS_ROOT}/include)
set(MBEDTLS_LIBRARY_DIRS ${MBEDTLS_ROOT}/lib)
set(NNG_INCLUDE_DIR ${NNG_ROOT}/include)
set(NNG_LIBRARY_DIRS ${NNG_ROOT}/lib)
include(FetchContent)
FetchContent_Declare(Kylin
GIT_REPOSITORY https://gitea.amass.fun/amass/Kylin.git
GIT_REPOSITORY https://amass.fun/gitea/amass/Kylin.git
)
set(KYLIN_WITH_NNG ON)
FetchContent_MakeAvailable(Kylin)
add_subdirectory(VocieProcess)
add_subdirectory(GatePass)
add_subdirectory(Record)
add_subdirectory(VoucherVerifyServer)
if(CROSS_BUILD)
add_subdirectory(Record)
endif()
add_subdirectory(VoucherVerifyServer)
add_subdirectory(NngDebuger)

View File

@ -0,0 +1,6 @@
add_executable(nngdebuger main.cpp)
target_link_libraries(nngdebuger
PRIVATE Nng
PRIVATE Universal
)

71
NngDebuger/NngDebuger.cpp Normal file
View File

@ -0,0 +1,71 @@
#include "NngDebuger.h"
#include "pe_input/pe_input.h"
#include "rw_zlog.h"
#include <nng/nng.h>
#include <nng/protocol/reqrep0/rep.h>
#include <string>
#include <boost/algorithm/string/trim.hpp>
void NngDebuger::run() {
nng_socket replier;
int status = nng_rep0_open(&replier);
do {
status = nng_listen(replier, "tcp://172.16.104.70:33892", nullptr, 0);
if (status != 0) {
LOGI("amass nng_listen: %d %s", status, nng_strerror(status));
} else {
LOGI("amass listen success.");
}
} while (status != 0);
while (!m_exit) {
char *buffer = nullptr;
size_t size;
status = nng_recv(replier, &buffer, &size, NNG_FLAG_ALLOC);
std::string message(buffer, size);
boost::trim(message);
process(message);
nng_free(buffer, size);
const char *reply = "World, Hello!";
nng_send(replier, (void *)reply, strlen(reply) + 1, 0);
}
}
void NngDebuger::process(const std::string &message) {
LOGI("amass received: %s", message.c_str());
if (m_peInput == nullptr) {
LOGI("amass peInput is null.");
return;
}
if (message == "1") {
LOGI("amass 1");
m_peInput->icReaderCallback(0, -1, "");
} else if (message == "2") {
m_peInput->icReaderCallback(0, -2, "");
} else if (message == "3") {
m_peInput->icReaderCallback(0, -3, "");
}
}
// /home/amass/Projects/FaceAccess/build/NngDebuger/nngdebuger
NngDebuger::~NngDebuger() {
m_exit = true;
if (m_thread && m_thread->joinable()) {
m_thread->join();
}
}
void NngDebuger::setPeInput(GPeInput *peInput) {
m_peInput = peInput;
}
NngDebuger::NngDebuger() {
m_exit = false;
m_thread = std::make_shared<std::thread>(&NngDebuger::run, this);
}

27
NngDebuger/NngDebuger.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef __NNGDEBUGER_H__
#define __NNGDEBUGER_H__
#include <memory>
#include <queue>
#include <thread>
class GPeInput;
class NngDebuger {
public:
NngDebuger();
~NngDebuger();
void setPeInput(GPeInput *peInput);
protected:
void run();
void process(const std::string &message);
private:
std::shared_ptr<std::thread> m_thread;
bool m_exit = true;
GPeInput *m_peInput = nullptr;
};
#endif // __NNGDEBUGER_H__

27
NngDebuger/main.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "Nng/Socket.h"
#include <cstring>
#include <iostream>
int main(int argc, char const *argv[]) {
using namespace Nng;
if (argc < 2) {
std::cout << "arg size: " << argc << std::endl;
return -2;
}
Socket request(Request);
std::error_code error;
request.dial("tcp://172.16.104.70:33892", error);
if (error) {
std::cerr << error.message() << std::endl;
return -1;
}
request.send(argv[1], strlen(argv[1]));
auto buffer = request.recv();
std::cout << buffer.data() << std::endl;
return 0;
}

View File

@ -32,6 +32,9 @@ keydata get hardware
`script/start-app.sh`有个`write_mac()`函数生成`/data/.mac`文件。
## 新老平台兼容
pb `BusinessReplyLogin``utcTimeStamp` 是新平台添加的,依靠这个值判断平台是新还是旧。
## 隐藏页面参数设置

View File

@ -12,6 +12,6 @@ int main(int argc, char const *argv[])
auto listener =
std::make_shared<Listener>(*ioContext->ioContext(), tcp::endpoint{tcp::v4(), 3392}, sharedState);
listener->startAccept();
ioContext->run<IoContext::Mode::Synchronous>();
ioContext->run();
return 0;
}

View File

@ -1,9 +1,9 @@
#!/bin/bash
cross_compile=true
cross_compile=false
build_hisi=false
debug_deploy=false
TARGET_IP="172.16.103.92"
TARGET_IP="172.16.104.49"
TARGET_PATH="/system/bin"
base_path=$(pwd)
libraries_root="/opt/Libraries"
@ -118,31 +118,43 @@ function clean() {
fi
}
function copy_ssh() {
function initialize() {
if [ -n "$1" ]; then
TARGET_IP=$1
fi
APP_DIR=$(dirname "$(dirname "$(readlink -f $0)")")
SSH_KEY=$(cat ~/.ssh/id_rsa.pub)
echo "ssh copy id to ${TARGET_IP} ..."
# chmod 600 ./resources/ssh_host_rsa_key_ok
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "mount -o remount rw /system/; mount -o remount rw /"
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "if [ ! -f /usr/bin/scp ]; then cp /oem/bin/scp /usr/bin/; else echo 'scp exist'; fi"
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "echo ${SSH_KEY} >> /oem/.ssh/authorized_keys"
scp -i ~/Projects/ssh_host_rsa_key_ok /mnt/e/Documents/gdb-rk root@${TARGET_IP}:/sdcard/gdb
scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/mpp/rk-libs/libeasymedia.so.1.0.1 root@${TARGET_IP}:/usr/lib/
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/toolchains/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/bin/gdbserver root@${TARGET_IP}:/sdcard
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_url* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_log* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_program_options* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_date_time* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_filesystem* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_thread* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_regex* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_chrono* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_atomic* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_container* root@${TARGET_IP}:/system/lib
scp -i ~/Projects/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_84_0/lib/libboost_json* root@${TARGET_IP}:/system/lib
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "sync"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "mount -o remount rw /system; mount -o remount rw /oem; mount -o remount rw /"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "grep -q 'mount -o remount rw' /etc/profile || echo 'mount -o remount rw /system; mount -o remount rw /oem; mount -o remount rw /' >> /etc/profile"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "if [ ! -f /usr/bin/scp ]; then cp /oem/bin/scp /usr/bin/; else echo 'scp exist'; fi"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "printf '%s\n' '${SSH_KEY}' | grep -qxFf - /oem/.ssh/authorized_keys || echo '${SSH_KEY}' >> /oem/.ssh/authorized_keys"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "test -e /sdcard/gdbserver || exit 1" && scp -i ~/.ssh/ssh_host_rsa_key_ok /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/bin/gdbserver root@${TARGET_IP}:/sdcard
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "test -e /sdcard/gdb || exit 1" && scp -i ~/.ssh/ssh_host_rsa_key_ok /mnt/e/Documents/瑞为/FacePass/gdb-rk root@${TARGET_IP}:/sdcard/gdb
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "sync"
file="src/gate_face/Makefile.mak"
if ! grep -q "/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf" $file; then
awk -v n=157 -v text='
INCLUDES += -I/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/boost_1_86_0/include
INCLUDES += -I/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/nng-1.9.0/include
LDFLAGS += -L/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/nng-1.9.0/lib -lnng
LDFLAGS += -L/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/mbedtls-3.6.2/lib -lmbedtls -lmbedcrypto -lmbedx509 -lp256m -leverest
' 'NR==n{print text}1' $file > $file.tmp && mv $file.tmp $file
fi
target_dir="src/gate_face"
if [ ! -f "$target_dir/NngDebuger.h" ]; then
cp "$APP_DIR/NngDebuger/NngDebuger.h" "$target_dir/"
cp "$APP_DIR/NngDebuger/NngDebuger.cpp" "$target_dir/"
fi
file="src/gate_face/Makefile"
if ! grep -q "NngDebuger.o" $file; then
sed -i '/^OBJS := /s/$/ NngDebuger.o/' $file
fi
}
function build_old() {
@ -185,27 +197,27 @@ function deploy_old() {
TARGET_IP=$1
fi
echo "deply to $TARGET_IP, path $TARGET_PATH"
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "mount -o remount rw /; mount -o remount rw /system/"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "mount -o remount rw /; mount -o remount rw /system/"
if [ $build_hisi = true ]; then
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace; sleep 1"
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace"
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace; sleep 1"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace"
else
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace;"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "killall start-app.sh; killall GateFace;"
fi
# scp -r -i ~/Projects/ssh_host_rsa_key_ok src/web/php/*.php root@${TARGET_IP}:/system/www/web/
# scp -r -i ~/.ssh/ssh_host_rsa_key_ok src/web/php/*.php root@${TARGET_IP}:/system/www/web/
# scp -r -i ~/Projects/ssh_host_rsa_key_ok resources/audio/*.wav root@${TARGET_IP}:/system/audio
scp -i ~/Projects/ssh_host_rsa_key_ok ./build/GateFace root@${TARGET_IP}:$TARGET_PATH
scp -i ~/.ssh/ssh_host_rsa_key_ok ./build/GateFace root@${TARGET_IP}:$TARGET_PATH
# scp -i ~/Projects/ssh_host_rsa_key_ok resources/language/FaceTick_EN.qm root@${TARGET_IP}:/system/language
# scp -i ~/Projects/ssh_host_rsa_key_ok ./build/netconfig root@${TARGET_IP}:$TARGET_PATH
if [ $build_hisi = true ]; then
scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-himix200-linux/rwStageProtocol/lib/librwSrvProtocol.so root@${TARGET_IP}:/system/lib/
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "reboot"
scp -i ~/.ssh/ssh_host_rsa_key_ok ./3rdparty/arm-himix200-linux/rwStageProtocol/lib/librwSrvProtocol.so root@${TARGET_IP}:/system/lib/
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "reboot"
else
# scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/librwhscheckpw/lib/librwhscheckpw.so root@${TARGET_IP}:/system/lib/
scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/rwStageProtocol/lib/librwSrvProtocol.so root@${TARGET_IP}:/system/lib/
scp -i ~/.ssh/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/rwStageProtocol/lib/librwSrvProtocol.so root@${TARGET_IP}:/system/lib/
# scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/ffmepg/lib/libavdevice.so.58 root@${TARGET_IP}:/system/lib/
# scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/ffmepg/lib/libavfilter.so.7 root@${TARGET_IP}:/system/lib/
# scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/ffmepg/lib/libavformat.so.58 root@${TARGET_IP}:/system/lib/
@ -213,11 +225,11 @@ function deploy_old() {
# scp -i ~/Projects/ssh_host_rsa_key_ok ./3rdparty/arm-linux-gnueabihf/ffmepg/lib/libswresample.so.3 root@${TARGET_IP}:/system/lib/
fi
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "sync"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "sync"
if [ $debug_deploy = false ]; then
if [ $build_hisi = false ]; then
ssh -i ~/Projects/ssh_host_rsa_key_ok root@${TARGET_IP} "echo 1 > /dev/watchdog"
ssh -i ~/.ssh/ssh_host_rsa_key_ok root@${TARGET_IP} "echo 1 > /dev/watchdog"
fi
fi
}
@ -238,8 +250,8 @@ function main() {
old)
build_old $@
;;
ssh)
copy_ssh $@
init)
initialize $@
;;
*)
build