Helper class for command line drivers: provides helper methods for command line based communication with devices like NanoVNA or TinySA.
More...
#include <CommandLineDriver.h>
|
std::string | ConverseSingle (const std::string commandString, bool hasEcho=true) |
| Converse with the device : send a command and read the reply over several lines. More...
|
|
size_t | ConverseMultiple (const std::string commandString, std::vector< std::string > &readLines, bool hasEcho=true, std::function< void(float)> progress=nullptr, size_t expecedLines=0) |
| Converse with the device by sending a command and receiving a single line response. More...
|
|
bool | ConverseSweep (int64_t &sweepStart, int64_t &sweepStop, int64_t &points, bool setFreqValues=false) |
| Set and/or read the sweep values from the device. More...
|
|
bool | ConverseSweep (int64_t &sweepStart, int64_t &sweepStop, bool setFreqValues=false) |
| Set and/or read the sweep values from the device. More...
|
|
std::string | ConverseString (const std::string commandString, std::function< void(float)> progress=nullptr, size_t expecedLines=0) |
| Base method to converse with the device. More...
|
|
std::string | DrainTransport () |
| Consume any pending data from the transport layer. More...
|
|
|
std::recursive_mutex | m_transportMutex |
|
size_t | m_maxResponseSize |
|
double | m_communicationTimeout |
|
SCPITransport * | m_transport |
|
std::string | m_vendor |
|
std::string | m_model |
|
std::string | m_serial |
|
std::string | m_fwVersion |
|
|
static const std::string | TRAILER_STRING = "ch> " |
|
static const size_t | TRAILER_STRING_LENGTH = TRAILER_STRING.size() |
|
static const std::string | EOL_STRING = "\r\n" |
|
static const size_t | EOL_STRING_LENGTH = EOL_STRING.size() |
|
Helper class for command line drivers: provides helper methods for command line based communication with devices like NanoVNA or TinySA.
◆ ConverseMultiple()
size_t CommandLineDriver::ConverseMultiple |
( |
const std::string |
commandString, |
|
|
std::vector< std::string > & |
readLines, |
|
|
bool |
hasEcho = true , |
|
|
std::function< void(float)> |
progress = nullptr , |
|
|
size_t |
expecedLines = 0 |
|
) |
| |
|
protected |
Converse with the device by sending a command and receiving a single line response.
- Parameters
-
commandString | the command string to send |
- Returns
- std::string the received response
- Parameters
-
hasEcho | true (default value) if the device is expected to echo the sent command |
progress | (optional) download progress function |
expectedLines | (optional) the number of lines expected from the device |
- Returns
- size_t the number of lines received from the device
◆ ConverseSingle()
std::string CommandLineDriver::ConverseSingle |
( |
const std::string |
commandString, |
|
|
bool |
hasEcho = true |
|
) |
| |
|
protected |
Converse with the device : send a command and read the reply over several lines.
- Parameters
-
commandString | the command string to send |
readLines | a verctor to store the reply lines |
hasEcho | true (default value) if the device is expected to echo the sent command |
- Returns
- size_t the number of lines received from the device
◆ ConverseString()
std::string CommandLineDriver::ConverseString |
( |
const std::string |
commandString, |
|
|
std::function< void(float)> |
progress = nullptr , |
|
|
size_t |
expecedLines = 0 |
|
) |
| |
|
protected |
Base method to converse with the device.
- Parameters
-
commandString | the command string to send to the device |
progress | (optional) download progress function |
expectedLines | (optional) the number of lines expected from the device |
- Returns
- std::string a string containing all the response from the device (may contain several lines separated by \r
)
◆ ConverseSweep() [1/2]
bool CommandLineDriver::ConverseSweep |
( |
int64_t & |
sweepStart, |
|
|
int64_t & |
sweepStop, |
|
|
bool |
setFreqValues = false |
|
) |
| |
|
inlineprotected |
Set and/or read the sweep values from the device.
- Parameters
-
sweepStart | the sweep start value (in/out) |
sweepStop | the sweep stop value (in/out) |
setFreqValues | (optional, defaults to false) true is the sweep frequency values have to be set on the device |
- Returns
- true is the value returned by the device is different from the one that shoudl have been set (e.g. out of range)
◆ ConverseSweep() [2/2]
bool CommandLineDriver::ConverseSweep |
( |
int64_t & |
sweepStart, |
|
|
int64_t & |
sweepStop, |
|
|
int64_t & |
points, |
|
|
bool |
setFreqValues = false |
|
) |
| |
|
protected |
Set and/or read the sweep values from the device.
- Parameters
-
sweepStart | the sweep start value (in/out) |
sweepStop | the sweep stop value (in/out) |
points | the number of points (in/out) |
setFreqValues | (optional, defaults to false) true is the sweep frequency values have to be set on the device |
- Returns
- true is the value returned by the device is different from the one that shoudl have been set (e.g. out of range)
◆ DrainTransport()
std::string CommandLineDriver::DrainTransport |
( |
| ) |
|
|
protected |
Consume any pending data from the transport layer.
- Returns
- the consumed data
The documentation for this class was generated from the following files: