stm32_ota/HARDWARE/LTE/EC20/ec20ftp.h

51 lines
2.7 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef _EC20FTP_H
#define _EC20FTP_H
#include "ec20net.h"
/*****************************************
*供外部使用的常变量定义
****************************************/
#define ACCOUNT_MAXLEN 128 //FTP登陆用户名\文件名、密码最大长度
/*****************************************
*自定义变量类型
****************************************/
typedef enum {Opening = 0, idle = 1, Transferring = 2, Closing = 3, Closed = 4, Error = 5 } FtpLoginState_e ; //FTP LOGIN状态枚举
typedef enum{bin = 0, ascii = 1}FtpFileType_e ; //FTP文件类型
typedef enum{Active = 0, passive = 1}FtpTransMode_e ; //FTP传输类型
typedef struct
{
uint8_t contextId ; //FTP链路通道ID
uint8_t userName[ACCOUNT_MAXLEN] ; //FTP 服务器登录用户名, 用户长度不能超过ACCOUNT_MAXLEN
uint8_t password[ACCOUNT_MAXLEN] ; //FTP 服务器登录密码, 密码不能超过ACCOUNT_MAXLEN
FtpFileType_e eFiletype ; //FTP传输文件类型
FtpTransMode_e eTransmode ; //FTP传输模式
uint8_t rsptimeout ; //FTP响应超时时间范围20——180S默认90S
uint8_t ftpServerIP[MAX_IP_LEN] ; //FTP Server的IP
uint16_t ftpServerPort ; //FTP Server的PORT
uint8_t ftpDirectory[ACCOUNT_MAXLEN] ; //访问FTP服务器的默认路径 例如:“/ABM”
}FtpP_s ; //FTP相关配置信息
/*****************************************
*内部函数声明
****************************************/
RunResult EC20_SendFtpCmd( uint8_t cmdNum, char *format,... ) ; // EC20通过串口发送ftp相关命令
/*****************************************
*对外接口函数声明
****************************************/
extern RunResult Ftp_Config( FtpP_s *psFtp ) ; //对FTP相关参数进行配置
extern RunResult Ftp_PDP_Init( FtpP_s *psFtp ) ; //初始化FTP链路 contextid
extern RunResult Ftp_Login( FtpP_s *psFtp ) ; //登录FTP服务器
extern RunResult Ftp_Logout(FtpP_s *psFtp) ; //退出FTP服务器
extern RunResult Ftp_Set_Dir( FtpP_s *psFtp ) ; //设置Ftp操作目录
extern RunResult Ftp_Find_File( uint8_t *dir, uint8_t *fileName ) ; //在dir目录中查找名为fileName的文件
extern u32 Ftp_Get_FileSize( uint8_t *fileName ) ; //查询*fileName 文件的大小
extern int Ftp_Down_File( uint8_t *fileName, uint32_t startPos, uint16_t transLen) ; //从名为fileName的文件startPos位置开始下载transLen长度的数据
extern RunResult Ftp_File_Rename( uint8_t *oldName, uint8_t *newName ) ; //文件重命名
#endif