添加广播方式升级
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "QByteArray"
|
||||
#include "QList"
|
||||
#include "QDebug"
|
||||
|
||||
class myarray : public QByteArray
|
||||
{
|
||||
@@ -19,6 +20,7 @@ public:
|
||||
}
|
||||
myarray(int size, char data) : QByteArray(size, data) {}
|
||||
myarray(const myarray &data) : QByteArray(data) {}
|
||||
myarray(const QByteArray &data) : QByteArray(data) {}
|
||||
virtual ~myarray() {}
|
||||
char &operator[](int index)
|
||||
{
|
||||
@@ -29,6 +31,13 @@ public:
|
||||
return data()[size-1];
|
||||
return data()[index];
|
||||
}
|
||||
bool operator==(const char *s){
|
||||
return QByteArray::operator==(s);
|
||||
}
|
||||
bool operator==(const myarray &s){
|
||||
// qDebug("s1=%s,s2=%s",data(),s.data());
|
||||
return strcmp(s.data(),data())==0;
|
||||
}
|
||||
myarray &operator=(const myarray &b)
|
||||
{
|
||||
QByteArray::operator=(b);
|
||||
|
@@ -9,9 +9,10 @@
|
||||
#include "base/file.h"
|
||||
#include <QApplication>
|
||||
#include <QCryptographicHash>
|
||||
#include "complier_info.h"
|
||||
|
||||
// 配置路径
|
||||
#define CFG_PATH QString("/home/root/config/")
|
||||
#define CFG_PATH mystring("/home/root/config/")
|
||||
// #define CFG_PATH qApp->applicationDirPath()+"/config/"
|
||||
|
||||
// 配置文件
|
||||
@@ -94,6 +95,49 @@ public:
|
||||
|
||||
mycfg::mycfg()
|
||||
{
|
||||
// 加載默認參數
|
||||
tcp_enable = true;
|
||||
server_ip = mystring("192.168.10.100");
|
||||
server_port = 9527;
|
||||
local_port = 0;
|
||||
local_ip = mystring("192.168.10.50");
|
||||
gateway_ip = mystring("192.168.10.1");
|
||||
netmask = mystring("255.255.255.0");
|
||||
can_bitrate = 100000;
|
||||
local_id = 1;
|
||||
slave_num=1;
|
||||
mcu_timeout=1000;
|
||||
debug_ip=mystring("192.168.10.100");
|
||||
debug_port=5346;
|
||||
build_date=mystring(BUILD_DATE);
|
||||
cmd_port=7777;
|
||||
log_redirect=mystring("console");
|
||||
soft_version=mystring(SOFT_VERSION);
|
||||
hard_version=mystring(HARD_VERSION);
|
||||
def_lua_judge=CFG_PATH+APP_JUDGE_FILE;
|
||||
use_lua_judge=true;
|
||||
config_path=CFG_PATH;
|
||||
device_type=mystring("checker");
|
||||
moter_count=20000;
|
||||
uart_bsp=115200;
|
||||
auto_test=false;
|
||||
coder_return_mode=1;
|
||||
slave_addr_start=1;
|
||||
slave_scheme_ext=0;
|
||||
init_env();
|
||||
if(!def_shell.isEmpty())
|
||||
{
|
||||
QString str="chmod 777 %1";
|
||||
system(str.arg(def_shell).toLocal8Bit().data());
|
||||
system((def_shell).toLocal8Bit().data());
|
||||
}
|
||||
reload();
|
||||
|
||||
// 自启动时把打印路径设置为文件
|
||||
if(qApp->applicationFilePath()==AUTO_START_PATH)
|
||||
{
|
||||
log_redirect=mystring("file");
|
||||
}
|
||||
}
|
||||
|
||||
void mycfg::to_class(mystring str)
|
||||
|
Reference in New Issue
Block a user