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: mbed MODSERIAL FATFileSystem
MbedLogger/MbedLogger.hpp
- Committer:
 - tnhnrl
 - Date:
 - 2017-12-20
 - Revision:
 - 35:2f66ea4863d5
 - Parent:
 - 34:9b66c5188051
 - Child:
 - 36:966a86937e17
 
File content as of revision 35:2f66ea4863d5:
#ifndef MBEDLOGGER_HPP
#define MBEDLOGGER_HPP
 
#include "mbed.h"
#include <string>
using namespace std;
#include    "DirectoryList.h"
  
class MbedLogger {
public:
    MbedLogger();           //constructor
    
    void openFile();
    void createTestLog();   //test log function
    
    //one log file type for now
    void createNewFiles();   //subsequent files (takes time to process)
    
    //save float array to file (append each time)
    void saveArrayToFile(string string_state, int input_state, float *input);
    
    //save the sequence title to file (append each time)
    void saveSequenceStringToFile(string str_input);
    
    //print the data to the serial terminal
    void printFromLogFile();
    
    //print the directory to the screen
    void printMbedDirectory();
    
    //close the current file stream [before creating a new one]
    void closeFile();
    
    //print the current MBED log file
    void printCurrentLogFile();
        
private:
    int _f;                 //file name number
    char _file_name[128];   //file name placeholder
    int _file_number;
    
    FILE *_fp;              //the file is a class member variable
};
 
#endif