142{
143 int count = 0;
145
146 while (stream)
147 {
149 stream.read((char*) &header, sizeof(header));
150
151 if (stream.gcount() != sizeof(header))
152 {
153 return;
154 }
155
156 std::cout << "Counter: " << ++count << '\n';
158
159 assert(header.FrameLength - sizeof(header) >= 0 && "Wrong frame length.");
160
161 std::size_t const payload_size = header.FrameLength - sizeof(header);
162
163 if (payload.capacity() < payload_size)
164 {
165 payload.resize(payload_size);
166 }
167
168 stream.read((char*) payload.data(), payload_size);
169
170 if (static_cast<std::size_t>(stream.gcount()) != payload_size)
171 {
172 return;
173 }
174
175 if (header.DataType ==
ttdc) {
177 }
else if (header.DataType ==
taes) {
179 } else {
180 std::cout << "Unknown data type\n";
181 }
182
184 }
185}
static const unsigned int taes
void print_acoustic_data(const char *const buffer, ssize_t buffer_size)
static const unsigned int ttdc
void print_optical_data(const char *const buffer, ssize_t buffer_size)