ftp_up.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ///*
  2. // * Copyright (c) 2006-2021, RT-Thread Development Team
  3. // *
  4. // * SPDX-License-Identifier: Apache-2.0
  5. // *
  6. // * Change Logs:
  7. // * Date Author Notes
  8. // * 2026-01-17 RuoFeng the first version
  9. // */
  10. //#ifndef APPLICATIONS_FTP_UP_H_
  11. //#define APPLICATIONS_FTP_UP_H_
  12. //
  13. //#include "rtthread.h"
  14. ///* FTP应用配置 - 可在外部重定义 */
  15. //
  16. //
  17. //#ifndef FTP_APP_CONFIG_CSV_PATTERN
  18. //#define FTP_APP_CONFIG_CSV_PATTERN "*.CSV" /* CSV文件匹配模式 */
  19. //#endif
  20. //
  21. ///* 上传缓冲区大小配置 */
  22. //
  23. //#define FTP_APP_UPLOAD_BUFFER_SIZE 512 /* 512字节上传缓冲区 */
  24. //
  25. //
  26. ///* 最大文件大小限制 */
  27. //#ifndef FTP_APP_MAX_FILE_SIZE
  28. //#define FTP_APP_MAX_FILE_SIZE (10 * 1024 * 1024) /* 最大支持10MB文件 */
  29. //#endif
  30. //
  31. ///* FTP操作结果 */
  32. //typedef enum {
  33. // FTP_APP_RESULT_SUCCESS = 0, /* 操作成功 */
  34. // FTP_APP_RESULT_ERROR, /* 通用错误 */
  35. // FTP_APP_RESULT_CONNECT_FAILED, /* FTP连接失败 */
  36. // FTP_APP_RESULT_FILE_NOT_FOUND, /* 文件不存在 */
  37. // FTP_APP_RESULT_DISK_NOT_READY, /* SD卡/USB未就绪 */
  38. // FTP_APP_RESULT_NETWORK_ERROR, /* 网络错误 */
  39. // FTP_APP_RESULT_BUSY, /* 设备忙 */
  40. // FTP_APP_RESULT_INVALID_PARAM, /* 参数无效 */
  41. // FTP_APP_RESULT_PATH_ERROR
  42. //} ftp_app_result_t;
  43. //
  44. ///* FTP应用接口 */
  45. //typedef struct {
  46. // /* 固件升级功能 */
  47. // ftp_app_result_t (*download_firmware)(void);
  48. //
  49. // /* CSV文件上传功能 */
  50. // ftp_app_result_t (*upload_all_csv)(void);
  51. // ftp_app_result_t (*upload_csv_by_date)(int year, int month, int day);
  52. // ftp_app_result_t (*upload_csv_file)(const char* filename);
  53. // ftp_app_result_t (*upload_ecode_csv)(void);
  54. //
  55. // /* FTP连接测试 */
  56. // ftp_app_result_t (*test_connection)(void);
  57. //
  58. // /* 状态查询 */
  59. // uint8_t (*is_busy)(void);
  60. // const char* (*get_last_error)(void);
  61. // uint32_t (*get_total_transferred)(void);
  62. //} ftp_app_ops_t;
  63. //
  64. ///* 全局操作接口 */
  65. //extern ftp_app_ops_t ftp_app;
  66. //
  67. ///* 便捷宏定义 */
  68. //#define FTP_DOWNLOAD_FIRMWARE() ftp_app.download_firmware()
  69. //#define FTP_UPLOAD_ALL_CSV() ftp_app.upload_all_csv()
  70. //#define FTP_UPLOAD_CSV_DATE(y,m,d) ftp_app.upload_csv_by_date(y,m,d)
  71. //#define FTP_UPLOAD_CSV_FILE(name) ftp_app.upload_csv_file(name)
  72. //#define FTP_TEST_CONNECTION() ftp_app.test_connection()
  73. //#define FTP_IS_BUSY() ftp_app.is_busy()
  74. //#define FTP_GET_LAST_ERROR() ftp_app.get_last_error()
  75. //#define FTP_GET_TOTAL_TRANSFERRED() ftp_app.get_total_transferred()
  76. //
  77. //#ifdef __cplusplus
  78. //}
  79. //#endif
  80. //
  81. //#endif /* APPLICATIONS_FTP_UP_H_ */