mirror of
https://github.com/espressif/openthread.git
synced 2026-08-06 10:47:46 +00:00
[config] time sync (#4020)
This commit is contained in:
+1
-1
@@ -387,7 +387,7 @@ build_samr21() {
|
||||
|
||||
export CPPFLAGS=" \
|
||||
-DOPENTHREAD_CONFIG_ANOUNCE_SENDER_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_ENABLE_TIME_SYNC=1 \
|
||||
-DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 \
|
||||
-DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
|
||||
|
||||
git checkout -- . || die
|
||||
|
||||
@@ -177,7 +177,7 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(TIME_SYNC),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_ENABLE_TIME_SYNC=1 -DOPENTHREAD_CONFIG_HEADER_IE_SUPPORT=1
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 -DOPENTHREAD_CONFIG_HEADER_IE_SUPPORT=1
|
||||
endif
|
||||
|
||||
ifeq ($(UDP_FORWARD),1)
|
||||
|
||||
@@ -1896,7 +1896,7 @@ static void cc1352RadioProcessReceiveQueue(otInstance *aInstance)
|
||||
|
||||
if (crcCorr->status.bCrcErr == 0 && (len - 2) < OT_RADIO_FRAME_MAX_SIZE)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
#else
|
||||
if (otPlatRadioGetPromiscuous(aInstance))
|
||||
|
||||
@@ -662,7 +662,7 @@ void readFrame(otInstance *aInstance)
|
||||
length = HWREG(RFCORE_SFR_RFDATA);
|
||||
otEXPECT(IEEE802154_MIN_LENGTH <= length && length <= IEEE802154_MAX_LENGTH);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
#else
|
||||
// Timestamp
|
||||
|
||||
@@ -1845,7 +1845,7 @@ static void cc2650RadioProcessReceiveQueue(otInstance *aInstance)
|
||||
|
||||
if (crcCorr->status.bCrcErr == 0 && (len - 2) < OT_RADIO_FRAME_MAX_SIZE)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
#else
|
||||
if (otPlatRadioGetPromiscuous(aInstance))
|
||||
|
||||
@@ -1877,7 +1877,7 @@ static void cc2652RadioProcessReceiveQueue(otInstance *aInstance)
|
||||
|
||||
if (crcCorr->status.bCrcErr == 0 && (len - 2) < OT_RADIO_FRAME_MAX_SIZE)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
#else
|
||||
if (otPlatRadioGetPromiscuous(aInstance))
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#error "Platform efr32mg12 doesn't support configuration option: OPENTHREAD_CONFIG_ENABLE_TIME_SYNC"
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform efr32mg12 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||
#endif
|
||||
|
||||
#ifndef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#ifndef OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#error "Platform efr32mg21 doesn't support configuration option: OPENTHREAD_CONFIG_ENABLE_TIME_SYNC"
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform efr32mg21 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#ifndef OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#error "Platform gp712 doesn't support configuration option: OPENTHREAD_CONFIG_ENABLE_TIME_SYNC"
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform gp712 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||
|
||||
@@ -770,7 +770,7 @@ static bool rf_process_rx_frame(void)
|
||||
/* Check if frame is valid */
|
||||
otEXPECT_ACTION((IEEE802154_MIN_LENGTH <= temp) && (temp <= IEEE802154_MAX_LENGTH), status = false);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
#else
|
||||
if (otPlatRadioGetPromiscuous(sInstance))
|
||||
|
||||
@@ -677,7 +677,7 @@ void RTC_IRQ_HANDLER(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint64_t otPlatTimeGet(void)
|
||||
{
|
||||
return nrf5AlarmGetCurrentTime();
|
||||
@@ -687,4 +687,4 @@ uint16_t otPlatTimeGetXtalAccuracy(void)
|
||||
{
|
||||
return XTAL_ACCURACY;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
@@ -201,13 +201,13 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the time synchronization service feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#define OPENTHREAD_CONFIG_ENABLE_TIME_SYNC 0
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -215,12 +215,12 @@
|
||||
*
|
||||
* Define as 1 to support IEEE 802.15.4-2015 Header IE (Information Element) generation and parsing, it must be set
|
||||
* to support following features:
|
||||
* 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is set).
|
||||
* 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set).
|
||||
*
|
||||
* @note If it's enabled, plaforms must support interrupt context and concurrent access AES.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_HEADER_IE_SUPPORT 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -733,7 +733,7 @@ void nrf_802154_received_raw(uint8_t *p_data, int8_t power, uint8_t lqi)
|
||||
receivedFrame->mInfo.mRxInfo.mAckedWithFramePending = false;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
// Get the timestamp when the SFD was received.
|
||||
uint32_t offset =
|
||||
(int32_t)otPlatAlarmMicroGetNow() - (int32_t)nrf_802154_first_symbol_timestamp_get(time, p_data[0]);
|
||||
@@ -853,8 +853,8 @@ void nrf_802154_tx_started(const uint8_t *aFrame)
|
||||
bool notifyFrameUpdated = false;
|
||||
assert(aFrame == sTransmitPsdu);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
if (sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0)
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (sTransmitFrame.mIeInfo->mTimeIeOffset != 0)
|
||||
{
|
||||
uint8_t *timeIe = sTransmitFrame.mPsdu + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset;
|
||||
uint64_t time = otPlatTimeGet() + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mNetworkTimeOffset;
|
||||
@@ -870,7 +870,7 @@ void nrf_802154_tx_started(const uint8_t *aFrame)
|
||||
|
||||
notifyFrameUpdated = true;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
if (notifyFrameUpdated)
|
||||
{
|
||||
|
||||
@@ -677,7 +677,7 @@ void RTC_IRQ_HANDLER(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint64_t otPlatTimeGet(void)
|
||||
{
|
||||
return nrf5AlarmGetCurrentTime();
|
||||
@@ -687,4 +687,4 @@ uint16_t otPlatTimeGetXtalAccuracy(void)
|
||||
{
|
||||
return XTAL_ACCURACY;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
@@ -223,13 +223,13 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the time synchronization service feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#define OPENTHREAD_CONFIG_ENABLE_TIME_SYNC 0
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -247,12 +247,12 @@
|
||||
*
|
||||
* Define as 1 to support IEEE 802.15.4-2015 Header IE (Information Element) generation and parsing, it must be set
|
||||
* to support following features:
|
||||
* 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is set).
|
||||
* 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set).
|
||||
*
|
||||
* @note If it's enabled, plaforms must support interrupt context and concurrent access AES.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_HEADER_IE_SUPPORT 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -733,7 +733,7 @@ void nrf_802154_received_raw(uint8_t *p_data, int8_t power, uint8_t lqi)
|
||||
receivedFrame->mInfo.mRxInfo.mAckedWithFramePending = false;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
// Get the timestamp when the SFD was received.
|
||||
uint32_t offset =
|
||||
(int32_t)otPlatAlarmMicroGetNow() - (int32_t)nrf_802154_first_symbol_timestamp_get(time, p_data[0]);
|
||||
@@ -743,7 +743,7 @@ void nrf_802154_received_raw(uint8_t *p_data, int8_t power, uint8_t lqi)
|
||||
{
|
||||
receivedFrame->mInfo.mRxInfo.mTimestamp = nrf5AlarmGetCurrentTime();
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif
|
||||
|
||||
sAckedWithFramePending = false;
|
||||
|
||||
@@ -854,8 +854,8 @@ void nrf_802154_tx_started(const uint8_t *aFrame)
|
||||
bool notifyFrameUpdated = false;
|
||||
assert(aFrame == sTransmitPsdu);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
if (sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0)
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (sTransmitFrame.mIeInfo->mTimeIeOffset != 0)
|
||||
{
|
||||
uint8_t *timeIe = sTransmitFrame.mPsdu + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset;
|
||||
uint64_t time = otPlatTimeGet() + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mNetworkTimeOffset;
|
||||
@@ -871,7 +871,7 @@ void nrf_802154_tx_started(const uint8_t *aFrame)
|
||||
|
||||
notifyFrameUpdated = true;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
if (notifyFrameUpdated)
|
||||
{
|
||||
|
||||
@@ -305,11 +305,11 @@ uint64_t otPlatTimeGet(void)
|
||||
return platformGetNow();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint16_t otPlatTimeGetXtalAccuracy(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME == 0
|
||||
|
||||
@@ -701,7 +701,7 @@ void radioSendMessage(otInstance *aInstance)
|
||||
#if OPENTHREAD_CONFIG_HEADER_IE_SUPPORT
|
||||
bool notifyFrameUpdated = false;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0)
|
||||
{
|
||||
uint8_t *timeIe = sTransmitFrame.mPsdu + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset;
|
||||
@@ -718,7 +718,7 @@ void radioSendMessage(otInstance *aInstance)
|
||||
|
||||
notifyFrameUpdated = true;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
if (notifyFrameUpdated)
|
||||
{
|
||||
|
||||
@@ -186,11 +186,11 @@ uint64_t otPlatTimeGet(void)
|
||||
return platformAlarmGetNow();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint16_t otPlatTimeGetXtalAccuracy(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_POSIX_VIRTUAL_TIME
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#ifndef OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#error "Platform qpg6095 doesn't support configuration option: OPENTHREAD_CONFIG_ENABLE_TIME_SYNC"
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform qpg6095 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||
|
||||
@@ -218,7 +218,7 @@ static void handleRx(void)
|
||||
{
|
||||
sRxDone = false;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
#else
|
||||
if (otPlatRadioGetPromiscuous(sInstance))
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef struct otThreadLinkInfo
|
||||
uint8_t mLqi; ///< Link Quality Indicator for a received message.
|
||||
bool mLinkSecurity; ///< Indicates whether or not link security is enabled.
|
||||
|
||||
// Applicable/Required only when time sync feature (`OPENTHREAD_CONFIG_ENABLE_TIME_SYNC`) is enabled.
|
||||
// Applicable/Required only when time sync feature (`OPENTHREAD_CONFIG_TIME_SYNC_ENABLE`) is enabled.
|
||||
uint8_t mTimeSyncSeq; ///< The time sync sequence.
|
||||
int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time, in microseconds.
|
||||
} otThreadLinkInfo;
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@
|
||||
#include <openthread/link.h>
|
||||
#include <openthread/ncp.h>
|
||||
#include <openthread/thread.h>
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#include <openthread/network_time.h>
|
||||
#endif
|
||||
|
||||
@@ -173,7 +173,7 @@ const struct Command Interpreter::sCommands[] = {
|
||||
{"networkidtimeout", &Interpreter::ProcessNetworkIdTimeout},
|
||||
#endif
|
||||
{"networkname", &Interpreter::ProcessNetworkName},
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
{"networktime", &Interpreter::ProcessNetworkTime},
|
||||
#endif
|
||||
{"panid", &Interpreter::ProcessPanId},
|
||||
@@ -1756,7 +1756,7 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
void Interpreter::ProcessNetworkTime(int argc, char *argv[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -1808,7 +1808,7 @@ void Interpreter::ProcessNetworkTime(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
void Interpreter::ProcessPanId(int argc, char *argv[])
|
||||
{
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ private:
|
||||
void ProcessNetworkIdTimeout(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessNetworkName(int argc, char *argv[]);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
void ProcessNetworkTime(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessPanId(int argc, char *argv[]);
|
||||
|
||||
@@ -341,6 +341,7 @@ HEADERS_COMMON = \
|
||||
config/parent_search.h \
|
||||
config/platform.h \
|
||||
config/sntp_client.h \
|
||||
config/time_sync.h \
|
||||
crypto/aes_ccm.hpp \
|
||||
crypto/aes_ecb.hpp \
|
||||
crypto/ecdsa.hpp \
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
#include "openthread/network_time.h"
|
||||
|
||||
@@ -96,4 +96,4 @@ void otNetworkTimeSyncSetCallback(otInstance *aInstance, otNetworkTimeSyncCallba
|
||||
return instance.Get<TimeSync>().SetTimeSyncCallback(aCallback, aCallbackContext);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
@@ -563,7 +563,7 @@ template <> inline MeshCoP::PendingDataset &Instance::Get(void)
|
||||
return mThreadNetif.mPendingDataset;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
template <> inline TimeSync &Instance::Get(void)
|
||||
{
|
||||
return mThreadNetif.mTimeSync;
|
||||
|
||||
@@ -650,7 +650,7 @@ Message *Message::Clone(uint16_t aLength) const
|
||||
|
||||
messageCopy->SetSubType(GetSubType());
|
||||
messageCopy->SetLinkSecurityEnabled(IsLinkSecurityEnabled());
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
messageCopy->SetTimeSync(IsTimeSync());
|
||||
#endif
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ struct MessageInfo
|
||||
bool mInPriorityQ : 1; ///< Indicates whether the message is queued in normal or priority queue.
|
||||
bool mTxSuccess : 1; ///< Indicates whether the direct tx of the message was successful.
|
||||
bool mDoNotEvict : 1; ///< Indicates whether or not this message may be evicted.
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
bool mTimeSync : 1; ///< Indicates whether the message is also used for time sync purpose.
|
||||
uint8_t mTimeSyncSeq; ///< The time sync sequence.
|
||||
int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time, in microseconds.
|
||||
@@ -734,7 +734,7 @@ public:
|
||||
return (!mBuffer.mHead.mInfo.mInPriorityQ) ? mBuffer.mHead.mInfo.mQueue.mMessage : NULL;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This method indicates whether or not the message is also used for time sync purpose.
|
||||
*
|
||||
@@ -786,7 +786,7 @@ public:
|
||||
*
|
||||
*/
|
||||
uint8_t GetTimeSyncSeq(void) const { return mBuffer.mHead.mInfo.mTimeSyncSeq; }
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -183,13 +183,13 @@
|
||||
*
|
||||
* Define as 1 to support IEEE 802.15.4-2015 Header IE (Information Element) generation and parsing, it must be set
|
||||
* to support following features:
|
||||
* 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is set).
|
||||
* 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set).
|
||||
*
|
||||
* @note If it's enabled, platform must support interrupt context and concurrent access AES.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT 1
|
||||
#else
|
||||
#define OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT 0
|
||||
|
||||
@@ -322,54 +322,6 @@
|
||||
#define OPENTHREAD_CONFIG_ENABLE_DEBUG_UART 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
*
|
||||
* Define as 1 to enable the time synchronization service feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#define OPENTHREAD_CONFIG_ENABLE_TIME_SYNC 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED
|
||||
*
|
||||
* Define as 1 to require time synchronization when attaching to a network. If the device is router capable
|
||||
* and cannot find a neighboring router supporting time synchronization, the device will form a new partition.
|
||||
* If the device is not router capable, the device will remain an orphan.
|
||||
*
|
||||
* Applicable only if time synchronization service feature is enabled (i.e., OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is set)
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_PERIOD
|
||||
*
|
||||
* Specifies the default period of time synchronization, in seconds.
|
||||
*
|
||||
* Applicable only if time synchronization service feature is enabled (i.e., OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is set).
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_PERIOD
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_PERIOD 30
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_XTAL_THRESHOLD
|
||||
*
|
||||
* Specifies the default XTAL threshold for a device to become Router in time synchronization enabled network, in PPM.
|
||||
*
|
||||
* Applicable only if time synchronization service feature is enabled (i.e., OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is set)
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_XTAL_THRESHOLD
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_XTAL_THRESHOLD 300
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH
|
||||
*
|
||||
@@ -415,17 +367,6 @@
|
||||
#define OPENTHREAD_CONFIG_DEFAULT_SED_DATAGRAM_COUNT 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US
|
||||
*
|
||||
* This setting sets the minimum amount of time (in microseconds) that the network time must jump due to
|
||||
* a time sync event for listeners to be notified of the new network time.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US 10000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES
|
||||
*
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes compile-time configurations for the Time Sync service.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_TIME_SYNC_H_
|
||||
#define CONFIG_TIME_SYNC_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the time synchronization service feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED
|
||||
*
|
||||
* Define as 1 to require time synchronization when attaching to a network. If the device is router capable
|
||||
* and cannot find a neighboring router supporting time synchronization, the device will form a new partition.
|
||||
* If the device is not router capable, the device will remain an orphan.
|
||||
*
|
||||
* Applicable only if time synchronization service feature is enabled (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set)
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_PERIOD
|
||||
*
|
||||
* Specifies the default period of time synchronization, in seconds.
|
||||
*
|
||||
* Applicable only if time synchronization service feature is enabled (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set).
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_PERIOD
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_PERIOD 30
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_XTAL_THRESHOLD
|
||||
*
|
||||
* Specifies the default XTAL threshold for a device to become Router in time synchronization enabled network, in PPM.
|
||||
*
|
||||
* Applicable only if time synchronization service feature is enabled (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set)
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_XTAL_THRESHOLD
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_XTAL_THRESHOLD 300
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US
|
||||
*
|
||||
* This setting sets the minimum amount of time (in microseconds) that the network time must jump due to
|
||||
* a time sync event for listeners to be notified of the new network time.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US 10000
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_TIME_SYNC_H_
|
||||
@@ -1012,7 +1012,7 @@ void Mac::BeginTransmit(void)
|
||||
bool applyTransmitSecurity = true;
|
||||
bool processTransmitAesCcm = true;
|
||||
Frame & sendFrame = mSubMac.GetTransmitFrame();
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint8_t timeIeOffset = 0;
|
||||
#endif
|
||||
|
||||
@@ -1078,7 +1078,7 @@ void Mac::BeginTransmit(void)
|
||||
break;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
timeIeOffset = GetTimeIeOffset(sendFrame);
|
||||
sendFrame.SetTimeIeOffset(timeIeOffset);
|
||||
|
||||
@@ -1982,7 +1982,7 @@ void Mac::LogFrameTxFailure(const Frame &, otError, uint8_t) const
|
||||
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint8_t Mac::GetTimeIeOffset(Frame &aFrame)
|
||||
{
|
||||
uint8_t offset = 0;
|
||||
@@ -1998,7 +1998,7 @@ uint8_t Mac::GetTimeIeOffset(Frame &aFrame)
|
||||
exit:
|
||||
return offset;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
} // namespace Mac
|
||||
} // namespace ot
|
||||
|
||||
@@ -677,7 +677,7 @@ private:
|
||||
void LogFrameTxFailure(const Frame &aFrame, otError aError, uint8_t aRetryCount) const;
|
||||
void LogBeacon(const char *aActionText, const BeaconPayload &aBeaconPayload) const;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
void ProcessTimeIe(Frame &aFrame);
|
||||
uint8_t GetTimeIeOffset(Frame &aFrame);
|
||||
#endif
|
||||
|
||||
@@ -1010,7 +1010,7 @@ exit:
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
const TimeIe *Frame::GetTimeIe(void) const
|
||||
{
|
||||
const TimeIe * timeIe = NULL;
|
||||
@@ -1031,7 +1031,7 @@ const TimeIe *Frame::GetTimeIe(void) const
|
||||
exit:
|
||||
return timeIe;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
void Frame::CopyFrom(const Frame &aFromFrame)
|
||||
{
|
||||
@@ -1049,7 +1049,7 @@ void Frame::CopyFrom(const Frame &aFromFrame)
|
||||
memcpy(mPsdu, aFromFrame.mPsdu, aFromFrame.GetPsduLength());
|
||||
|
||||
// mIeInfo may be null when TIME_SYNC is not enabled.
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
memcpy(mInfo.mTxInfo.mIeInfo, aFromFrame.mInfo.mTxInfo.mIeInfo, sizeof(otRadioIeInfo));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ private:
|
||||
uint16_t mHeaderIe;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This class implements vendor specific Header IE generation and parsing.
|
||||
*
|
||||
@@ -564,7 +564,7 @@ private:
|
||||
uint8_t mSequence;
|
||||
uint64_t mTime;
|
||||
} OT_TOOL_PACKED_END;
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
/**
|
||||
* This class implements IEEE 802.15.4 MAC frame generation and parsing.
|
||||
@@ -1265,7 +1265,7 @@ public:
|
||||
*/
|
||||
const uint64_t &GetTimestamp(void) const { return mInfo.mRxInfo.mTimestamp; }
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This method sets the Time IE offset.
|
||||
*
|
||||
@@ -1327,7 +1327,7 @@ public:
|
||||
*
|
||||
*/
|
||||
uint8_t ReadTimeSyncSeq(void) const { return GetTimeIe()->GetSequence(); }
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "config/parent_search.h"
|
||||
#include "config/platform.h"
|
||||
#include "config/sntp_client.h"
|
||||
#include "config/time_sync.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \
|
||||
OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
|
||||
@@ -577,7 +577,7 @@ start:
|
||||
// Initialize MAC header
|
||||
fcf = Mac::Frame::kFcfFrameData;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aMessage.IsTimeSync())
|
||||
{
|
||||
fcf |= Mac::Frame::kFcfFrameVersion2015 | Mac::Frame::kFcfIePresent;
|
||||
@@ -666,7 +666,7 @@ start:
|
||||
aFrame.SetDstAddr(aMacDest);
|
||||
aFrame.SetSrcAddr(aMacSource);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aMessage.IsTimeSync())
|
||||
{
|
||||
Mac::TimeIe * ie;
|
||||
@@ -847,7 +847,7 @@ start:
|
||||
if (nextOffset < aMessage.GetLength())
|
||||
{
|
||||
aFrame.SetFramePending(true);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
aMessage.SetTimeSync(false);
|
||||
#endif
|
||||
}
|
||||
@@ -1072,7 +1072,7 @@ void MeshForwarder::HandleReceivedFrame(Mac::Frame &aFrame)
|
||||
linkInfo.mRss = aFrame.GetRssi();
|
||||
linkInfo.mLqi = aFrame.GetLqi();
|
||||
linkInfo.mLinkSecurity = aFrame.GetSecurityEnabled();
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aFrame.GetTimeIe() != NULL)
|
||||
{
|
||||
linkInfo.mNetworkTimeOffset = aFrame.ComputeNetworkTimeOffset();
|
||||
@@ -1155,7 +1155,7 @@ void MeshForwarder::HandleFragment(uint8_t * aFrame,
|
||||
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
|
||||
message->SetPanId(aLinkInfo.mPanId);
|
||||
message->AddRss(aLinkInfo.mRss);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
message->SetTimeSyncSeq(aLinkInfo.mTimeSyncSeq);
|
||||
message->SetNetworkTimeOffset(aLinkInfo.mNetworkTimeOffset);
|
||||
#endif
|
||||
@@ -1344,7 +1344,7 @@ void MeshForwarder::HandleLowpanHC(uint8_t * aFrame,
|
||||
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
|
||||
message->SetPanId(aLinkInfo.mPanId);
|
||||
message->AddRss(aLinkInfo.mRss);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
message->SetTimeSyncSeq(aLinkInfo.mTimeSyncSeq);
|
||||
message->SetNetworkTimeOffset(aLinkInfo.mNetworkTimeOffset);
|
||||
#endif
|
||||
|
||||
@@ -1418,7 +1418,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
otError Mle::AppendTimeRequest(Message &aMessage)
|
||||
{
|
||||
TimeRequestTlv tlv;
|
||||
@@ -1448,7 +1448,7 @@ otError Mle::AppendXtalAccuracy(Message &aMessage)
|
||||
|
||||
return aMessage.AppendTlv(tlv);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
otError Mle::AppendActiveTimestamp(Message &aMessage)
|
||||
{
|
||||
@@ -1991,7 +1991,7 @@ otError Mle::SendParentRequest(ParentRequestType aType)
|
||||
SuccessOrExit(error = AppendChallenge(*message, mParentRequest.mChallenge, sizeof(mParentRequest.mChallenge)));
|
||||
SuccessOrExit(error = AppendScanMask(*message, scanMask));
|
||||
SuccessOrExit(error = AppendVersion(*message));
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
SuccessOrExit(error = AppendTimeRequest(*message));
|
||||
#endif
|
||||
|
||||
@@ -2830,7 +2830,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
|
||||
HandleAnnounce(aMessage, aMessageInfo);
|
||||
break;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
case Header::kCommandTimeSync:
|
||||
Get<MleRouter>().HandleTimeSync(aMessage, aMessageInfo);
|
||||
break;
|
||||
@@ -3193,7 +3193,7 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
|
||||
MleFrameCounterTlv mleFrameCounter;
|
||||
ChallengeTlv challenge;
|
||||
Mac::ExtAddress extAddress;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
TimeParameterTlv timeParameter;
|
||||
#endif
|
||||
|
||||
@@ -3318,7 +3318,7 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
|
||||
mleFrameCounter.SetFrameCounter(linkFrameCounter.GetFrameCounter());
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
// Time Parameter
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kTimeParameter, sizeof(timeParameter), timeParameter) == OT_ERROR_NONE)
|
||||
@@ -3337,7 +3337,7 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
// Challenge
|
||||
SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kChallenge, sizeof(challenge), challenge));
|
||||
@@ -3448,7 +3448,7 @@ otError Mle::HandleChildIdResponse(const Message &aMessage, const Ip6::MessageIn
|
||||
Get<MeshCoP::PendingDataset>().ClearNetwork();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
// Sync to Thread network time
|
||||
if (aMessage.GetTimeSyncSeq() != OT_TIME_SYNC_INVALID_SEQ)
|
||||
{
|
||||
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
|
||||
/**
|
||||
* Applicable/Required only when time synchronization service
|
||||
* (`OPENTHREAD_CONFIG_ENABLE_TIME_SYNC`) is enabled.
|
||||
* (`OPENTHREAD_CONFIG_TIME_SYNC_ENABLE`) is enabled.
|
||||
*
|
||||
*/
|
||||
kCommandTimeSync = 99, ///< Time Synchronization
|
||||
@@ -1349,7 +1349,7 @@ protected:
|
||||
*/
|
||||
otError AppendAddressRegistration(Message &aMessage, AddressRegistrationMode aMode = kAppendAllAddresses);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This method appends a Time Request TLV to a message.
|
||||
*
|
||||
@@ -1382,7 +1382,7 @@ protected:
|
||||
*
|
||||
*/
|
||||
otError AppendXtalAccuracy(Message &aMessage);
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
/**
|
||||
* This method appends a Active Timestamp TLV to a message.
|
||||
|
||||
@@ -504,7 +504,7 @@ otError MleRouter::SendLinkRequest(Neighbor *aNeighbor)
|
||||
break;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
SuccessOrExit(error = AppendTimeRequest(*message));
|
||||
#endif
|
||||
|
||||
@@ -563,7 +563,7 @@ otError MleRouter::HandleLinkRequest(const Message &aMessage, const Ip6::Message
|
||||
SourceAddressTlv sourceAddress;
|
||||
TlvRequestTlv tlvRequest;
|
||||
uint16_t rloc16;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
TimeRequestTlv timeRequest;
|
||||
#endif
|
||||
|
||||
@@ -651,7 +651,7 @@ otError MleRouter::HandleLinkRequest(const Message &aMessage, const Ip6::Message
|
||||
tlvRequest.SetLength(0);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (neighbor != NULL)
|
||||
{
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kTimeRequest, sizeof(timeRequest), timeRequest) == OT_ERROR_NONE)
|
||||
@@ -736,7 +736,7 @@ otError MleRouter::SendLinkAccept(const Ip6::MessageInfo &aMessageInfo,
|
||||
aNeighbor->SetState(Neighbor::kStateLinkRequest);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aNeighbor != NULL && aNeighbor->IsTimeSyncEnabled())
|
||||
{
|
||||
message->SetTimeSync(true);
|
||||
@@ -927,7 +927,7 @@ otError MleRouter::HandleLinkAccept(const Message & aMessage,
|
||||
mRetrieveNewNetworkData = true;
|
||||
SendDataRequest(aMessageInfo.GetPeerAddr(), dataRequestTlvs, sizeof(dataRequestTlvs), 0);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
Get<TimeSync>().HandleTimeSyncMessage(aMessage);
|
||||
#endif
|
||||
break;
|
||||
@@ -1234,7 +1234,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa
|
||||
VerifyOrExit(IsActiveRouter(sourceAddress.GetRloc16()) && route.IsValid());
|
||||
routerId = GetRouterId(sourceAddress.GetRloc16());
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
Get<TimeSync>().HandleTimeSyncMessage(aMessage);
|
||||
#endif
|
||||
|
||||
@@ -1563,7 +1563,7 @@ otError MleRouter::HandleParentRequest(const Message &aMessage, const Ip6::Messa
|
||||
ChallengeTlv challenge;
|
||||
Router * leader;
|
||||
Child * child;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
TimeRequestTlv timeRequest;
|
||||
#endif
|
||||
|
||||
@@ -1638,7 +1638,7 @@ otError MleRouter::HandleParentRequest(const Message &aMessage, const Ip6::Messa
|
||||
child->GetLinkInfo().AddRss(Get<Mac::Mac>().GetNoiseFloor(), linkInfo->mRss);
|
||||
child->ResetLinkFailures();
|
||||
child->SetState(Neighbor::kStateParentRequest);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kTimeRequest, sizeof(timeRequest), timeRequest) == OT_ERROR_NONE)
|
||||
{
|
||||
child->SetTimeSyncEnabled(true);
|
||||
@@ -1871,7 +1871,7 @@ void MleRouter::HandleStateUpdateTimer(void)
|
||||
|
||||
SynchronizeChildNetworkData();
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (mRole == OT_DEVICE_ROLE_LEADER || mRole == OT_DEVICE_ROLE_ROUTER)
|
||||
{
|
||||
Get<TimeSync>().ProcessTimeSync();
|
||||
@@ -1898,7 +1898,7 @@ void MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge
|
||||
SuccessOrExit(error = AppendLinkFrameCounter(*message));
|
||||
SuccessOrExit(error = AppendMleFrameCounter(*message));
|
||||
SuccessOrExit(error = AppendResponse(*message, aChallenge.GetChallenge(), aChallenge.GetChallengeLength()));
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aChild->IsTimeSyncEnabled())
|
||||
{
|
||||
SuccessOrExit(error = AppendTimeParameter(*message));
|
||||
@@ -2865,7 +2865,7 @@ otError MleRouter::SendChildIdResponse(Child &aChild)
|
||||
Get<IndirectSender>().SetChildUseShortAddress(aChild, false);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aChild.IsTimeSyncEnabled())
|
||||
{
|
||||
message->SetTimeSync(true);
|
||||
@@ -3807,7 +3807,7 @@ otError MleRouter::SendAddressSolicit(ThreadStatusTlv::Status aStatus)
|
||||
statusTlv.SetStatus(aStatus);
|
||||
SuccessOrExit(error = message->AppendTlv(statusTlv));
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
SuccessOrExit(error = AppendXtalAccuracy(*message));
|
||||
#endif
|
||||
|
||||
@@ -3993,7 +3993,7 @@ void MleRouter::HandleAddressSolicit(Coap::Message &aMessage, const Ip6::Message
|
||||
ThreadRloc16Tlv rlocTlv;
|
||||
ThreadStatusTlv statusTlv;
|
||||
Router * router = NULL;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
XtalAccuracyTlv xtalAccuracyTlv;
|
||||
#endif
|
||||
|
||||
@@ -4008,7 +4008,7 @@ void MleRouter::HandleAddressSolicit(Coap::Message &aMessage, const Ip6::Message
|
||||
SuccessOrExit(error = ThreadTlv::GetTlv(aMessage, ThreadTlv::kStatus, sizeof(statusTlv), statusTlv));
|
||||
VerifyOrExit(statusTlv.IsValid(), error = OT_ERROR_PARSE);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
// In a time sync enabled network, all routers' xtal accuracy must be less than the threshold.
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kXtalAccuracy, sizeof(xtalAccuracyTlv), xtalAccuracyTlv) != OT_ERROR_NONE ||
|
||||
xtalAccuracyTlv.GetXtalAccuracy() > Get<TimeSync>().GetXtalThreshold())
|
||||
@@ -4680,7 +4680,7 @@ bool MleRouter::IsSleepyChildSubscribed(const Ip6::Address &aAddress, Child &aCh
|
||||
aChild.HasIp6Address(GetInstance(), aAddress);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
void MleRouter::HandleTimeSync(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||
{
|
||||
LogMleMessage("Receive Time Sync", aMessageInfo.GetPeerAddr());
|
||||
@@ -4715,7 +4715,7 @@ exit:
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
} // namespace Mle
|
||||
} // namespace ot
|
||||
|
||||
@@ -647,7 +647,7 @@ public:
|
||||
*/
|
||||
static uint8_t LinkQualityToCost(uint8_t aLinkQuality);
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This method generates an MLE Time Synchronization message.
|
||||
*
|
||||
@@ -697,7 +697,7 @@ private:
|
||||
otError HandleDataRequest(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
void HandleNetworkDataUpdateRouter(void);
|
||||
otError HandleDiscoveryRequest(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
void HandleTimeSync(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
void HandlePartitionChange(void) {}
|
||||
void StopAdvertiseTimer(void) {}
|
||||
otError ProcessRouteTlv(const RouteTlv &) { return OT_ERROR_NONE; }
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
otError HandleTimeSync(const Message &, const Ip6::MessageInfo &) { return OT_ERROR_DROP; }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
|
||||
/**
|
||||
* Applicable/Required only when time synchronization service
|
||||
* (`OPENTHREAD_CONFIG_ENABLE_TIME_SYNC`) is enabled.
|
||||
* (`OPENTHREAD_CONFIG_TIME_SYNC_ENABLE`) is enabled.
|
||||
*
|
||||
*/
|
||||
kTimeRequest = 252, ///< Time Request TLV
|
||||
@@ -1859,7 +1859,7 @@ private:
|
||||
uint16_t mPanId;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This class implements Time Request TLV generation and parsing.
|
||||
*
|
||||
@@ -1998,7 +1998,7 @@ public:
|
||||
private:
|
||||
uint16_t mXtalAccuracy;
|
||||
} OT_TOOL_PACKED_END;
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
/**
|
||||
* This class implements Active Timestamp TLV generation and parsing.
|
||||
|
||||
@@ -105,7 +105,7 @@ ThreadNetif::ThreadNetif(Instance &aInstance)
|
||||
, mAnnounceBegin(aInstance)
|
||||
, mPanIdQuery(aInstance)
|
||||
, mEnergyScan(aInstance)
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
, mTimeSync(aInstance)
|
||||
#endif
|
||||
{
|
||||
|
||||
@@ -227,7 +227,7 @@ private:
|
||||
PanIdQueryServer mPanIdQuery;
|
||||
EnergyScanServer mEnergyScan;
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
TimeSync mTimeSync;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
#include "time_sync_service.hpp"
|
||||
|
||||
@@ -275,4 +275,4 @@ void TimeSync::CheckAndHandleChanges(bool aTimeUpdated)
|
||||
|
||||
} // namespace ot
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#include <openthread/network_time.h>
|
||||
|
||||
#include "common/locator.hpp"
|
||||
@@ -227,6 +227,6 @@ private:
|
||||
|
||||
} // namespace ot
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
#endif // TIME_SYNC_HPP_
|
||||
|
||||
@@ -324,7 +324,7 @@ public:
|
||||
*/
|
||||
uint8_t GetChallengeSize(void) const { return sizeof(mValidPending.mPending.mChallenge); }
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* This method indicates whether or not time sync feature is enabled.
|
||||
*
|
||||
@@ -362,7 +362,7 @@ private:
|
||||
uint16_t mRloc16; ///< The RLOC16
|
||||
uint8_t mState : 4; ///< The link state
|
||||
uint8_t mMode : 4; ///< The MLE device mode
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint8_t mLinkFailures : 7; ///< Consecutive link failure count
|
||||
bool mTimeSyncEnabled : 1; ///< Indicates whether or not time sync feature is enabled.
|
||||
#else
|
||||
|
||||
@@ -91,7 +91,7 @@ const ChangedPropsSet::Entry ChangedPropsSet::mSupportedProps[] = {
|
||||
{SPINEL_PROP_LAST_STATUS, SPINEL_STATUS_JOIN_RSP_TIMEOUT, false},
|
||||
{SPINEL_PROP_LAST_STATUS, SPINEL_STATUS_JOIN_SUCCESS, false},
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
{SPINEL_PROP_THREAD_NETWORK_TIME, SPINEL_STATUS_OK, false},
|
||||
#endif
|
||||
{SPINEL_PROP_PARENT_RESPONSE_INFO, SPINEL_STATUS_OK, true},
|
||||
|
||||
@@ -266,9 +266,9 @@ NcpBase::NcpBase(Instance *aInstance)
|
||||
otSetStateChangedCallback(mInstance, &NcpBase::HandleStateChanged, this);
|
||||
otIp6SetReceiveCallback(mInstance, &NcpBase::HandleDatagramFromStack, this);
|
||||
otIp6SetReceiveFilterEnabled(mInstance, true);
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
otNetworkTimeSyncSetCallback(mInstance, &NcpBase::HandleTimeSyncUpdate, this);
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#if OPENTHREAD_ENABLE_UDP_FORWARD
|
||||
otUdpForwardSetForwarder(mInstance, &NcpBase::HandleUdpForwardStream, this);
|
||||
#endif
|
||||
@@ -1777,7 +1777,7 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CAPS>(void)
|
||||
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CHANNEL_MANAGER));
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_TIME_SYNC));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_CNTR_IP_RX_FAILURE:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_IP_RX_FAILURE>;
|
||||
break;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
case SPINEL_PROP_THREAD_NETWORK_TIME:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NETWORK_TIME>;
|
||||
break;
|
||||
@@ -636,14 +636,14 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL>;
|
||||
break;
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
case SPINEL_PROP_TIME_SYNC_PERIOD:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_TIME_SYNC_PERIOD>;
|
||||
break;
|
||||
case SPINEL_PROP_TIME_SYNC_XTAL_THRESHOLD:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_TIME_SYNC_XTAL_THRESHOLD>;
|
||||
break;
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -974,7 +974,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL>;
|
||||
break;
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
case SPINEL_PROP_TIME_SYNC_PERIOD:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_TIME_SYNC_PERIOD>;
|
||||
break;
|
||||
|
||||
@@ -1049,7 +1049,7 @@ exit:
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_TIME_SYNC_PERIOD>(void)
|
||||
{
|
||||
return mEncoder.WriteUint16(otNetworkTimeGetSyncPeriod(mInstance));
|
||||
@@ -1085,7 +1085,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_TIME_SYNC_XTAL_THRESH
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
} // namespace Ncp
|
||||
} // namespace ot
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include <openthread/jam_detection.h>
|
||||
#endif
|
||||
#include <openthread/ncp.h>
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#include <openthread/network_time.h>
|
||||
#endif
|
||||
#include <openthread/platform/misc.h>
|
||||
@@ -3185,7 +3185,7 @@ void NcpBase::StopLegacy(void)
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_LEGACY
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NETWORK_TIME>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -3211,7 +3211,7 @@ void NcpBase::HandleTimeSyncUpdate(void)
|
||||
mChangedPropsSet.AddProperty(SPINEL_PROP_THREAD_NETWORK_TIME);
|
||||
mUpdateChangedPropsTask.Post();
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
void NcpBase::HandleActiveScanResult_Jump(otActiveScanResult *aResult, void *aContext)
|
||||
{
|
||||
|
||||
@@ -543,7 +543,7 @@ void otPlatSettingsWipe(otInstance *aInstance)
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
uint64_t otPlatTimeGet(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
@@ -557,6 +557,6 @@ uint16_t otPlatTimeGetXtalAccuracy(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
#endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
|
||||
} // extern "C"
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user