Keep the colleague's microbu-esp32c5 tree in this repository
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).
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
#ifndef MANUAL_RUNTIME_HPP_IPFSK6ZA
|
||||
#define MANUAL_RUNTIME_HPP_IPFSK6ZA
|
||||
|
||||
#include <vanetza/common/runtime.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
|
||||
/**
|
||||
* ManualRuntime is a manually triggered Runtime implementation.
|
||||
* Ensure that time progress is triggered monotonically!
|
||||
*/
|
||||
class ManualRuntime : public Runtime
|
||||
{
|
||||
public:
|
||||
ManualRuntime() = default;
|
||||
|
||||
/**
|
||||
* Create runtime
|
||||
* \param init initialization value of internal clock
|
||||
*/
|
||||
explicit ManualRuntime(Clock::time_point init);
|
||||
|
||||
/**
|
||||
* Trigger absolute time progress
|
||||
*
|
||||
* All expired callbacks will be invoked
|
||||
* \param tp new time point, has to be greater than now
|
||||
*/
|
||||
void trigger(Clock::time_point tp);
|
||||
|
||||
/**
|
||||
* Trigger relative time progress
|
||||
*
|
||||
* All expired callbacks will be invoked
|
||||
* \param d advance time by this duration
|
||||
*/
|
||||
void trigger(Clock::duration d);
|
||||
|
||||
/**
|
||||
* Reset runtime
|
||||
*
|
||||
* Drops all scheduled callbacks and resets internal clock
|
||||
* \param tp new time point
|
||||
*/
|
||||
void reset(Clock::time_point tp);
|
||||
|
||||
/**
|
||||
* Get time point of next scheduled event
|
||||
* \note time point might belong to an expired event, i.e. next() < now()
|
||||
* \return time point of next event or time_point::max if none
|
||||
*/
|
||||
Clock::time_point next() const;
|
||||
|
||||
// Runtime interface (see header there for details)
|
||||
void schedule(Clock::time_point, const Callback&, const void* = nullptr) override;
|
||||
void schedule(Clock::duration, const Callback&, const void* = nullptr) override;
|
||||
void cancel(const void* scope) override;
|
||||
Clock::time_point now() const override;
|
||||
|
||||
private:
|
||||
struct ScheduledCallback
|
||||
{
|
||||
ScheduledCallback(Clock::time_point tp, const Callback& cb, const void* scope) :
|
||||
deadline(tp), callback(cb), scope(scope) {}
|
||||
|
||||
ScheduledCallback(const ScheduledCallback&) = delete;
|
||||
ScheduledCallback& operator=(const ScheduledCallback&) = delete;
|
||||
|
||||
ScheduledCallback(ScheduledCallback&&) = default;
|
||||
ScheduledCallback& operator=(ScheduledCallback&&) = default;
|
||||
|
||||
Clock::time_point deadline;
|
||||
Callback callback;
|
||||
const void* scope;
|
||||
};
|
||||
|
||||
struct by_deadline {};
|
||||
using time_index = boost::multi_index::ordered_non_unique<
|
||||
boost::multi_index::tag<by_deadline>,
|
||||
boost::multi_index::member<ScheduledCallback, Clock::time_point, &ScheduledCallback::deadline>>;
|
||||
struct by_scope {};
|
||||
using scope_index = boost::multi_index::hashed_non_unique<
|
||||
boost::multi_index::tag<by_scope>,
|
||||
boost::multi_index::member<ScheduledCallback, const void*, &ScheduledCallback::scope>>;
|
||||
using queue_type = boost::multi_index_container<ScheduledCallback,
|
||||
boost::multi_index::indexed_by<time_index, scope_index>>;
|
||||
|
||||
void trigger();
|
||||
|
||||
Clock::time_point m_now;
|
||||
queue_type m_queue;
|
||||
};
|
||||
|
||||
} // namespace vanetza
|
||||
|
||||
#endif /* MANUAL_RUNTIME_HPP_IPFSK6ZA */
|
||||
|
||||
Reference in New Issue
Block a user