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>
79 template<
class t_type>
279 bool finished =
false;
386 for (
uint04 i = 0; i < Constant<uint04>::Invalid; i++)
390 if (display.
size() == 0)
401 const JSONNode& node = root[display];
402 if (node.
hasNode(
"Attempt Count"))
404 if (node.
hasNode(
"Failure Count"))
406 if (node.
hasNode(
"Total Response Time"))
408 if (allow_command_override)
414 if (node.
hasNode(
"Validation Regex"))
416 if (node.
hasNode(
"Default Args"))
418 if (node.
hasNode(
"Transmission Delay"))
420 if (node.
hasNode(
"Receive Delay"))
422 if (node.
hasNode(
"Response Timeout"))
437 for (
uint04 i = 0; i < Constant<uint04>::Invalid; i++)
442 if (display.
size() == 0)
452 node[
"Command"] = info.
command;
461 node[
"Average Response Time"] = 0;
463 node[
"Transmission Delay"] = info.
tx_delay;
464 node[
"Receive Delay"] = info.
rx_delay;
474 root +=
"Command" + del;
476 root +=
"Supported" + del;
477 root +=
"Attempt Count" + del;
478 root +=
"Failure Count" + del;
479 root +=
"Total Response Time" + del;
480 root +=
"Average Response Time" + del;
481 if (include_identity_info)
483 root +=
"Default Args" + del;
484 root +=
"Transmission Delay" + del;
485 root +=
"Receive Delay" + del;
486 root +=
"Response Timeout" + del;
487 root +=
"Validation Regex" + del;
489 for (
uint04 i = 0; i < Constant<uint04>::Invalid; i++)
495 if (display.
size() == 0)
504 root += display + del;
514 if (include_identity_info)
#define UNUSED(expr)
Definition BaseValues.hpp:409
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
constexpr t_index_type size() const
Definition Buffer.hpp:823
decltype(auto) last()
Definition Buffer.hpp:588
void clear()
Definition Buffer.hpp:422
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
bool hasKey(const t_key &key) const
Definition Dictionary.h:66
uint04 size() const
Definition Dictionary.h:144
Provides consistent interface to handle errors through the throw expression. All exceptions generated...
Definition Exception.hpp:47
virtual TranslatedString getMessage() const
Definition Exception.hpp:71
A base class for communicating with Hardware, typically firmware by the software. Commands a queued u...
Definition HardwareCommandQueue.h:81
JSONNode getCommandJSONInfo(bool only_supported) const
Definition HardwareCommandQueue.h:434
CommandInformation commandInformation(t_type command)
Definition HardwareCommandQueue.h:321
CommandQueueItem m_pending_block_command
Definition HardwareCommandQueue.h:539
CommandQueueItem m_current_command
Definition HardwareCommandQueue.h:538
TimeSpan commandTimeout() const
Definition HardwareCommandQueue.h:366
void finishCommand()
Definition HardwareCommandQueue.h:211
void removeCommand(t_type command)
Definition HardwareCommandQueue.h:128
void disableCommand(t_type command)
Definition HardwareCommandQueue.h:333
Time m_current_command_start_time
Definition HardwareCommandQueue.h:537
virtual bool allowMultipleCommandsInStream(t_type command, const String &args) const
Definition HardwareCommandQueue.h:168
virtual bool supportsCommand(t_type command) const
Definition HardwareCommandQueue.h:327
void setFromJSONInfo(const JSONNode &root, bool allow_command_override, ProgressInfo *log)
Definition HardwareCommandQueue.h:384
bool popCommandAndExecute()
Definition HardwareCommandQueue.h:174
virtual void cancelCommand()
Definition HardwareCommandQueue.h:244
virtual void retryCommand()
Definition HardwareCommandQueue.h:235
uint04 bufferOffset() const
Definition HardwareCommandQueue.h:530
bool hasPendingCommand(t_type command) const
Definition HardwareCommandQueue.h:101
void executeCommandBlocking(const t_type &command, const String &args=String())
Definition HardwareCommandQueue.h:277
bool hasPending() const
Definition HardwareCommandQueue.h:525
uint04 m_buffer_offset
Definition HardwareCommandQueue.h:540
void postCommand(t_type command, const String &args=String(), const String ®ex=String())
Definition HardwareCommandQueue.h:106
Dictionary< t_type, uint04 > m_pending_commands
Definition HardwareCommandQueue.h:534
const String & currentRegex() const
Definition HardwareCommandQueue.h:529
t_type currentCommand() const
Definition HardwareCommandQueue.h:527
void addCommandToFront(t_type command, const String &args=String(), const String ®ex=String())
Definition HardwareCommandQueue.h:143
Buffer< CommandRecord > m_records
Definition HardwareCommandQueue.h:536
virtual void executeCommand(const t_type &command, const String &args)=0
TimeSpan rxDelay() const
Definition HardwareCommandQueue.h:378
virtual void endCommandQueue()
Definition HardwareCommandQueue.h:362
String getCommandCSVInfo(bool only_supported, bool include_identity_info, char deliminator=',') const
Definition HardwareCommandQueue.h:470
Dictionary< t_type, CommandInformation > m_command_info
Definition HardwareCommandQueue.h:533
void clearCommands()
Definition HardwareCommandQueue.h:268
void setSupported(t_type command, bool supported)
Definition HardwareCommandQueue.h:355
Buffer< CommandQueueItem > m_ordered_commands
Definition HardwareCommandQueue.h:535
virtual void onFailure(const t_type &command)
Definition HardwareCommandQueue.h:262
void setBufferOffset(uint04 buffer_offset)
Definition HardwareCommandQueue.h:531
void setSupport(t_type command, CommandSupport support)
Definition HardwareCommandQueue.h:351
static const uint04 s_buffer_size
Definition HardwareCommandQueue.h:105
TimeSpan txDelay() const
Definition HardwareCommandQueue.h:372
const String & currentArgs() const
Definition HardwareCommandQueue.h:528
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 additional in...
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 NDEVR API.
Definition String.h:69
static TranslatedString DisplayString(const t_type &value)
Converts an object into a TranslatedString. To use this function an object must have overwritten Stri...
Definition TranslatedString.h:54
Logic for reading or writing to a string or a user friendly, TranslatedString.
Definition StringStream.h:230
static void RequestSleep(const TimeSpan &interval)
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
static 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
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:170
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
CommandSupport
Describes whether a HardwareCommandQueue supports certain commands. This is usually firmware.
Definition HardwareCommandQueue.h:51
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Definition HardwareCommandQueue.h:84
t_type command
Definition HardwareCommandQueue.h:85
String regex
Definition HardwareCommandQueue.h:87
String args
Definition HardwareCommandQueue.h:86
void clear()
Definition HardwareCommandQueue.h:88
Definition HardwareCommandQueue.h:96
t_type command
Definition HardwareCommandQueue.h:99
Time start_time
Definition HardwareCommandQueue.h:97
Time end_time
Definition HardwareCommandQueue.h:98