| 468 | } |
| 469 | |
| 470 | bool Transaction::cancel() { |
| 471 | if (!pImpl || pImpl->completed) { |
| 472 | return false; // Already completed or invalid |
| 473 | } |
| 474 | |
| 475 | // Note: Cancellation of in-progress DMA transfers is platform-specific |
| 476 | // and not always supported. For now, we mark it as cancelled and |
| 477 | // the next wait() call will handle it. |
| 478 | |
| 479 | pImpl->cancelled = true; |
| 480 | pImpl->completed = true; |
| 481 | pImpl->result = fl::task::Error("Transaction cancelled"); |
| 482 | |
| 483 | // Clear async state in device |
| 484 | if (pImpl->device && pImpl->device->pImpl) { |
| 485 | pImpl->device->pImpl->async_state.active = false; |
| 486 | } |
| 487 | |
| 488 | FL_LOG_SPI("Transaction: Cancelled"); |
| 489 | return true; |
| 490 | } |
| 491 | |
| 492 | fl::optional<fl::task::Error> Transaction::getResult() const { |
| 493 | if (!pImpl) { |
no test coverage detected