libcyberradio 22.01.24
Vita49Packet.h
1/* -*- c++ -*- */
2/***************************************************************************
3 * \file Vita49Packet.h
4 *
5 * \brief VITA 49 packet decoder.
6 *
7 * \author DA
8 * \copyright 2015 CyberRadio Solutions, Inc.
9 */
10
11#ifndef INCLUDED_LIBCYBERRADIO_VITA49PACKET_H
12#define INCLUDED_LIBCYBERRADIO_VITA49PACKET_H
13
14#include <stddef.h>
15#include <stdint.h>
16#include <string>
17
18
22namespace LibCyberRadio
23{
38 {
39 public:
59 Vita49Packet(int vitaType,
60 size_t payloadSize,
61 size_t vitaHeaderSize,
62 size_t vitaTailSize,
63 bool byteSwapped,
64 bool iqSwapped,
65 unsigned char* rawData = NULL,
66 size_t rawDataLen = 0);
70 virtual ~Vita49Packet();
76 Vita49Packet(const Vita49Packet& src);
82 virtual Vita49Packet& operator=(const Vita49Packet& src);
88 bool isVita49() const;
96 int16_t getSampleI(int sample);
104 int16_t getSampleQ(int sample);
110 std::string rawDataHex() { return rawDataBufferHex(_rawData, _totalPacketSize); };
116 std::string dump();
117
118 public:
119 // Packet structure configuration parameters
120 int vitaType;
121 size_t payloadSize;
122 size_t vitaHeaderSize;
123 size_t vitaTailSize;
124 bool byteSwapped;
125 bool iqSwapped;
126 // Decoded from packet structure
127 int samples;
128 uint32_t frameAlignmentWord;
129 int frameCount;
130 int frameSize;
131 int packetType;
132 int hasClassId;
133 int hasTrailer;
134 int timestampIntType;
135 int timestampFracType;
136 int packetCount;
137 int packetSize;
138 uint32_t streamId;
139 int organizationallyUniqueId;
140 int informationClassCode;
141 int packetClassCode;
142 uint32_t timestampInt;
143 uint64_t timestampFrac;
144 uint32_t frameTrailerWord;
145 int16_t* sampleData;
146
147 int source;
148 int tunerBw;
149 int atten;
150 int tunedFreq;
151 int32_t ddcFreqOffset;
152 int filter;
153 int delayTime;
154 int demod;
155 int ovs;
156 int agcGain;
157 int validDataCount;
158
159 protected:
160 uint32_t rawDataWord(int index);
161 std::string rawDataBufferHex(unsigned char* buf, int length);
162 void byteswapRawData(void);
163
164 protected:
165 // Raw data buffer
166 uint8_t* _rawData;
167 // Calculated quantities
168 size_t _totalPacketSize;
169 };
170
171} /* namespace LibCyberRadio */
172
173#endif /* INCLUDED_LIBCYBERRADIO_VITA49PACKET_H */
bool isVita49() const
Indicates whether the packet data is in VITA 49 format.
virtual ~Vita49Packet()
Destroys a Vita49Packet object.
std::string dump()
Gets a string dump of the contents of the data packet.
Vita49Packet(int vitaType, size_t payloadSize, size_t vitaHeaderSize, size_t vitaTailSize, bool byteSwapped, bool iqSwapped, unsigned char *rawData=NULL, size_t rawDataLen=0)
Constructs a Vita49Packet object.
int16_t getSampleQ(int sample)
Gets the Q component of a given data sample.
int16_t getSampleI(int sample)
Gets the I component of a given data sample.
virtual Vita49Packet & operator=(const Vita49Packet &src)
Assignment operator.
std::string rawDataHex()
Gets the raw data in hex-string format.
Defines functionality for LibCyberRadio applications.
Definition App.h:24