MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / ReadFile

Method ReadFile

src/SBC/SbcInterface.cpp:1695–1717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1693}
1694
1695int 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
1719bool SbcInterface::WriteFile(FileHandle handle, const char *buffer, size_t bufferLength) noexcept
1720{

Callers 1

ReadMethod · 0.80

Calls 2

IsConnectedFunction · 0.85
MessageMethod · 0.80

Tested by

no test coverage detected