NMEA2000 Library  0.1
Library to handle NMEA 2000 Communication written in C++
tN2kSyncScheduler Class Reference

Synchronized Scheduler for timed message sending. More...

#include <N2kTimer.h>

Public Member Functions

 tN2kSyncScheduler (bool Enable=false, uint32_t _Period=0, uint32_t _Offset=0)
 Constructor for sync scheduler. More...
 
void Disable ()
 Disable Scheduler. More...
 
uint64_t GetNextTime () const
 Get the Timestamp of the NextTime. More...
 
uint32_t GetOffset () const
 Get the Offset of the Scheduler. More...
 
uint32_t GetPeriod () const
 Get the Period of the Scheduler. More...
 
bool IsDisabled () const
 Checks if Scheduler is disabled. More...
 
bool IsEnabled () const
 Checks if Scheduler is enabled. More...
 
bool IsTime ()
 Check if ít is time. More...
 
uint64_t Remaining ()
 Calculate remaining time. More...
 
void SetOffset (uint32_t _Offset)
 Set the Offset of the Scheduler. More...
 
void SetPeriod (uint32_t _Period)
 Set the Period of the Scheduler. More...
 
void SetPeriodAndOffset (uint32_t _Period, uint32_t _Offset)
 Set the Period And Offset of the Scheduler. More...
 
void UpdateNextTime ()
 Update the timestamp for NextTime. More...
 

Static Public Member Functions

static void SetSyncOffset ()
 Set the SyncOffset of the scheduler. More...
 

Protected Attributes

uint64_t NextTime
 Timestamp for next event. More...
 
uint32_t Offset
 Offset to synchronize with others. More...
 
uint32_t Period
 Period for scheduler. More...
 

Static Protected Attributes

static uint64_t SyncOffset =0
 ??? More...
 

Detailed Description

Synchronized Scheduler for timed message sending.

tN2kSyncScheduler is meant to use for timed message sending. Each messages has defined offset and period, which can be maintained by request group function. tN2kSyncScheduler uses 64 bit millisecond time to prevent it ever roll over. Offset synchronizes with other schedulers.

Definition at line 124 of file N2kTimer.h.

Constructor & Destructor Documentation

◆ tN2kSyncScheduler()

tN2kSyncScheduler::tN2kSyncScheduler ( bool  Enable = false,
uint32_t  _Period = 0,
uint32_t  _Offset = 0 
)
inline

Constructor for sync scheduler.

This function initializes all parameters.

Parameters
Enabledefault = false
_PeriodPeriod [ms] of the scheduler, default = 0
_OffsetOffset [ms] of the scheduler, default = 0

Definition at line 145 of file N2kTimer.h.

Member Function Documentation

◆ Disable()

void tN2kSyncScheduler::Disable ( )
inline

Disable Scheduler.

Definition at line 157 of file N2kTimer.h.

◆ GetNextTime()

uint64_t tN2kSyncScheduler::GetNextTime ( ) const
inline

Get the Timestamp of the NextTime.

Returns
uint64_t Timestamp

Definition at line 236 of file N2kTimer.h.

◆ GetOffset()

uint32_t tN2kSyncScheduler::GetOffset ( ) const
inline

Get the Offset of the Scheduler.

Returns
uint32_t Offset in [ms] of the scheduler

Definition at line 222 of file N2kTimer.h.

◆ GetPeriod()

uint32_t tN2kSyncScheduler::GetPeriod ( ) const
inline

Get the Period of the Scheduler.

Returns
uint32_t Period in [ms] of the scheduler

Definition at line 229 of file N2kTimer.h.

◆ IsDisabled()

bool tN2kSyncScheduler::IsDisabled ( ) const
inline

Checks if Scheduler is disabled.

Returns
true -> Scheduler is disabled
false

Definition at line 165 of file N2kTimer.h.

◆ IsEnabled()

bool tN2kSyncScheduler::IsEnabled ( ) const
inline

Checks if Scheduler is enabled.

Returns
true -> Scheduler is enabled
false

Definition at line 173 of file N2kTimer.h.

◆ IsTime()

bool tN2kSyncScheduler::IsTime ( )
inline

Check if ít is time.

Returns
true -> when actual timestamp is greater the NextTime
false

Definition at line 181 of file N2kTimer.h.

◆ Remaining()

uint64_t tN2kSyncScheduler::Remaining ( )
inline

Calculate remaining time.

Returns
uint64_t Remaining time till NextTime

Definition at line 188 of file N2kTimer.h.

◆ SetOffset()

void tN2kSyncScheduler::SetOffset ( uint32_t  _Offset)
inline

Set the Offset of the Scheduler.

Parameters
_OffsetOffset in [ms] of the Scheduler

Definition at line 202 of file N2kTimer.h.

◆ SetPeriod()

void tN2kSyncScheduler::SetPeriod ( uint32_t  _Period)
inline

Set the Period of the Scheduler.

Parameters
_PeriodPeriod in [ms] of the Scheduler

Definition at line 195 of file N2kTimer.h.

◆ SetPeriodAndOffset()

void tN2kSyncScheduler::SetPeriodAndOffset ( uint32_t  _Period,
uint32_t  _Offset 
)
inline

Set the Period And Offset of the Scheduler.

Parameters
_PeriodPeriod in [ms] of the Scheduler
_OffsetOffset in [ms] of the Scheduler

Definition at line 210 of file N2kTimer.h.

◆ SetSyncOffset()

static void tN2kSyncScheduler::SetSyncOffset ( )
inlinestatic

Set the SyncOffset of the scheduler.

Definition at line 259 of file N2kTimer.h.

◆ UpdateNextTime()

void tN2kSyncScheduler::UpdateNextTime ( )
inline

Update the timestamp for NextTime.

Definition at line 242 of file N2kTimer.h.

Member Data Documentation

◆ NextTime

uint64_t tN2kSyncScheduler::NextTime
protected

Timestamp for next event.

Definition at line 129 of file N2kTimer.h.

◆ Offset

uint32_t tN2kSyncScheduler::Offset
protected

Offset to synchronize with others.

Definition at line 131 of file N2kTimer.h.

◆ Period

uint32_t tN2kSyncScheduler::Period
protected

Period for scheduler.

Definition at line 133 of file N2kTimer.h.

◆ SyncOffset

uint64_t tN2kSyncScheduler::SyncOffset =0
staticprotected

???

Definition at line 127 of file N2kTimer.h.


The documentation for this class was generated from the following files: