Skip to content

Commit

Permalink
Resolved conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Jun 8, 2022
1 parent f0204c2 commit 36ce661
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/controller/AutoCommissioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ CHIP_ERROR AutoCommissioner::StartCommissioning(DeviceCommissioner * commissione

Optional<System::Clock::Timeout> AutoCommissioner::GetCommandTimeout(DeviceProxy * device, CommissioningStage stage) const
{
<<<<<<< HEAD
// Network clusters can indicate the time required to connect, so if we are
// connecting, use that time as our "how long it takes to process server
// side" time. Otherwise pick a time that should be enough for the command
Expand Down
14 changes: 4 additions & 10 deletions src/platform/ESP32/NetworkCommissioningDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void ESPWiFiDriver::OnConnectWiFiNetwork()
{
if (mpConnectCallback)
{
DeviceLayer::SystemLayer().CancelTimer(ConnectWifiNetworkTimeout, NULL);
DeviceLayer::SystemLayer().CancelTimer(OnConnectWiFiNetworkFailed, NULL);
mpConnectCallback->OnResult(Status::kSuccess, CharSpan(), 0);
mpConnectCallback = nullptr;
}
Expand All @@ -192,14 +192,9 @@ void ESPWiFiDriver::OnConnectWiFiNetworkFailed()
}
}

void ESPWiFiDriver::ConnectWifiNetworkTimeout(chip::System::Layer * aLayer, void * aAppState)
void ESPWiFiDriver::OnConnectWiFiNetworkFailed(chip::System::Layer * aLayer, void * aAppState)
{
CHIP_ERROR error = chip::DeviceLayer::Internal::ESP32Utils::ClearWiFiStationProvision();
if (error != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "ClearWiFiStationProvision failed: %s", chip::ErrorStr(error));
}
NetworkCommissioning::ESPWiFiDriver::GetInstance().OnConnectWiFiNetworkFailed();
ESPWiFiDriver::GetInstance().OnConnectWiFiNetworkFailed();
}

void ESPWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback)
Expand All @@ -217,8 +212,7 @@ void ESPWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callbac
reinterpret_cast<const char *>(mStagingNetwork.credentials), mStagingNetwork.credentialsLen);

err = DeviceLayer::SystemLayer().StartTimer(
static_cast<System::Clock::Timeout>((kWiFiConnectNetworkTimeoutSeconds - 1) * secToMiliSec), ConnectWifiNetworkTimeout,
NULL);
static_cast<System::Clock::Timeout>((kWiFiConnectNetworkTimeoutSeconds) *secToMiliSec), OnConnectWiFiNetworkFailed, NULL);
mpConnectCallback = callback;
exit:
if (err != CHIP_NO_ERROR)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/ESP32/NetworkCommissioningDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class ESPWiFiDriver final : public WiFiDriver

CHIP_ERROR ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, const char * key, uint8_t keyLen);
void OnConnectWiFiNetwork();
static void ConnectWifiNetworkTimeout(chip::System::Layer * aLayer, void * aAppState);
void OnConnectWiFiNetworkFailed();
static void OnConnectWiFiNetworkFailed(chip::System::Layer * aLayer, void * aAppState);
void OnScanWiFiNetworkDone();
void OnNetworkStatusChange();

Expand Down

0 comments on commit 36ce661

Please sign in to comment.