Motor Driver Evaluation Kit NEVB-MTR1-t01-1.0.0
Firmware for NEVB-MTR1-KIT1 for trapezoidal control of BLDC motors using Hall-effect sensors
Loading...
Searching...
No Matches
SCPI_Parameters Class Reference

Stores parsed command parameters. More...

#include <scpi_types.h>

Inheritance diagram for SCPI_Parameters:
[legend]
Collaboration diagram for SCPI_Parameters:
[legend]

Public Member Functions

 SCPI_Parameters ()
 Default constructor.
 
 SCPI_Parameters (char *message)
 Parse parameters from a message.
 
- Public Member Functions inherited from SCPI_String_Array
char * operator[] (const byte index) const
 Read-only array indexing.
 
void Append (char *value)
 Append a new string to the array (LIFO push).
 
char * Pop ()
 Remove and return the last string (LIFO pop).
 
char * First () const
 Get the first appended string.
 
char * Last () const
 Get the last appended string.
 
uint8_t Size () const
 Get the number of stored strings.
 

Public Attributes

char * not_processed_message
 Remaining message text after parsing.
 
- Public Attributes inherited from SCPI_String_Array
bool overflow_error = false
 Flag set when exceeding storage_size.
 
const uint8_t storage_size = 6
 Max number of entries allowed.
 

Additional Inherited Members

- Protected Attributes inherited from SCPI_String_Array
uint8_t size_ = 0
 Current size of the array.
 
char * values_ [6]
 Internal storage for string pointers.
 

Detailed Description

Stores parsed command parameters.

Derived from SCPI_String_Array, this class splits a message using commas to extract and store parameters following an SCPI command.

Whitespace before each parameter is trimmed. The remaining unprocessed string is stored in not_processed_message.

Definition at line 92 of file scpi_types.h.

Constructor & Destructor Documentation

◆ SCPI_Parameters() [1/2]

SCPI_Parameters::SCPI_Parameters ( )

Default constructor.

Definition at line 156 of file scpi_types.cpp.

156{}

◆ SCPI_Parameters() [2/2]

SCPI_Parameters::SCPI_Parameters ( char * message)

Parse parameters from a message.

Construct and tokenize parameters from a message.

Splits the input string on ',' characters and trims leading whitespace for each parameter. Stores each parameter as a separate element in the array.

Parameters
messageNull-terminated string containing the SCPI parameter message.

Definition at line 166 of file scpi_types.cpp.

167{
168 char *parameter = message;
169 // Split using ','
170 parameter = strtok(parameter, ",");
171 while (parameter != NULL)
172 {
173 while (isspace(*parameter))
174 parameter++;
175 this->Append(parameter);
176 parameter = strtok(NULL, ",");
177 }
178 // TODO add support for strings parameters (do not split parameters inside "")
179}
void Append(char *value)
Append a new string to the array (LIFO push).
Here is the call graph for this function:

Member Data Documentation

◆ not_processed_message

char* SCPI_Parameters::not_processed_message

Remaining message text after parsing.

Definition at line 97 of file scpi_types.h.


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