![]() |
GM6000 Digital Heater Controller Build: 16 (Branch = develop)
SDX-1330
|
This concrete class provides a non-blocking implementation of Command PolledProcessor for a TShell engine. More...
This concrete class provides a non-blocking implementation of Command PolledProcessor for a TShell engine.
See Cpl::TShell::PolledProcessor for additional details.
#include <PolledProcessor.h>
Public Member Functions | |
PolledProcessor (Cpl::Container::SList< Command > &commands, Cpl::Text::Frame::StreamDecoder &deframer, Cpl::Text::Frame::StreamEncoder &framer, Cpl::System::Mutex &outputLock, char commentChar='#', char argEscape='`', char argDelimiter=' ', char argQuote='"', char argTerminator='\n', Security::Permission_T initialPermissionLevel = Security::ePUBLIC ) | |
Constructor. | |
bool | start (Cpl::Io::Input &infd, Cpl::Io::Output &outfd, bool blocking=true) noexcept |
See Cpl::TShell::ProcessorApi. | |
int | poll () noexcept |
See Cpl::TShell::ProcessorApi. | |
![]() | |
Processor (Cpl::Container::SList< Command > &commands, Cpl::Text::Frame::StreamDecoder &deframer, Cpl::Text::Frame::StreamEncoder &framer, Cpl::System::Mutex &outputLock, char commentChar='#', char argEscape='`', char argDelimiter=' ', char argQuote='"', char argTerminator = '\n', Security::Permission_T initialPermissionLevel = Security::ePUBLIC ) | |
Constructor. | |
bool | start (Cpl::Io::Input &infd, Cpl::Io::Output &outfd, bool blocking=true) noexcept |
See Cpl::TShell::ProcessorApi. | |
int | poll () noexcept |
See Cpl::TShell::ProcessorApi. | |
void | requestStop () noexcept |
See Cpl::TShell::ProcessorApi. | |
char | getEscapeChar () noexcept |
See Cpl::TShell::ProcessorApi. | |
char | getDelimiterChar () noexcept |
See Cpl::TShell::ProcessorApi. | |
char | getQuoteChar () noexcept |
See Cpl::TShell::ProcessorApi. | |
char | getTerminatorChar () noexcept |
See Cpl::TShell::ProcessorApi. | |
Cpl::Container::SList< Command > & | getCommands () noexcept |
See Cpl::TShell::Context_. | |
Command * | findCommand (const char *verb, size_t verbLength) noexcept |
See Cpl::TShell::Context_. | |
bool | writeFrame (const char *text) noexcept |
See Cpl::TShell::Context_. | |
bool | writeFrame (const char *text, size_t maxBytes) noexcept |
See Cpl::TShell::Context_. | |
Cpl::Text::String & | getOutputBuffer () noexcept |
See Cpl::TShell::Context_. | |
Cpl::Text::String & | getTokenBuffer () noexcept |
See Cpl::TShell::Context_. | |
Cpl::Text::String & | getTokenBuffer2 () noexcept |
See Cpl::TShell::Context_. | |
bool | oobRead (void *buffer, int numBytes, int &bytesRead) noexcept |
See Cpl::TShell::Context_. | |
Security::Permission_T | getUserPermissionLevel () const noexcept |
See Cpl::TShell::Context_. | |
Security::Permission_T | setUserPermissionLevel (Security::Permission_T newPermissionLevel) noexcept |
See Cpl::TShell::Context_. | |
![]() | |
virtual | ~Context_ () |
Virtual destructor. | |
![]() | |
virtual | ~ProcessorApi () |
Virtual destructor. | |
Protected Member Functions | |
int | readInput (size_t &frameSize) noexcept |
Helper method that executes the decoder, i.e. | |
![]() | |
virtual Command::Result_T | executeCommand (char *deframedInput, Cpl::Io::Output &outfd) noexcept |
Helper method that attempts to execute the content of the de-framed/decoded 'inputString'. | |
bool | outputCommandError (Command::Result_T result, const char *deframedInput) noexcept |
Helper method. | |
int | getAndProcessFrame (Cpl::Io::Output &outfd) noexcept |
Helper method that performs a 'single' read cycle of the input stream. | |
virtual void | sortCommandList () noexcept |
Helper method. | |
Protected Attributes | |
Cpl::Io::Output * | m_outFd |
Cached output stream pointer. | |
![]() | |
Cpl::Container::SList< Command > & | m_commands |
Command list. | |
Cpl::Text::Frame::StreamDecoder & | m_deframer |
Raw input de-framer. | |
Cpl::Text::Frame::StreamEncoder & | m_framer |
Output framer handle. | |
Cpl::System::Mutex & | m_outLock |
Output lock. | |
Security::Permission_T | m_userPermLevel |
User's permission level. | |
char | m_comment |
Comment character. | |
char | m_esc |
Argument Escape character. | |
char | m_del |
Argument delimiter. | |
char | m_quote |
Argument quote character. | |
char | m_term |
Argument terminator character. | |
bool | m_writeCommandPrompt |
Set to true when 'command prompt' should be outputted. | |
size_t | m_frameSize |
Current frame size. | |
bool | m_running |
My run state. | |
char | m_inputBuffer [OPTION_CPL_TSHELL_PROCESSOR_INPUT_SIZE+1] |
Input Frame buffer. | |
Cpl::Text::FString< OPTION_CPL_TSHELL_PROCESSOR_OUTPUT_SIZE > | m_outputBuffer |
Buffer that is used to construct output messages. | |
Cpl::Text::FString< OPTION_CPL_TSHELL_PROCESSOR_INPUT_SIZE > | m_tokenBuffer |
Shared token work buffer. | |
Cpl::Text::FString< OPTION_CPL_TSHELL_PROCESSOR_INPUT_SIZE > | m_tokenBuffer2 |
Shared token work buffer. | |
Cpl::TShell::PolledProcessor::PolledProcessor | ( | Cpl::Container::SList< Command > & | commands, |
Cpl::Text::Frame::StreamDecoder & | deframer, | ||
Cpl::Text::Frame::StreamEncoder & | framer, | ||
Cpl::System::Mutex & | outputLock, | ||
char | commentChar = '#', | ||
char | argEscape = '`', | ||
char | argDelimiter = ' ', | ||
char | argQuote = '"', | ||
char | argTerminator = '\n', | ||
Security::Permission_T | initialPermissionLevel = Security::ePUBLIC ) |
Constructor.
commands | Set of supported commands |
deframer | Frame decoder used to identify individual command strings within the raw Input stream |
framer | Frame encoder used to encapsulate the output of command in the Output stream. |
outputLock | Mutex to be used for ensuring the atomic output of the commands. |
commentChar | The comment character used to indicate that the input string is a comment and should not be executed. |
argEscape | Escape character to be used when escaping double quote characters inside a quoted argument. |
argDelimiter | The delimiter character used to separate the command verb and arguments. |
argQuote | The quote character used to 'double quote' a argument string. |
argTerminator | The command terminator character. |
initialPermissionLevel | The initial minimum permission level that a user needs to issue command(s) |
|
virtualnoexcept |
See Cpl::TShell::ProcessorApi.
Implements Cpl::TShell::ProcessorApi.
|
protectedvirtualnoexcept |
Helper method that executes the decoder, i.e.
logic to parse the incoming text. Returns 1 if a full/valid frame was found. Returns 0 if input frame is incomplete. Return -1 if an error occurred.
Reimplemented from Cpl::TShell::Processor.
|
virtualnoexcept |
See Cpl::TShell::ProcessorApi.
Implements Cpl::TShell::ProcessorApi.
|
protected |
Cached output stream pointer.