Ymodem ESP32 1.0.0
|
Ymodem Packet reception functions. More...
#include "YmodemUtils.h"
Go to the source code of this file.
Functions | |
int | processDataPacket (uint8_t *packet_data, int packet_length, fs::File &ffd, unsigned int file_size, unsigned int *errors) |
Processes a data packet received via Ymodem protocol. | |
void | handleEOFPacket (unsigned int *file_done, unsigned int *errors) |
Handles the End Of File (EOF) packet in the Ymodem protocol. | |
void | extractFileInfo (uint8_t *packet_data, char *getname, int *size) |
Extracts file information from a Ymodem packet. | |
int | processHeaderPacket (uint8_t *packet_data, int packet_length, unsigned int maxsize, char *getname, int *size, unsigned int *errors) |
Processes the header packet of a Ymodem transfer. | |
int | processPacket (uint8_t *packet_data, int packet_length, fs::File &ffd, unsigned int maxsize, char *getname, unsigned int packets_received, int *size, unsigned int *file_done, unsigned int *errors) |
Processes a received Ymodem packet. | |
int | handleFileSession (fs::File &ffd, unsigned int maxsize, char *getname, unsigned int *session_done, unsigned int *errors) |
Handles a file session for receiving data. | |
Ymodem Packet reception functions.
This file contains the functions to receive files using the Ymodem protocol. It processes the incoming packets, extracts the file information, and writes the data to the filesystem.
Definition in file YmodemReceive.h.
void extractFileInfo | ( | uint8_t * | packet_data, |
char * | getname, | ||
int * | size ) |
Extracts file information from a Ymodem packet.
This function parses the given packet data to extract the file name and size.
packet_data | Pointer to the packet data containing the file information. |
getname | Pointer to a character array where the extracted file name will be stored. |
size | Pointer to an integer where the extracted file size will be stored. |
Definition at line 54 of file YmodemReceive.cpp.
void handleEOFPacket | ( | unsigned int * | file_done, |
unsigned int * | errors ) |
Handles the End Of File (EOF) packet in the Ymodem protocol.
This function processes the EOF packet received during a Ymodem file transfer. It updates the status of the file transfer and tracks any errors encountered.
file_done | Pointer to an unsigned int that indicates whether the file transfer is complete. A non-zero value indicates completion. |
errors | Pointer to an unsigned int that tracks the number of errors encountered during the transfer. |
Definition at line 40 of file YmodemReceive.cpp.
int handleFileSession | ( | fs::File & | ffd, |
unsigned int | maxsize, | ||
char * | getname, | ||
unsigned int * | session_done, | ||
unsigned int * | errors ) |
Handles a file session for receiving data.
ffd | Reference to the file object where the received data will be stored. |
maxsize | Maximum size of the file to be received. |
getname | Pointer to a character array where the name of the received file will be stored. |
session_done | Pointer to an unsigned int that will be set to 1 if the session is completed successfully, 0 otherwise. |
errors | Pointer to an unsigned int that will be incremented if any errors occur during the session. |
Definition at line 144 of file YmodemReceive.cpp.
int processDataPacket | ( | uint8_t * | packet_data, |
int | packet_length, | ||
fs::File & | ffd, | ||
unsigned int | file_size, | ||
unsigned int * | errors ) |
Processes a data packet received via Ymodem protocol.
This function handles the data packet, writing its contents to the specified file, and updating the error count if any issues are encountered.
packet_data | Pointer to the data packet to be processed. |
packet_length | Length of the data packet. |
ffd | Reference to the file object where the data will be written. |
file_size | Total size of the file being received. |
errors | Pointer to an unsigned int where the error count will be updated. |
Definition at line 17 of file YmodemReceive.cpp.
int processHeaderPacket | ( | uint8_t * | packet_data, |
int | packet_length, | ||
unsigned int | maxsize, | ||
char * | getname, | ||
int * | size, | ||
unsigned int * | errors ) |
Processes the header packet of a Ymodem transfer.
This function extracts information from the header packet, such as the file name and size, and performs validation checks.
packet_data | Pointer to the packet data. |
packet_length | Length of the packet data. |
maxsize | Maximum allowed size for the file. |
getname | Pointer to a buffer where the file name will be stored. |
size | Pointer to an integer where the file size will be stored. |
errors | Pointer to an unsigned integer where the error count will be stored. |
Definition at line 92 of file YmodemReceive.cpp.
int processPacket | ( | uint8_t * | packet_data, |
int | packet_length, | ||
fs::File & | ffd, | ||
unsigned int | maxsize, | ||
char * | getname, | ||
unsigned int | packets_received, | ||
int * | size, | ||
unsigned int * | file_done, | ||
unsigned int * | errors ) |
Processes a received Ymodem packet.
This function handles the processing of a Ymodem packet, including writing data to a file, managing packet counts, and handling errors.
packet_data | Pointer to the data of the received packet. |
packet_length | Length of the received packet. |
ffd | Reference to the file object where data will be written. |
maxsize | Maximum allowed size of the file. |
getname | Pointer to a buffer where the filename will be stored. |
packets_received | Number of packets received so far. |
size | Pointer to an integer where the size of the file will be stored. |
file_done | Pointer to an unsigned integer that indicates if the file transfer is complete. |
errors | Pointer to an unsigned integer that counts the number of errors encountered. |
Definition at line 114 of file YmodemReceive.cpp.