Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
DejinChen committed Sep 6, 2024
1 parent f4a81a6 commit a059abb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ CHIP_ERROR ThreadScanResponseToTLV::EncodeTo(TLV::TLVWriter & writer, TLV::Tag t
} // namespace

#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
IntrusiveList<InstanceListNode> Instance::sInstances;
Instance::NetworkInstanceList Instance::sInstances;
#endif

Instance::Instance(EndpointId aEndpointId, WiFiDriver * apDelegate) :
Expand Down Expand Up @@ -1170,6 +1170,7 @@ void Instance::HandleQueryIdentity(HandlerContext & ctx, const Commands::QueryId
}
#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC

#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
void Instance::DisconnectLingeringConnection()
{
bool haveConnectedNetwork = false;
Expand All @@ -1190,6 +1191,7 @@ void Instance::DisconnectLingeringConnection()
LogErrorOnFailure(mpWirelessDriver->DisconnectFromNetwork());
}
}
#endif

void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t interfaceStatus)
{
Expand Down
12 changes: 10 additions & 2 deletions src/app/clusters/network-commissioning/network-commissioning.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ class Instance : public CommandHandlerInterface,

// TODO: This could be guarded by a separate multi-interface condition instead
#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
static IntrusiveList<InstanceListNode> sInstances;
class NetworkInstanceList : public IntrusiveList<InstanceListNode>
{
public:
~NetworkInstanceList() { this->Clear(); }
};

static NetworkInstanceList sInstances;
#endif

EndpointId mEndpointId = kInvalidEndpointId;
Expand Down Expand Up @@ -125,8 +131,10 @@ class Instance : public CommandHandlerInterface,
void SetLastNetworkId(ByteSpan lastNetworkId);
void ReportNetworksListChanged() const;

#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
// Disconnect if the current connection is not in the Networks list
void DisconnectLingeringConnection();
#endif

// Commits the breadcrumb value saved in mCurrentOperationBreadcrumb to the breadcrumb attribute in GeneralCommissioning
// cluster. Will set mCurrentOperationBreadcrumb to NullOptional.
Expand All @@ -151,7 +159,7 @@ class Instance : public CommandHandlerInterface,
Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::ThreadDriver * apDelegate);
Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::EthernetDriver * apDelegate);
virtual ~Instance() = default;
}; // namespace NetworkCommissioning
};

// NetworkDriver for the devices that don't have / don't need a real network driver.
class NullNetworkDriver : public DeviceLayer::NetworkCommissioning::EthernetDriver
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ESP32/NetworkCommissioningDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ CHIP_ERROR ESPWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen,
return ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Enabled);
}

#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
CHIP_ERROR ESPWiFiDriver::DisconnectFromNetwork()
{
if (chip::DeviceLayer::Internal::ESP32Utils::IsStationProvisioned())
Expand All @@ -245,6 +246,7 @@ CHIP_ERROR ESPWiFiDriver::DisconnectFromNetwork()
}
return CHIP_NO_ERROR;
}
#endif

void ESPWiFiDriver::OnConnectWiFiNetwork()
{
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ESP32/NetworkCommissioningDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ class ESPWiFiDriver final : public WiFiDriver
Status RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) override;
Status ReorderNetwork(ByteSpan networkId, uint8_t index, MutableCharSpan & outDebugText) override;
void ConnectNetwork(ByteSpan networkId, ConnectCallback * callback) override;
#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
CHIP_ERROR DisconnectFromNetwork() override;
#endif

// WiFiDriver
Status AddOrUpdateNetwork(ByteSpan ssid, ByteSpan credentials, MutableCharSpan & outDebugText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ void GenericThreadDriver::CheckInterfaceEnabled()
#endif
}

#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
CHIP_ERROR GenericThreadDriver::DisconnectFromNetwork()
{
if (ThreadStackMgrImpl().IsThreadProvisioned())
Expand All @@ -287,6 +288,7 @@ CHIP_ERROR GenericThreadDriver::DisconnectFromNetwork()
}
return CHIP_NO_ERROR;
}
#endif

size_t GenericThreadDriver::ThreadNetworkIterator::Count()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ class GenericThreadDriver final : public ThreadDriver
Status RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) override;
Status ReorderNetwork(ByteSpan networkId, uint8_t index, MutableCharSpan & outDebugText) override;
void ConnectNetwork(ByteSpan networkId, ConnectCallback * callback) override;
#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION
CHIP_ERROR DisconnectFromNetwork() override;
#endif

// ThreadDriver
Status AddOrUpdateNetwork(ByteSpan operationalDataset, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) override;
Expand Down

0 comments on commit a059abb

Please sign in to comment.