16 Star 38 Fork 15

广州灵派科技有限公司/Encoder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.cpp 2.79 KB
一键复制 编辑 原始数据 按行查看 历史
wangc 提交于 2024-11-13 15:20 . 20241113
#include <QApplication>
#include <QTextCodec>
#include <QFile>
#include "Link.h"
#include "Config.h"
#include "RPC.h"
#include "Json.h"
#include "Version.h"
#include "Record.h"
#include "Push.h"
#include "UART.h"
#include "Intercom.h"
#include "GB28181.h"
#include "Synchronization.h"
#include "oled/Oled.h"
#include <QFontDatabase>
#include "LED.h"
#include "Capture.h"
RPC *GRPC;
Record *GRecord;
Push *GPush;
UART *GUart;
Intercom *GIntercom;
GB28181 *Ggb28181;
Synchronization *GSync;
OLED *GOLED;
LED *GLED;
Capture *GCapture;
bool setVideoBuffer(int count)
{
bool ret = true;
QVariantMap videoBuffer = Json::loadFile(BUFFERPATH).toMap();
if(videoBuffer.contains("used"))
{
QString current = videoBuffer["used"].toString();
if(videoBuffer.contains(current))
{
QVariantMap curBuffer = videoBuffer[current].toMap();
QVariantMap board = Json::loadFile(BOARDPATH).toMap();
if(board.isEmpty())
board = Json::loadFile(DEFAULT_BOARDPATH).toMap();
board["videoBuffer"] = curBuffer;
Json::saveFile(board,BOARDPATH);
system("sync");
}
}
if(count > 2)
return false;
QVariantMap nboard = Json::loadFile(BOARDPATH).toMap();
if(nboard.isEmpty())
{
count++;
ret = setVideoBuffer(count);
}
return ret;
}
bool hadOledExec()
{
return QFile::exists("/link/bin/OLED");
}
int main(int argc, char *argv[])
{
argv[argc++]="-platform";
argv[argc++]="offscreen";
QApplication a(argc, argv);
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForLocale(codec);
qDebug("start");
if(!setVideoBuffer(0) || !Link::init())
return 0;
QString ver;
ver=ver.sprintf("%s build %s_%d",VERSION_VER,VERSION_DATE,VERSION_BUILD);
QVariantMap version=Json::loadFile("/link/config/version.json").toMap();
version["app"]=ver;
version["sdk"]=Link::getVersion()["version"].toString()
+" build "+Link::getVersion()["date"].toString()
+"_"+Link::getVersion()["build"].toString();
Json::saveFile(version,"/link/config/version.json");
GRPC=new RPC();
GRPC->startNTP();
Config::loadConfig(CFGPATH);
Config::loadAutoConfig();
GRecord=new Record();
GRecord->init();
GPush=new Push();
GPush->init();
#ifndef HI3516CV610
GUart=new UART();
GUart->init();
Ggb28181=new GB28181();
Ggb28181->init();
GSync=new Synchronization();
GSync->init();
GIntercom=new Intercom();
GIntercom->init();
#endif
GCapture=new Capture();
GCapture->init();
if(!hadOledExec())
{
GOLED=new OLED();
GOLED->init();
}
GLED=new LED();
GLED->init();
GRPC->init();
return a.exec();
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/LinkPi/Encoder.git
git@gitee.com:LinkPi/Encoder.git
LinkPi
Encoder
Encoder
master

搜索帮助