22
22
#include < controller/CommissioningWindowOpener.h>
23
23
#include < lib/support/CHIPMem.h>
24
24
25
+ class CommissioningWindowDelegate
26
+ {
27
+ public:
28
+ virtual void OnCommissioningWindowOpened (chip::NodeId deviceId, CHIP_ERROR err, chip::SetupPayload payload) = 0;
29
+ virtual ~CommissioningWindowDelegate () = default ;
30
+ };
31
+
25
32
class OpenCommissioningWindowCommand : public CHIPCommand
26
33
{
27
34
public:
@@ -31,6 +38,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand
31
38
mOnOpenBasicCommissioningWindowCallback (OnOpenBasicCommissioningWindowResponse, this )
32
39
{
33
40
AddArgument (" node-id" , 0 , UINT64_MAX, &mNodeId , " Node to send command to." );
41
+ AddArgument (" endpoint-id" , 0 , UINT16_MAX, &mEndpointId , " Endpoint to send command to." );
34
42
AddArgument (" option" , 0 , 2 , &mCommissioningWindowOption ,
35
43
" 1 to use Enhanced Commissioning Method.\n 0 to use Basic Commissioning Method." );
36
44
AddArgument (" window-timeout" , 0 , UINT16_MAX, &mCommissioningWindowTimeout ,
@@ -41,6 +49,9 @@ class OpenCommissioningWindowCommand : public CHIPCommand
41
49
AddArgument (" timeout" , 0 , UINT16_MAX, &mTimeout , " Time, in seconds, before this command is considered to have timed out." );
42
50
}
43
51
52
+ void RegisterDelegate (CommissioningWindowDelegate * delegate) { mDelegate = delegate; }
53
+ void UnregisterDelegate () { mDelegate = nullptr ; }
54
+
44
55
// ///////// CHIPCommand Interface /////////
45
56
CHIP_ERROR RunCommand () override ;
46
57
@@ -50,7 +61,9 @@ class OpenCommissioningWindowCommand : public CHIPCommand
50
61
51
62
private:
52
63
NodeId mNodeId ;
64
+ chip::EndpointId mEndpointId ;
53
65
chip::Controller::CommissioningWindowOpener::CommissioningWindowOption mCommissioningWindowOption ;
66
+ CommissioningWindowDelegate * mDelegate = nullptr ;
54
67
uint16_t mCommissioningWindowTimeout ;
55
68
uint32_t mIteration ;
56
69
uint16_t mDiscriminator ;
0 commit comments