Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
Diff: FileInterface.h
- Revision:
- 11:ea484e1b7fc4
- Parent:
- 1:6ec9998427ad
- Child:
- 13:2b51f5267c92
diff -r 735194df0097 -r ea484e1b7fc4 FileInterface.h --- a/FileInterface.h Mon Aug 11 21:59:00 2014 -0700 +++ b/FileInterface.h Tue Aug 12 02:34:46 2014 -0700 @@ -16,26 +16,104 @@ #include "types/FileList.h" +/** + * @ingroup api_file_macro + * @brief The maximum filename size of a file on the WiConnect WiFi module filesystem + */ #define FILE_NAME_MAX_SIZE 96 + +/** + * @ingroup api_file_macro + * @def FILE_MAKE_VERSION(major, minor, patch, rc) + * @brief Combine <\a major>.<\a minor>.<\a patch>.<\a rc> and create version as a uint32_t + */ #define FILE_MAKE_VERSION(major, minor, patch, rc) ((unsigned int)((major) << 27)|(unsigned int)((minor) << 21)|(unsigned int)((patch) << 8)|(unsigned int)((rc) << 0)) +/** + * @ingroup api_file_macro + * @def FILE_VERSION_ARGS(version) + * @brief Given a uint32_t \a version, return arguments for a variable argument function such as printf(). The format string is: %d.%d.%d.%d + */ #define FILE_VERSION_ARGS(version) (unsigned int)((version >> 27) & 0x1F),(unsigned int)((version >> 21) & 0x3F),(unsigned int)((version >> 8) & 0x1FFF),(unsigned int)(version & 0xFF) namespace wiconnect { +/** + * @ingroup types_file + * + * @brief The provides an interface for creating TCP/UDP/TLS/HTTP client sockets. + * A client socket connects to a remote server. + * + */ class FileInterface { public: + /** + * @ingroup api_file + * + * @brief Create a file on the Wiconnect WiFi module flash filesystem. + */ WiconnectResult createFile(const ReaderFunc &reader, void *user, const char *name, uint32_t size, uint32_t version = 0, FileType type = FILE_TYPE_ANY, bool isEssential = false, int32_t checksum = -1); + + /** + * @ingroup api_file + * + * @brief Open a file on the Wiconnect WiFi module flash filesystem for reading. + */ WiconnectResult openFile(File &file, const char *name); + + /** + * @ingroup api_file + * + * @brief Delete a file for the Wiconnect WiFi module flash filesystem. + */ WiconnectResult deleteFile(const char *name); + + /** + * @ingroup api_file + * + * @brief Delete a file for the Wiconnect WiFi module flash filesystem. + */ WiconnectResult deleteFile(const File &file); + + /** + * @ingroup api_file + * + * @brief List the files on the Wiconnect WiFi module flash filesystem. + */ WiconnectResult listFiles(FileList &list, const char *name = NULL, FileType type = FILE_TYPE_ANY, uint32_t version = 0); + + // ------------------------------------------------------------------------ + + + /** + * @ingroup conversion_util + * + * @brief Convert file version uint32 to string. + */ static const char* fileVersionIntToStr(uint32_t version, bool verbose = true, char *buffer = NULL); + + /** + * @ingroup conversion_util + * + * @brief Convert string to file version uint32. + */ static bool fileVersionStrToInt(const char *versionStr, uint32_t *versionIntPtr); + + /** + * @ingroup conversion_util + * + * Convert @ref FileType to string. + */ static const char* fileTypeToStr(FileType type); + + /** + * @ingroup conversion_util + * + * @brief Convert @ref FileFlags to string. + */ static const char* fileFlagsToStr(FileFlags flags, char *buffer = NULL); protected: