class SingleSourceTimeSyncClient

Defined at line 1129 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/time/WeaveTime.h

Public Members

TimeChangeNotificationHandler OnTimeChangeNotificationReceived

Protected Members

void * mApp
WeaveExchangeManager * mExchangeMgr
Binding * mBinding
bool mIsInCallback
ClientState mClientState
ExchangeContext * mExchangeContext
int32_t mFlightTime_usec
timesync_t mUnadjTimestampLastSent_usec
timesync_t mRemoteTimestamp_usec
timesync_t mRegisterSyncResult_usec
SyncCompletionHandler mOnSyncCompleted

Public Methods

void Abort ()

Abort current time sync operation. Release Binding. Abort active exchange. Move back to idle state.

ClientState GetClientState ()

Retrieve current state of this client

Returns

current state

Defined at line 1147 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/time/WeaveTime.h

WEAVE_ERROR Init (void *const aApp, WeaveExchangeManager *const aExchangeMgr)

Initialize this client. Must be called before other functions can be used.

Zero/NULL initialize all internal data and register with Time Change Notification.

Parameters

aApp [in] A pointer to higher layer data, used in callbacks to higher layer.
aExchangeMgr [in] A pointer to Exchange Manager, which would be used in registering for Time Change Notification message handler

Returns

WEAVE_NO_ERROR on success

WEAVE_ERROR Sync (Binding *const aBinding, SyncCompletionHandler OnSyncCompleted)

Sync using the given Binding and makes a callback using the pointer provided.

If there is a time sync operation going on, it would be aborted implicitly without callback being made.

Not available in callback OnSyncCompleted, but allowed in OnTimeChangeNotificationReceived .

On error, Abort would be called implicitly before returning from this function.

Parameters

aBinding [in] Binding to be used in contacting the time server
OnSyncCompleted [in] Callback function to be used after the time sync operations are completed

Returns

#WEAVE_NO_ERROR on success

Protected Methods

void RegisterSyncResultIfNewOrBetter (const timesync_t aNow_usec, const timesync_t aRemoteTimestamp_usec, const int32_t aFlightTime_usec)
void _AbortWithCallback (const WEAVE_ERROR aErrorCode)
WEAVE_ERROR SendSyncRequest ()
void SetClientState (const ClientState state)
const char * GetClientStateName ()
void HandleTimeChangeNotification (ExchangeContext * aEC, const IPPacketInfo * aPktInfo, const WeaveMessageInfo * aMsgInfo, uint32_t aProfileId, uint8_t aMsgType, PacketBuffer * aPayload)
void HandleSyncResponse (ExchangeContext * aEC, const IPPacketInfo * aPktInfo, const WeaveMessageInfo * aMsgInfo, uint32_t aProfileId, uint8_t aMsgType, PacketBuffer * aPayload)
void InvalidateRegisteredResult ()

Invalidate the registered information for time correction

Defined at line 1262 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/time/WeaveTime.h

bool IsRegisteredResultValid ()

Check if the registered information for time correction is valid

Defined at line 1265 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/time/WeaveTime.h

void OnSyncResponse (uint32_t aProfileId, uint8_t aMsgType, PacketBuffer * aPayload)
void HandleResponseTimeout (ExchangeContext * aEC)
void OnResponseTimeout ()
void ProceedToNextState ()
void EnterSync2 ()
void FinalProcessing ()

Enumerations

enum ClientState
Name Value Comments
kClientState_Idle 0

Initialized, waiting for Time Change Notification, but no actual time sync operation is happening

kClientState_Sync_1 1

Working on the first time sync attempt

kClientState_Sync_2 2

Working on the second time sync attempt

current state of this Time Sync Client

Defined at line 1134 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/time/WeaveTime.h

enum (unnamed)
Name Value
kFlightTimeMinimum 0
kFlightTimeInvalid -1

Defined at line 1213 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/time/WeaveTime.h