ESP_IOT v2.5
IOT ESP Coding
SPIFFModule.cpp File Reference
#include "SPIFFModule.h"
#include "FS.h"
#include "SPIFFS.h"
Include dependency graph for SPIFFModule.cpp:

Go to the source code of this file.

Macros

#define SPIFF_FILE_NAME   (char*)"/messages.txt"
 
#define FORMAT_SPIFFS_IF_FAILED   true
 
#define SPIFF_SCREEN_FILE_NAME   (char*)"/M5Screen.bmp"
 

Functions

boolean useSpiff ()
 helper for using the spiff or not.. More...
 
void listDir (fs::FS &fs, const char *dirname, uint8_t levels)
 list the directory of the SPIFF More...
 
void readFile (fs::FS &fs, const char *path)
 reads the file name specified. The result is SerialDebug.write More...
 
void writeFile (fs::FS &fs, const char *path, const char *message)
 writes the message to the file specified More...
 
void appendFile (fs::FS &fs, const char *path, const char *message)
 appends the message to the file More...
 
void renameFile (fs::FS &fs, const char *path1, const char *path2)
 renames the file More...
 
void deleteFile (fs::FS &fs, const char *path)
 deletes the file specified More...
 
void println_SPIFFModule (char *string)
 The SPIFF module is for storing messages that are retrievable later as it stores on a folder area of the ESP chip. More...
 
void print_SPIFFModule (char *string)
 print a string to spiff (NO new line is added) More...
 
void printInt_SPIFFModule (int val)
 print a int to spiff (NO new line is added) More...
 
void deleteFiles_SPIFFModule ()
 delete the spiff files.. More...
 
void printFile_SPIFFModule ()
 prints the spiff file to the SerialDebug output More...
 
int len_SPIFFFile (fs::FS &fs, const char *path)
 calculate the length of the SPFF file More...
 
int linesInFile_SPIFFModule (fs::FS &fs, const char *path)
 reads the file name specified. returning the number of lines.. More...
 
void sendStrings_SPIFFModule (int numberOfLines)
 sends SPIFF module strings over MQTT, starting at the number back specified. This will use the current users MQTT credentials.. More...
 
void writeFB_SPIFFModule (uint8_t *buf, size_t len, char *fileName)
 writes a FB to a file.. More...
 
void setup_SPIFFModule ()
 the setup for this module More...
 
void loop_SPIFFModule ()
 a loop if anything (nothing right now) More...
 
void printSM_SPIFFModule (char *semanticMarker)
 
void println_SPIFFModule_JSON (char *attribute, char *value)
 4.4.24 output a line in JSON format adding timestamp as well More...
 
void printTimestamp_SPIFFModule ()
 prints a timestamp time: <time> : More...
 
void saveScreen_SPIFFModule ()
 save the screen to a file on the SPIFF More...
 

Macro Definition Documentation

◆ FORMAT_SPIFFS_IF_FAILED

#define FORMAT_SPIFFS_IF_FAILED   true

◆ SPIFF_FILE_NAME

#define SPIFF_FILE_NAME   (char*)"/messages.txt"

Definition at line 6 of file SPIFFModule.cpp.

◆ SPIFF_SCREEN_FILE_NAME

#define SPIFF_SCREEN_FILE_NAME   (char*)"/M5Screen.bmp"

Function Documentation

◆ appendFile()

void appendFile ( fs::FS &  fs,
const char *  path,
const char *  message 
)

appends the message to the file

Definition at line 107 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteFile()

void deleteFile ( fs::FS &  fs,
const char *  path 
)

deletes the file specified

Definition at line 142 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteFiles_SPIFFModule()

void deleteFiles_SPIFFModule ( )

delete the spiff files..

Definition at line 250 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ len_SPIFFFile()

int len_SPIFFFile ( fs::FS &  fs,
const char *  path 
)

calculate the length of the SPFF file

Definition at line 263 of file SPIFFModule.cpp.

Here is the caller graph for this function:

◆ linesInFile_SPIFFModule()

int linesInFile_SPIFFModule ( fs::FS &  fs,
const char *  path 
)

reads the file name specified. returning the number of lines..

Definition at line 289 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listDir()

void listDir ( fs::FS &  fs,
const char *  dirname,
uint8_t  levels 
)

list the directory of the SPIFF

Definition at line 26 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop_SPIFFModule()

void loop_SPIFFModule ( )

a loop if anything (nothing right now)

Definition at line 475 of file SPIFFModule.cpp.

◆ print_SPIFFModule()

void print_SPIFFModule ( char *  string)

print a string to spiff (NO new line is added)

Definition at line 237 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printFile_SPIFFModule()

void printFile_SPIFFModule ( )

prints the spiff file to the SerialDebug output

Definition at line 256 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printInt_SPIFFModule()

void printInt_SPIFFModule ( int  val)

print a int to spiff (NO new line is added)

Definition at line 242 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ println_SPIFFModule()

void println_SPIFFModule ( char *  string)

The SPIFF module is for storing messages that are retrievable later as it stores on a folder area of the ESP chip.

print a string to spiff (a new line is added)

Definition at line 230 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ println_SPIFFModule_JSON()

void println_SPIFFModule_JSON ( char *  attribute,
char *  value 
)

4.4.24 output a line in JSON format adding timestamp as well

4.4.24 output a line in JSON format adding timestamp as well {'time':time, 'attribute':'value'}

print a time too.. NEED a format for this to distinguish from others..

Definition at line 489 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printSM_SPIFFModule()

void printSM_SPIFFModule ( char *  semanticMarker)

sends the Semantic Marker onto the SPIFF format- {'time':time, 'SM':'<sm>'}

Definition at line 481 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printTimestamp_SPIFFModule()

void printTimestamp_SPIFFModule ( )

prints a timestamp time: <time> :

The SPIFF module is for storing messages that are retrievable later as it stores on a folder area of the ESP chip prints a timestamp time: <time> :

Definition at line 507 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFile()

void readFile ( fs::FS &  fs,
const char *  path 
)

reads the file name specified. The result is SerialDebug.write

Definition at line 64 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ renameFile()

void renameFile ( fs::FS &  fs,
const char *  path1,
const char *  path2 
)

renames the file

Definition at line 128 of file SPIFFModule.cpp.

Here is the call graph for this function:

◆ saveScreen_SPIFFModule()

void saveScreen_SPIFFModule ( )

save the screen to a file on the SPIFF

Definition at line 690 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendStrings_SPIFFModule()

void sendStrings_SPIFFModule ( int  numberOfLines)

sends SPIFF module strings over MQTT, starting at the number back specified. This will use the current users MQTT credentials..

publish a binary file.. fileExtension is .jpg, .json, .txt etc

8.16.25 MQTT

Definition at line 317 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_SPIFFModule()

void setup_SPIFFModule ( )

the setup for this module

Definition at line 441 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ useSpiff()

boolean useSpiff ( )

helper for using the spiff or not..

Definition at line 19 of file SPIFFModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeFB_SPIFFModule()

void writeFB_SPIFFModule ( uint8_t *  buf,
size_t  len,
char *  fileName 
)

writes a FB to a file..

Parameters
bufPointer to the pixel data
lenLength of the buffer in bytes

Definition at line 419 of file SPIFFModule.cpp.

Here is the call graph for this function:

◆ writeFile()

void writeFile ( fs::FS &  fs,
const char *  path,
const char *  message 
)

writes the message to the file specified

Definition at line 86 of file SPIFFModule.cpp.

Here is the call graph for this function: