Developer Application Interface (ARC API) v4.5.8
ARC, Inc. GenIV Application Interface
CArcStatusPacket.h
1// +------------------------------------------------------------------------------------------------------------------+
2// | FILE: CArcStatusPacket.h ( GenIV ) |
3// +------------------------------------------------------------------------------------------------------------------+
4// | PURPOSE: This file defines the ARC status packet class. |
5// | |
6// | AUTHOR: Scott Streit DATE: Feb 23, 2018 |
7// | |
8// | Copyright 2014 Astronomical Research Cameras, Inc. All rights reserved. |
9// +------------------------------------------------------------------------------------------------------------------+
12#pragma once
13
14#include <execution>
15
16#include <CArcPacket.h>
17#include <ArcErrorDefs.h>
18#include <ArcCommandDefs.h>
19#include <CArcDeviceDllMain.h>
20
21
22
23namespace arc
24{
25 namespace gen4
26 {
27
31 class GEN4_CARCDEVICE_API CArcStatusPacket : public CArcPacket
32 {
33 public:
34
35 /* Constructor
36 */
37 CArcStatusPacket( void ) = default;
38
39 /* Destructor
40 */
41 virtual ~CArcStatusPacket( void ) = default;
42
49 void assign( std::uint8_t* pData, const std::uint32_t uiSize );
50
54 bool headerValid( void ) const noexcept override;
55
59 constexpr std::uint32_t command( void ) noexcept
60 {
61 return *m_pPayload;
62 }
63
69 std::uint32_t value( const std::uint32_t uiIndex = 0 ) const;
70
75 const std::uint32_t* valueData( void );
76
81 std::uint8_t valueCount( void );
82
87 bool compare( const std::uint32_t uiValue = static_cast<std::uint32_t>( cmds_e::DONE ) ) noexcept;
88
93 template<typename... Args> std::enable_if_t<std::conjunction_v<std::is_same<std::uint32_t, Args>...>, bool> compare( Args... args )
94 {
95 std::array tArgsArray { args... };
96
97 return std::any_of( std::execution::par, tArgsArray.cbegin(), tArgsArray.cend(), [ this ]( auto uiArg ) { return ( uiArg == this->value() ); } );
98 }
99
103 bool success( void ) noexcept;
104
108 bool containsError( void ) noexcept;
109
113 errorCodes_e errorCode( void ) noexcept;
114
119 const std::string errorCodeDescription( void );
120
127 const std::string getName( void ) const override;
128
130 static constexpr std::uint32_t STATUS_START_INDEX = 1;
131
132 protected:
133
134 /* The packet payload id */
135 static constexpr std::uint8_t PAYLOAD_ID = 0xAF;
136 };
137
138
139 } // end gen4 namespace
140} // end arc namespace
void assign(std::uint8_t *pData, const std::uint32_t uiSize)
CArcStatusPacket(void)=default
std::uint32_t value(const std::uint32_t uiIndex=0) const
errorCodes_e errorCode(void) noexcept
virtual ~CArcStatusPacket(void)=default
const std::uint32_t * valueData(void)
const std::string getName(void) const override
const std::string errorCodeDescription(void)
bool headerValid(void) const noexcept override
std::uint8_t valueCount(void)
bool containsError(void) noexcept
std::enable_if_t< std::conjunction_v< std::is_same< std::uint32_t, Args >... >, bool > compare(Args... args)
bool compare(const std::uint32_t uiValue=static_cast< std::uint32_t >(cmds_e::DONE)) noexcept
constexpr std::uint32_t command(void) noexcept
bool success(void) noexcept
Definition: CArcBase.h:50