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
FileInterface.h@1:6ec9998427ad, 2014-08-11 (annotated)
- Committer:
- dan_ackme
- Date:
- Mon Aug 11 03:29:30 2014 -0700
- Revision:
- 1:6ec9998427ad
- Parent:
- 0:ea85c4bb5e1f
- Child:
- 11:ea484e1b7fc4
fixed compiler warnings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan_ackme | 0:ea85c4bb5e1f | 1 | /* |
dan_ackme | 0:ea85c4bb5e1f | 2 | * Copyright 2014, ACKme Networks |
dan_ackme | 0:ea85c4bb5e1f | 3 | * All Rights Reserved. |
dan_ackme | 0:ea85c4bb5e1f | 4 | * |
dan_ackme | 0:ea85c4bb5e1f | 5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; |
dan_ackme | 0:ea85c4bb5e1f | 6 | * the contents of this file may not be disclosed to third parties, copied |
dan_ackme | 0:ea85c4bb5e1f | 7 | * or duplicated in any form, in whole or in part, without the prior |
dan_ackme | 0:ea85c4bb5e1f | 8 | * written permission of ACKme Networks. |
dan_ackme | 0:ea85c4bb5e1f | 9 | */ |
dan_ackme | 0:ea85c4bb5e1f | 10 | |
dan_ackme | 0:ea85c4bb5e1f | 11 | #pragma once |
dan_ackme | 0:ea85c4bb5e1f | 12 | |
dan_ackme | 0:ea85c4bb5e1f | 13 | #include "mbed.h" |
dan_ackme | 0:ea85c4bb5e1f | 14 | |
dan_ackme | 0:ea85c4bb5e1f | 15 | #include "WiconnectTypes.h" |
dan_ackme | 0:ea85c4bb5e1f | 16 | #include "types/FileList.h" |
dan_ackme | 0:ea85c4bb5e1f | 17 | |
dan_ackme | 0:ea85c4bb5e1f | 18 | |
dan_ackme | 0:ea85c4bb5e1f | 19 | #define FILE_NAME_MAX_SIZE 96 |
dan_ackme | 0:ea85c4bb5e1f | 20 | #define FILE_MAKE_VERSION(major, minor, patch, rc) ((unsigned int)((major) << 27)|(unsigned int)((minor) << 21)|(unsigned int)((patch) << 8)|(unsigned int)((rc) << 0)) |
dan_ackme | 0:ea85c4bb5e1f | 21 | #define FILE_VERSION_ARGS(version) (unsigned int)((version >> 27) & 0x1F),(unsigned int)((version >> 21) & 0x3F),(unsigned int)((version >> 8) & 0x1FFF),(unsigned int)(version & 0xFF) |
dan_ackme | 0:ea85c4bb5e1f | 22 | |
dan_ackme | 0:ea85c4bb5e1f | 23 | |
dan_ackme | 0:ea85c4bb5e1f | 24 | namespace wiconnect { |
dan_ackme | 0:ea85c4bb5e1f | 25 | |
dan_ackme | 0:ea85c4bb5e1f | 26 | |
dan_ackme | 0:ea85c4bb5e1f | 27 | class FileInterface |
dan_ackme | 0:ea85c4bb5e1f | 28 | { |
dan_ackme | 0:ea85c4bb5e1f | 29 | public: |
dan_ackme | 0:ea85c4bb5e1f | 30 | 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); |
dan_ackme | 0:ea85c4bb5e1f | 31 | WiconnectResult openFile(File &file, const char *name); |
dan_ackme | 0:ea85c4bb5e1f | 32 | WiconnectResult deleteFile(const char *name); |
dan_ackme | 0:ea85c4bb5e1f | 33 | WiconnectResult deleteFile(const File &file); |
dan_ackme | 0:ea85c4bb5e1f | 34 | WiconnectResult listFiles(FileList &list, const char *name = NULL, FileType type = FILE_TYPE_ANY, uint32_t version = 0); |
dan_ackme | 0:ea85c4bb5e1f | 35 | |
dan_ackme | 0:ea85c4bb5e1f | 36 | static const char* fileVersionIntToStr(uint32_t version, bool verbose = true, char *buffer = NULL); |
dan_ackme | 0:ea85c4bb5e1f | 37 | static bool fileVersionStrToInt(const char *versionStr, uint32_t *versionIntPtr); |
dan_ackme | 0:ea85c4bb5e1f | 38 | static const char* fileTypeToStr(FileType type); |
dan_ackme | 0:ea85c4bb5e1f | 39 | static const char* fileFlagsToStr(FileFlags flags, char *buffer = NULL); |
dan_ackme | 0:ea85c4bb5e1f | 40 | |
dan_ackme | 0:ea85c4bb5e1f | 41 | protected: |
dan_ackme | 1:6ec9998427ad | 42 | FileInterface(Wiconnect *wiconnect); |
dan_ackme | 1:6ec9998427ad | 43 | |
dan_ackme | 0:ea85c4bb5e1f | 44 | WiconnectResult processFileList(char *responseStr, FileList &list, const char *name, FileType type, uint32_t version); |
dan_ackme | 0:ea85c4bb5e1f | 45 | private: |
dan_ackme | 0:ea85c4bb5e1f | 46 | Wiconnect *wiconnect; |
dan_ackme | 0:ea85c4bb5e1f | 47 | }; |
dan_ackme | 0:ea85c4bb5e1f | 48 | |
dan_ackme | 0:ea85c4bb5e1f | 49 | } |