obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
77 lines
1.8 KiB
C++
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
|