A partial commit that changes CANFrame over to be based on
QCanBusFrame so that things are more compatible with other Qt based CAN bus code. Not complete yet but getting there.
This commit is contained in:
@@ -10,11 +10,11 @@ SnifferItem::SnifferItem(const CANFrame& pFrame, quint32 seq):
|
||||
mNotch[i] =0;
|
||||
mMarker.data[i] = 0;
|
||||
mMarker.dataTimestamp[i] = 0;
|
||||
mCurrent.data[i] = pFrame.data[i];
|
||||
mCurrent.data[i] = pFrame.payload()[i];
|
||||
mCurrent.dataTimestamp[i] = seq;
|
||||
}
|
||||
mLastMarker = mMarker;
|
||||
mCurrent.len = pFrame.len;
|
||||
mCurrent.len = pFrame.payload().length();
|
||||
/* that's dirty */
|
||||
update(pFrame, seq, false);
|
||||
update(pFrame, seq, false);
|
||||
@@ -115,18 +115,18 @@ void SnifferItem::update(const CANFrame& pFrame, quint32 timeSeq, bool mute)
|
||||
/* copy new value */
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
maskedData = pFrame.data[i];
|
||||
maskedData = pFrame.payload()[i];
|
||||
if (mute) maskedData &= ~mNotch[i];
|
||||
maskedCurr = mCurrent.data[i];
|
||||
if (mute) maskedCurr &= ~mNotch[i];
|
||||
if (maskedCurr != maskedData)
|
||||
{
|
||||
mCurrent.data[i] = pFrame.data[i];
|
||||
mCurrent.data[i] = pFrame.payload()[i];
|
||||
mCurrent.dataTimestamp[i] = timeSeq;
|
||||
}
|
||||
}
|
||||
mCurrent.len = pFrame.len;
|
||||
mCurrentTime = pFrame.timestamp;
|
||||
mCurrent.len = pFrame.payload().length();
|
||||
mCurrentTime = pFrame.timeStamp().microSeconds();
|
||||
|
||||
/* update marker */
|
||||
//We "OR" our stored marker with the changed bits.
|
||||
|
||||
@@ -300,20 +300,20 @@ void SnifferModel::update(CANConnection*, QVector<CANFrame>& pFrames)
|
||||
{
|
||||
foreach(const CANFrame& frame, pFrames)
|
||||
{
|
||||
if(!mMap.contains(frame.ID))
|
||||
if(!mMap.contains(frame.frameId()))
|
||||
{
|
||||
int index = std::distance(mMap.begin(), mMap.lowerBound(frame.ID));
|
||||
int index = std::distance(mMap.begin(), mMap.lowerBound(frame.frameId()));
|
||||
/* add the frame */
|
||||
beginInsertRows(QModelIndex(), index, index);
|
||||
mMap[frame.ID] = new SnifferItem(frame, mTimeSequence);
|
||||
mMap[frame.ID]->update(frame, mTimeSequence, mMuteNotched);
|
||||
mMap[frame.frameId()] = new SnifferItem(frame, mTimeSequence);
|
||||
mMap[frame.frameId()]->update(frame, mTimeSequence, mMuteNotched);
|
||||
endInsertRows();
|
||||
|
||||
emit idChange(frame.ID, true);
|
||||
emit idChange(frame.frameId(), true);
|
||||
}
|
||||
else
|
||||
//updateData
|
||||
mMap[frame.ID]->update(frame, mTimeSequence, mMuteNotched);
|
||||
mMap[frame.frameId()]->update(frame, mTimeSequence, mMuteNotched);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user