Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Thread]Add a GenericThreadDriver constructor to set 2 private timeout variab… #27016

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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