-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathinfopacket.cpp
65 lines (60 loc) · 1.47 KB
/
infopacket.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "infopacket.h"
#include "ui_infopacket.h"
InfoPacket::InfoPacket(QWidget *parent) :
QDialog(parent),
PackeManager(INFO_PACKET),
ui(new Ui::InfoPacket)
{
setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);
hide();
ui->setupUi(this);
}
InfoPacket::~InfoPacket()
{
delete ui;
}
/**
*函数名:根据界面选择返回obj
*函数参数:NULL
*函数作用:NULL
*函数返回值:NULL
*备注:NULL
*/
VCI_CAN_OBJ InfoPacket::getObj()
{
memset(&obj,0,sizeof(obj));
QByteArray ba;ba.resize(8);memset(ba.data(),0,ba.size());
char c = 0x00;
//生命信号
ba[0] = (unsigned char)ui->lineEdit->text().toUInt();
//硬件主版本号
ba[1] = (unsigned char)ui->lineEdit_2->text().toUInt();
//硬件次版本号
ba[2] = (unsigned char)ui->lineEdit_3->text().toUInt();
//软件主版本号
ba[3] = (unsigned char)ui->lineEdit_4->text().toUInt();
//软件次版本号
ba[4] = (unsigned char)ui->lineEdit_5->text().toUInt();
//can2故障状态
if(0==ui->comboBox_2->currentIndex())
{
c = c | (0x01<<4);
}
else if(1==ui->comboBox_2->currentIndex())
{
c = c | (0x02<<4);
}
//can1故障状态
if(0==ui->comboBox->currentIndex())
{
c = c | (0x01<<6);
}
else if(1==ui->comboBox->currentIndex())
{
c = c | (0x02<<6);
}
ba[5] = c;c=0x00;
obj.DataLen = ba.size();
memcpy(obj.Data,ba.data(),ba.size());
return obj;
}