34#include <NDEVR/BaseValues.h>
35#include <NDEVR/String.h>
36#include <NDEVR/Dictionary.h>
37#include <NDEVR/RWLock.h>
38#include <NDEVR/Time.h>
39#include <NDEVR/TimeSpan.h>
40#include <NDEVR/Thread.h>
41#include <NDEVR/JSONNode.h>
42#include <NDEVR/ProgressInfo.h>
43#include <NDEVR/LogMessage.h>
44#include <NDEVR/Exception.h>
70 template<
class t_type>
270 bool finished =
false;
377 for (
uint04 i = 0; i < Constant<uint04>::Invalid; i++)
381 if (display.
size() == 0)
392 const JSONNode& node = root[display];
393 if (node.
hasNode(
"Attempt Count"))
395 if (node.
hasNode(
"Failure Count"))
397 if (node.
hasNode(
"Total Response Time"))
399 if (allow_command_override)
405 if (node.
hasNode(
"Validation Regex"))
407 if (node.
hasNode(
"Default Args"))
409 if (node.
hasNode(
"Transmission Delay"))
411 if (node.
hasNode(
"Receive Delay"))
413 if (node.
hasNode(
"Response Timeout"))
428 for (
uint04 i = 0; i < Constant<uint04>::Invalid; i++)
433 if (display.
size() == 0)
443 node[
"Command"] = info.
command;
452 node[
"Average Response Time"] = 0;
454 node[
"Transmission Delay"] = info.
tx_delay;
455 node[
"Receive Delay"] = info.
rx_delay;
465 root +=
"Command" + del;
467 root +=
"Supported" + del;
468 root +=
"Attempt Count" + del;
469 root +=
"Failure Count" + del;
470 root +=
"Total Response Time" + del;
471 root +=
"Average Response Time" + del;
472 if (include_identity_info)
474 root +=
"Default Args" + del;
475 root +=
"Transmission Delay" + del;
476 root +=
"Receive Delay" + del;
477 root +=
"Response Timeout" + del;
478 root +=
"Validation Regex" + del;
480 for (
uint04 i = 0; i < Constant<uint04>::Invalid; i++)
486 if (display.
size() == 0)
495 root += display + del;
505 if (include_identity_info)
#define UNUSED(expr)
Definition BaseValues.hpp:406
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
constexpr t_index_type size() const
Definition Buffer.hpp:1374
decltype(auto) last()
Definition Buffer.hpp:930
void clear()
Definition Buffer.hpp:557
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:59
bool hasKey(const t_key &key) const
Definition Dictionary.h:64
uint04 size() const
Definition Dictionary.h:142
Definition Exception.hpp:52
virtual TranslatedString getMessage() const
Definition Exception.hpp:123
Definition HardwareCommandQueue.h:72
JSONNode getCommandJSONInfo(bool only_supported) const
Definition HardwareCommandQueue.h:425
CommandInformation commandInformation(t_type command)
Definition HardwareCommandQueue.h:312
CommandQueueItem m_pending_block_command
Definition HardwareCommandQueue.h:530
CommandQueueItem m_current_command
Definition HardwareCommandQueue.h:529
TimeSpan commandTimeout() const
Definition HardwareCommandQueue.h:357
void finishCommand()
Definition HardwareCommandQueue.h:202
void removeCommand(t_type command)
Definition HardwareCommandQueue.h:119
void disableCommand(t_type command)
Definition HardwareCommandQueue.h:324
Time m_current_command_start_time
Definition HardwareCommandQueue.h:528
virtual bool allowMultipleCommandsInStream(t_type command, const String &args) const
Definition HardwareCommandQueue.h:159
virtual bool supportsCommand(t_type command) const
Definition HardwareCommandQueue.h:318
void setFromJSONInfo(const JSONNode &root, bool allow_command_override, ProgressInfo *log)
Definition HardwareCommandQueue.h:375
bool popCommandAndExecute()
Definition HardwareCommandQueue.h:165
virtual void cancelCommand()
Definition HardwareCommandQueue.h:235
virtual void retryCommand()
Definition HardwareCommandQueue.h:226
uint04 bufferOffset() const
Definition HardwareCommandQueue.h:521
bool hasPendingCommand(t_type command) const
Definition HardwareCommandQueue.h:92
void executeCommandBlocking(const t_type &command, const String &args=String())
Definition HardwareCommandQueue.h:268
bool hasPending() const
Definition HardwareCommandQueue.h:516
uint04 m_buffer_offset
Definition HardwareCommandQueue.h:531
void postCommand(t_type command, const String &args=String(), const String ®ex=String())
Definition HardwareCommandQueue.h:97
Dictionary< t_type, uint04 > m_pending_commands
Definition HardwareCommandQueue.h:525
const String & currentRegex() const
Definition HardwareCommandQueue.h:520
t_type currentCommand() const
Definition HardwareCommandQueue.h:518
void addCommandToFront(t_type command, const String &args=String(), const String ®ex=String())
Definition HardwareCommandQueue.h:134
Buffer< CommandRecord > m_records
Definition HardwareCommandQueue.h:527
virtual void executeCommand(const t_type &command, const String &args)=0
TimeSpan rxDelay() const
Definition HardwareCommandQueue.h:369
virtual void endCommandQueue()
Definition HardwareCommandQueue.h:353
String getCommandCSVInfo(bool only_supported, bool include_identity_info, char deliminator=',') const
Definition HardwareCommandQueue.h:461
Dictionary< t_type, CommandInformation > m_command_info
Definition HardwareCommandQueue.h:524
void clearCommands()
Definition HardwareCommandQueue.h:259
void setSupported(t_type command, bool supported)
Definition HardwareCommandQueue.h:346
Buffer< CommandQueueItem > m_ordered_commands
Definition HardwareCommandQueue.h:526
virtual void onFailure(const t_type &command)
Definition HardwareCommandQueue.h:253
void setBufferOffset(uint04 buffer_offset)
Definition HardwareCommandQueue.h:522
void setSupport(t_type command, CommandSupport support)
Definition HardwareCommandQueue.h:342
static const uint04 s_buffer_size
Definition HardwareCommandQueue.h:96
TimeSpan txDelay() const
Definition HardwareCommandQueue.h:363
const String & currentArgs() const
Definition HardwareCommandQueue.h:519
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Definition JSONParser.h:60
decltype(auto) getAs() const
Definition JSONParser.h:201
bool hasNode(const String &child_node) const
Definition JSONParser.h:249
@ e_error
Definition LogMessage.h:53
A light-weight base class for Log that allows processes to update, without the need for.
Definition ProgressInfo.hpp:48
virtual bool addMessage(const LogMessage &message)=0
Used to lock a particular variable for reading. Any number of readers can be created when no write lo...
Definition RWLock.h:91
The core String class for the software.
Definition String.h:47
static TranslatedString DisplayString(const t_type &value)
Definition TranslatedString.h:54
Logic for reading or writing to a string or a user friendly, TranslatedString.
Definition StringStream.h:118
static void RequestSleep(const TimeSpan &interval)
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
static NDEVR_BASE_API Time SystemTime()
Retrieves the current system time.
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
constexpr fltp08 elapsedSeconds() const
Definition TimeSpan.h:111
NDEVR_BASE_API const String & englishTranslation() const
Used to lock a particular variable for writing. Only one write lock can be created when no read locks...
Definition RWLock.h:115
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:177
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:125
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:94
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:379
CommandSupport
Definition HardwareCommandQueue.h:48
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved.
Definition BaseValues.hpp:230
Definition HardwareCommandQueue.h:75
t_type command
Definition HardwareCommandQueue.h:76
String regex
Definition HardwareCommandQueue.h:78
String args
Definition HardwareCommandQueue.h:77
void clear()
Definition HardwareCommandQueue.h:79
Definition HardwareCommandQueue.h:87
t_type command
Definition HardwareCommandQueue.h:90
Time start_time
Definition HardwareCommandQueue.h:88
Time end_time
Definition HardwareCommandQueue.h:89