#include <global_time_sync_slave.hpp>
Public Member Functions | |
MonotonicTime | getLastAdjustmentTime () const |
NodeID | getMasterNodeID () const |
GlobalTimeSyncSlave (INode &node) | |
bool | isActive () const |
bool | isSuppressed () const |
int | start () |
void | suppress (bool suppressed) |
Private Types | |
typedef MethodBinder< GlobalTimeSyncSlave *, void(GlobalTimeSyncSlave::*)(const ReceivedDataStructure< protocol::GlobalTimeSync > &)> | GlobalTimeSyncCallback |
enum | State { Update, Adjust } |
Private Member Functions | |
void | adjustFromMsg (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg) |
ISystemClock & | getSystemClock () const |
void | handleGlobalTimeSync (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg) |
void | processMsg (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg) |
void | updateFromMsg (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg) |
![]() | |
Noncopyable () | |
~Noncopyable () | |
Private Attributes | |
MonotonicTime | last_adjustment_ts_ |
NodeID | master_nid_ |
uint8_t | prev_iface_index_ |
TransferID | prev_tid_ |
MonotonicTime | prev_ts_mono_ |
UtcTime | prev_ts_utc_ |
enum uavcan::GlobalTimeSyncSlave::State | state_ |
Subscriber< protocol::GlobalTimeSync, GlobalTimeSyncCallback > | sub_ |
bool | suppressed_ |
Please read the specs to learn how the time synchronization works.
No more than one object of this class is allowed per node; otherwise a disaster is bound to happen.
NOTE: In order for this class to work, the platform driver must implement:
Ref. M. Gergeleit, H. Streich - "Implementing a Distributed High-Resolution Real-Time Clock using the CAN-Bus" http://modecs.cs.uni-salzburg.at/results/related_documents/CAN_clock.pdf
Definition at line 28 of file global_time_sync_slave.hpp.
|
private |
Definition at line 32 of file global_time_sync_slave.hpp.
|
private |
Enumerator | |
---|---|
Update | |
Adjust |
Definition at line 39 of file global_time_sync_slave.hpp.
|
inlineexplicit |
Definition at line 137 of file global_time_sync_slave.hpp.
|
inlineprivate |
Definition at line 47 of file global_time_sync_slave.hpp.
|
inline |
Last time when the local clock adjustment was performed.
Definition at line 193 of file global_time_sync_slave.hpp.
|
inline |
Node ID of the master the slave is currently locked on. Returns an invalid Node ID if there's no active master.
Definition at line 188 of file global_time_sync_slave.hpp.
|
inlineprivate |
Definition at line 45 of file global_time_sync_slave.hpp.
|
inlineprivate |
Definition at line 124 of file global_time_sync_slave.hpp.
|
inline |
If the clock sync slave sees any clock sync masters in the network, it is ACTIVE. When the last master times out (PUBLISHER_TIMEOUT), the slave will be INACTIVE. Note that immediately after start up the slave will be INACTIVE until it finds a master. Please read the specs to learn more.
Definition at line 177 of file global_time_sync_slave.hpp.
|
inline |
Definition at line 169 of file global_time_sync_slave.hpp.
|
inlineprivate |
Definition at line 77 of file global_time_sync_slave.hpp.
|
inline |
Starts the time sync slave. Once started, it works on its own and does not require any attention from the application, other than to handle a clock adjustment request occasionally. Returns negative error code.
Definition at line 149 of file global_time_sync_slave.hpp.
|
inline |
Enable or disable the suppressed mode.
In suppressed mode the slave will continue tracking time sync masters in the network, but will not perform local clock adjustments. So it's kind of a dry run - all the time sync logic works except the local clock will not receive adjustments.
Suppressed mode is useful for nodes that can act as a back-up clock sync masters - as long as the node sees a higher priority time sync master in the network, its slave will be NOT suppressed in order to sync the local clock with the global master. As soon as all other higher priority masters go down, the local node will suppress its time sync slave instance and become a new master.
Suppressed mode is disabled by default.
Definition at line 168 of file global_time_sync_slave.hpp.
|
inlineprivate |
Definition at line 64 of file global_time_sync_slave.hpp.
|
private |
Definition at line 38 of file global_time_sync_slave.hpp.
|
private |
Definition at line 40 of file global_time_sync_slave.hpp.
|
private |
Definition at line 42 of file global_time_sync_slave.hpp.
|
private |
Definition at line 41 of file global_time_sync_slave.hpp.
|
private |
Definition at line 37 of file global_time_sync_slave.hpp.
|
private |
Definition at line 36 of file global_time_sync_slave.hpp.
|
private |
|
private |
Definition at line 34 of file global_time_sync_slave.hpp.
|
private |
Definition at line 43 of file global_time_sync_slave.hpp.