Browse Source

add zlinuxcomponents

master
zhaohe 3 years ago
parent
commit
9195165a13
  1. 13
      .gitmodules
  2. 3
      CMakeLists.txt
  3. 1
      README.md
  4. 0
      env/rootfs/.mark
  5. 7
      sh/iflytool.sh
  6. 24
      src/main.cpp

13
.gitmodules

@ -6,16 +6,19 @@
url = ../../zwsd_common_lib/zcmake.git
[submodule "dep/zwebservice"]
path = dep/zwebservice
url = ../../zlinux_demo_projects/zwebservice.git
url = ../../z2nd_lib/zwebservice.git
[submodule "dep/zservice_container"]
path = dep/zservice_container
url = ../../zlinux_demo_projects/zservice_container.git
url = ../../z2nd_lib/zservice_container.git
[submodule "dep/websocketpp"]
path = dep/websocketpp
url = ../../zlinux_demo_projects/websocketpp.git
url = ../../z2nd_lib/websocketpp.git
[submodule "dep/asio1.12.2"]
path = dep/asio1.12.2
url = ../../zlinux_demo_projects/asio1.12.2.git
url = ../../z2nd_lib/asio1.12.2.git
[submodule "dep/zclipp"]
path = dep/zclipp
url = ../../zlinux_demo_projects/zclipp.git
url = ../../z2nd_lib/zclipp.git
[submodule "dep/zlinuxcomponents"]
path = dep/zlinuxcomponents
url = zwsd@192.168.1.3:z2nd_lib/zlinuxcomponents.git

3
CMakeLists.txt

@ -41,12 +41,13 @@ include(dep/asio1.12.2/module.cmake)
include(dep/websocketpp/module.cmake)
include(dep/zservice_container/module.cmake)
include(dep/zwebservice/module.cmake)
include(dep/zlinuxcomponents/module.cmake)
zadd_executable(
TARGET
app.out
INSTALL
app
./app
LINK_LIBRARIES
pthread
INCLUDE_DIRECTORIES

1
README.md

@ -29,6 +29,7 @@ build/ 应用程序编译目录
# 配置ssh-key,免密登录
./sh/iflytool.sh --ip <ip> ssh_copy_id
```
## 唤醒词引擎环境测试

0
env/rootfs/.mark

7
sh/iflytool.sh

@ -34,7 +34,9 @@ function do_flash_to_targetboard() {
function do_flashapp_to_targetboard() {
# 杀死目标程序
set +e
ssh ${TARGET_USER}@${IP} "killall app.out"
set -e
# 拷贝目标程序
scp -r ${PROJECT_PATH}/build/app/app.out ${TARGET_USER}@${IP}:/app/
}
@ -173,7 +175,10 @@ if [ "$is_flash" = true ] || [ "$is_reboot" = true ]; then
exit 1
fi
fi
# flashapp
if [ "$is_flashapp" = true ]; then
is_build=true
fi
# 检查build目录是否存在
if [ ! -d "${PROJECT_PATH}/build" ]; then
echo "build directory not exist, please run envsetup first"

24
src/main.cpp

@ -4,6 +4,7 @@
#include "spdlog/spdlog.h"
#include "version.hpp"
#include "zclipp/include/clipp.h"
#include "zlinuxcomponents/rootfs_auto_update.hpp"
#include "zservice_container/zservice_container.hpp"
#include "zwebservice/zwebservice.hpp"
//
@ -12,6 +13,8 @@
#include "service/light_control_service.hpp"
#include "service/main_control_service.hpp"
#include "service/report_service.hpp"
//
#include "dirent.h"
using namespace iflytop;
using namespace core;
using namespace std;
@ -51,6 +54,7 @@ int main(int argc, char *argv[]) {
/***********************************************************************************************************************
* =======================================================Main======================================================== *
***********************************************************************************************************************/
int Main::main(int argc, char *argv[]) {
string g_host_server_ip;
string g_device_id;
@ -64,6 +68,8 @@ int Main::main(int argc, char *argv[]) {
}
#endif
logger->info("system setup start.");
spdlog::flush_on(spdlog::level::debug);
logger->info("#");
@ -71,11 +77,27 @@ int Main::main(int argc, char *argv[]) {
logger->info("# version:{}", VERSION);
logger->info("#");
BUILD_AND_REG_SERRVICE(Config);
GET_SERVICE(Config)->initialize();
if (!g_device_id.empty()) GET_SERVICE(Config)->set_deviceId(g_device_id);
/**
* @brief rootfs目录中的文件和系统中对应路径的文件是否一致
*
*
* ./rootfs/etc/asound.conf /etc/asound.conf
*
*/
auto rootfsAutoUpdate = make_shared<RootfsAutoUpdate>();
rootfsAutoUpdate->compareAndReplace();
logger->info("rootfs changed:{}", rootfsAutoUpdate->isChanged() ? "yes" : "no");
if (rootfsAutoUpdate->isChanged()) {
logger->info("reboot system.");
logger->warn("not auto reboot, please reboot manually.");
// system("reboot");
}
#if 0
BUILD_AND_REG_SERRVICE(DeviceIOService);
#else

Loading…
Cancel
Save