Skip to content

Commit

Permalink
Add a GenericThreadDriver constructor to set 2 private timeout variab…
Browse files Browse the repository at this point in the history
…le, Add setter for those same variables so user cand modify them at runtime if they need to. (#27016)
  • Loading branch information
jmartinez-silabs authored and pull[bot] committed Oct 9, 2023
1 parent ba632d2 commit 1130186
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,24 @@ class GenericThreadDriver final : public ThreadDriver
bool exhausted = false;
};

GenericThreadDriver(uint8_t scanTimeoutSec = 10, uint8_t connectTimeoutSec = 20)
{
scanNetworkTimeoutSeconds = scanTimeoutSec;
connectNetworkTimeout = connectTimeoutSec;
}

// BaseDriver
NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); }
CHIP_ERROR Init(Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) override;
void Shutdown() override;

// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
uint8_t GetScanNetworkTimeoutSeconds() override { return 10; }
uint8_t GetConnectNetworkTimeoutSeconds() override { return 20; }
uint8_t GetScanNetworkTimeoutSeconds() override { return scanNetworkTimeoutSeconds; }
uint8_t GetConnectNetworkTimeoutSeconds() override { return connectNetworkTimeout; }

void SetScanNetworkTimeoutSeconds(uint8_t scanTimeoutSec) { scanNetworkTimeoutSeconds = scanTimeoutSec; }
void SetConnectNetworkTimeoutSeconds(uint8_t connectTimeoutSec) { connectNetworkTimeout = connectTimeoutSec; }

CHIP_ERROR CommitConfiguration() override;
CHIP_ERROR RevertConfiguration() override;
Expand All @@ -103,6 +112,8 @@ class GenericThreadDriver final : public ThreadDriver
void ScanNetworks(ThreadDriver::ScanCallback * callback) override;

private:
uint8_t scanNetworkTimeoutSeconds;
uint8_t connectNetworkTimeout;
Status MatchesNetworkId(const Thread::OperationalDataset & dataset, const ByteSpan & networkId) const;
CHIP_ERROR BackupConfiguration();

Expand Down

0 comments on commit 1130186

Please sign in to comment.