Files
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
2026-09-24 10:56:05 +02:00

77 lines
1.8 KiB
C++

#include <vanetza/common/runtime.hpp>
#include <vanetza/dcc/bursty_transmit_rate_control.hpp>
#include <vanetza/dcc/state_machine.hpp>
#include <stdexcept>
namespace vanetza
{
namespace dcc
{
BurstyTransmitRateControl::BurstyTransmitRateControl(const StateMachine& fsm, const Runtime& rt) :
m_burst_budget(rt), m_fsm_budget(fsm, rt), m_fsm(fsm)
{
}
Clock::duration BurstyTransmitRateControl::delay(const Transmission& tx)
{
Clock::duration delay = Clock::duration::max();
switch (tx.profile()) {
case Profile::DP0:
delay = m_burst_budget.delay();
break;
case Profile::DP1:
case Profile::DP2:
case Profile::DP3:
delay = m_fsm_budget.delay();
break;
default:
throw std::invalid_argument("Invalid DCC Profile");
break;
};
return delay;
}
Clock::duration BurstyTransmitRateControl::interval(const Transmission& tx)
{
Clock::duration interval = Clock::duration::max();
switch (tx.profile()) {
case Profile::DP0:
interval = m_burst_budget.burst_period();
break;
case Profile::DP1:
case Profile::DP2:
case Profile::DP3:
interval = m_fsm.transmission_interval();
break;
default:
throw std::invalid_argument("Invalid DCC Profile");
break;
}
return interval;
}
void BurstyTransmitRateControl::notify(const Transmission& tx)
{
switch (tx.profile()) {
case Profile::DP0:
m_burst_budget.notify();
break;
case Profile::DP1:
case Profile::DP2:
case Profile::DP3:
m_fsm_budget.notify();
break;
default:
throw std::invalid_argument("Invalid DCC Profile");
break;
};
}
} // namespace dcc
} // namespace vanetza