@@ -76,7 +76,8 @@ static_assert(OPENTHREAD_API_VERSION >= 219, "OpenThread version too old");
76
76
namespace {
77
77
#ifndef _NO_NETWORK_COMMISSIONING_DRIVER_
78
78
NetworkCommissioning::GenericThreadDriver sGenericThreadDriver ;
79
- app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance (0 /* Endpoint Id */ , &sGenericThreadDriver );
79
+ app::Clusters::NetworkCommissioning::Instance
80
+ sThreadNetworkCommissioningInstance (CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID /* Endpoint Id */ , &sGenericThreadDriver );
80
81
#endif
81
82
82
83
void initNetworkCommissioningThreadDriver (void )
@@ -1093,9 +1094,6 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstanc
1093
1094
CHIP_ERROR err = CHIP_NO_ERROR;
1094
1095
otError otErr = OT_ERROR_NONE;
1095
1096
1096
- // If InterfaceEnabled is false, do not start Thread
1097
- bool InterfaceEnabled = true ;
1098
-
1099
1097
// Arrange for OpenThread errors to be translated to text.
1100
1098
RegisterOpenThreadErrorFormatter ();
1101
1099
@@ -1133,15 +1131,8 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstanc
1133
1131
memset (&mSrpClient , 0 , sizeof (mSrpClient ));
1134
1132
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
1135
1133
1136
- initNetworkCommissioningThreadDriver ();
1137
-
1138
- #ifndef _NO_NETWORK_COMMISSIONING_DRIVER_
1139
- InterfaceEnabled = sGenericThreadDriver .GetEnabled ();
1140
- ChipLogError (DeviceLayer, " %s:%d interface:%d" , __FILE__, __LINE__, InterfaceEnabled);
1141
- #endif
1142
-
1143
1134
// If the Thread stack has been provisioned, but is not currently enabled, enable it now.
1144
- if (InterfaceEnabled && otThreadGetDeviceRole (mOTInst ) == OT_DEVICE_ROLE_DISABLED && otDatasetIsCommissioned (otInst))
1135
+ if (otThreadGetDeviceRole (mOTInst ) == OT_DEVICE_ROLE_DISABLED && otDatasetIsCommissioned (otInst))
1145
1136
{
1146
1137
// Enable the Thread IPv6 interface.
1147
1138
otErr = otIp6SetEnabled (otInst, true );
@@ -1153,6 +1144,8 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstanc
1153
1144
ChipLogProgress (DeviceLayer, " OpenThread ifconfig up and thread start" );
1154
1145
}
1155
1146
1147
+ initNetworkCommissioningThreadDriver ();
1148
+
1156
1149
exit :
1157
1150
1158
1151
ChipLogProgress (DeviceLayer, " OpenThread started: %s" , otThreadErrorToString (otErr));
0 commit comments