| 1693 | } |
| 1694 | |
| 1695 | int SbcInterface::ReadFile(FileHandle handle, char *buffer, size_t bufferLength) noexcept |
| 1696 | { |
| 1697 | // Don't do anything if the SBC is not connected |
| 1698 | if (!IsConnected()) |
| 1699 | { |
| 1700 | return false; |
| 1701 | } |
| 1702 | |
| 1703 | // Set up the request content |
| 1704 | MutexLocker locker(fileMutex); |
| 1705 | |
| 1706 | fileHandle = handle; |
| 1707 | fileReadBuffer = buffer; |
| 1708 | fileBufferLength = bufferLength; |
| 1709 | if (!DoFileOperation(FileOperation::read)) |
| 1710 | { |
| 1711 | reprap.GetPlatform().Message(ErrorMessage, "Timeout while trying to read from file\n"); |
| 1712 | return -1; |
| 1713 | } |
| 1714 | |
| 1715 | // Return the number of bytes read |
| 1716 | return fileSuccess ? (int)fileOffset : -1; |
| 1717 | } |
| 1718 | |
| 1719 | bool SbcInterface::WriteFile(FileHandle handle, const char *buffer, size_t bufferLength) noexcept |
| 1720 | { |
no test coverage detected