| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- ///*
- // * Copyright (c) 2006-2021, RT-Thread Development Team
- // *
- // * SPDX-License-Identifier: Apache-2.0
- // *
- // * Change Logs:
- // * Date Author Notes
- // * 2026-01-17 RuoFeng the first version
- // */
- //#ifndef APPLICATIONS_FTP_UP_H_
- //#define APPLICATIONS_FTP_UP_H_
- //
- //#include "rtthread.h"
- ///* FTP应用配置 - 可在外部重定义 */
- //
- //
- //#ifndef FTP_APP_CONFIG_CSV_PATTERN
- //#define FTP_APP_CONFIG_CSV_PATTERN "*.CSV" /* CSV文件匹配模式 */
- //#endif
- //
- ///* 上传缓冲区大小配置 */
- //
- //#define FTP_APP_UPLOAD_BUFFER_SIZE 512 /* 512字节上传缓冲区 */
- //
- //
- ///* 最大文件大小限制 */
- //#ifndef FTP_APP_MAX_FILE_SIZE
- //#define FTP_APP_MAX_FILE_SIZE (10 * 1024 * 1024) /* 最大支持10MB文件 */
- //#endif
- //
- ///* FTP操作结果 */
- //typedef enum {
- // FTP_APP_RESULT_SUCCESS = 0, /* 操作成功 */
- // FTP_APP_RESULT_ERROR, /* 通用错误 */
- // FTP_APP_RESULT_CONNECT_FAILED, /* FTP连接失败 */
- // FTP_APP_RESULT_FILE_NOT_FOUND, /* 文件不存在 */
- // FTP_APP_RESULT_DISK_NOT_READY, /* SD卡/USB未就绪 */
- // FTP_APP_RESULT_NETWORK_ERROR, /* 网络错误 */
- // FTP_APP_RESULT_BUSY, /* 设备忙 */
- // FTP_APP_RESULT_INVALID_PARAM, /* 参数无效 */
- // FTP_APP_RESULT_PATH_ERROR
- //} ftp_app_result_t;
- //
- ///* FTP应用接口 */
- //typedef struct {
- // /* 固件升级功能 */
- // ftp_app_result_t (*download_firmware)(void);
- //
- // /* CSV文件上传功能 */
- // ftp_app_result_t (*upload_all_csv)(void);
- // ftp_app_result_t (*upload_csv_by_date)(int year, int month, int day);
- // ftp_app_result_t (*upload_csv_file)(const char* filename);
- // ftp_app_result_t (*upload_ecode_csv)(void);
- //
- // /* FTP连接测试 */
- // ftp_app_result_t (*test_connection)(void);
- //
- // /* 状态查询 */
- // uint8_t (*is_busy)(void);
- // const char* (*get_last_error)(void);
- // uint32_t (*get_total_transferred)(void);
- //} ftp_app_ops_t;
- //
- ///* 全局操作接口 */
- //extern ftp_app_ops_t ftp_app;
- //
- ///* 便捷宏定义 */
- //#define FTP_DOWNLOAD_FIRMWARE() ftp_app.download_firmware()
- //#define FTP_UPLOAD_ALL_CSV() ftp_app.upload_all_csv()
- //#define FTP_UPLOAD_CSV_DATE(y,m,d) ftp_app.upload_csv_by_date(y,m,d)
- //#define FTP_UPLOAD_CSV_FILE(name) ftp_app.upload_csv_file(name)
- //#define FTP_TEST_CONNECTION() ftp_app.test_connection()
- //#define FTP_IS_BUSY() ftp_app.is_busy()
- //#define FTP_GET_LAST_ERROR() ftp_app.get_last_error()
- //#define FTP_GET_TOTAL_TRANSFERRED() ftp_app.get_total_transferred()
- //
- //#ifdef __cplusplus
- //}
- //#endif
- //
- //#endif /* APPLICATIONS_FTP_UP_H_ */
|