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:
- 0:ea85c4bb5e1f
- Child:
- 1:6ec9998427ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FileInterface.h Mon Aug 11 09:58:24 2014 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright 2014, ACKme Networks + * All Rights Reserved. + * + * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; + * the contents of this file may not be disclosed to third parties, copied + * or duplicated in any form, in whole or in part, without the prior + * written permission of ACKme Networks. + */ + +#pragma once + +#include "mbed.h" + +#include "WiconnectTypes.h" +#include "types/FileList.h" + + +#define FILE_NAME_MAX_SIZE 96 +#define FILE_MAKE_VERSION(major, minor, patch, rc) ((unsigned int)((major) << 27)|(unsigned int)((minor) << 21)|(unsigned int)((patch) << 8)|(unsigned int)((rc) << 0)) +#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 { + + +class FileInterface +{ +public: + FileInterface(Wiconnect *wiconnect); + + 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); + WiconnectResult openFile(File &file, const char *name); + WiconnectResult deleteFile(const char *name); + WiconnectResult deleteFile(const File &file); + WiconnectResult listFiles(FileList &list, const char *name = NULL, FileType type = FILE_TYPE_ANY, uint32_t version = 0); + + static const char* fileVersionIntToStr(uint32_t version, bool verbose = true, char *buffer = NULL); + static bool fileVersionStrToInt(const char *versionStr, uint32_t *versionIntPtr); + static const char* fileTypeToStr(FileType type); + static const char* fileFlagsToStr(FileFlags flags, char *buffer = NULL); + +protected: + WiconnectResult processFileList(char *responseStr, FileList &list, const char *name, FileType type, uint32_t version); +private: + Wiconnect *wiconnect; +}; + +} +