SNTP
這個模組包含控管 SNTP 通訊的功能。
摘要
類型 |
|
---|---|
otSntpQuery
|
typedefstruct otSntpQuery
這個結構會導入 SNTP 查詢參數。 |
otSntpResponseHandler)(void *aContext, uint64_t aTime, otError aResult)
|
typedefvoid(*
當系統收到 SNTP 回應時,就會呼叫此函式指標。 |
函式 |
|
---|---|
otSntpClientQuery(otInstance *aInstance, const otSntpQuery *aQuery, otSntpResponseHandler aHandler, void *aContext)
|
這個函式會傳送 SNTP 查詢。
|
otSntpClientSetUnixEra(otInstance *aInstance, uint32_t aUnixEra)
|
void
這個函式會設定 Unix 時代的數字。
|
結構 |
|
---|---|
otSntpQuery |
這個結構會導入 SNTP 查詢參數。 |
類型
otSntpResponseHandler
void(* otSntpResponseHandler)(void *aContext, uint64_t aTime, otError aResult)
當系統收到 SNTP 回應時,就會呼叫此函式指標。
說明 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||||
傳回值 |
|
函式
otSntpClientQuery
otError otSntpClientQuery( otInstance *aInstance, const otSntpQuery *aQuery, otSntpResponseHandler aHandler, void *aContext )
這個函式會傳送 SNTP 查詢。
這項功能僅適用於已啟用OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE
的功能。
說明 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
otSntpClientSetUnixEra
void otSntpClientSetUnixEra( otInstance *aInstance, uint32_t aUnixEra )
這個函式會設定 Unix 時代的數字。
Unix era 的預設值預設為 0, 而從 2006 年起
說明 | |||||
---|---|---|---|---|---|
參數 |
|
巨集
OT_SNTP_DEFAULT_SERVER_IP
OT_SNTP_DEFAULT_SERVER_IP "2001:4860:4806:8::"
定義預設的 SNTP 伺服器位址:Google NTP 伺服器。
OT_SNTP_DEFAULT_SERVER_PORT
OT_SNTP_DEFAULT_SERVER_PORT 123
定義預設的 SNTP 伺服器通訊埠。