You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include "zmain.hpp"
//
#include "configs/config.hpp"
#include "iflytopcpp/core/spdlogfactory/logger.hpp"
#include "iflytopcpp/core/thread/thread.hpp"
#include "spdlog/spdlog.h"
#include "version.hpp"
#include "zlinuxcomponents/rootfs_auto_update.hpp"
#include "zservice_container/zservice_container.hpp"
#include "zwebservice/zwebservice.hpp"
//
#include "service/device_io_service.hpp"
#include "service/device_io_service_mock.hpp"
#include "service/light_control_service.hpp"
#include "service/main_control_service.hpp"
#include "service/report_service.hpp"
//
#include "zlinuxcomponents/audio/audio_recoder.hpp"
//
using namespace iflytop; using namespace core; using namespace std; using namespace clipp;
ZMAIN(); /***********************************************************************************************************************
* =======================================================Main======================================================== * ***********************************************************************************************************************/ void Main::onSIGINT() { exit(0); } int Main::main(int argc, char *argv[]) { string g_host_server_ip; string g_device_id; #if 0
auto cli = ( //
(required("-device_id") & value("device_id", g_device_id)).doc("device_id") //
); if (!parse(argc, argv, cli)) { cout << make_man_page(cli, argv[0]); exit(-1); } #endif
logger->info("system setup start.");
spdlog::flush_on(spdlog::level::debug);
logger->info("#"); logger->info("# company:{}", "ifytop"); 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");
}
// AudioRecoder::get().initialize();
shared_ptr<AudioRecoder> audioRecoder(new AudioRecoder());
#if 0
BUILD_AND_REG_SERRVICE(DeviceIOService); #else
BUILD_AND_REG_MOCK_SERRVICE(DeviceIOService, DeviceIOServiceMock); #endif
GET_SERVICE(DeviceIOService)->initialize();
BUILD_AND_REG_SERRVICE(ZWebService); GET_SERVICE(ZWebService)->initialize();
BUILD_AND_REG_SERRVICE(LightControlService); GET_SERVICE(LightControlService)->initialize(); GET_SERVICE(LightControlService)->start();
BUILD_AND_REG_SERRVICE(ReportService); GET_SERVICE(ReportService)->initialize(); GET_SERVICE(ReportService)->start();
BUILD_AND_REG_SERRVICE(MainControlService); GET_SERVICE(MainControlService)->initialize();
logger->info("system setup end."); while (true) sleep(1000); }
|