Skip to content

Commit

Permalink
Add two new interrogation packets.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcooke authored and malcom2073 committed Apr 13, 2014
1 parent 453d404 commit 8db914e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
66 changes: 66 additions & 0 deletions plugins/freeems/freeemscomms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,26 @@ int FreeEmsComms::getOperatingSystem()
m_reqList.append(req);
return m_sequenceNumber-1;
}
int FreeEmsComms::getSupportEmail()
{
QMutexLocker locker(&m_reqListMutex);
RequestClass req;
req.type = GET_SUPPORT_EMAIL;
req.sequencenumber = m_sequenceNumber;
m_sequenceNumber++;
m_reqList.append(req);
return m_sequenceNumber-1;
}
int FreeEmsComms::getBuiltByName()
{
QMutexLocker locker(&m_reqListMutex);
RequestClass req;
req.type = GET_BUILT_BY_NAME;
req.sequencenumber = m_sequenceNumber;
m_sequenceNumber++;
m_reqList.append(req);
return m_sequenceNumber-1;
}
int FreeEmsComms::retrieveBlockFromFlash(unsigned short location, unsigned short offset, unsigned short size)
{
QMutexLocker locker(&m_reqListMutex);
Expand Down Expand Up @@ -1120,6 +1140,14 @@ void FreeEmsComms::run()
emit interrogateTaskStart("Ecu Info Operating System",seq);
m_interrogatePacketList.append(seq);

seq = getBuiltByName();
emit interrogateTaskStart("Ecu Info Built By Name",seq);
m_interrogatePacketList.append(seq);

seq = getSupportEmail();
emit interrogateTaskStart("Ecu Info Support Email",seq);
m_interrogatePacketList.append(seq);

seq = getLocationIdList(0x00,0x00);
emit interrogateTaskStart("Ecu Info Location ID List",seq);
m_interrogatePacketList.append(seq);
Expand Down Expand Up @@ -1206,6 +1234,44 @@ void FreeEmsComms::run()
}
m_waitingInfoMutex.unlock();
}
else if (m_threadReqList[i].type == GET_BUILT_BY_NAME)
{
m_waitingInfoMutex.lock();
if (!m_waitingForResponse)
{
m_waitingForResponse = true;
m_timeoutMsecs = QDateTime::currentDateTime().currentMSecsSinceEpoch();
m_currentWaitingRequest = m_threadReqList[i];
m_payloadWaitingForResponse = GET_BUILT_BY_NAME;
if (!sendPacket(GET_BUILT_BY_NAME))
{
QLOG_FATAL() << "Error writing packet. Quitting thread";
return;
}
m_threadReqList.removeAt(i);
i--;
}
m_waitingInfoMutex.unlock();
}
else if (m_threadReqList[i].type == GET_SUPPORT_EMAIL)
{
m_waitingInfoMutex.lock();
if (!m_waitingForResponse)
{
m_waitingForResponse = true;
m_timeoutMsecs = QDateTime::currentDateTime().currentMSecsSinceEpoch();
m_currentWaitingRequest = m_threadReqList[i];
m_payloadWaitingForResponse = GET_SUPPORT_EMAIL;
if (!sendPacket(GET_SUPPORT_EMAIL))
{
QLOG_FATAL() << "Error writing packet. Quitting thread";
return;
}
m_threadReqList.removeAt(i);
i--;
}
m_waitingInfoMutex.unlock();
}
else if (m_threadReqList[i].type == GET_OPERATING_SYSTEM)
{
m_waitingInfoMutex.lock();
Expand Down
2 changes: 2 additions & 0 deletions plugins/freeems/freeemscomms.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class FreeEmsComms : public EmsComms
int getDecoderName();
int getFirmwareBuildDate();
int getCompilerVersion();
int getSupportEmail();
int getBuiltByName();
int getOperatingSystem();
int echoPacket(QByteArray packet);
Q_INVOKABLE int startBenchTest(unsigned char eventspercycle,unsigned short numcycles,unsigned short ticksperevent,QVariantList pineventmask,QVariantList pinmode);
Expand Down
2 changes: 2 additions & 0 deletions plugins/freeems/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ enum RequestType
GET_FIRMWARE_BUILD_DATE=0xEEF0,
GET_COMPILER_VERSION=0xEEF2,
GET_OPERATING_SYSTEM=0xEEF4,
GET_BUILT_BY_NAME=0xEEF6,
GET_SUPPORT_EMAIL=0xEEF8,
GET_LOCATION_ID_INFO=0xF8E0,
SERIAL_CONNECT=0xFFFF01,
SERIAL_DISCONNECT=0xFFFF02,
Expand Down

0 comments on commit 8db914e

Please sign in to comment.