| 24 | } |
| 25 | |
| 26 | quint64 FramePlaybackObject::updatePosition(bool forward) |
| 27 | { |
| 28 | //qDebug() << "updatePosition"; |
| 29 | if (!currentSeqItem) { |
| 30 | playbackTimer->stop(); //pushing this button halts automatic playback |
| 31 | playbackActive = false; |
| 32 | currentPosition = 0; |
| 33 | return 0; |
| 34 | } |
| 35 | if (forward) |
| 36 | { |
| 37 | if (currentPosition < (currentSeqItem->data.count() - 1)) currentPosition++; //still in same file so keep going |
| 38 | else //hit the end of the current file |
| 39 | { |
| 40 | qDebug() << "hit end of current sequence"; |
| 41 | currentSeqItem->currentLoopCount++; |
| 42 | currentPosition = 0; |
| 43 | if (currentSeqItem->currentLoopCount == currentSeqItem->maxLoops) //have we looped enough times? |
| 44 | { |
| 45 | playbackActive = false; |
| 46 | playbackTimer->stop(); |
| 47 | emit EndOfFrameCache(); |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | else |
| 52 | { |
| 53 | if (currentPosition > 0) currentPosition--; |
| 54 | else //hit the beginning of the current sequence |
| 55 | { |
| 56 | qDebug() << "hit start of current sequence"; |
| 57 | currentSeqItem->currentLoopCount++; |
| 58 | currentPosition = currentSeqItem->data.count() - 1; |
| 59 | if (currentSeqItem->currentLoopCount == currentSeqItem->maxLoops) //have we looped enough times? |
| 60 | { |
| 61 | playbackActive = false; |
| 62 | playbackTimer->stop(); |
| 63 | emit EndOfFrameCache(); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | //only send frame out if its ID is checked in the list. Otherwise discard it. |
| 69 | CANFrame *thisFrame = ¤tSeqItem->data[currentPosition]; |
| 70 | uint32_t originalBus = thisFrame->bus; |
| 71 | if (currentSeqItem->idFilters.find(thisFrame->ID).value()) |
| 72 | { |
| 73 | if (whichBusSend > -1) |
| 74 | { |
| 75 | thisFrame->bus = whichBusSend; |
| 76 | sendingBuffer.append(*thisFrame); |
| 77 | } |
| 78 | else if (whichBusSend == -1) |
| 79 | { |
| 80 | for (int c = 0; c < numBuses; c++) |
| 81 | { |
| 82 | thisFrame->bus = c; |
| 83 | sendingBuffer.append(*thisFrame); |