Changed a lot of pointer references to const (it's more correct and

fixes a weird problem), fixed a problem with JSON to DBC, a few other
fixes
This commit is contained in:
Collin Kidder
2020-02-13 22:01:06 -05:00
parent 1a5d67d09e
commit d550fa79a0
18 changed files with 76 additions and 62 deletions
+6 -9
View File
@@ -59,12 +59,13 @@ void ISOTP_HANDLER::sendISOTPFrame(int bus, int ID, QByteArray data)
lastSenderID = ID;
lastSenderBus = bus;
frame.bus = bus;
frame.setFrameId(ID);
if (ID > 0x7FF) frame.setExtendedFrameFormat(true);
else frame.setExtendedFrameFormat(false);
if (data.length() < 8)
{
frame.bus = bus;
frame.setFrameId(ID);
if (ID > 0x7FF) frame.setExtendedFrameFormat(true);
else frame.setExtendedFrameFormat(false);
QByteArray bytes(8,0);
bytes.resize(8);
bytes[0] = data.length();
@@ -74,10 +75,6 @@ void ISOTP_HANDLER::sendISOTPFrame(int bus, int ID, QByteArray data)
}
else //need to send a multi-part ISO_TP message - Respects timing and frame number based flow control
{
frame.bus = bus;
frame.setFrameId(ID);
if (ID > 0x7FF) frame.setExtendedFrameFormat(true);
else frame.setExtendedFrameFormat(false);
QByteArray bytes(8, 0);
bytes[0] = 0x10 + (data.length() / 256);
bytes[1] = data.length() & 0xFF;
@@ -159,7 +156,7 @@ void ISOTP_HANDLER::processFrame(const CANFrame &frame)
//int offset;
ISOTP_MESSAGE msg;
ISOTP_MESSAGE *pMsg;
unsigned char *data = reinterpret_cast<unsigned char *>(frame.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(frame.payload().constData());
//int dataLen = frame.payload().count();
frameType = 0;
+4 -2
View File
@@ -177,7 +177,7 @@ UDS_HANDLER::~UDS_HANDLER()
void UDS_HANDLER::gotISOTPFrame(ISOTP_MESSAGE msg)
{
qDebug() << "UDS handler got ISOTP frame";
unsigned char *data = reinterpret_cast<unsigned char *>(msg.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData());
int dataLen = msg.payload().count();
UDS_MESSAGE udsMsg;
udsMsg.bus = msg.bus;
@@ -258,6 +258,8 @@ void UDS_HANDLER::sendUDSFrame(const UDS_MESSAGE &msg)
data.append(msg.payload());
isoHandler->sendISOTPFrame(msg.bus, msg.frameId(), data);
//qDebug() << "Data sending: " << data;
qDebug() << "Sent UDS service: " << getServiceShortDesc(msg.service) << " on bus " << msg.bus;
}
@@ -327,7 +329,7 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
bool isResponse = true;
int dataSize;
int addrSize;
unsigned char *data = reinterpret_cast<unsigned char *>(msg.payload().data());
const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData());
int dataLen = msg.payload().length();
if (msg.isErrorReply)