Agora  1.2.0
Agora project
file_receiver.h
Go to the documentation of this file.
1 
5 #ifndef FILE_RECEIVER_H_
6 #define FILE_RECEIVER_H_
7 
8 #include <array>
9 #include <fstream>
10 #include <ios>
11 #include <iostream>
12 #include <string>
13 
14 #include "mac_data_receiver.h"
15 
19 class FileReceiver : public MacDataReceiver {
20  public:
21  static constexpr size_t kFileStreamRxSize = (2048u);
22  static constexpr size_t kFileStreamLocalRxBufSize = (kFileStreamRxSize * 10u);
23 
24  explicit FileReceiver(std::string &file_name);
25  ~FileReceiver() override;
26 
27  size_t Load(unsigned char *destination, size_t requested_bytes) final;
28 
29  private:
30  std::string file_name_;
31  std::ifstream data_stream_;
32  std::array<uint8_t, FileReceiver::kFileStreamLocalRxBufSize> local_rx_buffer_;
33 
36 };
37 
38 #endif // FILE_RECEIVER_H_
mac_data_receiver.h
Declaration file for the MacDataReceiver interface class.
file_receiver.h
Declaration file for the FileReceiver class.
FileReceiver
The File Receiver class creates a binary file source for Agora.
Definition: file_receiver.h:19
FileReceiver::data_stream_
std::ifstream data_stream_
Definition: file_receiver.h:31
FileReceiver::kFileStreamLocalRxBufSize
static constexpr size_t kFileStreamLocalRxBufSize
Definition: file_receiver.h:22
FileReceiver::data_available_
size_t data_available_
Definition: file_receiver.h:34
u
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
FileReceiver::FileReceiver
FileReceiver(std::string &file_name)
Definition: file_receiver.cc:15
MacDataReceiver
The MacDataReceiver interface class.
Definition: mac_data_receiver.h:13
FileReceiver::~FileReceiver
~FileReceiver() override
Definition: file_receiver.cc:22
FileReceiver::Load
size_t Load(unsigned char *destination, size_t requested_bytes) final
Definition: file_receiver.cc:28
FileReceiver::file_name_
std::string file_name_
Definition: file_receiver.h:30
AGORA_LOG_INFO
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
AGORA_LOG_FRAME
#define AGORA_LOG_FRAME(...)
Definition: logger.h:72
FileReceiver::kFileStreamRxSize
static constexpr size_t kFileStreamRxSize
Definition: file_receiver.h:21
FileReceiver::local_rx_buffer_
std::array< uint8_t, FileReceiver::kFileStreamLocalRxBufSize > local_rx_buffer_
Definition: file_receiver.h:32
max
max(y1, y1_1)
kMaxReadAttempts
static constexpr size_t kMaxReadAttempts
Definition: file_receiver.cc:13
FileReceiver::data_start_offset_
size_t data_start_offset_
Definition: file_receiver.h:35