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.
Dependencies: FileManager GPSGms6 SDFileSystem mbed
Fork of 2545_SD_Card by
Diff: FileManager.cpp
- Revision:
- 4:aa7ac2ac6913
- Parent:
- 2:c96b02fcb98e
- Child:
- 5:07aaa6e3784c
--- a/FileManager.cpp Fri May 06 20:23:08 2016 +0000
+++ b/FileManager.cpp Mon May 09 08:59:23 2016 +0000
@@ -3,6 +3,8 @@
char m_GpsInterval[XMLTEXT_SIZE];
char m_DataInterval[XMLTEXT_SIZE];
+Variable_Data_TypeDef m_varList[MAX_VAR];
+unsigned int m_amountVarList;
static void removeSpaces(char* s , int size);
static void getXmlText(char *str, char *ret);
@@ -101,7 +103,7 @@
if (fp == NULL) { // if it can't open the file then print error message
printf("Error! Unable to open file!\n");
} else { // opened file so can write
- printf("\n Writing to Gps Log File....");
+ printf("\r\n Writing to Gps Log File....");
fprintf(fp, "%s,%s\n",date,time); // print formatted string to file (CSV)
@@ -141,4 +143,41 @@
{
//Return whether or not CRC is enabled
return atoi( m_DataInterval );
-}
\ No newline at end of file
+}
+
+Variable_Data_TypeDef * readVarFile()
+{
+ // now open file for reading
+ FILE *fp = fopen(VARIABLE_FILE_NAME, "r");
+
+ if (fp == NULL) { // if it can't open the file then print error message
+ printf("\nError! Unable to open file! %s \n", VARIABLE_FILE_NAME);
+ return NULL;
+ } else { // opened file so can write
+
+ char buf[1024];
+ int index = 0;
+ memset(m_varList, ' ', sizeof(m_varList));
+ while (fgets(buf, sizeof(buf), fp) != NULL)
+ {
+ if (strstr (buf,VAR_NAME_TAG))
+ {
+ getXmlText(buf , m_varList[index].varName);
+
+ }
+ else if (strstr (buf,VAR_ADDR_TAG))
+ {
+ getXmlText(buf , m_varList[index].varAddress);
+ index++;
+ }
+
+ }
+ fclose(fp); // ensure you close the file after reading
+ m_amountVarList = index;
+ return m_varList;
+ }
+}
+int getVarListAmount(){
+ return m_amountVarList;
+}
+
