Integrating FTP Client APIs for Embedded Devices: Implementation and File Management
This guide covers the integration of FTP client APIs for embedded devices, focusing on user upgrades and file management. It details commands like put, get, mkdir, and more, enabling efficient communication between a master device and its networked counterparts. The document includes sample C code for establishing FTP connections (FCConnect), file retrieval (FCRetrieveFile), storage (FCStoreFile), and directory management (FCMakeDir, FCRemoveDir). It also addresses enhancements in the .NET OS v6.0 file system for seamless FTP operations, ensuring reliable file transfers.
Integrating FTP Client APIs for Embedded Devices: Implementation and File Management
E N D
Presentation Transcript
FTP Client API FTP in embedded devices Implementing an FTP Client FTP Command APIs Other FTP Client APIs
Uses for FTP in Embedded Devices User Upgrades the Master with new File USER MASTER FTP Connection FTP FTP FTP Master then Upgrades all Devices on Network
APIs provided for… • put • get • mkdir • bye • rmdir • del • dir • others Integrating an FTP Client FCConnect(char server, char username, char password) Application Entry
Connection Establishment Setup for FTP put Command Sample FTP Client Implementation Declarations #include fcIntapi.h
Sample FTP Client Implementation (2) #include fcIntapi.h FTP put Command
FTP Client Command APIs • int FCRetrieveFile (unsigned long h, char *pathname, int type); • int FCStoreFile (unsigned long h, char *pathname, int type); • int FCSetCurrentDir (unsigned long h, char* dir); • int FCGetCurrentDir (unsigned long h, char* buffer, int len); • int FCListDir (unsigned long h, int verbose, char *szpathname, char *buffer, int len, int *flag); • int FCDisconnect (unsigned long h); • int FCMakeDir (unsigned long h, char* dir); • int FCRemoveDir (unsigned long h, char* dir); • int FCDeleteFile (unsigned long h, char* file);
Other FTP Client APIs • int FCGetData (unsigned long h, char *buffer, int len); // needed to actually retrieve the data after an FCRetrieveFile call • int FCPutData (unsigned long h, char *buffer, int len, int flag); // needed to actually send the data after an FCStoreFile call • int FCHandleToSocket (unsigned long handle); // returns the control socket for the current session
FTP Client Summary • FCConnect – issue commands – FCDisconnect • Can retrieve and store files, set or get current directory make and remove directories • FCGetData and FCPutData are required to process data after retrieve and store requests.
Net+Os v6.0 Enhancements File System
FTP Client (File System) • Send files from the NETOS file system to FTP server • Retrieve and save files from FTP server to NETOS file system
FTP Client (File System) • FCSaveFile • Create/save a file in the file system. • Call FCRetrieveFile to initiate file retrieval from FTP server • FCSendFile • Send a file from the file system to FTP server • Call FCStoreFile to initiate file creation in FTP server
FTP Client (File System) • FCGetFileStatus • Return the status from FCSaveFile or FCSendFile call