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
- Committer:
- Lucyjungz
- Date:
- 2016-05-18
- Revision:
- 11:e21d4c5bfd1b
- Parent:
- 10:a8003d357cf2
- Child:
- 14:4ba6147f067b
File content as of revision 11:e21d4c5bfd1b:
/* ############### Constant Defination ################## */ #define DEVICE_NAME "sd" /** Device directory */ // DEVICE_NAME must be put in between "/" for file name #define SETUP_FILE_NAME "/sd/RMS_Tester.xml" /** Setup File Name */ #define GPS_LOG_FILE_NAME "/sd/YYYY-MM-DD.gps.csv " /** GPS Log File Name */ #define RTL_LOG_FILE_NAME "/sd/YYYY-MM-DD.rtl.csv" /** RMS Log File Name */ #define VARIABLE_FILE_NAME "/sd/20160216185627_upload.xml" /** Mini RMS Log File Name */ #define MINIRMS_LOG_FILE_NAME "/sd/miniRMS.log" /** XML Tag */ #define GPS_TAG "<Gps>" /** GPS Tag */ #define DATA_TAG "<Data>" /** Data Tag */ #define UPDATE_INTERVAL_TAG "<Update_Interval>" /** Update Internal Tag */ #define VAR_NAME_TAG "<varName>" /** Variable Name Tag */ #define VAR_ADDR_TAG "<varAddress>" /** Variable Address Tag */ #define VAR_TYPE_TAG "<varType>" /** Variable Type Tag */ #define VAR_LSB1_TAG "<LSB1>" /** Variable LSB1 Tag */ #define VAR_LSB2_TAG "<LSB2>" /** Variable LSB2 Tag */ #define VAR_BITMASK_TAG "<BitMask>" /** Variable Bit Mask Tag */ #define VAR_UNIT_TAG "<Unit>" /** Variable Unit Tag */ /** XML Text Size */ #define XMLTEXT_SIZE 20 /** XML Text Maximum size */ #define VAR_NAME_MAX_SIZE 20 /** Variable Name Maximum Size */ #define VAR_ADDR_MAX_SIZE 10 /** Variable Address Maximum Size */ #define VAR_TYPE_MAX_SIZE 3 /** Variable Type Maximum Size */ #define VAR_LSB1_MAX_SIZE 3 /** Variable LSB1 Maximum Size */ #define VAR_LSB2_MAX_SIZE 10 /** Variable LSB2 Maximum Size */ #define VAR_BITMASK_MAX_SIZE 5 /** Variable Bit Mask Maximum Size */ #define VAR_UNIT_MAX_SIZE 20 /** Variable Unit Maximum Size */ #define MAX_VAR 50 /** Maximum variable to be supported */ #define RMS_HEADER_TIME "Time" /** RMS Header Time tag */ #define RMS_HEADER_MSECOND "MSecond" /** RMS MSecond Time tag */ /* ############### Enum ################## */ typedef enum { STATE_FINDING, /** Finding */ STATE_FOUND_DATA, /** Found Data tag */ STATE_FOUND_DATA_INTERVAL, /**< Found update internal of tag*/ STATE_FOUND_GPS, /** Found GPS tag */ STATE_FOUND_GPS_INTERVAL, /** Found update internal of GPS*/ } ReadingFileState; /* ############### Structure ################## */ typedef struct { char varName[VAR_NAME_MAX_SIZE]; /** char array Variable Name */ char varAddress[VAR_ADDR_MAX_SIZE+1]; /** char array Variable Address */ char varType[VAR_TYPE_MAX_SIZE]; /** char array Variable Type */ char varLSB1[VAR_LSB1_MAX_SIZE]; /** char array Variable LSB1 */ char varLSB2[VAR_LSB2_MAX_SIZE]; /** char array Variable LSB2 */ char varBitMask[VAR_BITMASK_MAX_SIZE]; /** char array Variable Bit Mask */ char varUnit[VAR_UNIT_MAX_SIZE]; /** char array Variable Unit */ } Variable_Data_TypeDef; /* ############### Function Prototype ################## */ void FileManager_ReadSetupFile(); void FileManager_DeleteFile(char filename[]); int FileManager_GPSInterval(); int FileManager_DataInterval(); void FileManager_LogGPSData(time_t timestamp ,char lat[], char longti[]); void FileManager_LogSystemData(float gps_interval); Variable_Data_TypeDef * FileManager_ReadVarFile(); int FileManager_GetAmountVarList(); Variable_Data_TypeDef * FileManager_GetVarList(); void FileManager_LogRMSData(time_t timestamp ,float * var, int size); void FileManager_LogRMSHeader(time_t timestamp); bool FileManager_IsFileExist(char filename[]);