Midnight Sun Firmware
Loading...
Searching...
No Matches
Terminal

Class that interfaces with the simulation API via a terminal UI. More...

#include <app_terminal.h>

Collaboration diagram for Terminal:

Public Member Functions

 Terminal (Server *server)
 Constructs a Terminal object. More...
 
void run ()
 While true spin-loop to handle shell inputs. More...
 

Private Member Functions

std::string toLower (const std::string &input)
 Convert a string input to lower case. More...
 
void handleGpioCommands (const std::string &action, std::vector< std::string > &tokens)
 Handle GPIO commands provoidede an action statement and tokenized parameters. More...
 
void parseCommand (std::vector< std::string > &tokens)
 Parse the tokens and branch to the appropiate handler function. More...
 

Private Attributes

Serverm_Server
 
ClientConnectionm_targetClient
 

Detailed Description

Class that interfaces with the simulation API via a terminal UI.

This class is responsible packaging commands based on terminal inputs This class is the lightest application-layer, and should be replaced in the future with a GUI

Constructor & Destructor Documentation

◆ Terminal()

Terminal ( Server server)

Constructs a Terminal object.

Initializes the Terminal. The constructor sets up internal variables The constructor shall bind to the server

Parameters
serverPointer to a server instance

Member Function Documentation

◆ handleGpioCommands()

void handleGpioCommands ( const std::string &  action,
std::vector< std::string > &  tokens 
)
private

Handle GPIO commands provoidede an action statement and tokenized parameters.

Parameters
actionAction statement to select the Remote procedure call
tokensList containing action parameters to format the Remote procedure call

◆ parseCommand()

void parseCommand ( std::vector< std::string > &  tokens)
private

Parse the tokens and branch to the appropiate handler function.

This shall branch to handleGpioCommands, handleI2CCommands, handleSPICommands and handleInterruptCommands

Parameters
tokensList containing tokenized input string

◆ run()

void run ( )

While true spin-loop to handle shell inputs.

This function must be called after server initialization This function will never return. To exit safely, you must enter 'exit'

Create tokens out of input string Input = "GPIO GET_PIN_STATE A9" tokens = ["GPIO", "GET_PIN_STATE", "A9"]

◆ toLower()

std::string toLower ( const std::string &  input)
private

Convert a string input to lower case.

Parameters
inputString input to be converted
Returns
Lower-case version of the input string

Member Data Documentation

◆ m_Server

Server* m_Server
private

Pointer to the server instance

◆ m_targetClient

ClientConnection* m_targetClient
private

Pointer to a target client instance


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