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@7:ab015947e368, 2016-05-17 (annotated)
- Committer:
- Lucyjungz
- Date:
- Tue May 17 11:55:35 2016 +0000
- Revision:
- 7:ab015947e368
- Parent:
- 6:5bd75c0f607c
- Child:
- 10:a8003d357cf2
Add MSecond
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>" |
Lucyjungz | 6:5bd75c0f607c | 17 | #define VAR_LSB1_TAG "<LSB1>" |
Lucyjungz | 6:5bd75c0f607c | 18 | #define VAR_LSB2_TAG "<LSB2>" |
Lucyjungz | 6:5bd75c0f607c | 19 | #define VAR_BITMASK_TAG "<BitMask>" |
Lucyjungz | 5:7c513eee7b2b | 20 | #define VAR_UNIT_TAG "<Unit>" |
nsrwsurasak | 0:a27e0d3581d1 | 21 | #define XMLTEXT_SIZE 20 |
nsrwsurasak | 0:a27e0d3581d1 | 22 | |
nsrwsurasak | 0:a27e0d3581d1 | 23 | #define VAR_NAME_MAX_SIZE 20 |
nsrwsurasak | 0:a27e0d3581d1 | 24 | #define VAR_ADDR_MAX_SIZE 10 |
Lucyjungz | 6:5bd75c0f607c | 25 | #define VAR_LSB1_MAX_SIZE 3 |
Lucyjungz | 6:5bd75c0f607c | 26 | #define VAR_LSB2_MAX_SIZE 10 |
Lucyjungz | 6:5bd75c0f607c | 27 | #define VAR_BITMASK_MAX_SIZE 5 |
Lucyjungz | 5:7c513eee7b2b | 28 | #define VAR_UNIT_MAX_SIZE 20 |
Lucyjungz | 5:7c513eee7b2b | 29 | |
nsrwsurasak | 0:a27e0d3581d1 | 30 | #define MAX_VAR 50 |
nsrwsurasak | 0:a27e0d3581d1 | 31 | |
Lucyjungz | 1:1f1f2b99756b | 32 | #define RMS_HEADER_TIME "Time" |
Lucyjungz | 7:ab015947e368 | 33 | #define RMS_MSECOND "MSecond" |
Lucyjungz | 1:1f1f2b99756b | 34 | |
Lucyjungz | 3:6e08d0bba1bb | 35 | |
Lucyjungz | 3:6e08d0bba1bb | 36 | /* ############### Enum ################## */ |
nsrwsurasak | 0:a27e0d3581d1 | 37 | typedef enum { |
nsrwsurasak | 0:a27e0d3581d1 | 38 | STATE_FINDING, /** Finding */ |
nsrwsurasak | 0:a27e0d3581d1 | 39 | STATE_FOUND_DATA, /** Found Data tag */ |
nsrwsurasak | 0:a27e0d3581d1 | 40 | STATE_FOUND_DATA_INTERVAL, /**< Found update internal of tag*/ |
nsrwsurasak | 0:a27e0d3581d1 | 41 | STATE_FOUND_GPS, /** Found GPS tag */ |
nsrwsurasak | 0:a27e0d3581d1 | 42 | STATE_FOUND_GPS_INTERVAL, /** Found update internal of GPS*/ |
nsrwsurasak | 0:a27e0d3581d1 | 43 | } ReadingFileState; |
nsrwsurasak | 0:a27e0d3581d1 | 44 | |
nsrwsurasak | 0:a27e0d3581d1 | 45 | |
Lucyjungz | 3:6e08d0bba1bb | 46 | /* ############### Structure ################## */ |
Lucyjungz | 3:6e08d0bba1bb | 47 | |
nsrwsurasak | 0:a27e0d3581d1 | 48 | typedef struct { |
nsrwsurasak | 0:a27e0d3581d1 | 49 | char varName[VAR_NAME_MAX_SIZE]; |
nsrwsurasak | 0:a27e0d3581d1 | 50 | char varAddress[VAR_ADDR_MAX_SIZE+1]; |
Lucyjungz | 6:5bd75c0f607c | 51 | char varLSB1[VAR_LSB1_MAX_SIZE]; |
Lucyjungz | 6:5bd75c0f607c | 52 | char varLSB2[VAR_LSB2_MAX_SIZE]; |
Lucyjungz | 6:5bd75c0f607c | 53 | char varBitMask[VAR_BITMASK_MAX_SIZE]; |
Lucyjungz | 5:7c513eee7b2b | 54 | char varUnit[VAR_UNIT_MAX_SIZE]; |
nsrwsurasak | 0:a27e0d3581d1 | 55 | } Variable_Data_TypeDef; |
nsrwsurasak | 0:a27e0d3581d1 | 56 | |
Lucyjungz | 3:6e08d0bba1bb | 57 | |
Lucyjungz | 3:6e08d0bba1bb | 58 | /* ############### Function Prototype ################## */ |
Lucyjungz | 4:ec62bf823914 | 59 | void FileManager_ReadSetupFile(); |
Lucyjungz | 4:ec62bf823914 | 60 | void FileManager_DeleteFile(char filename[]); |
Lucyjungz | 4:ec62bf823914 | 61 | int FileManager_GPSInterval(); |
Lucyjungz | 4:ec62bf823914 | 62 | int FileManager_DataInterval(); |
Lucyjungz | 4:ec62bf823914 | 63 | void FileManager_LogGPSData(time_t timestamp ,char lat[], char longti[]); |
Lucyjungz | 4:ec62bf823914 | 64 | void FileManager_LogSystemData(float gps_interval); |
Lucyjungz | 4:ec62bf823914 | 65 | Variable_Data_TypeDef * FileManager_ReadVarFile(); |
Lucyjungz | 4:ec62bf823914 | 66 | int FileManager_GetAmountVarList(); |
Lucyjungz | 4:ec62bf823914 | 67 | Variable_Data_TypeDef * FileManager_GetVarList(); |
Lucyjungz | 4:ec62bf823914 | 68 | void FileManager_LogRMSData(time_t timestamp ,float * var, int size); |
Lucyjungz | 4:ec62bf823914 | 69 | void FileManager_LogRMSHeader(time_t timestamp); |
Lucyjungz | 4:ec62bf823914 | 70 | bool FileManager_IsFileExist(char filename[]); |