Developer Application Interface (ARC API) v4.5.8
ARC, Inc. GenIV Application Interface
CArcImagePacket.h
1 // +------------------------------------------------------------------------------------------------------------------+
2 // | FILE: CArcImagePacket.h ( GenIV ) |
3 // +------------------------------------------------------------------------------------------------------------------+
4 // | PURPOSE: This file defines the ARC image packet. |
5 // | |
6 // | AUTHOR: Scott Streit DATE: Mar 1, 2018 |
7 // | |
8 // | Copyright 2014 Astronomical Research Cameras, Inc. All rights reserved. |
9 // +------------------------------------------------------------------------------------------------------------------+
12#pragma once
13
14#include <CArcPacket.h>
15
16
17namespace arc
18{
19 namespace gen4
20 {
21
26 {
27 std::uint8_t uiPayloadId;
28 std::uint8_t uiReservedByte1;
29 std::uint8_t uiReservedByte2;
30 std::uint8_t uiPayloadLength;
31 std::uint32_t uiReserved;
33 };
34
35
41 struct imageDataHeader_t final
42 {
43 std::uint16_t uwRow;
44 std::uint16_t uwChannel;
45 std::uint16_t uwCol;
46 std::uint16_t uwPixelCount;
47 };
48
49
54 using dataSection_t = std::pair<imageDataHeader_t*, std::uint16_t*>;
55
56
57
62 class GEN4_CARCDEVICE_API CArcImagePacket final : public CArcPacket
63 {
64 public:
65
69
74
77 virtual ~CArcImagePacket( void ) = default;
78
82 virtual bool headerValid( void ) const noexcept override;
83
87 bool endOfImage( void ) const noexcept;
88
93 bool endOfImage( const imagePacketHeader_t* pHeader ) const noexcept;
94
102 void assign( std::uint8_t* pData, std::uint32_t uiSize );
103
108 void assign( void );
109
113 bool hasMoreDataSections( void ) const noexcept;
114
122
127 const std::string getName( void ) const override;
128
130 static constexpr std::uint16_t MAX_PACKET_SIZE = 1500;
131
136 friend std::ostream& operator<<( std::ostream& tStream, const arc::gen4::CArcImagePacket& rPacket );
137
142 void serialize( std::ostream& tStream );
143
148 void deserialize( std::istream& tStream );
149
150 protected:
151
153 static constexpr std::uint8_t PAYLOAD_ID = 0xAA;
154
156 static constexpr std::uint32_t EOI_RESERVED = 0x454F4949;
157
160
163
165 std::uint16_t* m_pNextDataSection;
166
168 std::uint16_t* m_pPayload;
169
171 std::uint16_t* m_pEndOfPacket;
172
175 };
176
177
182 std::ostream& operator<<( std::ostream& tStream, const arc::gen4::CArcImagePacket& rPacket );
183
184
185 } // end gen4 namespace
186} // end arc namespace
arc::gen4::dataSection_t getNextDataSection(void)
CArcImagePacket(const CArcImagePacket &rPacket)
std::uint16_t * m_pNextDataSection
bool hasMoreDataSections(void) const noexcept
imageDataHeader_t * m_pDataHeader
std::uint16_t * m_pEndOfPacket
virtual bool headerValid(void) const noexcept override
virtual ~CArcImagePacket(void)=default
friend std::ostream & operator<<(std::ostream &tStream, const arc::gen4::CArcImagePacket &rPacket)
void assign(std::uint8_t *pData, std::uint32_t uiSize)
void deserialize(std::istream &tStream)
const std::string getName(void) const override
void serialize(std::ostream &tStream)
imagePacketHeader_t * m_pHeader
bool endOfImage(void) const noexcept
bool endOfImage(const imagePacketHeader_t *pHeader) const noexcept
std::ostream & operator<<(std::ostream &tStream, const arc::gen4::CArcImagePacket &rPacket)
std::pair< imageDataHeader_t *, std::uint16_t * > dataSection_t
Definition: CArcBase.h:50