|
@@ -18,6 +18,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|
{
|
|
{
|
|
CANPacker xPac("/home/yuchuli/ADCC_CH.dbc");
|
|
CANPacker xPac("/home/yuchuli/ADCC_CH.dbc");
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
|
|
+
|
|
|
|
+ setWindowTitle("View Signal Base CAN DBC");
|
|
}
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
MainWindow::~MainWindow()
|
|
@@ -207,8 +209,8 @@ bool MainWindow::parselogline(char * strline,struct CanFrame & xFrame)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- struct CanFrame xFrame;
|
|
|
|
xFrame.address = cu.fd.can_id;
|
|
xFrame.address = cu.fd.can_id;
|
|
|
|
+ // std::cout<<" id: "<<xFrame.address<<std::endl;
|
|
xFrame.src = 0;
|
|
xFrame.src = 0;
|
|
int i;
|
|
int i;
|
|
for(i=0;i<cu.fd.len;i++)
|
|
for(i=0;i<cu.fd.len;i++)
|
|
@@ -221,6 +223,8 @@ bool MainWindow::parselogline(char * strline,struct CanFrame & xFrame)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -300,10 +304,10 @@ bool MainWindow::parseascline(char * strline,struct CanFrame & xFrame)
|
|
int i;
|
|
int i;
|
|
for(i=0;i<nlen;i++)
|
|
for(i=0;i<nlen;i++)
|
|
{
|
|
{
|
|
- unsigned char c1;
|
|
|
|
|
|
+ int c1;
|
|
int npos = i+ 9;
|
|
int npos = i+ 9;
|
|
- sscanf(strlist.at(npos).toLatin1().data(),"%02X",&c1);
|
|
|
|
- xFrame.dat.push_back(c1);
|
|
|
|
|
|
+ sscanf(strlist.at(npos).toLatin1().data(),"%X",&c1);
|
|
|
|
+ xFrame.dat.push_back((unsigned char)c1);
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
@@ -344,6 +348,7 @@ void MainWindow::on_pushButton_Next_clicked()
|
|
if((index<static_cast<int>( mvectorrawframe.size())) && (index>= 0))
|
|
if((index<static_cast<int>( mvectorrawframe.size())) && (index>= 0))
|
|
{
|
|
{
|
|
ui->plainTextEdit_Frame->setPlainText(mvectorrawframe[index]);
|
|
ui->plainTextEdit_Frame->setPlainText(mvectorrawframe[index]);
|
|
|
|
+// std::cout<<" id: "<<mvectorFrame[index].address<<std::endl;
|
|
updateparse();
|
|
updateparse();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -439,6 +444,7 @@ void MainWindow::updateparse()
|
|
std::vector<SignalValue> xvals;
|
|
std::vector<SignalValue> xvals;
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
mpParser->update(xvectorcandata,xvals);
|
|
mpParser->update(xvectorcandata,xvals);
|
|
if(xvals.size()> 0)
|
|
if(xvals.size()> 0)
|
|
{
|
|
{
|
|
@@ -446,12 +452,26 @@ void MainWindow::updateparse()
|
|
char strline[1000];
|
|
char strline[1000];
|
|
snprintf(strout,10000,"");
|
|
snprintf(strout,10000,"");
|
|
unsigned int i;
|
|
unsigned int i;
|
|
|
|
+ int maxnamelen = 0;
|
|
for(i=0;i<xvals.size();i++)
|
|
for(i=0;i<xvals.size();i++)
|
|
{
|
|
{
|
|
- snprintf(strline,1000,"%s:\t%f\n",xvals[i].name.data(),xvals[i].value);
|
|
|
|
|
|
+ std::string strname = xvals[i].name;
|
|
|
|
+ int nlenstr = strname.length();
|
|
|
|
+ if(nlenstr > maxnamelen)maxnamelen = nlenstr;
|
|
|
|
+ }
|
|
|
|
+ for(i=0;i<xvals.size();i++)
|
|
|
|
+ {
|
|
|
|
+ int nlenstr = xvals[i].name.length();
|
|
|
|
+ int nspace = maxnamelen - nlenstr + 1;
|
|
|
|
+ snprintf(strline,1000,"%s:%*s\t%g\n",xvals[i].name.data(),nspace," ",xvals[i].value);
|
|
strncat(strout,strline,10000);
|
|
strncat(strout,strline,10000);
|
|
}
|
|
}
|
|
|
|
+ QFont xFont = ui->plainTextEdit_Value->font();
|
|
|
|
+ xFont.setFamily("Courier New"); // 设置等宽字体族
|
|
|
|
+ xFont.setFixedPitch(true);
|
|
|
|
+ ui->plainTextEdit_Value->setFont(xFont);
|
|
ui->plainTextEdit_Value->setPlainText(strout);
|
|
ui->plainTextEdit_Value->setPlainText(strout);
|
|
|
|
+
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -467,6 +487,13 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
|
|
|
ui->plainTextEdit_Value->setGeometry(50,180,sizemain.width()-100,sizemain.height() -230);
|
|
ui->plainTextEdit_Value->setGeometry(50,180,sizemain.width()-100,sizemain.height() -230);
|
|
|
|
|
|
|
|
+ ui->pushButton_Pre->setGeometry(sizemain.width()-250,80,90,40);
|
|
|
|
+ ui->pushButton_Next->setGeometry(sizemain.width()-140,80,90,40);
|
|
|
|
+ ui->lineEdit_FrameGo->setGeometry(sizemain.width()-250,126,90,40);
|
|
|
|
+ ui->pushButton_Goto->setGeometry(sizemain.width()-140,126,90,40);
|
|
|
|
+
|
|
|
|
+ ui->plainTextEdit_Frame->setGeometry(50,80,sizemain.width()-320,86);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|