Vanetza
 
Loading...
Searching...
No Matches
data_rates.hpp
1#ifndef DATA_RATES_802DOT11P_HPP_SL3RZPZO
2#define DATA_RATES_802DOT11P_HPP_SL3RZPZO
3
4#include <cstddef>
5
6namespace vanetza
7{
8namespace access
9{
10
12{
13public:
14 /**
15 * Create data rate for ITS-G5 band
16 * \param kbps kilo-bits per second transfer rate
17 * \param cbits number of coded bits per symbol
18 */
19 constexpr DataRateG5(unsigned kbps, unsigned cbits) :
20 m_bytes_per_second(kbps * 1000 / 8),
21 m_coded_bits_per_symbol(cbits) {}
22
23 /**
24 * Get tranfer rate as number of bytes per second
25 * \return transfer rate
26 */
27 unsigned bytes_per_second() const { return m_bytes_per_second; }
28
29 /**
30 * Calculate length of PHY data length
31 * \param psdu size of PSDU, i.e. MPDU (MAC header + payload)
32 * \return length in bytes
33 */
34 std::size_t data_length(std::size_t psdu) const;
35
36private:
37 unsigned m_bytes_per_second;
38 unsigned m_coded_bits_per_symbol;
39};
40
41static const DataRateG5 G5_3Mbps { 3000, 48 };
42static const DataRateG5 G5_4dot5Mbps { 4500, 48 };
43static const DataRateG5 G5_6Mbps { 6000, 96 };
44static const DataRateG5 G5_9Mbps { 9000, 96 };
45static const DataRateG5 G5_12Mbps { 12000, 192 };
46static const DataRateG5 G5_18bps { 18000, 192 };
47static const DataRateG5 G5_24Mbps { 24000, 288 };
48static const DataRateG5 G5_27Mbps { 27000, 288 };
49
50} // namespace access
51} // namespace vanetza
52
53#endif /* DATA_RATES_802DOT11P_HPP_SL3RZPZO */
54
unsigned bytes_per_second() const
Definition: data_rates.hpp:27
std::size_t data_length(std::size_t psdu) const
Definition: data_rates.cpp:9
constexpr DataRateG5(unsigned kbps, unsigned cbits)
Definition: data_rates.hpp:19