Vanetza
 
Loading...
Searching...
No Matches
position_updater.hpp
1#ifndef POSITION_UPDATER_HPP_KMWXTJRO
2#define POSITION_UPDATER_HPP_KMWXTJRO
3
4#include <vanetza/common/clock.hpp>
5#include <vanetza/units/frequency.hpp>
6
7namespace vanetza
8{
9
10// forward declarations
11class Runtime;
12class PositionProvider;
13namespace geonet { class Router; }
14
15namespace geonet
16{
17
18/**
19 * PositionUpdater helps updating a Router's position vector periodically
20 */
22{
23public:
24 /**
25 * Create PositionUpdater scheduling position updates read from position provider
26 * \note the default update rate is derived from router's MIB.
27 * \param runtime where updater schedules its callback
28 * \param pos position updates are read from this source
29 * \param router position sink
30 */
31 PositionUpdater(Runtime& runtime, PositionProvider& pos, Router& router);
33
34 /**
35 * Change rate at which update is looking up new positions
36 * \note MIB setting is not affected
37 * \note an update interval smaller than zero disables updates
38 * \param interval update interval
39 */
40 void update_rate(Clock::duration interval);
41 void update_rate(units::Frequency);
42
43private:
44 void schedule();
45
46 Runtime& m_runtime;
47 PositionProvider& m_positioning;
48 Router& m_router;
49 Clock::duration m_interval;
50};
51
52} // namespace geonet
53} // namespace vanetza
54
55#endif /* POSITION_UPDATER_HPP_KMWXTJRO */
56
void update_rate(Clock::duration interval)