添加自研批检仪检测命令

This commit is contained in:
ranchuan
2023-11-27 14:31:00 +08:00
parent b3a0d7b57c
commit a0b0f41c39
45 changed files with 3778 additions and 2628 deletions

View File

@@ -10,33 +10,59 @@
#include "interface/interface.h"
#include "base/mycfg.h"
#include "QThread"
#include "QTimer"
// 定义处理命令的类
class HandlePc:public QObject{
class HandlePc : public QObject
{
Q_OBJECT
public:
HandlePc(){busy=0;}
virtual ~HandlePc(){}
virtual int dolater(int cmd,myarray data)=0;
HandlePc() {
busy = 0;
timer_ = nullptr;
}
virtual ~HandlePc() {
if(timer_!=nullptr){
delete timer_;
}
}
virtual int dolater(int cmd, myarray data) = 0;
virtual void timeout()=0;
int busy;
protected:
void timeout_start(int ms){
if(timer_==nullptr){
timer_=new QTimer();
connect(timer_,&QTimer::timeout,this,&HandlePc::timeout);
}
timer_->start(ms);
}
void timeout_stop(){
if(timer_!=nullptr){
timer_->stop();
}
}
private:
QTimer *timer_;
signals:
void send_data_signal(int cmd,myarray data);
void send_data_signal(int cmd, myarray data);
};
class ProtPc:public QObject{
class ProtPc : public QObject
{
Q_OBJECT
public:
ProtPc(){if_=nullptr;codec_=nullptr;handle_=nullptr;}
~ProtPc(){}
ProtPc()
{
if_ = nullptr;
codec_ = nullptr;
handle_ = nullptr;
}
~ProtPc() {}
void init();
protected slots:
void send_data_slot(int cmd,myarray data);
void send_data_slot(int cmd, myarray data);
protected:
InterFace *if_;
Codec *codec_;
@@ -45,31 +71,18 @@ protected:
myarray recv_data;
};
ProtPc *protPc();
typedef struct
{
int cmd;
HandlePc *(*handle_get_fun)();
} handlepc_def;
typedef struct{
int cmd;
HandlePc *(*handle_get_fun)();
}handlepc_def;
#define protpc_export(cmd_,fun_) \
__attribute__((used)) static handlepc_def _handlepc_##name_ __attribute__((section("protpc")))={\
.cmd=cmd_,\
.handle_get_fun=fun_,\
}
#define protpc_export(cmd_, fun_) \
__attribute__((used)) static handlepc_def _handlepc_##name_ __attribute__((section("protpc"))) = { \
.cmd = cmd_, \
.handle_get_fun = fun_, \
}
#endif