添加debug重定向,添加命令行
This commit is contained in:
48
prot_cmd/cmd_cmdline.cpp
Normal file
48
prot_cmd/cmd_cmdline.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "prot/prot_cmdline.h"
|
||||
#include "base/mycfg.h"
|
||||
#include "QNetworkConfigurationManager"
|
||||
#include "QTimer"
|
||||
#include "QtNetwork"
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取设备基本信息
|
||||
static void whos(QList<myarray> args)
|
||||
{
|
||||
QString out;
|
||||
QString name = "local_id:%1,name:%2";
|
||||
QString hostName = QHostInfo::localHostName();
|
||||
command *c=command_start();
|
||||
mycfg *cfg_=syscfg();
|
||||
name = name.arg(cfg_->local_id).arg(hostName);
|
||||
out.append(name + "\n");
|
||||
out.append("builed time:" + cfg_->build_date + "\n");
|
||||
QList<QNetworkInterface> network = QNetworkInterface::allInterfaces();
|
||||
foreach (QNetworkInterface net, network)
|
||||
{
|
||||
QString str = "net:%1";
|
||||
QString netName = net.humanReadableName();
|
||||
str = str.arg(netName);
|
||||
out.append(str + "\n");
|
||||
QList<QNetworkAddressEntry> list = net.addressEntries(); // 获取IP地址与子掩码等
|
||||
foreach (QNetworkAddressEntry address, list)
|
||||
{
|
||||
QString str = "ip:%1";
|
||||
if (address.ip().protocol() == QAbstractSocket::IPv4Protocol) // 获取IPv4的地址
|
||||
{
|
||||
out.append(str.arg(address.ip().toString()) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
out = "ack:1," + out;
|
||||
c->send(out.toLocal8Bit());
|
||||
}
|
||||
|
||||
cmdline_export(whos, whos, print device base info.);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -211,7 +211,7 @@ static HandlePc *get_selfdev_slaveupdate(){
|
||||
return new selfdev_slaveupdate();
|
||||
}
|
||||
|
||||
protpc_export(0x40, get_selfdev_slaveupdate);
|
||||
protpc_export(0x41, get_selfdev_slaveupdate);
|
||||
|
||||
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define cmd_pc_h__
|
||||
|
||||
#include "prot/prot_pc.h"
|
||||
#include "prot/prot_m4.h"
|
||||
|
||||
|
||||
// 检测 自研批检仪
|
||||
|
Reference in New Issue
Block a user