ADTF  3.18.2
IReferenceClock::ISync2RefChannelabstract

Interface for synchronizing external timestamps to stream time. More...

Inheritance diagram for IReferenceClock::ISync2RefChannel:
[legend]

Public Member Functions

 ADTF_IID (ISync2RefChannel, "sync2ref_channel.reference_clock.ant.streaming.adtf.iid")
 Marks the ISync2RefChannel to be castable with the adtf::ucom::ant::ucom_cast. More...
 
virtual tTimeStamp Sync2RefTime (tTimeStamp tmInputTime)=0
 Converts an input timestamp to the StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift. More...
 
virtual tTimeStamp Sync2RefTime (tTimeStamp tmRefStreamTime, tTimeStamp tmInputTime)=0
 Converts an input timestamp to the given StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift. More...
 
- Public Member Functions inherited from IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 Marks the IObject to be castable with the ucom_cast() More...
 

Additional Inherited Members

- Protected Member Functions inherited from IObject
 ~IObject ()=default
 Protected destructor --> Use implemented Destroy() instead of delete!
 

Detailed Description

Interface for synchronizing external timestamps to stream time.

Definition at line 138 of file reference_clock_intf.h.

Member Function Documentation

◆ ADTF_IID()

ADTF_IID ( ISync2RefChannel  ,
"sync2ref_channel.reference_clock.ant.streaming.adtf.iid"   
)

◆ Sync2RefTime() [1/2]

virtual tTimeStamp Sync2RefTime ( tTimeStamp  tmInputTime)
pure virtual

Converts an input timestamp to the StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift.

Example usage:

// store as SyncChannel as member while initializing !!
_runtime->GetObject(pClock);
//...
pClock->GetSync2RefChannel(m_oSyncChannel);
//...
//use it while creating sample
pNewSample->SetTime(m_oSyncChannel->Sync2RefTime(tmHardwareTime));
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.
Parameters
[in]tmInputTimeThe input timestamp which must be synchronized.
IMPORTANT: tmInputTime should not be lower than the tmInputTime of the last call of Sync2RefTime. Otherwise this will result in a internal offset reset.
Returns
Synchronized timestamp of StreamTime corresponding to the input timestamp

◆ Sync2RefTime() [2/2]

virtual tTimeStamp Sync2RefTime ( tTimeStamp  tmRefStreamTime,
tTimeStamp  tmInputTime 
)
pure virtual

Converts an input timestamp to the given StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift.

The main goal of this function is to identify a clock offset between an InputTime (i.e. a hardware time) and the StreamTime.

This function returns a synchronized timestamp of the StreamTime which corresponds to the input timestamp. The return value must be the SampleTime for a new sample that contains the InputData recreated for this input timestamp. (sample timestamp used in adtf::streaming::ant::ISample::SetTime )

The offset will be identified by using the appeared minimum offset between StreamTime and InputTime.

The function will remember the offset of every call and will adjust the internal offset every 5 seconds automatically to compensate a clock drift between the InputTime and StreamTime.

Remind: Every timestamp in tTimeStamp is expected in microseconds as long as the function documentation does not define something else!

The function can only handle positive tmRefStreamTime and tmInputTime values.

Parameters
[in]tmRefStreamTimeStream timestamp to reference to [microseconds]
[in]tmInputTimeThe input timestamp which must be synchronized.
IMPORTANT: tmInputTime should not be lower than the tmInputTime of the last call of Sync2RefTime. Otherwise this will result in a internal offset reset. [microseconds]
Returns
Synchronized timestamp of StreamTime corresponding to the input timestamp