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_Commands Class Reference

Stores parsed command tokens. More...

#include <scpi_types.h>

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

Public Member Functions

 SCPI_Commands ()
 Default constructor.
 
 SCPI_Commands (char *message)
 Parse command tokens 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 token 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 tokens.

Derived from SCPI_String_Array, this class is used to tokenize an SCPI command message into parts separated by ':'.

Remaining unparsed text is stored in not_processed_message.

Definition at line 74 of file scpi_types.h.

Constructor & Destructor Documentation

◆ SCPI_Commands() [1/2]

SCPI_Commands::SCPI_Commands ( )

Default constructor.

Definition at line 118 of file scpi_types.cpp.

118{}

◆ SCPI_Commands() [2/2]

SCPI_Commands::SCPI_Commands ( char * message)

Parse command tokens from a message.

Construct and tokenize a SCPI command from a message.

Splits the input string on ':' characters, storing resulting tokens in the array. Terminates tokenization at the first whitespace (space or tab), storing the rest in not_processed_message.

Parameters
messageNull-terminated string containing the SCPI command message.

Definition at line 129 of file scpi_types.cpp.

130{
131 char *token = message;
132 // Trim leading spaces and tabs
133 while (isspace(*token))
134 token++;
135 // Save parameters and multicommands for later
136 not_processed_message = strpbrk(token, " \t");
137 if (not_processed_message != NULL)
138 {
139 not_processed_message[0] = '\0';
141 }
142 // Split using ':'
143 token = strtok(token, ":");
144 while (token != NULL)
145 {
146 this->Append(token);
147 token = strtok(NULL, ":");
148 }
149}
char * not_processed_message
Remaining message text after token parsing.
Definition scpi_types.h:79
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_Commands::not_processed_message

Remaining message text after token parsing.

Definition at line 79 of file scpi_types.h.


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