TinyTelnetServer
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
SDFileCommands Class Reference

Class providing SD card file commands for TinyTelnetServer. More...

#include <SDFileCommands.h>

Public Member Functions

 SDFileCommands (TinySerialServer &server)
 Default constructor.
 
void addCommands (TinySerialServer &server)
 Register file commands (inspired by linux) with the server. More...
 
void addCommandsWindows (TinySerialServer &server)
 Register file commands (inspired by Windows) with the server. More...
 
void setMaxFileLength (int len)
 Defines the maximum length for file names.
 

Static Public Member Functions

static bool cmd_cat (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Display contents of a file.
 
static bool cmd_cd (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 
static bool cmd_cp (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Copy a file.
 
static bool cmd_df (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Show SD card space information.
 
static bool cmd_head (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Show first N lines of a file.
 
static bool cmd_ls (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 List files in a directory.
 
static bool cmd_mkdir (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Create a new directory.
 
static bool cmd_mv (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Move/rename a file.
 
static bool cmd_pwd (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 
static bool cmd_rm (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Remove a file or directory. More...
 
static bool cmd_touch (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Create empty files or update timestamps.
 
static bool cmd_write (telnet::Str &cmd, telnet::Vector< telnet::Str > parameters, Print &out, TinySerialServer *self)
 Write text to a file.
 

Static Protected Member Functions

static String dirUp (const char *current)
 
static bool removeDirectory (const char *dirPath, Print &out)
 Remove a directory and all its contents recursively. More...
 
static String resolveName (const char *path)
 Resolve relative path name.
 

Detailed Description

Class providing SD card file commands for TinyTelnetServer.

Implements common file operations:

The SD API does nto support cd and pwd, so we simulate this functionality.

Member Function Documentation

◆ addCommands()

void addCommands ( TinySerialServer server)
inline

Register file commands (inspired by linux) with the server.

Parameters
serverThe TinySerialServer to register commands with

◆ addCommandsWindows()

void addCommandsWindows ( TinySerialServer server)
inline

Register file commands (inspired by Windows) with the server.

Parameters
serverThe TinySerialServer to register commands with

◆ cmd_rm()

static bool cmd_rm ( telnet::Str cmd,
telnet::Vector< telnet::Str parameters,
Print &  out,
TinySerialServer self 
)
inlinestatic

Remove a file or directory.

resolve file name

◆ dirUp()

static String dirUp ( const char *  current)
inlinestaticprotected

Move one path level up Returns the parent directory of the current directory

◆ removeDirectory()

static bool removeDirectory ( const char *  dirPath,
Print &  out 
)
inlinestaticprotected

Remove a directory and all its contents recursively.

Parameters
dirPathPath to directory
outOutput stream for messages
Returns
true if successful

The documentation for this class was generated from the following file: