@@ -345,7 +345,7 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory
345
345
346
346
- (NSString *)description
347
347
{
348
- return [NSString stringWithFormat: @" <%@ : %p uuid %@ >" , NSStringFromClass (self .class ), self , self .uniqueIdentifier];
348
+ return [NSString stringWithFormat: @" <%@ : %p , uuid: %@ , suspended: %@ >" , NSStringFromClass (self .class ), self , self .uniqueIdentifier, MTR_YES_NO ( self .suspended) ];
349
349
}
350
350
351
351
- (BOOL )isRunning
@@ -823,6 +823,15 @@ - (BOOL)setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload
823
823
newNodeID : (NSNumber *)newNodeID
824
824
error : (NSError * __autoreleasing *)error
825
825
{
826
+ if (self.suspended ) {
827
+ MTR_LOG_ERROR (" %@ suspended: can't set up commissioning session for device ID 0x%016llX with setup payload %@" , self, newNodeID.unsignedLongLongValue , payload);
828
+ // TODO: Can we do a better error here?
829
+ if (error) {
830
+ *error = [MTRError errorForCHIPErrorCode: CHIP_ERROR_INCORRECT_STATE];
831
+ }
832
+ return NO ;
833
+ }
834
+
826
835
MTR_LOG (" Setting up commissioning session for device ID 0x%016llX with setup payload %@" , newNodeID.unsignedLongLongValue , payload);
827
836
828
837
[[MTRMetricsCollector sharedInstance ] resetMetrics ];
@@ -952,6 +961,15 @@ - (BOOL)commissionNodeWithID:(NSNumber *)nodeID
952
961
commissioningParams : (MTRCommissioningParameters *)commissioningParams
953
962
error : (NSError * __autoreleasing *)error
954
963
{
964
+ if (self.suspended ) {
965
+ MTR_LOG_ERROR (" %@ suspended: can't commission device ID 0x%016llX with paramaters %@" , self, nodeID.unsignedLongLongValue , commissioningParams);
966
+ // TODO: Can we do a better error here?
967
+ if (error) {
968
+ *error = [MTRError errorForCHIPErrorCode: CHIP_ERROR_INCORRECT_STATE];
969
+ }
970
+ return NO ;
971
+ }
972
+
955
973
auto block = ^BOOL {
956
974
chip::Controller::CommissioningParameters params;
957
975
if (commissioningParams.csrNonce ) {
0 commit comments