SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
remotedatablock.h
Go to the documentation of this file.
1 // Copyright (C) 2018 Edouard Griffiths, F4EXB. //
3 // //
4 // Remote sink channel (Rx) data block //
5 // //
6 // SDRangel can serve as a remote SDR front end that handles the interface //
7 // with a physical device and sends or receives the I/Q samples stream via UDP //
8 // to or from another SDRangel instance or any program implementing the same //
9 // protocol. The remote SDRangel is controlled via its Web REST API. //
10 // //
11 // This program is free software; you can redistribute it and/or modify //
12 // it under the terms of the GNU General Public License as published by //
13 // the Free Software Foundation as version 3 of the License, or //
14 // (at your option) any later version. //
15 // //
16 // This program is distributed in the hope that it will be useful, //
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
19 // GNU General Public License V3 for more details. //
20 // //
21 // You should have received a copy of the GNU General Public License //
22 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
24 
25 #ifndef CHANNEL_REMOTEDATABLOCK_H_
26 #define CHANNEL_REMOTEDATABLOCK_H_
27 
28 #include <stdint.h>
29 #include <string.h>
30 #include <algorithm>
31 #include <QString>
32 #include "dsp/dsptypes.h"
33 
34 #define UDPSINKFEC_UDPSIZE 512
35 #define UDPSINKFEC_NBORIGINALBLOCKS 128
36 //#define UDPSINKFEC_NBTXBLOCKS 8
37 
38 #pragma pack(push, 1)
40 {
47 
51 
52  bool operator==(const RemoteMetaDataFEC& rhs)
53  {
54  // Only the first 6 fields are relevant
55  return (m_centerFrequency == rhs.m_centerFrequency)
56  && (m_sampleRate == rhs.m_sampleRate)
57  && (m_sampleBytes == rhs.m_sampleBytes)
58  && (m_sampleBits == rhs.m_sampleBits)
59  && (m_nbOriginalBlocks == rhs.m_nbOriginalBlocks)
60  && (m_nbFECBlocks == rhs.m_nbFECBlocks);
61  }
62 
63  void init()
64  {
65  m_centerFrequency = 0;
66  m_sampleRate = 0;
67  m_sampleBytes = 0;
68  m_sampleBits = 0;
69  m_nbOriginalBlocks = 0;
70  m_nbFECBlocks = 0;
71  m_tv_sec = 0;
72  m_tv_usec = 0;
73  m_crc32 = 0;
74  }
75 };
76 
78 {
85 
86  void init()
87  {
88  m_frameIndex = 0;
89  m_blockIndex = 0;
90  m_sampleBytes = 2;
91  m_sampleBits = 16;
92  m_filler = 0;
93  m_filler2 = 0;
94  }
95 };
96 
97 static const int RemoteUdpSize = UDPSINKFEC_UDPSIZE;
98 static const int RemoteNbOrginalBlocks = UDPSINKFEC_NBORIGINALBLOCKS;
99 static const int RemoteNbBytesPerBlock = UDPSINKFEC_UDPSIZE - sizeof(RemoteHeader);
100 
102 {
103  uint8_t buf[RemoteNbBytesPerBlock];
104 
105  void init() {
106  std::fill(buf, buf+RemoteNbBytesPerBlock, 0);
107  }
108 };
109 
111 {
114 
115  void init()
116  {
117  m_header.init();
118  m_protectedBlock.init();
119  }
120 };
121 #pragma pack(pop)
122 
124 {
130  QString m_dataAddress;
132 
134  m_complete = false;
135  m_processed = false;
136  m_frameIndex = 0;
137  m_nbBlocksFEC = 0;
138  m_txDelay = 100;
139  m_dataAddress = "127.0.0.1";
140  m_dataPort = 9090;
141  }
142 };
143 
145 {
151 
153  m_blockCount = 0;
154  m_originalCount = 0;
155  m_recoveryCount = 0;
156  m_metaRetrieved = false;
157  m_frameIndex = -1;
158  }
159 };
160 
162 {
163 public:
165  m_superBlocks = new RemoteSuperBlock[256];
166  }
168  delete[] m_superBlocks;
169  }
173 };
174 
175 #endif /* CHANNEL_REMOTEDATABLOCK_H_ */
uint32_t m_sampleRate
12 sample rate in Hz
RemoteSuperBlock * m_superBlocks
#define UDPSINKFEC_UDPSIZE
RemoteProtectedBlock m_protectedBlock
uint8_t m_filler
int m_recoveryCount
number of recovery blocks received
unsigned int uint32_t
Definition: rtptypes_win.h:46
#define UDPSINKFEC_NBORIGINALBLOCKS
uint8_t m_sampleBytes
13 4 LSB: number of bytes per sample (2 or 4)
unsigned char uint8_t
Definition: rtptypes_win.h:42
RemoteRxControlBlock m_rxControlBlock
int m_originalCount
number of original blocks received
unsigned short uint16_t
Definition: rtptypes_win.h:44
uint32_t m_crc32
28 CRC32 of the above
uint8_t m_sampleBytes
number of bytes per sample (2 or 4) for this block
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
uint32_t m_tv_usec
24 microseconds of timestamp at start time of super-frame processing
uint8_t m_blockIndex
uint8_t m_sampleBits
14 number of effective bits per sample (deprecated)
uint32_t m_tv_sec
20 seconds of timestamp at start time of super-frame processing
RemoteTxControlBlock m_txControlBlock
uint16_t m_filler2
RemoteHeader m_header
uint16_t m_frameIndex
uint8_t m_nbOriginalBlocks
15 number of blocks with original (protected) data
bool operator==(const RemoteMetaDataFEC &rhs)
int m_frameIndex
this frame index or -1 if unset
uint64_t m_centerFrequency
8 center frequency in kHz
uint8_t m_sampleBits
number of bits per sample
int m_blockCount
number of blocks received for this frame
bool m_metaRetrieved
true if meta data (block zero) was retrieved
unsigned __int64 uint64_t
Definition: rtptypes_win.h:48