30
30
#include < type_traits>
31
31
#include < zap-generated/tests/CHIPClustersTest.h>
32
32
33
+ constexpr uint16_t kTimeoutInSeconds = 30 ;
34
+
33
35
class TestCommand : public CHIPCommand
34
36
{
35
37
public:
@@ -39,20 +41,26 @@ class TestCommand : public CHIPCommand
39
41
{
40
42
AddArgument (" node-id" , 0 , UINT64_MAX, &mNodeId );
41
43
AddArgument (" delayInMs" , 0 , UINT64_MAX, &mDelayInMs );
44
+ AddArgument (" timeout" , 0 , UINT16_MAX, &mTimeout );
42
45
AddArgument (" endpoint-id" , CHIP_ZCL_ENDPOINT_MIN, CHIP_ZCL_ENDPOINT_MAX, &mEndpointId );
43
46
AddArgument (" PICS" , &mPICSFilePath );
44
47
}
45
48
46
49
// ///////// CHIPCommand Interface /////////
47
50
CHIP_ERROR RunCommand () override ;
48
- chip::System::Clock::Timeout GetWaitDuration () const override { return chip::System::Clock::Seconds16 (30 ); }
51
+ chip::System::Clock::Timeout GetWaitDuration () const override
52
+ {
53
+ return chip::System::Clock::Seconds16 (mTimeout .HasValue () ? mTimeout .Value () : kTimeoutInSeconds );
54
+ }
49
55
50
56
virtual void NextTest () = 0;
51
57
52
58
// ///////// GlobalCommands Interface /////////
53
59
CHIP_ERROR Wait (chip::System::Clock::Timeout ms);
54
60
CHIP_ERROR WaitForMs (uint16_t ms) { return Wait (chip::System::Clock::Milliseconds32 (ms)); }
61
+ CHIP_ERROR WaitForCommissionee ();
55
62
CHIP_ERROR Log (const char * message);
63
+ CHIP_ERROR Prompt (const char * message);
56
64
57
65
protected:
58
66
ChipDevice * mDevice ;
@@ -261,5 +269,6 @@ class TestCommand : public CHIPCommand
261
269
chip::Optional<uint64_t > mDelayInMs ;
262
270
chip::Optional<char *> mPICSFilePath ;
263
271
chip::Optional<chip::EndpointId> mEndpointId ;
272
+ chip::Optional<uint16_t > mTimeout ;
264
273
chip::Optional<std::map<std::string, bool >> PICS;
265
274
};
0 commit comments