mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-31 12:34:29 -04:00
Modify LogFile to open/close file on SD card status.
Previously, would only open on construction, which was only when the receiver mode changed, which wasn't all that useful.
This commit is contained in:
parent
30ca545b52
commit
bd07e4e7e5
8 changed files with 34 additions and 15 deletions
|
@ -25,24 +25,32 @@
|
|||
#include <string>
|
||||
|
||||
#include "ff.h"
|
||||
#include "sd_card.hpp"
|
||||
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
using namespace lpc43xx;
|
||||
|
||||
class LogFile {
|
||||
public:
|
||||
LogFile(const std::string file_path);
|
||||
~LogFile();
|
||||
|
||||
bool open_for_append(const std::string& file_path);
|
||||
bool open();
|
||||
bool close();
|
||||
bool is_ready();
|
||||
|
||||
bool write_entry(const rtc::RTC& datetime, const std::string& entry);
|
||||
|
||||
private:
|
||||
const std::string file_path;
|
||||
|
||||
FIL f;
|
||||
|
||||
SignalToken sd_card_status_signal_token;
|
||||
|
||||
bool write(const std::string& message);
|
||||
|
||||
void on_sd_card_status(const sd_card::Status status);
|
||||
};
|
||||
|
||||
#endif/*__LOG_FILE_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue