diff --git a/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp b/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp index 1bab4b09f58eda..5d877aad9bed7a 100644 --- a/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp +++ b/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp @@ -79,7 +79,16 @@ void chip::NXP::App::CommonDeviceCallbacks::DeviceEventCallback(const ChipDevice case DeviceEventType::kCommissioningComplete: CommonDeviceCallbacks::OnComissioningComplete(event); break; -#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WPA + case DeviceEventType::kThreadConnectivityChange: + if (!ConnectivityMgr().IsWiFiStationConnected() && (event->ThreadConnectivityChange.Result == kConnectivity_Established)) + { + // Restart DnsSd service when operating as Matter over Thread + chip::app::DnssdServer::Instance().StartServer(); + } + break; +#endif // CHIP_DEVICE_CONFIG_ENABLE_WPA +#endif // CHIP_ENABLE_OPENTHREAD case DeviceLayer::DeviceEventType::kDnssdInitialized: ChipLogProgress(DeviceLayer, "kDnssdInitialized"); #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -158,20 +167,13 @@ void chip::NXP::App::CommonDeviceCallbacks::OnSessionEstablished(chip::DeviceLay #if CHIP_ENABLE_OPENTHREAD void chip::NXP::App::CommonDeviceCallbacks::OnComissioningComplete(const chip::DeviceLayer::ChipDeviceEvent * event) { -#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ #if CHIP_DEVICE_CONFIG_ENABLE_WPA - if (ConnectivityMgr().IsWiFiStationConnected()) - { - // Disable thr nwk commissioining cluster - app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::Set(CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID, 0); - } - else if (ConnectivityMgr().IsThreadProvisioned()) + if (!ConnectivityMgr().IsWiFiStationConnected() && ConnectivityMgr().IsThreadProvisioned()) { // Set WIFI cluster interface attribute to disable. app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::Set(0, 0); } #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA -#endif // _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ #if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED /* diff --git a/src/platform/nxp/common/DnssdImpl.cpp b/src/platform/nxp/common/DnssdImpl.cpp index 439327017897b2..5b35693534059f 100644 --- a/src/platform/nxp/common/DnssdImpl.cpp +++ b/src/platform/nxp/common/DnssdImpl.cpp @@ -33,15 +33,25 @@ namespace Dnssd { CHIP_ERROR ChipDnssdInit(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context) { - NxpChipDnssdInit(initCallback, errorCallback, context); - OpenThreadDnssdInit(initCallback, errorCallback, context); + if (ConnectivityMgr().IsWiFiStationConnected()) + { + ReturnErrorOnFailure(NxpChipDnssdInit(initCallback, errorCallback, context)); + } + else if (ConnectivityMgr().IsThreadProvisioned()) + { + ReturnErrorOnFailure(OpenThreadDnssdInit(initCallback, errorCallback, context)); + } + else + { + initCallback(context, CHIP_ERROR_INCORRECT_STATE); + } return CHIP_NO_ERROR; } void ChipDnssdShutdown() { - NxpChipDnssdShutdown(); + // Empty implementation. Intentionally left blank } CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCallback callback, void * context) diff --git a/src/platform/nxp/common/DnssdImplBr.cpp b/src/platform/nxp/common/DnssdImplBr.cpp index 6b84f1f258d8be..56ccb6f13ade52 100644 --- a/src/platform/nxp/common/DnssdImplBr.cpp +++ b/src/platform/nxp/common/DnssdImplBr.cpp @@ -144,23 +144,17 @@ static uint32_t mServiceListFreeIndex; CHIP_ERROR NxpChipDnssdInit(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context) { - CHIP_ERROR error = CHIP_NO_ERROR; - otInstance * thrInstancePtr = ThreadStackMgrImpl().OTInstance(); - struct netif * extNetif = (ConnectivityManagerImpl().GetExternalInterface()).GetPlatformInterface(); - - // Don't try to do anything until the mDNS server is started - VerifyOrExit(otMdnsIsEnabled(thrInstancePtr), error = CHIP_ERROR_INCORRECT_STATE); + struct netif * extNetif = (ConnectivityManagerImpl().GetExternalInterface()).GetPlatformInterface(); mNetifIndex = netif_get_index(extNetif); + initCallback(context, CHIP_NO_ERROR); -exit: - initCallback(context, error); - return error; + return CHIP_NO_ERROR; } void NxpChipDnssdShutdown() { - otMdnsSetEnabled(ThreadStackMgrImpl().OTInstance(), false, 0); + // Empty implementation. Intentionally left blank } #if USE_MDNS_NEXT_SERVICE_API CHIP_ERROR NxpChipDnssdRemoveServices() diff --git a/src/platform/nxp/rt/rw61x/BUILD.gn b/src/platform/nxp/rt/rw61x/BUILD.gn index e80dd3cbd823f4..7ac204e92c55e9 100644 --- a/src/platform/nxp/rt/rw61x/BUILD.gn +++ b/src/platform/nxp/rt/rw61x/BUILD.gn @@ -179,7 +179,6 @@ static_library("nxp_platform") { if (chip_mdns == "platform") { if (chip_enable_wifi) { sources += [ - "../../../OpenThread/DnssdImpl.cpp", "../../../OpenThread/OpenThreadDnssdImpl.cpp", "../../../OpenThread/OpenThreadDnssdImpl.h", "../../common/DnssdImpl.cpp", diff --git a/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn b/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn index 978c45f8a6da8d..6c00f94b3a077e 100644 --- a/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn +++ b/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn @@ -52,7 +52,6 @@ config("openthread_rw61x_config") { "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1", "OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE=1", "OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE=1", - "OPENTHREAD_CONFIG_GENERIC_TASKLET_ENABLE=1", "OPENTHREAD_CONFIG_SRP_SERVER_ADVERTISING_PROXY_ENABLE=1", "OPENTHREAD_CONFIG_DNSSD_DISCOVERY_PROXY_ENABLE=1", "OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE=1",