Vanetza
 
Loading...
Searching...
No Matches
dcc_mco_field.hpp
1#ifndef DCC_MCO_FIELD_HPP_RLZ4PQMF
2#define DCC_MCO_FIELD_HPP_RLZ4PQMF
3
4#include <vanetza/common/bit_number.hpp>
5#include <vanetza/dcc/channel_load.hpp>
6#include <cstdint>
7
8namespace vanetza
9{
10namespace geonet
11{
12
13/**
14 * DCC-MCO (Multi Channel Operations) is specified in TS 102 636-4-2 V1.1.1
15 * DccMcoField implements the SHB header field extension.
16 */
18{
19public:
21
23
24 // copy operations
25 DccMcoField(const DccMcoField&) = default;
26 DccMcoField& operator=(const DccMcoField&) = default;
27
28 // conversion from/to 4 bytes (host byte order)
29 explicit DccMcoField(uint32_t);
30 DccMcoField& operator=(uint32_t);
31 explicit operator uint32_t() const;
32
33 void local_cbr(const ChannelLoad&);
34 ChannelLoad local_cbr() const;
35
36 void neighbour_cbr(const ChannelLoad&);
37 ChannelLoad neighbour_cbr() const;
38
39 /**
40 * Output power of packet transmission
41 * \return [0; 31] dBm (values are cramped at limits)
42 */
43 void output_power(unsigned dbm);
44 unsigned output_power() const;
45
46private:
47 using cbr_type = uint8_t;
49
50 cbr_type m_cbr_l0_hop; /*< local CBR measurement */
51 cbr_type m_cbr_l1_hop; /*< maximum CBR measurement from 1-hop neighbours */
52 power_type m_output_power; /*< output power of packet transmission */
53};
54
55} // namespace geonet
56} // namespace vanetza
57
58#endif /* DCC_MCO_FIELD_HPP_RLZ4PQMF */
59
void output_power(unsigned dbm)