| 516 | } |
| 517 | |
| 518 | int FrameSenderWindow::fetchOperand(int idx, ModifierOperand op) |
| 519 | { |
| 520 | CANFrame *tempFrame = nullptr; |
| 521 | if (op.ID == 0) //numeric constant |
| 522 | { |
| 523 | if (op.notOper) return ~op.databyte; |
| 524 | else return op.databyte; |
| 525 | } |
| 526 | else if (op.ID == -2) //fetch data from a data byte within the output frame |
| 527 | { |
| 528 | if (op.notOper) return ~sendingData.at(idx).data[op.databyte]; |
| 529 | else return sendingData.at(idx).data[op.databyte]; |
| 530 | } |
| 531 | else //look up external data byte |
| 532 | { |
| 533 | tempFrame = lookupFrame(op.ID, op.bus); |
| 534 | if (tempFrame != nullptr) |
| 535 | { |
| 536 | if (op.notOper) return ~tempFrame->data[op.databyte]; |
| 537 | else return tempFrame->data[op.databyte]; |
| 538 | } |
| 539 | else return 0; |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | /// <summary> |
| 544 | /// Try to find the most recent frame given the input criteria |