Developer Application Interface (ARC API) v4.5.8
ARC, Inc. GenIV Application Interface
arc::gen4::CArcCommandPacket Class Reference

#include <CArcCommandPacket.h>

Inheritance diagram for arc::gen4::CArcCommandPacket:
arc::gen4::CArcPacket arc::gen4::CArcBase arc::gen4::CArcDLoadPacket

Public Member Functions

 CArcCommandPacket (const std::uint8_t uiId=0)
 
 CArcCommandPacket (const arc::gen4::cmds_e tCmd, const std::uint8_t uiId=0)
 
 CArcCommandPacket (const std::uint32_t uiCmd, const std::uint8_t uiId=0)
 
 CArcCommandPacket (const std::vector< std::uint32_t > &vCmdList, const std::uint8_t uiId=0)
 
 CArcCommandPacket (const std::vector< std::any > &vCmdList, const std::uint8_t uiId=0)
 
 CArcCommandPacket (const arc::gen4::CArcCommandPacket &tObject)=delete
 
CArcCommandPacketoperator= (const arc::gen4::CArcCommandPacket &tObject)=delete
 
 CArcCommandPacket (arc::gen4::CArcCommandPacket &&tObject) noexcept=delete
 
CArcCommandPacketoperator= (arc::gen4::CArcCommandPacket &&tObject) noexcept=delete
 
virtual ~CArcCommandPacket (void)=default
 
bool headerValid (void) const noexcept override
 
const std::string getName (void) const override
 
bool isStartId (void) const noexcept
 
std::uint32_t command (void) const noexcept
 
std::uint8_t getDestination (void) const noexcept
 
template<uint32Type... Args>
void add (const Args... args)
 
- Public Member Functions inherited from arc::gen4::CArcPacket
virtual ~CArcPacket (void)=default
 
constexpr std::uint32_t headerLength (void) const noexcept
 
constexpr std::uint32_t headerByteLength (void) const noexcept
 
std::uint8_t packetId (void) const
 
bool checkPacketId (std::uint32_t uiHeader, std::uint8_t uiPacketId) const noexcept
 
std::uint8_t payloadId (void) const
 
std::uint8_t payloadLength (void) const
 
std::uint32_t payloadByteLength (void) const
 
std::uint32_t * payload (void) const noexcept
 
void add (const std::uint32_t uiValue)
 
std::uint32_t length (void) const noexcept
 
std::uint32_t byteLength (void) const noexcept
 
std::uint32_t maxByteLength (void) const noexcept
 
std::uint32_t maxLength (void) const noexcept
 
std::uint32_t at (const std::uint32_t uiIndex) const
 
std::uint32_t & operator[] (const std::uint32_t uiIndex)
 
std::uint8_t * data (void) const noexcept
 
virtual const std::string toString (void) const
 
virtual const std::string toLogString (void) const
 
- Public Member Functions inherited from arc::gen4::CArcBase
virtual ~CArcBase (void)
 

Static Protected Member Functions

static std::uint8_t getNextId (void)
 

Protected Attributes

std::uint32_t * m_pCommand
 
std::uint32_t * m_pArgs
 
- Protected Attributes inherited from arc::gen4::CArcPacket
packetHeader_tm_pHeader
 
std::uint32_t * m_pPayload
 
std::unique_ptr< std::uint8_t[]> m_pData
 
std::uint32_t m_uiSize
 

Static Protected Attributes

static constexpr std::uint8_t PAYLOAD_ID = 0xAC
 
static const std::uint8_t MAX_ID = 255
 
static std::uint8_t m_uiId
 
- Static Protected Attributes inherited from arc::gen4::CArcPacket
static constexpr auto MAX_PACKET_SIZE = static_cast< std::uint32_t >( 1024 )
 
- Static Protected Attributes inherited from arc::gen4::CArcBase
static const std::string m_sVersion
 

Additional Inherited Members

- Static Public Member Functions inherited from arc::gen4::CArcBase
static const std::string version (void)
 
static void zeroMemory (void *pDest, std::size_t uiSize)
 
static void copyMemory (void *pDest, void *pSrc, std::size_t uiSize)
 
template<typename T >
static std::tuple< T *, T * > copyAndIncrement (void *pDest, void *pSrc, const std::size_t uiSize)
 
template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string getSystemErrorMessage (ErrCode iErrCode)
 
static const std::string getSystemErrorMessage (void)
 
static std::uint32_t getSystemError (void) noexcept
 
static pStringList_t splitString (const std::string &sString, const char &zDelim=' ')
 
static std::string formatString (const char *pszFmt,...)
 
static const std::filesystem::path incrementFileName (const std::filesystem::path &tFilePath="", const std::int32_t iStartValue=-1)
 
static std::string convertWideToAnsi (const wchar_t wzString[]) noexcept
 
static std::string convertWideToAnsi (const std::wstring &wsString)
 
static std::wstring convertAnsiToWide (const char *pszString)
 
static std::string cmdToString (const std::uint32_t uiCmd)
 
template<typename T >
static std::string iterToString (T *begin, T *end, const char zSeperator=' ')
 
static std::string setDots (const std::string &sText, const std::size_t uiMaxLength, const char szDot='.')
 
static std::string trim (const std::string &sText) noexcept
 
static const std::chrono::time_point< std::chrono::high_resolution_clock > startCodeTime (void) noexcept
 
template<typename T >
static constexpr auto endCodeTime (const std::chrono::time_point< std::chrono::high_resolution_clock > tStartTimePoint) noexcept
 
- Protected Member Functions inherited from arc::gen4::CArcPacket
 CArcPacket (const std::uint32_t uiSize=MAX_PACKET_SIZE)
 
void incrementLength (const std::uint8_t uiIncr=1) noexcept
 
- Protected Member Functions inherited from arc::gen4::CArcBase
 CArcBase (void)=default
 
 CArcBase (const CArcBase &)=delete
 
 CArcBase (CArcBase &&)=delete
 
CArcBaseoperator= (const CArcBase &)=delete
 
CArcBaseoperator= (CArcBase &&)=delete
 

Detailed Description

ARC GenIV command packet class. Controller commands are sent using this packet type.

Definition at line 39 of file CArcCommandPacket.h.

Constructor & Destructor Documentation

◆ CArcCommandPacket() [1/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( const std::uint8_t  uiId = 0)

Constructor

Parameters
uiId- The packet id. A value of zero results in auto id generation ( default = 0 ).

◆ CArcCommandPacket() [2/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( const arc::gen4::cmds_e  tCmd,
const std::uint8_t  uiId = 0 
)

Creates a new command packet using the specified command value and auto generated packet id.

Parameters
tCmd- A valid command from the arc::gen4::cmds_e enumeration.
uiId- The packet id. A value of zero results in auto id generation ( default = 0 ).

◆ CArcCommandPacket() [3/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( const std::uint32_t  uiCmd,
const std::uint8_t  uiId = 0 
)

Creates a new command packet using the specified command value and an auto generated packet id.

Parameters
uiCmd- A valid command value.
uiId- The packet id. A value of zero results in auto id generation ( default = 0 ).

◆ CArcCommandPacket() [4/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( const std::vector< std::uint32_t > &  vCmdList,
const std::uint8_t  uiId = 0 
)

Creates a new command packet using the specified command list and auto generated packet id.

Parameters
vCmdList- The command list. See std::vector for details.
uiId- The packet id. A value of zero results in auto id generation ( default = 0 ).

◆ CArcCommandPacket() [5/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( const std::vector< std::any > &  vCmdList,
const std::uint8_t  uiId = 0 
)

Creates a new command packet using the specified command list and auto generated packet id.

Parameters
vCmdList- The command list. See std::vector for details. The first argument must be of type arc::gen4::cmds_e. All remaining arguments must be of type unsigned int. Format is command, arg0, arg1, ...
uiId- The packet id. A value of zero results in auto id generation ( default = 0 ).

◆ CArcCommandPacket() [6/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( const arc::gen4::CArcCommandPacket tObject)
delete

Copy constructor. Removed since each command has a unique id and should not be copied.

Parameters
tObject- A arc::gen4::CArcCommandPacket instance to copy.

◆ CArcCommandPacket() [7/7]

arc::gen4::CArcCommandPacket::CArcCommandPacket ( arc::gen4::CArcCommandPacket &&  tObject)
deletenoexcept

Move constructor. Removed since each command has a unique id and should not be copied.

Parameters
tObject- A arc::gen4::CArcCommandPacket instance to move.

◆ ~CArcCommandPacket()

virtual arc::gen4::CArcCommandPacket::~CArcCommandPacket ( void  )
virtualdefault

Destructor

Member Function Documentation

◆ operator=() [1/2]

CArcCommandPacket & arc::gen4::CArcCommandPacket::operator= ( const arc::gen4::CArcCommandPacket tObject)
delete

Copy assignment constructor. Removed since each command has a unique id and should not be copied.

Parameters
tObject- A arc::gen4::CArcCommandPacket instance to copy.

◆ operator=() [2/2]

CArcCommandPacket & arc::gen4::CArcCommandPacket::operator= ( arc::gen4::CArcCommandPacket &&  tObject)
deletenoexcept

Move assignment constructor. Removed since each command has a unique id and should not be copied.

Parameters
tObject- A arc::gen4::CArcCommandPacket instance to move.

◆ headerValid()

bool arc::gen4::CArcCommandPacket::headerValid ( void  ) const
overridevirtualnoexcept

Returns whether or not the header contains valid values.

Returns
Returns true if the header contains valid values.

Implements arc::gen4::CArcPacket.

Reimplemented in arc::gen4::CArcDLoadPacket.

◆ getName()

const std::string arc::gen4::CArcCommandPacket::getName ( void  ) const
overridevirtual

Returns the packet name.

Returns
The packet name.
Exceptions
Anyexception thrown by std::string

Implements arc::gen4::CArcPacket.

Reimplemented in arc::gen4::CArcDLoadPacket.

◆ isStartId()

bool arc::gen4::CArcCommandPacket::isStartId ( void  ) const
noexcept

Returns whether or not the packet ID matches the initial start ID.

Returns
true if the packet ID matches the initial start ID; false otherwise.

◆ command()

std::uint32_t arc::gen4::CArcCommandPacket::command ( void  ) const
noexcept

Returns the command code

Returns
The command code

◆ getDestination()

std::uint8_t arc::gen4::CArcCommandPacket::getDestination ( void  ) const
noexcept

Returns the command destination

Returns
The command destination, which is defined as follows: 0 : NXP 8 : ARC-440 broadcast 1-14 : ARC-440 board id 15 : FPGA

◆ add()

template<uint32Type... Args>
void arc::gen4::CArcCommandPacket::add ( const Args...  args)
inline

Adds all the values (in order) to the end of the current payload.

Parameters
uiCmdList- One or more values to append to the current payload. All values must be of type std::uint32_t.
Exceptions
std::out_of_rangeexception if insertion goes beyond the maximum length of the packet.

Definition at line 133 of file CArcCommandPacket.h.

◆ getNextId()

static std::uint8_t arc::gen4::CArcCommandPacket::getNextId ( void  )
staticprotected

Increments and returns the next unique packet identifier, which is used to uniquely idenfity command packets.

Returns
The next unique packet identifier.

Member Data Documentation

◆ PAYLOAD_ID

constexpr std::uint8_t arc::gen4::CArcCommandPacket::PAYLOAD_ID = 0xAC
staticconstexprprotected

Payload identifier

Definition at line 146 of file CArcCommandPacket.h.

◆ MAX_ID

const std::uint8_t arc::gen4::CArcCommandPacket::MAX_ID = 255
staticprotected

Maximum packet ID value

Definition at line 154 of file CArcCommandPacket.h.

◆ m_uiId

std::uint8_t arc::gen4::CArcCommandPacket::m_uiId
staticprotected

Unique packet identifier

Definition at line 157 of file CArcCommandPacket.h.

◆ m_pCommand

std::uint32_t* arc::gen4::CArcCommandPacket::m_pCommand
protected

Definition at line 159 of file CArcCommandPacket.h.

◆ m_pArgs

std::uint32_t* arc::gen4::CArcCommandPacket::m_pArgs
protected

Definition at line 161 of file CArcCommandPacket.h.