[ncp] notify host asynchronously upon a significant thread network time change (#3238)

This commit is contained in:
Joseph Newman
2018-11-07 22:32:31 -08:00
committed by Jonathan Hui
parent a5f1ed263d
commit 4f99bcfaf3
10 changed files with 223 additions and 24 deletions
+17
View File
@@ -63,6 +63,8 @@ typedef enum otNetworkTimeStatus
OT_NETWORK_TIME_SYNCHRONIZED = 1, ///< The device network time is synchronized.
} otNetworkTimeStatus;
typedef void (*otNetworkTimeSyncCallbackFn)(void *aCallbackContext);
/**
* zero is considered as invalid time synchronization sequence.
*
@@ -128,6 +130,21 @@ otError otNetworkTimeSetXtalThreshold(otInstance *aInstance, uint16_t aXTALThres
*/
uint16_t otNetworkTimeGetXtalThreshold(otInstance *aInstance);
/**
* Set a callback to be called when a network time sync or status change occurs
*
* This callback shall be called only when the network time offset jumps by
* OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US or when the status changes.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aCallbackFn The callback function to be called
* @param[in] aCallbackContext The context to be passed to the callback function upon invocation
*
*/
void otNetworkTimeSyncSetCallback(otInstance * aInstance,
otNetworkTimeSyncCallbackFn aCallbackFn,
void * aCallbackContext);
/**
* @}
*