I need to transfer files from the SPIFFS of the ESP8266 (Arduino/C++) to the PC over serial communication and using the YMODEM protocol.
As far as the YMODEM protocol is concerned, I have a complete implementation including auxiliary functions needed by the protocol and my project compiles successfully without any issue. However, the problem lies in the following function needed to transfer the file:
/**
* @brief Transmit a file using the YMODEM protocol
* @param buffer: Address of the first byte
* @retval The size of the file
*/
uint8_t Ymodem_Trsfer(uint8_t *buffer, const uint8_t* sendFileName, uint32_t sizeFile)
{
// code goes here
}
As you can see above, the function takes a pointer to a data buffer as a parameter. The file I want to transfer (almost 64 KB) is a binary file stored into the SPIFFS and downloaded earlier from web server over HTTP. I have no problem reading bytes from file and using most Stream methods on it, however, I'm not sure how to pass the address of the open file/stream to the function above so I can send its contents over YMODEM.
I have certain scenarios in mind, but I'd love to get some feedback first.