Vanetza
 
Loading...
Searching...
No Matches
limeric_budget.hpp
1#ifndef LIMERIC_BUDGET_HPP_RQYL16AG
2#define LIMERIC_BUDGET_HPP_RQYL16AG
3
4#include <vanetza/common/clock.hpp>
5
6namespace vanetza
7{
8
9// forward declaration
10class Runtime;
11
12namespace dcc
13{
14
15// forward declaration
16class DutyCyclePermit;
17
18/**
19 * LimericBudget models Annex B of TS 102 687 v1.2.1, i.e.
20 * packet handling to meet the channel occupancy limit
21 */
23{
24public:
26
27 /**
28 * Get delay until next transmission is allowed
29 * \return remaining transmission delay
30 */
31 Clock::duration delay();
32
33 /**
34 * Get current interval between transmissions
35 * \return transmission interval
36 */
37 Clock::duration interval();
38
39 /**
40 * Notify budget about transmission activity
41 * \param tx_on over-the-air duration of transmission
42 */
43 void notify(Clock::duration tx_on);
44
45 /**
46 * Recalculate current transmission interval.
47 *
48 * Transmission interval is derived from Limeric's current permitted duty cycle.
49 * Hence, this method should be called whenever Limeric changes its duty cycle.
50 */
51 void update();
52
53private:
54 Clock::duration clamp_interval(Clock::duration) const;
55
56 const DutyCyclePermit& m_duty_cycle_permit;
57 const Runtime& m_runtime;
58 Clock::duration m_interval;
59 Clock::time_point m_tx_start;
60 Clock::duration m_tx_on;
61};
62
63} // namespace dcc
64} // namespace vanetza
65
66#endif /* LIMERIC_BUDGET_HPP_RQYL16AG */
67
void notify(Clock::duration tx_on)