批检仪检测流程验证成功
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
广播方式升级从机发现卡死现象
|
广播方式升级从机发现卡死现象
|
||||||
2023.12.5
|
2023.12.5
|
||||||
广播方式升级从机成功
|
广播方式升级从机成功
|
||||||
|
2023.12.7
|
||||||
|
批检仪检测流程验证成功
|
||||||
|
|
||||||
|
|
||||||
|
@@ -151,7 +151,7 @@ void mycfg::to_class(mystring str)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QJsonObject j = doc.object();
|
j = doc.object();
|
||||||
}
|
}
|
||||||
tcp_enable = j.value("tcp_enable").toBool(true);
|
tcp_enable = j.value("tcp_enable").toBool(true);
|
||||||
server_ip = j.value("server_ip").toString("192.168.80.80");
|
server_ip = j.value("server_ip").toString("192.168.80.80");
|
||||||
|
@@ -42,6 +42,7 @@ SOURCES += \
|
|||||||
prot/prot_pc.cpp \
|
prot/prot_pc.cpp \
|
||||||
prot/prot_slave.cpp \
|
prot/prot_slave.cpp \
|
||||||
prot_cmd/cmd_cmdline.cpp \
|
prot_cmd/cmd_cmdline.cpp \
|
||||||
|
prot_cmd/cmd_m4.cpp \
|
||||||
prot_cmd/cmd_pc.cpp \
|
prot_cmd/cmd_pc.cpp \
|
||||||
prot_cmd/cmd_slave.cpp
|
prot_cmd/cmd_slave.cpp
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@ HEADERS += \
|
|||||||
prot/prot_pc.h \
|
prot/prot_pc.h \
|
||||||
prot/prot_slave.h \
|
prot/prot_slave.h \
|
||||||
prot_cmd/cmd_cmdline.h \
|
prot_cmd/cmd_cmdline.h \
|
||||||
|
prot_cmd/cmd_m4.h \
|
||||||
prot_cmd/cmd_pc.h \
|
prot_cmd/cmd_pc.h \
|
||||||
prot_cmd/cmd_slave.h
|
prot_cmd/cmd_slave.h
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BUILD_DATE "2023-12-05 18:18:14"
|
#define BUILD_DATE "2023-12-07 18:27:08"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"build_date": "2023-12-05 18:18:14",
|
"build_date": "2023-12-07 18:27:08",
|
||||||
"hard_version": "MHPZ2_V1.00",
|
"hard_version": "MHPZ2_V1.00",
|
||||||
"private": [
|
"private": [
|
||||||
"info.json",
|
"info.json",
|
||||||
|
4
main.cpp
4
main.cpp
@@ -12,6 +12,7 @@
|
|||||||
#include "prot/prot_slave.h"
|
#include "prot/prot_slave.h"
|
||||||
#include "prot/prot_cmdline.h"
|
#include "prot/prot_cmdline.h"
|
||||||
#include "base/debug.h"
|
#include "base/debug.h"
|
||||||
|
#include "prot_cmd/cmd_m4.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -22,8 +23,8 @@ int main(int argc, char *argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
// w.show();
|
// w.show();
|
||||||
|
mydebug_init();
|
||||||
mycfg *cfg=syscfg();
|
mycfg *cfg=syscfg();
|
||||||
|
|
||||||
if(cfg->log_redirect=="file"){
|
if(cfg->log_redirect=="file"){
|
||||||
mydebug_init("debug");
|
mydebug_init("debug");
|
||||||
}else{
|
}else{
|
||||||
@@ -35,6 +36,7 @@ int main(int argc, char *argv[])
|
|||||||
protPc();
|
protPc();
|
||||||
protSlave();
|
protSlave();
|
||||||
command_start();
|
command_start();
|
||||||
|
cmd_m4_init();
|
||||||
// 注册信号数据类型
|
// 注册信号数据类型
|
||||||
qRegisterMetaType<myarray>("myarray");
|
qRegisterMetaType<myarray>("myarray");
|
||||||
|
|
||||||
|
@@ -41,20 +41,7 @@ void ProtPc::init()
|
|||||||
myarray data=codec_->decode(src,dst,cmd,recv_data);
|
myarray data=codec_->decode(src,dst,cmd,recv_data);
|
||||||
recv_data.remove(0,pack_len);
|
recv_data.remove(0,pack_len);
|
||||||
// qDebug("host recv removed:%s",recv_data.toHex(' ').data());
|
// qDebug("host recv removed:%s",recv_data.toHex(' ').data());
|
||||||
if(handle_!=nullptr){
|
docmd(cmd,data);
|
||||||
if(handle_->busy==0){
|
|
||||||
disconnect(handle_,&HandlePc::send_data_signal,this,&ProtPc::send_data_slot);
|
|
||||||
delete handle_;
|
|
||||||
}else{
|
|
||||||
qWarning("prot_pc is busy.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handle_=handlePcFind(cmd);
|
|
||||||
if(handle_!=nullptr){
|
|
||||||
connect(handle_,&HandlePc::send_data_signal,this,&ProtPc::send_data_slot);
|
|
||||||
handle_->dolater(cmd,data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -68,6 +55,31 @@ void ProtPc::send_data_slot(int cmd, myarray data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ProtPc::docmd(int cmd,myarray data)
|
||||||
|
{
|
||||||
|
if(handle_!=nullptr){
|
||||||
|
if(handle_->busy==0){
|
||||||
|
disconnect(handle_,&HandlePc::send_data_signal,this,&ProtPc::send_data_slot);
|
||||||
|
delete handle_;
|
||||||
|
}else{
|
||||||
|
qWarning("prot_pc is busy.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handle_=handlePcFind(cmd);
|
||||||
|
if(handle_!=nullptr){
|
||||||
|
connect(handle_,&HandlePc::send_data_signal,this,&ProtPc::send_data_slot);
|
||||||
|
handle_->dolater(cmd,data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ProtPc *g_protpc;
|
static ProtPc *g_protpc;
|
||||||
ProtPc *protPc()
|
ProtPc *protPc()
|
||||||
{
|
{
|
||||||
|
@@ -60,7 +60,8 @@ public:
|
|||||||
}
|
}
|
||||||
~ProtPc() {}
|
~ProtPc() {}
|
||||||
void init();
|
void init();
|
||||||
protected slots:
|
bool docmd(int cmd,myarray data);
|
||||||
|
public slots:
|
||||||
void send_data_slot(int cmd, myarray data);
|
void send_data_slot(int cmd, myarray data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -32,9 +32,11 @@ void prot_slave::init()
|
|||||||
}else{
|
}else{
|
||||||
handle=slaves[src-1];
|
handle=slaves[src-1];
|
||||||
if(handle!=nullptr){
|
if(handle!=nullptr){
|
||||||
// handle->dolater(cmd,data);
|
handle->dolater(cmd,data);
|
||||||
emit slave_dolater_signal(cmd,data);
|
// connect(this,&prot_slave::slave_dolater_signal,handle,&HandleSlave::dolater);
|
||||||
}else{
|
// emit slave_dolater_signal(cmd,data);
|
||||||
|
// disconnect(this,&prot_slave::slave_dolater_signal,handle,&HandleSlave::dolater);
|
||||||
|
}else{
|
||||||
qWarning("slave addr=%d not have handle.",src);
|
qWarning("slave addr=%d not have handle.",src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +68,6 @@ bool prot_slave::set_slave_handle(int addr, HandleSlave *handle)
|
|||||||
}
|
}
|
||||||
handle->addr=addr;
|
handle->addr=addr;
|
||||||
connect(handle, &HandleSlave::send_data_signal, this, &prot_slave::send_data_slot);
|
connect(handle, &HandleSlave::send_data_signal, this, &prot_slave::send_data_slot);
|
||||||
connect(this,&prot_slave::slave_dolater_signal,handle,&HandleSlave::dolater);
|
|
||||||
slaves.replace(addr - 1, handle);
|
slaves.replace(addr - 1, handle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
49
prot_cmd/cmd_m4.cpp
Normal file
49
prot_cmd/cmd_m4.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
#include "base/base.h"
|
||||||
|
#include "base/check_cfg.h"
|
||||||
|
#include "base/mycfg.h"
|
||||||
|
#include "prot/prot_m4.h"
|
||||||
|
#include "prot/prot_pc.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
int key_pressed;
|
||||||
|
int ke1_pressed;
|
||||||
|
}self_def;
|
||||||
|
|
||||||
|
|
||||||
|
static self_def g_self;
|
||||||
|
|
||||||
|
|
||||||
|
void cmd_m4_init()
|
||||||
|
{
|
||||||
|
prot_m4 *m4=protM4();
|
||||||
|
m4->set_irq_fun([=](myarray data){
|
||||||
|
ProtPc *pc=protPc();
|
||||||
|
g_self.key_pressed=1;
|
||||||
|
qDebug("key press");
|
||||||
|
pc->send_data_slot(0x37,myarray(1,char(0)));
|
||||||
|
},"key press");
|
||||||
|
m4->set_irq_fun([=](myarray data){
|
||||||
|
g_self.key_pressed=0;
|
||||||
|
qDebug("key up");
|
||||||
|
},"key up");
|
||||||
|
m4->set_irq_fun([=](myarray data){
|
||||||
|
g_self.ke1_pressed=1;
|
||||||
|
qDebug("ke1 press");
|
||||||
|
},"ke1 press");
|
||||||
|
m4->set_irq_fun([=](myarray data){
|
||||||
|
g_self.ke1_pressed=0;
|
||||||
|
qDebug("ke1 up");
|
||||||
|
},"ke1 up");
|
||||||
|
// m4->set_irq_fun([=](myarray data){
|
||||||
|
// ProtPc *pc=protPc();
|
||||||
|
// qDebug("send 0x37 to pc");
|
||||||
|
// pc->send_data_slot(0x37,myarray(1,char(0)));
|
||||||
|
// },"key press");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
prot_cmd/cmd_m4.h
Normal file
14
prot_cmd/cmd_m4.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef CMD_M4_H
|
||||||
|
#define CMD_M4_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cmd_m4_init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CMD_M4_H
|
@@ -201,11 +201,19 @@ protpc_export(0x31, get_selfdev_checkend);
|
|||||||
int selfdev_moter::dolater(int cmd, myarray data)
|
int selfdev_moter::dolater(int cmd, myarray data)
|
||||||
{
|
{
|
||||||
prot_m4 *m4 = protM4();
|
prot_m4 *m4 = protM4();
|
||||||
|
mycfg *cfg_=syscfg();
|
||||||
connect(this, &selfdev_moter::send_to_m4_signal, m4, &prot_m4::send_data_slot);
|
connect(this, &selfdev_moter::send_to_m4_signal, m4, &prot_m4::send_data_slot);
|
||||||
if(data[0]==0x02){
|
if(data[0]==0x02){
|
||||||
emit send_to_m4_signal(moter_ctrl("up"));
|
emit send_to_m4_signal(moter_ctrl("up"));
|
||||||
}else if(data[0]==0x03){
|
}else if(data[0]==0x03){
|
||||||
emit send_to_m4_signal(moter_ctrl("down"));
|
emit send_to_m4_signal(moter_ctrl("down"));
|
||||||
|
}else if(data[0]==0x01){
|
||||||
|
if(data.size()>=3){
|
||||||
|
int count=(data[1])|(data[2]<<8);
|
||||||
|
cfg_->moter_count=20000+count;
|
||||||
|
qDebug("moter count=%d",cfg_->moter_count);
|
||||||
|
cfg_->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
emit send_data_signal(0x40,myarray(1,char(0)));
|
emit send_data_signal(0x40,myarray(1,char(0)));
|
||||||
return 0;
|
return 0;
|
||||||
@@ -281,7 +289,7 @@ protpc_export(0xfe, get_selfdev_slaveupdate);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 方案升级
|
||||||
int selfdev_update_scheme::dolater(int cmd, myarray data)
|
int selfdev_update_scheme::dolater(int cmd, myarray data)
|
||||||
{
|
{
|
||||||
myarray r;
|
myarray r;
|
||||||
@@ -358,6 +366,229 @@ protpc_export(0x22, get_selfdev_update_scheme);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 本机升级
|
||||||
|
int selfdev_hostupdate::dolater(int cmd, myarray data)
|
||||||
|
{
|
||||||
|
myarray r;
|
||||||
|
int len_filename=data[0];
|
||||||
|
mystring name=data.mid(1,len_filename);
|
||||||
|
prot_slave *slave=protSlave();
|
||||||
|
mycfg *cfg_=syscfg();
|
||||||
|
busy=1;
|
||||||
|
qInfo()<<"host_app name:"<<name<<endl;
|
||||||
|
data.remove(0,len_filename+1);
|
||||||
|
|
||||||
|
// TODO 校验主板程序
|
||||||
|
|
||||||
|
r.append(uint8_t(0));
|
||||||
|
cfg_->save_file(name,data);
|
||||||
|
emit send_data_signal(0xfd,myarray(1,char(0)));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HandlePc *get_selfdev_hostupdata(){
|
||||||
|
return new selfdev_hostupdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protpc_export(0xfd, get_selfdev_hostupdata);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// jwt升级
|
||||||
|
int selfdev_jwtupdate::dolater(int cmd, myarray data)
|
||||||
|
{
|
||||||
|
myarray r;
|
||||||
|
int len_filename=data[0];
|
||||||
|
mystring name=data.mid(1,len_filename);
|
||||||
|
prot_slave *slave=protSlave();
|
||||||
|
mycfg *cfg_=syscfg();
|
||||||
|
busy=1;
|
||||||
|
qInfo()<<"jwt_app name:"<<name<<endl;
|
||||||
|
data.remove(0,len_filename+1);
|
||||||
|
|
||||||
|
// TODO 校验小板程序
|
||||||
|
|
||||||
|
r.append(uint8_t(0));
|
||||||
|
cfg_->save_file(name,data);
|
||||||
|
emit send_data_signal(0xfe,myarray(1,char(0)));
|
||||||
|
|
||||||
|
// 自动给小板升级
|
||||||
|
// start_updata_mcu(cfg_->config_path+name,slave_addrs);
|
||||||
|
HandleBoardCast *b=new boardcast_updata_jwt();
|
||||||
|
bool ack=slave->set_boardcast_handle(cfg_->calc_slave_addrs(),b);
|
||||||
|
if(ack==false){
|
||||||
|
qWarning("handle is busy.");
|
||||||
|
busy=0;
|
||||||
|
}else{
|
||||||
|
connect(b,&HandleBoardCast::end_signal,this,&selfdev_slaveupdate::slave_end_slot);
|
||||||
|
b->start(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HandlePc *get_selfdev_jwtupdate(){
|
||||||
|
return new selfdev_jwtupdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protpc_export(0x27, get_selfdev_jwtupdate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 自研批检仪自检
|
||||||
|
int selfdev_bootinfo::dolater(int cmd, myarray data)
|
||||||
|
{
|
||||||
|
prot_slave *slave=protSlave();
|
||||||
|
mycfg *cfg=syscfg();
|
||||||
|
busy=1;
|
||||||
|
// 这里开始检测
|
||||||
|
qDebug("get bootinfo.");
|
||||||
|
emit send_data_signal(cmd,myarray(1,0));
|
||||||
|
QList<int> addrs=cfg->calc_slave_addrs();
|
||||||
|
foreach(int addr, addrs){
|
||||||
|
HandleSlave *s=new slave_check();
|
||||||
|
bool ack=slave->set_slave_handle(addr,s);
|
||||||
|
if(ack==false){
|
||||||
|
qWarning("addr %d handle is busy.",addr);
|
||||||
|
}else{
|
||||||
|
connect(s,&HandleSlave::end_signal,this,&selfdev_bootinfo::slave_end_slot);
|
||||||
|
s->start(myarray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
slave_acked.clear();
|
||||||
|
for(int i=0;i<cfg->slave_num;i++){
|
||||||
|
slave_acked.append(myarray());
|
||||||
|
}
|
||||||
|
slave_acked_num=0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void selfdev_bootinfo::timeout()
|
||||||
|
{
|
||||||
|
busy=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct{
|
||||||
|
char build_time[20];
|
||||||
|
char softverion[8];
|
||||||
|
int runtime;
|
||||||
|
uint8_t wdog;
|
||||||
|
char devicetype[12];
|
||||||
|
uint8_t localip[4];
|
||||||
|
uint8_t hostip[4];
|
||||||
|
uint16_t hostport;
|
||||||
|
uint8_t localid;
|
||||||
|
uint32_t schemeid;
|
||||||
|
uint32_t slave_online;
|
||||||
|
}local_bootinfo;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct{
|
||||||
|
uint8_t app_state;
|
||||||
|
uint8_t slaver_addr;
|
||||||
|
uint16_t chip_tmper;
|
||||||
|
uint16_t ad_2v5;
|
||||||
|
uint16_t ad_1v25;
|
||||||
|
uint16_t ad_wave;
|
||||||
|
uint16_t ad_5v5_just;
|
||||||
|
uint16_t ad_26v_just;
|
||||||
|
uint16_t hard_version;
|
||||||
|
uint16_t soft_version;
|
||||||
|
uint16_t res_just;
|
||||||
|
uint32_t scheme_id;
|
||||||
|
}bootinfo_data;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
// 填充本机自检信息
|
||||||
|
myarray bootinfo_fill_local(void)
|
||||||
|
{
|
||||||
|
int tick=-1;
|
||||||
|
uint8_t wdog=0;
|
||||||
|
uint32_t temp32=0;
|
||||||
|
uint16_t temp16=0;
|
||||||
|
uint8_t temp8=0;
|
||||||
|
uint8_t ip[4]={0};
|
||||||
|
QStringList iplist;
|
||||||
|
mycfg *cfg_=syscfg();
|
||||||
|
check_cfg *ccfg_=check_plan();
|
||||||
|
uint8_t *d=(uint8_t *)calloc(1,sizeof(local_bootinfo));
|
||||||
|
memcpy(d,cfg_->build_date.toLocal8Bit(),cfg_->build_date.size()+1);d+=20;
|
||||||
|
memcpy(d,cfg_->soft_version.toLocal8Bit(),cfg_->soft_version.size()+1);d+=8;
|
||||||
|
memcpy(d,&tick,4);d+=4;
|
||||||
|
memcpy(d,&wdog,1);d+=1;
|
||||||
|
memcpy(d,cfg_->device_type.toLocal8Bit(),cfg_->device_type.size()+1);d+=12;
|
||||||
|
iplist=cfg_->local_ip.split('.');
|
||||||
|
ip[0]=iplist[0].toInt();
|
||||||
|
ip[1]=iplist[1].toInt();
|
||||||
|
ip[2]=iplist[2].toInt();
|
||||||
|
ip[3]=iplist[3].toInt();
|
||||||
|
memcpy(d,ip,4);d+=4;
|
||||||
|
iplist=cfg_->server_ip.split('.');
|
||||||
|
ip[0]=iplist[0].toInt();
|
||||||
|
ip[1]=iplist[1].toInt();
|
||||||
|
ip[2]=iplist[2].toInt();
|
||||||
|
ip[3]=iplist[3].toInt();
|
||||||
|
memcpy(d,ip,4);d+=4;
|
||||||
|
temp16=cfg_->server_port;
|
||||||
|
memcpy(d,&temp16,2);d+=2;
|
||||||
|
temp8=cfg_->local_id;
|
||||||
|
memcpy(d,&temp8,1);d+=1;
|
||||||
|
temp32=ccfg_->get_plan_id();
|
||||||
|
memcpy(d,&temp32,4);d+=4;
|
||||||
|
temp32=0;
|
||||||
|
for(int i=0;i<cfg_->slave_num;i++){
|
||||||
|
temp32|=1<<i;
|
||||||
|
}
|
||||||
|
memcpy(d,&temp32,4);d+=4;
|
||||||
|
myarray arry((char *)d,sizeof(local_bootinfo));
|
||||||
|
free(d);
|
||||||
|
return arry;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static myarray slave_to_bootinfo_byte(myarray data){
|
||||||
|
data.append(sizeof(bootinfo_data)-data.size(),0);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void selfdev_bootinfo::slave_end_slot(int addr,int ack, myarray data)
|
||||||
|
{
|
||||||
|
if(addr<=0||addr>slave_acked.size()){
|
||||||
|
qWarning("slave addr err:%d",addr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
slave_acked.replace(addr-1,data);
|
||||||
|
slave_acked_num++;
|
||||||
|
if(slave_acked_num>=slave_acked.size()){
|
||||||
|
myarray r;
|
||||||
|
r.append(char(0));
|
||||||
|
r+=bootinfo_fill_local();
|
||||||
|
for(int i=0;i<slave_acked.size();i++){
|
||||||
|
r.append(slave_to_bootinfo_byte(slave_acked[i]));
|
||||||
|
}
|
||||||
|
emit send_data_signal(0x34,r);
|
||||||
|
busy=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static HandlePc *get_selfdev_bootinfo(){
|
||||||
|
return new selfdev_bootinfo();
|
||||||
|
}
|
||||||
|
protpc_export(0x34, get_selfdev_bootinfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -109,6 +109,53 @@ signals:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 本机升级
|
||||||
|
class selfdev_hostupdate : public selfdev_slaveupdate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
selfdev_hostupdate() : selfdev_slaveupdate() {}
|
||||||
|
~selfdev_hostupdate() {}
|
||||||
|
int dolater(int cmd, myarray data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// jwt升级
|
||||||
|
class selfdev_jwtupdate : public selfdev_slaveupdate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
selfdev_jwtupdate() : selfdev_slaveupdate() {}
|
||||||
|
~selfdev_jwtupdate() {}
|
||||||
|
int dolater(int cmd, myarray data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 自检
|
||||||
|
class selfdev_bootinfo : public HandlePc
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
selfdev_bootinfo() : HandlePc() {
|
||||||
|
slave_acked_num=0;
|
||||||
|
}
|
||||||
|
~selfdev_bootinfo() {
|
||||||
|
}
|
||||||
|
int dolater(int cmd, myarray data);
|
||||||
|
void timeout();
|
||||||
|
public slots:
|
||||||
|
void slave_end_slot(int addr,int ack, myarray data);
|
||||||
|
protected:
|
||||||
|
QList<myarray> slave_acked;
|
||||||
|
int slave_acked_num;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -383,3 +383,42 @@ int boardcast_updata_jwt::start(myarray data)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 获取自检信息
|
||||||
|
int slave_bootinfo::start(myarray data)
|
||||||
|
{
|
||||||
|
mycfg *cfg_=syscfg();
|
||||||
|
int timeout=5000;
|
||||||
|
busy=1;
|
||||||
|
cmd=0x13;
|
||||||
|
qDebug("addr %d get bootinfo,timeout=%d",addr,timeout);
|
||||||
|
send_data(cmd,myarray(),3);
|
||||||
|
timeout_start(timeout);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void slave_bootinfo::timeout()
|
||||||
|
{
|
||||||
|
timeout_stop();
|
||||||
|
qWarning("addr %d get bootinfo.",addr);
|
||||||
|
end(1,myarray());
|
||||||
|
busy=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slave_bootinfo::dolater(int cmd, myarray data)
|
||||||
|
{
|
||||||
|
if(cmd!=this->cmd){
|
||||||
|
qWarning("addr %d recv err cmd:%02x",addr,cmd);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
timeout_stop_retry();
|
||||||
|
end(0,data);
|
||||||
|
busy=0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -122,4 +122,18 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 自检信息
|
||||||
|
class slave_bootinfo:public HandleSlave
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
slave_bootinfo():HandleSlave(){}
|
||||||
|
int start(myarray data);
|
||||||
|
int dolater(int cmd, myarray data);
|
||||||
|
void timeout();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // CMD_SLAVE_H
|
#endif // CMD_SLAVE_H
|
||||||
|
Reference in New Issue
Block a user