@@ -78,6 +78,8 @@ namespace chip {
78
78
namespace DeviceLayer {
79
79
namespace Internal {
80
80
81
+ static_assert (OPENTHREAD_API_VERSION >= 219 , " OpenThread version too old" );
82
+
81
83
// Network commissioning
82
84
namespace {
83
85
#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_
@@ -189,17 +191,6 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_OnPlatformEvent(const
189
191
{
190
192
if (event->Type == DeviceEventType::kThreadStateChange )
191
193
{
192
- #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT && (OPENTHREAD_API_VERSION < 218)
193
- if (event->ThreadStateChange .AddressChanged )
194
- {
195
- const otSrpClientHostInfo * hostInfo = otSrpClientGetHostInfo (Impl ()->OTInstance ());
196
- if (hostInfo && hostInfo->mName )
197
- {
198
- Impl ()->_SetupSrpHost (hostInfo->mName );
199
- }
200
- }
201
- #endif
202
-
203
194
bool isThreadAttached = Impl ()->_IsThreadAttached ();
204
195
// Avoid sending muliple events if the attachement state didn't change (Child->router or disable->Detached)
205
196
if (event->ThreadStateChange .RoleChanged && (isThreadAttached != mIsAttached ))
@@ -1568,12 +1559,8 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_WriteThreadNetw
1568
1559
otOperationalDataset activeDataset;
1569
1560
otError otErr = otDatasetGetActive (mOTInst , &activeDataset);
1570
1561
VerifyOrReturnError (otErr == OT_ERROR_NONE, MapOpenThreadError (otErr));
1571
- #if OPENTHREAD_API_VERSION >= 219
1572
1562
uint64_t activeTimestamp = (activeDataset.mActiveTimestamp .mSeconds << 16 ) | (activeDataset.mActiveTimestamp .mTicks << 1 ) |
1573
1563
activeDataset.mActiveTimestamp .mAuthoritative ;
1574
- #else
1575
- uint64_t activeTimestamp = activeDataset.mActiveTimestamp ;
1576
- #endif
1577
1564
err = encoder.Encode (activeTimestamp);
1578
1565
}
1579
1566
break ;
@@ -1582,12 +1569,8 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_WriteThreadNetw
1582
1569
otOperationalDataset activeDataset;
1583
1570
otError otErr = otDatasetGetActive (mOTInst , &activeDataset);
1584
1571
VerifyOrReturnError (otErr == OT_ERROR_NONE, MapOpenThreadError (otErr));
1585
- #if OPENTHREAD_API_VERSION >= 219
1586
1572
uint64_t pendingTimestamp = (activeDataset.mPendingTimestamp .mSeconds << 16 ) |
1587
1573
(activeDataset.mPendingTimestamp .mTicks << 1 ) | activeDataset.mPendingTimestamp .mAuthoritative ;
1588
- #else
1589
- uint64_t pendingTimestamp = activeDataset.mPendingTimestamp ;
1590
- #endif
1591
1574
err = encoder.Encode (pendingTimestamp);
1592
1575
}
1593
1576
break ;
@@ -2118,8 +2101,6 @@ void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_UpdateNetworkStatus()
2118
2101
2119
2102
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
2120
2103
2121
- static_assert (OPENTHREAD_API_VERSION >= 156 , " SRP Client requires a more recent OpenThread version" );
2122
-
2123
2104
template <class ImplClass >
2124
2105
void GenericThreadStackManagerImpl_OpenThread<ImplClass>::OnSrpClientNotification(otError aError,
2125
2106
const otSrpClientHostInfo * aHostInfo,
@@ -2459,9 +2440,6 @@ template <class ImplClass>
2459
2440
CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetupSrpHost(const char * aHostName)
2460
2441
{
2461
2442
CHIP_ERROR error = CHIP_NO_ERROR;
2462
- #if OPENTHREAD_API_VERSION < 218
2463
- Inet::IPAddress hostAddress;
2464
- #endif
2465
2443
2466
2444
VerifyOrReturnError (mSrpClient .mIsInitialized , CHIP_ERROR_WELL_UNINITIALIZED);
2467
2445
@@ -2477,21 +2455,9 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetupSrpHost(co
2477
2455
error = MapOpenThreadError (otSrpClientSetHostName (mOTInst , mSrpClient .mHostName ));
2478
2456
SuccessOrExit (error);
2479
2457
2480
- #if OPENTHREAD_API_VERSION >= 218
2481
2458
error = MapOpenThreadError (otSrpClientEnableAutoHostAddress (mOTInst ));
2482
- #endif
2483
2459
}
2484
2460
2485
- #if OPENTHREAD_API_VERSION < 218
2486
- // Check if device has any external IPv6 assigned. If not, host will be set without IPv6 addresses
2487
- // and updated later on.
2488
- if (ThreadStackMgr ().GetExternalIPv6Address (hostAddress) == CHIP_NO_ERROR)
2489
- {
2490
- memcpy (&mSrpClient .mHostAddress .mFields .m32 , hostAddress.Addr , sizeof (hostAddress.Addr ));
2491
- error = MapOpenThreadError (otSrpClientSetHostAddresses (mOTInst , &mSrpClient .mHostAddress , 1 ));
2492
- }
2493
- #endif
2494
-
2495
2461
exit :
2496
2462
Impl ()->UnlockThreadStack ();
2497
2463
0 commit comments