添加广播方式升级
This commit is contained in:
59
main.cpp
59
main.cpp
@@ -6,55 +6,38 @@
|
||||
#include <QTextCodec>
|
||||
#include "base/base.h"
|
||||
#include "base/mycfg.h"
|
||||
#include "base/check_cfg.h"
|
||||
#include "interface/interface.h"
|
||||
#include "prot/prot_m4.h"
|
||||
#include "prot/prot_pc.h"
|
||||
#include "prot/prot_slave.h"
|
||||
|
||||
#define log(fmt, ...) \
|
||||
{ \
|
||||
QString str = QString::asprintf(fmt, ##__VA_ARGS__); \
|
||||
printf("%s", str.toLocal8Bit().data()); \
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
typedef std::function<void(int, int)> Fun;
|
||||
|
||||
class B
|
||||
{
|
||||
public:
|
||||
void call(int a, Fun f)
|
||||
{
|
||||
f(a, 2);
|
||||
}
|
||||
};
|
||||
|
||||
class Test
|
||||
{
|
||||
public:
|
||||
void callback(int a, int b)
|
||||
{
|
||||
// qDebug()<<a<<"+"<<b<<"="<<a+b<<endl;
|
||||
qDebug("%d+%d=%d,%s", a, b, a + b, QString("ssssss").toLocal8Bit().data());
|
||||
}
|
||||
|
||||
void bind()
|
||||
{
|
||||
Fun fun = std::bind(&Test::callback, this, _1, _2);
|
||||
B b;
|
||||
b.call(1, fun);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
// Test test;
|
||||
// test.bind();
|
||||
|
||||
qDebug("local ip=%s", syscfg()->local_ip.data());
|
||||
InterFace *if_ = interFaceFind("tcp");
|
||||
// w.show();
|
||||
syscfg();
|
||||
check_plan();
|
||||
prot_m4 *m4=protM4();
|
||||
protPc();
|
||||
protSlave();
|
||||
|
||||
// 获取m4的编译时间
|
||||
m4->set_irq_fun([=](myarray data){
|
||||
qDebug("m4 app:%s",data.data());
|
||||
m4->del_irq_fun(nullptr,"buildtime: ");
|
||||
},"buildtime: ");
|
||||
m4->send_data_slot("build");
|
||||
m4->set_irq_fun([=](myarray data){
|
||||
qDebug("m4 app: moter inited");
|
||||
m4->del_irq_fun(nullptr,"moterinited");
|
||||
},"moterinited");
|
||||
m4->send_data_slot("moterinit");
|
||||
return app.exec();
|
||||
}
|
||||
|
Reference in New Issue
Block a user