Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FileManager.h@4:ec62bf823914, 2016-05-15 (annotated)
- Committer:
- Lucyjungz
- Date:
- Sun May 15 10:10:25 2016 +0000
- Revision:
- 4:ec62bf823914
- Parent:
- 3:6e08d0bba1bb
- Child:
- 5:7c513eee7b2b
Rename Function with Proper Prefix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Lucyjungz | 3:6e08d0bba1bb | 1 | /* ############### Constant Defination ################## */ |
Lucyjungz | 3:6e08d0bba1bb | 2 | |
Lucyjungz | 1:1f1f2b99756b | 3 | #define DEVICE_NAME "sd" |
Lucyjungz | 1:1f1f2b99756b | 4 | |
Lucyjungz | 1:1f1f2b99756b | 5 | // DEVICE_NAME must be put in between "/" for file name |
nsrwsurasak | 0:a27e0d3581d1 | 6 | #define SETUP_FILE_NAME "/sd/RMS_Tester.xml" |
Lucyjungz | 2:18e004a47f52 | 7 | #define GPS_LOG_FILE_NAME "/sd/YYYY-MM-DD.gps.csv " |
Lucyjungz | 1:1f1f2b99756b | 8 | #define RTL_LOG_FILE_NAME "/sd/YYYY-MM-DD.rtl.csv" |
nsrwsurasak | 0:a27e0d3581d1 | 9 | #define VARIABLE_FILE_NAME "/sd/20160216185627_upload.xml" |
nsrwsurasak | 0:a27e0d3581d1 | 10 | #define MINIRMS_LOG_FILE_NAME "/sd/miniRMS.log" |
nsrwsurasak | 0:a27e0d3581d1 | 11 | |
nsrwsurasak | 0:a27e0d3581d1 | 12 | #define GPS_TAG "<Gps>" |
nsrwsurasak | 0:a27e0d3581d1 | 13 | #define DATA_TAG "<Data>" |
nsrwsurasak | 0:a27e0d3581d1 | 14 | #define UPDATE_INTERVAL_TAG "<Update_Interval>" |
nsrwsurasak | 0:a27e0d3581d1 | 15 | #define VAR_NAME_TAG "<varName>" |
nsrwsurasak | 0:a27e0d3581d1 | 16 | #define VAR_ADDR_TAG "<varAddress>" |
nsrwsurasak | 0:a27e0d3581d1 | 17 | #define XMLTEXT_SIZE 20 |
nsrwsurasak | 0:a27e0d3581d1 | 18 | |
nsrwsurasak | 0:a27e0d3581d1 | 19 | #define VAR_NAME_MAX_SIZE 20 |
nsrwsurasak | 0:a27e0d3581d1 | 20 | #define VAR_ADDR_MAX_SIZE 10 |
nsrwsurasak | 0:a27e0d3581d1 | 21 | #define MAX_VAR 50 |
nsrwsurasak | 0:a27e0d3581d1 | 22 | |
Lucyjungz | 1:1f1f2b99756b | 23 | #define RMS_HEADER_TIME "Time" |
Lucyjungz | 1:1f1f2b99756b | 24 | |
Lucyjungz | 3:6e08d0bba1bb | 25 | |
Lucyjungz | 3:6e08d0bba1bb | 26 | /* ############### Enum ################## */ |
nsrwsurasak | 0:a27e0d3581d1 | 27 | typedef enum { |
nsrwsurasak | 0:a27e0d3581d1 | 28 | STATE_FINDING, /** Finding */ |
nsrwsurasak | 0:a27e0d3581d1 | 29 | STATE_FOUND_DATA, /** Found Data tag */ |
nsrwsurasak | 0:a27e0d3581d1 | 30 | STATE_FOUND_DATA_INTERVAL, /**< Found update internal of tag*/ |
nsrwsurasak | 0:a27e0d3581d1 | 31 | STATE_FOUND_GPS, /** Found GPS tag */ |
nsrwsurasak | 0:a27e0d3581d1 | 32 | STATE_FOUND_GPS_INTERVAL, /** Found update internal of GPS*/ |
nsrwsurasak | 0:a27e0d3581d1 | 33 | } ReadingFileState; |
nsrwsurasak | 0:a27e0d3581d1 | 34 | |
nsrwsurasak | 0:a27e0d3581d1 | 35 | |
Lucyjungz | 3:6e08d0bba1bb | 36 | /* ############### Structure ################## */ |
Lucyjungz | 3:6e08d0bba1bb | 37 | |
nsrwsurasak | 0:a27e0d3581d1 | 38 | typedef struct { |
nsrwsurasak | 0:a27e0d3581d1 | 39 | char varName[VAR_NAME_MAX_SIZE]; |
nsrwsurasak | 0:a27e0d3581d1 | 40 | char varAddress[VAR_ADDR_MAX_SIZE+1]; |
nsrwsurasak | 0:a27e0d3581d1 | 41 | } Variable_Data_TypeDef; |
nsrwsurasak | 0:a27e0d3581d1 | 42 | |
Lucyjungz | 3:6e08d0bba1bb | 43 | |
Lucyjungz | 3:6e08d0bba1bb | 44 | /* ############### Function Prototype ################## */ |
Lucyjungz | 4:ec62bf823914 | 45 | void FileManager_ReadSetupFile(); |
Lucyjungz | 4:ec62bf823914 | 46 | void FileManager_DeleteFile(char filename[]); |
Lucyjungz | 4:ec62bf823914 | 47 | int FileManager_GPSInterval(); |
Lucyjungz | 4:ec62bf823914 | 48 | int FileManager_DataInterval(); |
Lucyjungz | 4:ec62bf823914 | 49 | void FileManager_LogGPSData(time_t timestamp ,char lat[], char longti[]); |
Lucyjungz | 4:ec62bf823914 | 50 | void FileManager_LogSystemData(float gps_interval); |
Lucyjungz | 4:ec62bf823914 | 51 | Variable_Data_TypeDef * FileManager_ReadVarFile(); |
Lucyjungz | 4:ec62bf823914 | 52 | int FileManager_GetAmountVarList(); |
Lucyjungz | 4:ec62bf823914 | 53 | Variable_Data_TypeDef * FileManager_GetVarList(); |
Lucyjungz | 4:ec62bf823914 | 54 | void FileManager_LogRMSData(time_t timestamp ,float * var, int size); |
Lucyjungz | 4:ec62bf823914 | 55 | void FileManager_LogRMSHeader(time_t timestamp); |
Lucyjungz | 4:ec62bf823914 | 56 | bool FileManager_IsFileExist(char filename[]); |