From a2f1773e110d8da665c3650c5de5f690099529f3 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Oct 2024 16:50:55 -0400 Subject: [PATCH 01/39] When logging work items in MTRDevice_Concrete, include names, not just ids. (#35920) Makes it easier to tell what commands are being sent, and what attributes are being written. --- src/darwin/Framework/CHIP/MTRDevice_Concrete.mm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm index 5d6e47c8d9d781..125ced558eb961 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm @@ -2845,7 +2845,10 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) } }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ 0x%llx (%@) 0x%llx (%@)", + endpointID, + clusterID.unsignedLongLongValue, MTRClusterNameForID(static_cast(clusterID.unsignedLongLongValue)), + attributeID.unsignedLongLongValue, MTRAttributeNameForID(static_cast(clusterID.unsignedLongLongValue), static_cast(attributeID.unsignedLongLongValue))]; } else { [self _readThroughSkipped]; } @@ -2975,7 +2978,11 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID completion(MTRAsyncWorkComplete); }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ 0x%llx 0x%llx: %@", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue, value]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ 0x%llx (%@) 0x%llx (%@): %@", + endpointID, + clusterID.unsignedLongLongValue, MTRClusterNameForID(static_cast(clusterID.unsignedLongLongValue)), + attributeID.unsignedLongLongValue, MTRAttributeNameForID(static_cast(clusterID.unsignedLongLongValue), static_cast(attributeID.unsignedLongLongValue)), + value]; } - (NSArray *> *)readAttributePaths:(NSArray *)attributePaths @@ -3122,7 +3129,11 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID workDone(values, error); }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"invoke %@ 0x%llx 0x%llx: %@", endpointID, clusterID.unsignedLongLongValue, commandID.unsignedLongLongValue, commandFields]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"invoke %@ 0x%llx (%@) 0x%llx (%@): %@", + endpointID, + clusterID.unsignedLongLongValue, MTRClusterNameForID(static_cast(clusterID.unsignedLongLongValue)), + commandID.unsignedLongLongValue, MTRRequestCommandNameForID(static_cast(clusterID.unsignedLongLongValue), static_cast(commandID.unsignedLongLongValue)), + commandFields]; } - (void)openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode From cc28e0a9e1cc51929c0330309d356c4b11de5b0a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Oct 2024 17:39:35 -0400 Subject: [PATCH 02/39] Fix Matter.framework path descriptions to be more readable. (#35921) 1) For request paths, clearly mark wildcards instead of logging 0. 2) For all paths except command paths, when we have a value (cluster id, attribute id, event id) that we can find a string representation for, log that string representation. Command paths are a bit complicated because we have to know whether this is a request or a response and we don't have that information in MTRCommandPath at the moment. Will be done in a followup. --- src/darwin/Framework/CHIP/MTRBaseDevice.mm | 77 ++++++++++++++++++---- 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index 5975872589d409..f00c57a61be18c 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -2302,6 +2302,45 @@ - (void)deregisterReportHandlersWithClientQueue:(dispatch_queue_t)queue completi @end +static NSString * FormatPossiblyWildcardEndpoint(NSNumber * _Nullable possiblyWildcardEndpoint) +{ + if (possiblyWildcardEndpoint == nil) { + return @"wildcard"; + } + + return [NSString stringWithFormat:@"%u", possiblyWildcardEndpoint.unsignedShortValue]; +} + +static NSString * FormatPossiblyWildcardCluster(NSNumber * _Nullable possiblyWildcardCluster) +{ + if (possiblyWildcardCluster == nil) { + return @"wildcard"; + } + + return [NSString stringWithFormat:@"0x%llx (%llu, %@)", + possiblyWildcardCluster.unsignedLongLongValue, + possiblyWildcardCluster.unsignedLongLongValue, + MTRClusterNameForID(static_cast(possiblyWildcardCluster.unsignedLongLongValue))]; +} + +static NSString * FormatPossiblyWildcardClusterElement(NSNumber * _Nullable possiblyWildcardCluster, NSNumber * _Nullable possiblyWildcardElement, NSString * (^nameGetter)(MTRClusterIDType clusterID, NSNumber * elementID)) +{ + if (possiblyWildcardElement == nil) { + return @"wildcard"; + } + + if (possiblyWildcardCluster == nil) { + // We can't get a useful name for this, so just return the numeric + // value. + return [NSString stringWithFormat:@"0x%llx (%llu)", possiblyWildcardElement.unsignedLongLongValue, possiblyWildcardElement.unsignedLongLongValue]; + } + + return [NSString stringWithFormat:@"0x%llx (%llu, %@)", + possiblyWildcardElement.unsignedLongLongValue, + possiblyWildcardElement.unsignedLongLongValue, + nameGetter(static_cast(possiblyWildcardCluster.unsignedLongLongValue), possiblyWildcardElement)]; +} + @implementation MTRAttributeRequestPath - (instancetype)initWithEndpointID:(NSNumber * _Nullable)endpointID clusterID:(NSNumber * _Nullable)clusterID @@ -2315,9 +2354,12 @@ - (instancetype)initWithEndpointID:(NSNumber * _Nullable)endpointID - (NSString *)description { - return [NSString stringWithFormat:@"", - _endpoint.unsignedShortValue, _cluster.unsignedLongLongValue, _cluster.unsignedLongLongValue, - _attribute.unsignedLongLongValue, _attribute.unsignedLongLongValue]; + NSString * endpointStr = FormatPossiblyWildcardEndpoint(_endpoint); + NSString * clusterStr = FormatPossiblyWildcardCluster(_cluster); + NSString * attributeStr = FormatPossiblyWildcardClusterElement(_cluster, _attribute, ^(MTRClusterIDType clusterID, NSNumber * attributeID) { + return MTRAttributeNameForID(clusterID, static_cast(attributeID.unsignedLongLongValue)); + }); + return [NSString stringWithFormat:@"", endpointStr, clusterStr, attributeStr]; } + (MTRAttributeRequestPath *)requestPathWithEndpointID:(NSNumber * _Nullable)endpointID @@ -2439,9 +2481,12 @@ - (instancetype)initWithEndpointID:(NSNumber * _Nullable)endpointID - (NSString *)description { - return [NSString stringWithFormat:@"", - _endpoint.unsignedShortValue, _cluster.unsignedLongLongValue, _cluster.unsignedLongLongValue, - _event.unsignedLongLongValue, _event.unsignedLongLongValue]; + NSString * endpointStr = FormatPossiblyWildcardEndpoint(_endpoint); + NSString * clusterStr = FormatPossiblyWildcardCluster(_cluster); + NSString * eventStr = FormatPossiblyWildcardClusterElement(_cluster, _event, ^(MTRClusterIDType clusterID, NSNumber * eventID) { + return MTREventNameForID(clusterID, static_cast(eventID.unsignedLongLongValue)); + }); + return [NSString stringWithFormat:@"", endpointStr, clusterStr, eventStr]; } + (MTREventRequestPath *)requestPathWithEndpointID:(NSNumber * _Nullable)endpointID @@ -2561,8 +2606,9 @@ - (instancetype)initWithPath:(const ConcreteClusterPath &)path - (NSString *)description { - return [NSString stringWithFormat:@"", _endpoint.unsignedShortValue, - _cluster.unsignedLongLongValue, _cluster.unsignedLongLongValue]; + return [NSString stringWithFormat:@"", _endpoint.unsignedShortValue, + _cluster.unsignedLongLongValue, _cluster.unsignedLongLongValue, + MTRClusterNameForID(static_cast(_cluster.unsignedLongLongValue))]; } + (MTRClusterPath *)clusterPathWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID @@ -2646,9 +2692,11 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path - (NSString *)description { - return [NSString stringWithFormat:@"", - self.endpoint.unsignedShortValue, self.cluster.unsignedLongLongValue, self.cluster.unsignedLongLongValue, - _attribute.unsignedLongLongValue, _attribute.unsignedLongLongValue]; + return [NSString stringWithFormat:@"", + self.endpoint.unsignedShortValue, + self.cluster.unsignedLongLongValue, self.cluster.unsignedLongLongValue, MTRClusterNameForID(static_cast(self.cluster.unsignedLongLongValue)), + _attribute.unsignedLongLongValue, _attribute.unsignedLongLongValue, + MTRAttributeNameForID(static_cast(self.cluster.unsignedLongLongValue), static_cast(_attribute.unsignedLongLongValue))]; } + (MTRAttributePath *)attributePathWithEndpointID:(NSNumber *)endpointID @@ -2743,8 +2791,11 @@ - (instancetype)initWithPath:(const ConcreteEventPath &)path - (NSString *)description { return - [NSString stringWithFormat:@"", self.endpoint.unsignedShortValue, - self.cluster.unsignedLongLongValue, self.cluster.unsignedLongLongValue, _event.unsignedLongLongValue, _event.unsignedLongLongValue]; + [NSString stringWithFormat:@"", + self.endpoint.unsignedShortValue, + self.cluster.unsignedLongLongValue, self.cluster.unsignedLongLongValue, MTRClusterNameForID(static_cast(self.cluster.unsignedLongLongValue)), + _event.unsignedLongLongValue, _event.unsignedLongLongValue, + MTREventNameForID(static_cast(self.cluster.unsignedLongLongValue), static_cast(_event.unsignedLongLongValue))]; } + (MTREventPath *)eventPathWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID eventID:(NSNumber *)eventID From 213bf23f10760e88b943bcf28ebe9d19431a0244 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Oct 2024 18:26:37 -0400 Subject: [PATCH 03/39] Fix formatting of unknown IDs in MTRClusterNames bits. (#35922) IDs are unsigned; we should not be formatting them with %d, because for vendor-prefixed ones that might make them look negative. --- .../CHIP/templates/MTRClusterNames-src.zapt | 14 +- .../CHIP/zap-generated/MTRClusterNames.mm | 970 +++++++++--------- 2 files changed, 492 insertions(+), 492 deletions(-) diff --git a/src/darwin/Framework/CHIP/templates/MTRClusterNames-src.zapt b/src/darwin/Framework/CHIP/templates/MTRClusterNames-src.zapt index 59281604dc00e0..3ec7fe0b8ad427 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusterNames-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusterNames-src.zapt @@ -23,7 +23,7 @@ NSString * MTRClusterNameForID(MTRClusterIDType clusterID) {{/zcl_clusters}} default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -72,7 +72,7 @@ NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType {{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -80,7 +80,7 @@ NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType {{/zcl_clusters}} default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -119,7 +119,7 @@ NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType {{> commandIDs clusterName=label}} default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -127,7 +127,7 @@ NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType {{/zcl_clusters}} default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -183,7 +183,7 @@ NSString * MTREventNameForID(MTRClusterIDType clusterID, MTREventIDType eventID) {{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -191,7 +191,7 @@ NSString * MTREventNameForID(MTRClusterIDType clusterID, MTREventIDType eventID) {{/zcl_clusters}} default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index dff1198510af80..b9be1f665de912 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -389,7 +389,7 @@ break; default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -442,7 +442,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -481,7 +481,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -536,7 +536,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -627,7 +627,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -662,7 +662,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -717,7 +717,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -756,7 +756,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -819,7 +819,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -866,7 +866,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -993,7 +993,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1028,7 +1028,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1079,7 +1079,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1122,7 +1122,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1169,7 +1169,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1208,7 +1208,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1247,7 +1247,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1410,7 +1410,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1485,7 +1485,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1564,7 +1564,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1599,7 +1599,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1670,7 +1670,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -1721,7 +1721,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2008,7 +2008,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2095,7 +2095,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2166,7 +2166,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2253,7 +2253,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2356,7 +2356,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2403,7 +2403,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2450,7 +2450,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2509,7 +2509,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2560,7 +2560,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2599,7 +2599,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2638,7 +2638,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2677,7 +2677,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2752,7 +2752,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2799,7 +2799,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2858,7 +2858,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2909,7 +2909,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -2952,7 +2952,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3011,7 +3011,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3062,7 +3062,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3113,7 +3113,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3164,7 +3164,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3207,7 +3207,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3250,7 +3250,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3309,7 +3309,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3356,7 +3356,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3407,7 +3407,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3446,7 +3446,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3533,7 +3533,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3584,7 +3584,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3627,7 +3627,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3698,7 +3698,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3757,7 +3757,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3816,7 +3816,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3863,7 +3863,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3922,7 +3922,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -3981,7 +3981,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4048,7 +4048,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4127,7 +4127,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4238,7 +4238,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4297,7 +4297,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4356,7 +4356,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4423,7 +4423,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4466,7 +4466,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4533,7 +4533,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4660,7 +4660,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4715,7 +4715,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4758,7 +4758,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4809,7 +4809,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4860,7 +4860,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -4911,7 +4911,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5126,7 +5126,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5249,7 +5249,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5308,7 +5308,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5435,7 +5435,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5710,7 +5710,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5793,7 +5793,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -5840,7 +5840,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6083,7 +6083,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6174,7 +6174,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6229,7 +6229,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6280,7 +6280,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6351,7 +6351,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6402,7 +6402,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6453,7 +6453,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6544,7 +6544,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6623,7 +6623,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6702,7 +6702,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6781,7 +6781,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6860,7 +6860,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -6939,7 +6939,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7018,7 +7018,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7097,7 +7097,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7176,7 +7176,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7255,7 +7255,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7334,7 +7334,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7377,7 +7377,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7436,7 +7436,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7483,7 +7483,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7526,7 +7526,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7573,7 +7573,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7616,7 +7616,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7695,7 +7695,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7738,7 +7738,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7773,7 +7773,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7808,7 +7808,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7851,7 +7851,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7894,7 +7894,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -7937,7 +7937,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8004,7 +8004,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8039,7 +8039,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8106,7 +8106,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8141,7 +8141,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8180,7 +8180,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8227,7 +8227,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8270,7 +8270,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8309,7 +8309,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8700,7 +8700,7 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; @@ -8739,13 +8739,13 @@ break; default: - result = [NSString stringWithFormat:@"", attributeID]; + result = [NSString stringWithFormat:@"", attributeID]; break; } break; default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -8773,7 +8773,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8807,7 +8807,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8841,7 +8841,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8887,7 +8887,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8897,7 +8897,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8907,7 +8907,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8917,7 +8917,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8931,7 +8931,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8989,7 +8989,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -8999,7 +8999,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9021,7 +9021,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9035,7 +9035,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9045,7 +9045,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9055,7 +9055,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9065,7 +9065,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9075,7 +9075,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9085,7 +9085,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9111,7 +9111,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9149,7 +9149,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9163,7 +9163,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9185,7 +9185,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9199,7 +9199,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9213,7 +9213,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9227,7 +9227,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9241,7 +9241,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9271,7 +9271,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9285,7 +9285,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9295,7 +9295,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9317,7 +9317,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9359,7 +9359,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9385,7 +9385,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9395,7 +9395,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9405,7 +9405,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9415,7 +9415,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9437,7 +9437,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9463,7 +9463,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9489,7 +9489,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9503,7 +9503,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9513,7 +9513,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9527,7 +9527,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9541,7 +9541,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9555,7 +9555,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9565,7 +9565,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9579,7 +9579,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9593,7 +9593,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9607,7 +9607,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9617,7 +9617,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9631,7 +9631,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9641,7 +9641,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9655,7 +9655,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9673,7 +9673,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9683,7 +9683,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9701,7 +9701,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9727,7 +9727,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9749,7 +9749,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9791,7 +9791,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9805,7 +9805,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9819,7 +9819,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9837,7 +9837,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9855,7 +9855,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9865,7 +9865,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9875,7 +9875,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9893,7 +9893,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9923,7 +9923,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9941,7 +9941,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -9983,7 +9983,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10021,7 +10021,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10031,7 +10031,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10041,7 +10041,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10055,7 +10055,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10069,7 +10069,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10083,7 +10083,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10177,7 +10177,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10215,7 +10215,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10233,7 +10233,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10243,7 +10243,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10281,7 +10281,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10295,7 +10295,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10305,7 +10305,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10391,7 +10391,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10401,7 +10401,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10411,7 +10411,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10421,7 +10421,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10431,7 +10431,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10441,7 +10441,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10451,7 +10451,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10461,7 +10461,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10471,7 +10471,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10481,7 +10481,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10491,7 +10491,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10501,7 +10501,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10511,7 +10511,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10521,7 +10521,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10531,7 +10531,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10541,7 +10541,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10551,7 +10551,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10561,7 +10561,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10575,7 +10575,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10601,7 +10601,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10623,7 +10623,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10633,7 +10633,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10667,7 +10667,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10681,7 +10681,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10747,7 +10747,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10773,7 +10773,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10787,7 +10787,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10801,7 +10801,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10819,7 +10819,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10837,7 +10837,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10859,7 +10859,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10869,7 +10869,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10891,7 +10891,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10941,7 +10941,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10955,7 +10955,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10985,7 +10985,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -10999,7 +10999,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11009,7 +11009,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11027,7 +11027,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11145,7 +11145,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11163,13 +11163,13 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -11187,7 +11187,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11213,7 +11213,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11223,7 +11223,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11233,7 +11233,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11243,7 +11243,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11253,7 +11253,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11263,7 +11263,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11277,7 +11277,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11287,7 +11287,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11297,7 +11297,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11315,7 +11315,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11325,7 +11325,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11335,7 +11335,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11345,7 +11345,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11355,7 +11355,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11365,7 +11365,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11375,7 +11375,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11401,7 +11401,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11427,7 +11427,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11441,7 +11441,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11459,7 +11459,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11469,7 +11469,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11479,7 +11479,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11489,7 +11489,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11499,7 +11499,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11513,7 +11513,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11523,7 +11523,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11533,7 +11533,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11543,7 +11543,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11569,7 +11569,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11587,7 +11587,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11597,7 +11597,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11607,7 +11607,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11617,7 +11617,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11635,7 +11635,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11645,7 +11645,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11659,7 +11659,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11673,7 +11673,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11683,7 +11683,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11693,7 +11693,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11707,7 +11707,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11721,7 +11721,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11731,7 +11731,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11745,7 +11745,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11759,7 +11759,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11769,7 +11769,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11779,7 +11779,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11793,7 +11793,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11803,7 +11803,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11813,7 +11813,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11823,7 +11823,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11833,7 +11833,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11843,7 +11843,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11857,7 +11857,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11871,7 +11871,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11909,7 +11909,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11919,7 +11919,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11929,7 +11929,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11939,7 +11939,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11949,7 +11949,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11959,7 +11959,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11969,7 +11969,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11979,7 +11979,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11989,7 +11989,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -11999,7 +11999,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12009,7 +12009,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12023,7 +12023,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12033,7 +12033,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12043,7 +12043,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12057,7 +12057,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12071,7 +12071,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12085,7 +12085,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12119,7 +12119,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12129,7 +12129,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12147,7 +12147,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12157,7 +12157,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12175,7 +12175,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12185,7 +12185,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12195,7 +12195,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12205,7 +12205,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12215,7 +12215,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12225,7 +12225,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12235,7 +12235,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12245,7 +12245,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12255,7 +12255,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12265,7 +12265,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12275,7 +12275,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12285,7 +12285,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12295,7 +12295,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12305,7 +12305,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12315,7 +12315,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12325,7 +12325,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12335,7 +12335,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12345,7 +12345,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12355,7 +12355,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12365,7 +12365,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12375,7 +12375,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12389,7 +12389,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12403,7 +12403,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12417,7 +12417,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12427,7 +12427,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12445,7 +12445,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12459,7 +12459,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12473,7 +12473,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12483,7 +12483,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12493,7 +12493,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12507,7 +12507,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12521,7 +12521,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12531,7 +12531,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12545,7 +12545,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12555,7 +12555,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12569,7 +12569,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12583,7 +12583,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12597,7 +12597,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12615,7 +12615,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12625,7 +12625,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12635,7 +12635,7 @@ switch (commandID) { default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12649,7 +12649,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12723,7 +12723,7 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; @@ -12737,13 +12737,13 @@ break; default: - result = [NSString stringWithFormat:@"", commandID]; + result = [NSString stringWithFormat:@"", commandID]; break; } break; default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } @@ -12763,7 +12763,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12773,7 +12773,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12783,7 +12783,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12793,7 +12793,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12803,7 +12803,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12813,7 +12813,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12823,7 +12823,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12846,7 +12846,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12865,7 +12865,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12892,7 +12892,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12902,7 +12902,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12925,7 +12925,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12935,7 +12935,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12945,7 +12945,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12955,7 +12955,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12965,7 +12965,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12988,7 +12988,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -12998,7 +12998,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13008,7 +13008,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13018,7 +13018,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13045,7 +13045,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13060,7 +13060,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13079,7 +13079,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13102,7 +13102,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13112,7 +13112,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13143,7 +13143,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13174,7 +13174,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13213,7 +13213,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13223,7 +13223,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13233,7 +13233,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13243,7 +13243,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13253,7 +13253,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13263,7 +13263,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13278,7 +13278,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13288,7 +13288,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13298,7 +13298,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13317,7 +13317,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13327,7 +13327,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13337,7 +13337,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13347,7 +13347,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13357,7 +13357,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13367,7 +13367,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13377,7 +13377,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13387,7 +13387,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13397,7 +13397,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13407,7 +13407,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13422,7 +13422,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13432,7 +13432,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13442,7 +13442,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13497,7 +13497,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13512,7 +13512,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13522,7 +13522,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13532,7 +13532,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13551,7 +13551,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13570,7 +13570,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13580,7 +13580,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13590,7 +13590,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13600,7 +13600,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13619,7 +13619,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13638,7 +13638,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13653,7 +13653,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13672,7 +13672,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13691,7 +13691,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13706,7 +13706,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13729,7 +13729,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13756,7 +13756,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13791,7 +13791,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13801,7 +13801,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13811,7 +13811,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13821,7 +13821,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13831,7 +13831,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13841,7 +13841,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13872,7 +13872,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13882,7 +13882,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13892,7 +13892,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13971,7 +13971,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13981,7 +13981,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -13991,7 +13991,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14001,7 +14001,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14011,7 +14011,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14021,7 +14021,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14031,7 +14031,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14041,7 +14041,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14051,7 +14051,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14061,7 +14061,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14071,7 +14071,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14086,7 +14086,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14096,7 +14096,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14106,7 +14106,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14116,7 +14116,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14126,7 +14126,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14136,7 +14136,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14146,7 +14146,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14156,7 +14156,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14166,7 +14166,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14176,7 +14176,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14186,7 +14186,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14196,7 +14196,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14206,7 +14206,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14216,7 +14216,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14226,7 +14226,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14236,7 +14236,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14251,7 +14251,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14266,7 +14266,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14276,7 +14276,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14286,7 +14286,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14296,7 +14296,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14306,7 +14306,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14316,7 +14316,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14326,7 +14326,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14336,7 +14336,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14351,7 +14351,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14366,7 +14366,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14376,7 +14376,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14386,7 +14386,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14396,7 +14396,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14406,7 +14406,7 @@ switch (eventID) { default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14421,7 +14421,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14444,7 +14444,7 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; @@ -14459,13 +14459,13 @@ break; default: - result = [NSString stringWithFormat:@"", eventID]; + result = [NSString stringWithFormat:@"", eventID]; break; } break; default: - result = [NSString stringWithFormat:@"", clusterID]; + result = [NSString stringWithFormat:@"", clusterID]; break; } From 641103f33acd8e17a191e150e06e21725c59dd9d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Oct 2024 19:30:45 -0400 Subject: [PATCH 04/39] Fix some error messages when XPC exceptions happen. (#35923) Things got a bit too copy/pasted. --- src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index 45c675121e3675..038be7934c1196 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -64,7 +64,7 @@ - (void)_unregisterNodeID:(NSNumber *)nodeID MTR_LOG_ERROR("Unregister node error: %@ nodeID: %@", error, nodeID); }] deviceController:self.uniqueIdentifier unregisterNodeID:nodeID]; } @catch (NSException * exception) { - MTR_LOG_ERROR("Exception registering nodeID: %@", exception); + MTR_LOG_ERROR("Exception unregistering nodeID: %@", exception); } } @@ -78,7 +78,7 @@ - (void)_checkinWithContext:(NSDictionary *)context MTR_LOG_ERROR("Checkin error: %@", error); }] deviceController:self.uniqueIdentifier checkInWithContext:context]; } @catch (NSException * exception) { - MTR_LOG_ERROR("Exception registering nodeID: %@", exception); + MTR_LOG_ERROR("Exception checking in with context: %@", exception); } } From 89f78ca5f1ad1b70887ed6c04633be9d16115d45 Mon Sep 17 00:00:00 2001 From: Philip Gregor <147669098+pgregorr-amazon@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:53:00 -0700 Subject: [PATCH 05/39] tv-casting-app fix load stale binding endpoints from un-needed fabrics (#35907) * tv-casting-app fix loading stale binding endpoints from un-needed fabrics * Fixing style issues * Addressed comments by sharadb-amazon * Addressed comments by sharadb-amazon 2 * Addressed comments by sharadb-amazon 3 --- .../linux/simple-app-helper.cpp | 3 ++ .../tv-casting-common/core/CastingPlayer.cpp | 4 +- .../tv-casting-common/core/Endpoint.h | 7 +--- .../support/CastingStore.cpp | 26 ++++++++---- .../support/ChipDeviceEventHandler.cpp | 20 +++++---- .../support/EndpointListLoader.cpp | 42 ++++++++++++++----- 6 files changed, 67 insertions(+), 35 deletions(-) diff --git a/examples/tv-casting-app/linux/simple-app-helper.cpp b/examples/tv-casting-app/linux/simple-app-helper.cpp index 115fe9f7869fc9..4bdf660bd5bda9 100644 --- a/examples/tv-casting-app/linux/simple-app-helper.cpp +++ b/examples/tv-casting-app/linux/simple-app-helper.cpp @@ -450,6 +450,9 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) targetCastingPlayer->VerifyOrEstablishConnection(connectionCallbacks, matter::casting::core::kCommissioningWindowTimeoutSec, idOptions); + ChipLogProgress(AppServer, "CommandHandler() request, VerifyOrEstablishConnection() called, calling StopDiscovery()"); + // Stop discovery since we have discovered, and are now connecting to the desired CastingPlayer. + matter::casting::core::CastingPlayerDiscovery::GetInstance()->StopDiscovery(); return CHIP_NO_ERROR; } if (strcmp(argv[0], "setcommissionerpasscode") == 0) diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp index 83fc6b4b563a9e..37d442f7142aa2 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp @@ -380,10 +380,10 @@ chip::Inet::IPAddress * CastingPlayer::GetIpAddressForUDCRequest() void CastingPlayer::FindOrEstablishSession(void * clientContext, chip::OnDeviceConnected onDeviceConnected, chip::OnDeviceConnectionFailure onDeviceConnectionFailure) { - ChipLogProgress(AppServer, "CastingPlayer.FindOrEstablishSession called on nodeId=0x" ChipLogFormatX64 " fabricIndex=%d", + ChipLogProgress(AppServer, "CastingPlayer::FindOrEstablishSession() called on nodeId=0x" ChipLogFormatX64 " fabricIndex=%d", ChipLogValueX64(mAttributes.nodeId), mAttributes.fabricIndex); VerifyOrReturn(mAttributes.nodeId != 0 && mAttributes.fabricIndex != 0, - ChipLogError(AppServer, "CastingPlayer.FindOrEstablishSession called on invalid nodeId/fabricIndex")); + ChipLogError(AppServer, "CastingPlayer::FindOrEstablishSession() called on invalid nodeId/fabricIndex")); ConnectionContext * connectionContext = new ConnectionContext(clientContext, this, onDeviceConnected, onDeviceConnectionFailure); diff --git a/examples/tv-casting-app/tv-casting-common/core/Endpoint.h b/examples/tv-casting-app/tv-casting-common/core/Endpoint.h index 734f1e3d5ae140..85e67dbfe95ade 100644 --- a/examples/tv-casting-app/tv-casting-common/core/Endpoint.h +++ b/examples/tv-casting-app/tv-casting-common/core/Endpoint.h @@ -105,7 +105,6 @@ class Endpoint : public std::enable_shared_from_this */ std::vector GetServerList() { - ChipLogProgress(AppServer, "Endpoint::GetServerList() mClusters.size(): %d", static_cast(mClusters.size())); std::vector serverList; for (auto const & cluster : mClusters) { @@ -123,7 +122,6 @@ class Endpoint : public std::enable_shared_from_this template void RegisterCluster(const chip::ClusterId clusterId) { - ChipLogProgress(AppServer, "Endpoint::RegisterCluster() Registering clusterId %d for endpointId %d", clusterId, GetId()); static_assert(std::is_base_of::value, "T must be derived from BaseCluster"); auto cluster = std::make_shared(shared_from_this()); cluster->SetUp(); @@ -137,7 +135,6 @@ class Endpoint : public std::enable_shared_from_this memory::Strong GetCluster() { static_assert(std::is_base_of::value, "T must be derived from BaseCluster"); - ChipLogProgress(AppServer, "Endpoint::GetCluster() mClusters.size(): %d", static_cast(mClusters.size())); for (const auto & pair : mClusters) { auto cluster = std::dynamic_pointer_cast(pair.second); @@ -151,8 +148,8 @@ class Endpoint : public std::enable_shared_from_this void LogDetail() const { - ChipLogProgress(AppServer, "Endpoint::LogDetail() Endpoint ID: %d, Vendor ID: %d, Product ID: %d", mAttributes.mId, - mAttributes.mVendorId, mAttributes.mProductId); + ChipLogProgress(AppServer, "Endpoint::LogDetail() Endpoint ID: %d, Vendor ID: %d, Product ID: %d, Clusters: %d", + mAttributes.mId, mAttributes.mVendorId, mAttributes.mProductId, static_cast(mClusters.size())); } }; diff --git a/examples/tv-casting-app/tv-casting-common/support/CastingStore.cpp b/examples/tv-casting-app/tv-casting-common/support/CastingStore.cpp index 93bd00616dac6c..1ddf40a9b27abc 100644 --- a/examples/tv-casting-app/tv-casting-common/support/CastingStore.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/CastingStore.cpp @@ -78,8 +78,9 @@ std::vector CastingStore::ReadAll() size_t castingStoreDataSize = 0; err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Get(kCastingStoreDataKey, castingStoreData, kCastingStoreDataMaxBytes, &castingStoreDataSize); - VerifyOrReturnValue(err == CHIP_NO_ERROR, std::vector(), - ChipLogError(AppServer, "KeyValueStoreMgr.Get failed %" CHIP_ERROR_FORMAT, err.Format())); + VerifyOrReturnValue( + err == CHIP_NO_ERROR, std::vector(), + ChipLogError(AppServer, "CastingStore::ReadAll() KeyValueStoreMgr.Get failed %" CHIP_ERROR_FORMAT, err.Format())); ChipLogProgress(AppServer, "CastingStore::ReadAll() Read TLV(CastingStoreData) from KVS store with size: %lu bytes", static_cast(castingStoreDataSize)); @@ -252,6 +253,9 @@ std::vector CastingStore::ReadAll() if (endpointContainerTagNum == kCastingPlayerEndpointIdTag) { err = reader.Get(endpointAttributes.mId); + // Log which endpoints we cached. + ChipLogProgress(AppServer, "CastingStore::ReadAll() Endpoints container endpointAttributes.mId: %d", + endpointAttributes.mId); VerifyOrReturnValue(err == CHIP_NO_ERROR, std::vector(), ChipLogError(AppServer, "TLVReader.Get failed %" CHIP_ERROR_FORMAT, err.Format())); continue; @@ -475,7 +479,7 @@ CHIP_ERROR CastingStore::WriteAll(std::vector castingPlayer for (auto & castingPlayer : castingPlayers) { - ChipLogProgress(AppServer, "CastingStore::WriteAll() writing castingPlayer:"); + ChipLogProgress(AppServer, "CastingStore::WriteAll() writing CastingPlayer:"); chip::TLV::TLVType castingPlayerContainerType; // CastingPlayer container starts ReturnErrorOnFailure( @@ -547,7 +551,8 @@ CHIP_ERROR CastingStore::WriteAll(std::vector castingPlayer ReturnErrorOnFailure(tlvWriter.StartContainer(chip::TLV::ContextTag(kCastingPlayerEndpointServerListContainerTag), chip::TLV::kTLVType_Structure, serverListContainerType)); std::vector serverList = endpoint->GetServerList(); - ChipLogProgress(AppServer, "CastingStore::WriteAll() writing CastingPlayer Endpoint ServerList:"); + ChipLogProgress(AppServer, "CastingStore::WriteAll() writing CastingPlayer Endpoint ID: %d ServerList.size(): %d", + endpoint->GetId(), static_cast(serverList.size())); for (chip::ClusterId clusterId : serverList) { ChipLogProgress(AppServer, "CastingStore::WriteAll() clusterId: %d", clusterId); @@ -586,7 +591,7 @@ CHIP_ERROR CastingStore::DeleteAll() CHIP_ERROR err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Delete(kCastingStoreDataKey); if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) // no error, if the key-value pair was not stored { - ChipLogProgress(AppServer, "CastingStore::DeleteAll ignoring error %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogProgress(AppServer, "CastingStore::DeleteAll() ignoring error %" CHIP_ERROR_FORMAT, err.Format()); return CHIP_NO_ERROR; } return err; @@ -594,7 +599,7 @@ CHIP_ERROR CastingStore::DeleteAll() CHIP_ERROR CastingStore::Delete(core::CastingPlayer castingPlayer) { - ChipLogProgress(AppServer, "CastingStore::Delete"); + ChipLogProgress(AppServer, "CastingStore::Delete()"); // Read cache of CastingPlayers std::vector castingPlayers = ReadAll(); @@ -608,7 +613,7 @@ CHIP_ERROR CastingStore::Delete(core::CastingPlayer castingPlayer) if (it != castingPlayers.end()) { - ChipLogProgress(AppServer, "CastingStore::Delete deleting CastingPlayer %s from CastingStore cache", it->GetId()); + ChipLogProgress(AppServer, "CastingStore::Delete() deleting CastingPlayer %s from CastingStore cache", it->GetId()); castingPlayers.erase(it); return WriteAll(castingPlayers); } @@ -618,7 +623,7 @@ CHIP_ERROR CastingStore::Delete(core::CastingPlayer castingPlayer) void CastingStore::OnFabricRemoved(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) { - ChipLogProgress(AppServer, "CastingStore::OnFabricRemoved"); + ChipLogProgress(AppServer, "CastingStore::OnFabricRemoved()"); // Read cache of CastingPlayers std::vector castingPlayers = ReadAll(); @@ -633,12 +638,15 @@ void CastingStore::OnFabricRemoved(const chip::FabricTable & fabricTable, chip:: if (it != castingPlayers.end()) { - ChipLogProgress(AppServer, "CastingStore::OnFabricRemoved deleting CastingPlayer %s from CastingStore cache", + ChipLogProgress(AppServer, "CastingStore::OnFabricRemoved() deleting CastingPlayer %s from CastingStore cache", it->GetId()); castingPlayers.erase(it); WriteAll(castingPlayers); } } + CHIP_ERROR err = chip::Server::GetInstance().GetSessionResumptionStorage()->DeleteAll(fabricIndex); + ChipLogProgress(AppServer, "CastingStore::OnFabricRemoved() SessionResumptionStorage.DeleteAll(%d) status %" CHIP_ERROR_FORMAT, + fabricIndex, err.Format()); } }; // namespace support diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp index cf8ca82366a7bb..f027c8d1c477df 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp @@ -62,6 +62,7 @@ void ChipDeviceEventHandler::Handle(const chip::DeviceLayer::ChipDeviceEvent * e CastingPlayer::GetTargetCastingPlayer()->SetNodeId(targetNodeId); CastingPlayer::GetTargetCastingPlayer()->SetFabricIndex(targetFabricIndex); + ChipLogProgress(AppServer, "ChipDeviceEventHandler::Handle() calling FindOrEstablishSession()"); CastingPlayer::GetTargetCastingPlayer()->FindOrEstablishSession( nullptr, [](void * context, chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle) { @@ -144,12 +145,12 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL bool & runPostCommissioning, chip::NodeId & targetNodeId, chip::FabricIndex & targetFabricIndex) { - ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster called"); + ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() called"); if (CastingPlayer::GetTargetCastingPlayer()->IsConnected()) { // re-use existing nodeId and fabricIndex - ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster already connected to video player"); + ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() already connected to video player"); runPostCommissioning = true; targetNodeId = CastingPlayer::GetTargetCastingPlayer()->GetNodeId(); targetFabricIndex = CastingPlayer::GetTargetCastingPlayer()->GetFabricIndex(); @@ -159,7 +160,7 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL else if (sUdcInProgress) { ChipLogProgress(AppServer, - "ChipDeviceEventHandler::HandleBindingsChangedViaCluster UDC is in progress while handling " + "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() UDC is in progress while handling " "kBindingsChangedViaCluster with " "fabricIndex: %d", event->BindingsChanged.fabricIndex); @@ -170,7 +171,7 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL for (const auto & binding : chip::BindingTable::GetInstance()) { ChipLogProgress(AppServer, - "ChipDeviceEventHandler::HandleBindingsChangedViaCluster Read cached binding type=%d fabrixIndex=%d " + "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() Read cached binding type=%d fabrixIndex=%d " "nodeId=0x" ChipLogFormatX64 " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, @@ -178,7 +179,7 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL if (binding.type == MATTER_UNICAST_BINDING && event->BindingsChanged.fabricIndex == binding.fabricIndex) { ChipLogProgress(AppServer, - "ChipDeviceEventHandler::HandleBindingsChangedViaCluster Matched accessingFabricIndex with " + "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() Matched accessingFabricIndex with " "nodeId=0x" ChipLogFormatX64, ChipLogValueX64(binding.nodeId)); targetNodeId = binding.nodeId; @@ -190,9 +191,10 @@ void ChipDeviceEventHandler::HandleBindingsChangedViaCluster(const chip::DeviceL if (targetNodeId == 0 && runPostCommissioning == false) { - ChipLogError(AppServer, - "ChipDeviceEventHandler::HandleBindingsChangedViaCluster accessingFabricIndex: %d did not match bindings", - event->BindingsChanged.fabricIndex); + ChipLogError( + AppServer, + "ChipDeviceEventHandler::HandleBindingsChangedViaCluster() accessingFabricIndex: %d did not match bindings", + event->BindingsChanged.fabricIndex); CastingPlayer::GetTargetCastingPlayer()->mOnCompleted(CHIP_ERROR_INCORRECT_STATE, CastingPlayer::GetTargetCastingPlayer()); return; @@ -204,7 +206,7 @@ void ChipDeviceEventHandler::HandleCommissioningComplete(const chip::DeviceLayer bool & runPostCommissioning, chip::NodeId & targetNodeId, chip::FabricIndex & targetFabricIndex) { - ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleCommissioningComplete called"); + ChipLogProgress(AppServer, "ChipDeviceEventHandler::HandleCommissioningComplete() called"); sUdcInProgress = false; targetNodeId = event->CommissioningComplete.nodeId; targetFabricIndex = event->CommissioningComplete.fabricIndex; diff --git a/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp b/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp index 44e76f628b5a18..a54c4ddc59debf 100644 --- a/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/EndpointListLoader.cpp @@ -51,9 +51,17 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM mExchangeMgr = exchangeMgr; mSessionHandle = sessionHandle; + chip::NodeId targetCastingPlayerNodeId = CastingPlayer::GetTargetCastingPlayer()->GetNodeId(); + chip::FabricIndex targetCastingPlayerFabricIndex = CastingPlayer::GetTargetCastingPlayer()->GetFabricIndex(); + ChipLogProgress(AppServer, + "EndpointListLoader::Initialize() targetCastingPlayerNodeId: 0x" ChipLogFormatX64 + ", targetCastingPlayerFabricIndex: %d", + ChipLogValueX64(targetCastingPlayerNodeId), targetCastingPlayerFabricIndex); + for (const auto & binding : chip::BindingTable::GetInstance()) { - if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && targetCastingPlayerNodeId == binding.nodeId && + targetCastingPlayerFabricIndex == binding.fabricIndex) { // check to see if we discovered a new endpoint in the bindings chip::EndpointId endpointId = binding.remote; @@ -66,6 +74,8 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM } } } + ChipLogProgress(AppServer, "EndpointListLoader::Initialize() mNewEndpointsToLoad++, mNewEndpointsToLoad: %lu", + mNewEndpointsToLoad); mPendingAttributeReads = mNewEndpointsToLoad * kTotalDesiredAttributes; mEndpointAttributesList = new EndpointAttributes[mNewEndpointsToLoad]; @@ -78,16 +88,24 @@ CHIP_ERROR EndpointListLoader::Load() VerifyOrReturnError(CastingPlayer::GetTargetCastingPlayer() != nullptr, CHIP_ERROR_INCORRECT_STATE); + chip::NodeId targetCastingPlayerNodeId = CastingPlayer::GetTargetCastingPlayer()->GetNodeId(); + chip::FabricIndex targetCastingPlayerFabricIndex = CastingPlayer::GetTargetCastingPlayer()->GetFabricIndex(); + ChipLogProgress(AppServer, + "EndpointListLoader::Load() targetCastingPlayerNodeId: 0x" ChipLogFormatX64 + ", targetCastingPlayerFabricIndex: %d", + ChipLogValueX64(targetCastingPlayerNodeId), targetCastingPlayerFabricIndex); + int endpointIndex = -1; bool isLoadingRequired = false; for (const auto & binding : chip::BindingTable::GetInstance()) { ChipLogProgress(AppServer, - "Binding type=%d fab=%d nodeId=0x" ChipLogFormatX64 + "EndpointListLoader::Load() Binding type=%d fab=%d nodeId=0x" ChipLogFormatX64 " groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI, binding.type, binding.fabricIndex, ChipLogValueX64(binding.nodeId), binding.groupId, binding.local, binding.remote, ChipLogValueMEI(binding.clusterId.value_or(0))); - if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer()->GetNodeId() == binding.nodeId) + if (binding.type == MATTER_UNICAST_BINDING && targetCastingPlayerNodeId == binding.nodeId && + targetCastingPlayerFabricIndex == binding.fabricIndex) { // if we discovered a new Endpoint from the bindings, read its EndpointAttributes chip::EndpointId endpointId = binding.remote; @@ -98,7 +116,8 @@ CHIP_ERROR EndpointListLoader::Load() }) == endpoints.end()) { // Read attributes and mEndpointAttributesList for (endpointIndex + 1) - ChipLogProgress(AppServer, "EndpointListLoader::Load Reading attributes for endpointId %d", endpointId); + ChipLogProgress(AppServer, "EndpointListLoader::Load() Reading attributes for endpointId: %d, on fabricIndex: %d", + endpointId, binding.fabricIndex); isLoadingRequired = true; mEndpointAttributesList[++endpointIndex].mId = endpointId; ReadVendorId(&mEndpointAttributesList[endpointIndex]); @@ -121,7 +140,7 @@ CHIP_ERROR EndpointListLoader::Load() void EndpointListLoader::Complete() { - ChipLogProgress(AppServer, "EndpointListLoader::Complete called with mPendingAttributeReads %lu", mPendingAttributeReads); + ChipLogProgress(AppServer, "EndpointListLoader::Complete() called with mPendingAttributeReads: %lu", mPendingAttributeReads); if (mPendingAttributeReads > 0) { mPendingAttributeReads--; @@ -161,7 +180,7 @@ void EndpointListLoader::Complete() // callback client OnCompleted VerifyOrReturn(CastingPlayer::GetTargetCastingPlayer()->mOnCompleted, - ChipLogError(AppServer, "EndpointListLoader::Complete mOnCompleted() not found")); + ChipLogError(AppServer, "EndpointListLoader::Complete() mOnCompleted() not found")); CastingPlayer::GetTargetCastingPlayer()->mOnCompleted(CHIP_NO_ERROR, CastingPlayer::GetTargetCastingPlayer()); } } @@ -180,7 +199,8 @@ CHIP_ERROR EndpointListLoader::ReadVendorId(EndpointAttributes * endpointAttribu }, [](void * context, CHIP_ERROR err) { EndpointAttributes * _endpointAttributes = static_cast(context); - ChipLogError(AppServer, "EndpointListLoader ReadAttribute(VendorID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT, + ChipLogError(AppServer, + "EndpointListLoader::ReadAttribute(VendorID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT, _endpointAttributes->mId, err.Format()); EndpointListLoader::GetInstance()->Complete(); }); @@ -201,7 +221,7 @@ CHIP_ERROR EndpointListLoader::ReadProductId(EndpointAttributes * endpointAttrib [](void * context, CHIP_ERROR err) { EndpointAttributes * _endpointAttributes = static_cast(context); ChipLogError(AppServer, - "EndpointListLoader ReadAttribute(ProductID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT, + "EndpointListLoader::ReadAttribute(ProductID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT, _endpointAttributes->mId, err.Format()); EndpointListLoader::GetInstance()->Complete(); }); @@ -227,7 +247,7 @@ CHIP_ERROR EndpointListLoader::ReadDeviceTypeList(EndpointAttributes * endpointA [](void * context, CHIP_ERROR err) { EndpointAttributes * _endpointAttributes = static_cast(context); ChipLogError(AppServer, - "EndpointListLoader ReadAttribute(DeviceTypeList) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT, + "EndpointListLoader::ReadAttribute(DeviceTypeList) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT, _endpointAttributes->mId, err.Format()); EndpointListLoader::GetInstance()->Complete(); }); @@ -251,7 +271,9 @@ CHIP_ERROR EndpointListLoader::ReadServerList(std::vector * end EndpointListLoader::GetInstance()->Complete(); }, [](void * context, CHIP_ERROR err) { - ChipLogError(AppServer, "EndpointListLoader ReadAttribute(ServerList) failed. Err: %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(AppServer, + "EndpointListLoader::ReadServerList() ReadAttribute(ServerList) failed. Err: %" CHIP_ERROR_FORMAT, + err.Format()); EndpointListLoader::GetInstance()->Complete(); }); } From 425b53c5d4d7a3dab16b1dbf66b9d5a6d5862fbb Mon Sep 17 00:00:00 2001 From: Marcos B <15697303+gmarcosb@users.noreply.github.com> Date: Fri, 4 Oct 2024 23:42:54 -0600 Subject: [PATCH 06/39] Re-enerated using updated alchemy which recognizes Cameras domain (#35895) --- src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml index 42a538e7a065a9..379caa47ce6469 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chime-cluster.xml @@ -18,7 +18,7 @@ limitations under the License. XML generated by Alchemy; DO NOT EDIT. Source: src/app_clusters/Chime.adoc Parameters: in-progress -Git: 0.9-fall2024-225-g1da0e33be +Git: 0.9-fall2024-301-g4e2f0c1c4 --> @@ -29,7 +29,7 @@ Git: 0.9-fall2024-225-g1da0e33be - + Chime 0x0556 CHIME_CLUSTER From 5c9d4f9db1ec71a0b188e8a4de891c0af9783fcb Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Sat, 5 Oct 2024 15:31:26 -0400 Subject: [PATCH 07/39] Update Darwin availability annotations for new camera bits. (#35925) --- src/darwin/Framework/CHIP/templates/availability.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 0237acfb4635a7..fdf5c00538a3dd 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9753,6 +9753,9 @@ - WaterHeaterManagement - WaterHeaterMode - WiFiNetworkManagement + # Targeting Camera enablement + - Chime + - WebRTCTransportProvider attributes: AccessControl: # Targeting 1.4 @@ -9856,6 +9859,8 @@ - LandmarkTag - PositionTag - RelativePositionTag + # Targeting Camera enablement + - ThreeLevelAutoEnum enum values: ApplicationLauncher: StatusEnum: From ef0132bc778bfd597593c6c60f2cc7f4361ff7bc Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Sat, 5 Oct 2024 12:31:51 -0700 Subject: [PATCH 08/39] [Fabric-Sync] Fix compile warnings (#35927) --- examples/fabric-admin/device_manager/DeviceManager.cpp | 4 ++-- examples/fabric-admin/device_manager/DeviceManager.h | 6 +++--- examples/fabric-admin/rpc/RpcServer.cpp | 4 ++-- examples/fabric-bridge-app/linux/main.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index 4f7b1c77551e80..8acb5636f4f648 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -114,7 +114,7 @@ void DeviceManager::RemoveSyncedDevice(NodeId nodeId) ChipLogValueX64(device->GetNodeId()), device->GetEndpointId()); } -void DeviceManager::OpenDeviceCommissioningWindow(NodeId nodeId, uint32_t commissioningTimeoutSec, uint32_t iterations, +void DeviceManager::OpenDeviceCommissioningWindow(NodeId nodeId, uint32_t iterations, uint16_t commissioningTimeoutSec, uint16_t discriminator, const ByteSpan & salt, const ByteSpan & verifier) { ChipLogProgress(NotSpecified, "Opening commissioning window for Node ID: " ChipLogFormatX64, ChipLogValueX64(nodeId)); @@ -422,7 +422,7 @@ void DeviceManager::HandleReverseOpenCommissioningWindow(TLV::TLVReader & data) ChipLogProgress(NotSpecified, " PAKEPasscodeVerifier size: %lu", value.PAKEPasscodeVerifier.size()); ChipLogProgress(NotSpecified, " salt size: %lu", value.salt.size()); - OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.commissioningTimeout, value.iterations, value.discriminator, + OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.iterations, value.commissioningTimeout, value.discriminator, ByteSpan(value.salt.data(), value.salt.size()), ByteSpan(value.PAKEPasscodeVerifier.data(), value.PAKEPasscodeVerifier.size())); } diff --git a/examples/fabric-admin/device_manager/DeviceManager.h b/examples/fabric-admin/device_manager/DeviceManager.h index 5e43e78e3a8aed..1514c417be4b4d 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.h +++ b/examples/fabric-admin/device_manager/DeviceManager.h @@ -94,17 +94,17 @@ class DeviceManager : public PairingDelegate * This function initiates the process to open the commissioning window for a device identified by the given node ID. * * @param nodeId The ID of the node that should open the commissioning window. - * @param commissioningTimeoutSec The time in seconds before the commissioning window closes. This value determines - * how long the commissioning window remains open for incoming connections. * @param iterations The number of PBKDF (Password-Based Key Derivation Function) iterations to use * for deriving the PAKE (Password Authenticated Key Exchange) verifier. + * @param commissioningTimeoutSec The time in seconds before the commissioning window closes. This value determines + * how long the commissioning window remains open for incoming connections. * @param discriminator The device-specific discriminator, determined during commissioning, which helps * to uniquely identify the device among others. * @param salt The salt used in the cryptographic operations for commissioning. * @param verifier The PAKE verifier used to authenticate the commissioning process. * */ - void OpenDeviceCommissioningWindow(chip::NodeId nodeId, uint32_t commissioningTimeoutSec, uint32_t iterations, + void OpenDeviceCommissioningWindow(chip::NodeId nodeId, uint32_t iterations, uint16_t commissioningTimeoutSec, uint16_t discriminator, const chip::ByteSpan & salt, const chip::ByteSpan & verifier); /** diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index d68eb11786086e..8613d06c6f3d9f 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -101,9 +101,9 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate // TODO(#35875): OpenDeviceCommissioningWindow uses the same controller every time and doesn't currently accept // FabricIndex. For now we are dropping fabric index from the scoped node id. NodeId nodeId = request.id.node_id; - uint32_t commissioningTimeoutSec = request.commissioning_timeout; uint32_t iterations = request.iterations; uint16_t discriminator = request.discriminator; + uint16_t commissioningTimeoutSec = static_cast(request.commissioning_timeout); // Log the request details for debugging ChipLogProgress(NotSpecified, @@ -111,7 +111,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate static_cast(nodeId), commissioningTimeoutSec, iterations, discriminator); // Open the device commissioning window using raw binary data for salt and verifier - DeviceMgr().OpenDeviceCommissioningWindow(nodeId, commissioningTimeoutSec, iterations, discriminator, + DeviceMgr().OpenDeviceCommissioningWindow(nodeId, iterations, commissioningTimeoutSec, discriminator, ByteSpan(request.salt.bytes, request.salt.size), ByteSpan(request.verifier.bytes, request.verifier.size)); diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 3e93c9878f90da..a101fd3d32a91a 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -81,10 +81,10 @@ bool HandleCustomOption(const char * aProgram, ArgParser::OptionSet * aOptions, switch (aIdentifier) { case kOptionFabricAdminServerPortNumber: - gFabricAdminServerPort = atoi(aValue); + gFabricAdminServerPort = static_cast(atoi(aValue)); break; case kOptionLocalServerPortNumber: - gLocalServerPort = atoi(aValue); + gLocalServerPort = static_cast(atoi(aValue)); break; default: ArgParser::PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); From 45a68f88939dec2f2372a7e37abeeae627f81411 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Sun, 6 Oct 2024 19:39:53 -0700 Subject: [PATCH 09/39] Use ScheduleLambda() instead of PlatformMgr().ScheduleWork to excute command (#35926) * Use ScheduleLambda() instead of PlatformMgr().ScheduleWork to excute command * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../fabric-sync/FabricSyncCommand.cpp | 11 +- .../device_manager/PairingManager.cpp | 269 ++++++++---------- .../device_manager/PairingManager.h | 52 +--- 3 files changed, 129 insertions(+), 203 deletions(-) diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index c8d9f3da96b323..879d28cd156956 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -30,15 +30,6 @@ using namespace ::chip; -namespace { - -void CheckFabricBridgeSynchronizationSupport(intptr_t ignored) -{ - DeviceMgr().ReadSupportedDeviceCategories(); -} - -} // namespace - void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) { if (mBridgeNodeId != deviceId) @@ -73,7 +64,7 @@ void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_E // // Note: The Fabric-Admin MUST NOT send the RequestCommissioningApproval command // if the remote Fabric-Bridge lacks Fabric Synchronization support. - DeviceLayer::PlatformMgr().ScheduleWork(CheckFabricBridgeSynchronizationSupport, 0); + DeviceLayer::SystemLayer().ScheduleLambda([]() { DeviceMgr().ReadSupportedDeviceCategories(); }); } } else diff --git a/examples/fabric-admin/device_manager/PairingManager.cpp b/examples/fabric-admin/device_manager/PairingManager.cpp index c46a0ca000897b..41b4c8744e16b3 100644 --- a/examples/fabric-admin/device_manager/PairingManager.cpp +++ b/examples/fabric-admin/device_manager/PairingManager.cpp @@ -131,98 +131,97 @@ CHIP_ERROR PairingManager::OpenCommissioningWindow(NodeId nodeId, EndpointId end return CHIP_ERROR_INCORRECT_STATE; } - auto params = Platform::MakeUnique(); - params->nodeId = nodeId; - params->endpointId = endpointId; - params->commissioningWindowTimeout = commissioningTimeoutSec; - params->iteration = iterations; - params->discriminator = discriminator; + // Ensure salt and verifier sizes are valid + if (!salt.empty() && salt.size() > chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length) + { + ChipLogError(NotSpecified, "Salt size exceeds buffer capacity"); + return CHIP_ERROR_BUFFER_TOO_SMALL; + } - if (!salt.empty()) + if (!verifier.empty() && verifier.size() > chip::Crypto::kSpake2p_VerifierSerialized_Length) { - if (salt.size() > sizeof(params->saltBuffer)) - { - ChipLogError(NotSpecified, "Salt size exceeds buffer capacity"); - return CHIP_ERROR_BUFFER_TOO_SMALL; - } + ChipLogError(NotSpecified, "Verifier size exceeds buffer capacity"); + return CHIP_ERROR_BUFFER_TOO_SMALL; + } - memcpy(params->saltBuffer, salt.data(), salt.size()); - params->salt = ByteSpan(params->saltBuffer, salt.size()); + if (!salt.empty()) + { + memcpy(mSaltBuffer, salt.data(), salt.size()); + mSalt = ByteSpan(mSaltBuffer, salt.size()); + } + else + { + mSalt = ByteSpan(); } if (!verifier.empty()) { - if (verifier.size() > sizeof(params->verifierBuffer)) - { - ChipLogError(NotSpecified, "Verifier size exceeds buffer capacity"); - return CHIP_ERROR_BUFFER_TOO_SMALL; - } - - memcpy(params->verifierBuffer, verifier.data(), verifier.size()); - params->verifier = ByteSpan(params->verifierBuffer, verifier.size()); + memcpy(mVerifierBuffer, verifier.data(), verifier.size()); + mVerifier = ByteSpan(mVerifierBuffer, verifier.size()); } - - // Schedule work on the Matter thread - return DeviceLayer::PlatformMgr().ScheduleWork(OnOpenCommissioningWindow, reinterpret_cast(params.release())); -} - -void PairingManager::OnOpenCommissioningWindow(intptr_t context) -{ - Platform::UniquePtr params(reinterpret_cast(context)); - PairingManager & self = PairingManager::Instance(); - - if (self.mCommissioner == nullptr) + else { - ChipLogError(NotSpecified, "Commissioner is null, cannot open commissioning window"); - return; + mVerifier = ByteSpan(); } - self.mWindowOpener = Platform::MakeUnique(self.mCommissioner); + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId, endpointId, commissioningTimeoutSec, iterations, discriminator]() { + PairingManager & self = PairingManager::Instance(); - if (!params->verifier.empty()) - { - if (params->salt.empty()) + if (self.mCommissioner == nullptr) { - ChipLogError(NotSpecified, "Salt is required when verifier is set"); - self.mWindowOpener.reset(); + ChipLogError(NotSpecified, "Commissioner is null, cannot open commissioning window"); return; } - CHIP_ERROR err = - self.mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() - .SetNodeId(params->nodeId) - .SetEndpointId(params->endpointId) - .SetTimeout(params->commissioningWindowTimeout) - .SetIteration(params->iteration) - .SetDiscriminator(params->discriminator) - .SetVerifier(params->verifier) - .SetSalt(params->salt) - .SetCallback(&self.mOnOpenCommissioningWindowVerifierCallback)); - if (err != CHIP_NO_ERROR) + self.mWindowOpener = Platform::MakeUnique(self.mCommissioner); + + if (!self.mVerifier.empty()) { - ChipLogError(NotSpecified, "Failed to open commissioning window with verifier: %s", ErrorStr(err)); - self.mWindowOpener.reset(); + if (self.mSalt.empty()) + { + ChipLogError(NotSpecified, "Salt is required when verifier is set"); + self.mWindowOpener.reset(); + return; + } + + // Open the commissioning window with verifier parameters + CHIP_ERROR err = + self.mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(nodeId) + .SetEndpointId(endpointId) + .SetTimeout(commissioningTimeoutSec) + .SetIteration(iterations) + .SetDiscriminator(discriminator) + .SetVerifier(self.mVerifier) + .SetSalt(self.mSalt) + .SetCallback(&self.mOnOpenCommissioningWindowVerifierCallback)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to open commissioning window with verifier: %s", ErrorStr(err)); + self.mWindowOpener.reset(); + } } - } - else - { - SetupPayload ignored; - CHIP_ERROR err = self.mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() - .SetNodeId(params->nodeId) - .SetEndpointId(params->endpointId) - .SetTimeout(params->commissioningWindowTimeout) - .SetIteration(params->iteration) - .SetDiscriminator(params->discriminator) - .SetSetupPIN(NullOptional) - .SetSalt(NullOptional) - .SetCallback(&self.mOnOpenCommissioningWindowCallback), - ignored); - if (err != CHIP_NO_ERROR) + else { - ChipLogError(NotSpecified, "Failed to open commissioning window with passcode: %s", ErrorStr(err)); - self.mWindowOpener.reset(); + SetupPayload ignored; + // Open the commissioning window with passcode parameters + CHIP_ERROR err = self.mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(nodeId) + .SetEndpointId(endpointId) + .SetTimeout(commissioningTimeoutSec) + .SetIteration(iterations) + .SetDiscriminator(discriminator) + .SetSetupPIN(NullOptional) + .SetSalt(NullOptional) + .SetCallback(&self.mOnOpenCommissioningWindowCallback), + ignored); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to open commissioning window with passcode: %s", ErrorStr(err)); + self.mWindowOpener.reset(); + } } - } + }); } void PairingManager::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, SetupPayload payload) @@ -290,7 +289,7 @@ void PairingManager::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) if (err == CHIP_NO_ERROR) { // print to console - fprintf(stderr, "New device with Node ID: " ChipLogFormatX64 "has been successfully added.\n", ChipLogValueX64(nodeId)); + fprintf(stderr, "New device with Node ID: " ChipLogFormatX64 " has been successfully added.\n", ChipLogValueX64(nodeId)); // mCommissioner has a lifetime that is the entire life of the application itself // so it is safe to provide to StartDeviceSynchronization. @@ -580,34 +579,24 @@ CHIP_ERROR PairingManager::PairDeviceWithCode(NodeId nodeId, const char * payloa return CHIP_ERROR_INVALID_STRING_LENGTH; } - auto params = Platform::MakeUnique(); - VerifyOrReturnError(params != nullptr, CHIP_ERROR_NO_MEMORY); - - params->nodeId = nodeId; - Platform::CopyString(params->payloadBuffer, sizeof(params->payloadBuffer), payload); + Platform::CopyString(mOnboardingPayload, sizeof(mOnboardingPayload), payload); - // Schedule work on the Matter thread - return DeviceLayer::PlatformMgr().ScheduleWork(OnPairDeviceWithCode, reinterpret_cast(params.release())); -} - -void PairingManager::OnPairDeviceWithCode(intptr_t context) -{ - Platform::UniquePtr params(reinterpret_cast(context)); - PairingManager & self = PairingManager::Instance(); + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId]() { + PairingManager & self = PairingManager::Instance(); - self.InitPairingCommand(); + self.InitPairingCommand(); - CommissioningParameters commissioningParams = self.GetCommissioningParameters(); - auto discoveryType = DiscoveryType::kDiscoveryNetworkOnly; + CommissioningParameters commissioningParams = self.GetCommissioningParameters(); + auto discoveryType = DiscoveryType::kDiscoveryNetworkOnly; - self.mNodeId = params->nodeId; - self.mOnboardingPayload = params->payloadBuffer; + self.mNodeId = nodeId; - CHIP_ERROR err = self.mCommissioner->PairDevice(params->nodeId, params->payloadBuffer, commissioningParams, discoveryType); - if (err != CHIP_NO_ERROR) - { - ChipLogError(NotSpecified, "Failed to pair device with code, error: %s", ErrorStr(err)); - } + CHIP_ERROR err = self.mCommissioner->PairDevice(nodeId, self.mOnboardingPayload, commissioningParams, discoveryType); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair device with code, error: %s", ErrorStr(err)); + } + }); } CHIP_ERROR PairingManager::PairDevice(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, @@ -619,72 +608,50 @@ CHIP_ERROR PairingManager::PairDevice(chip::NodeId nodeId, uint32_t setupPINCode return CHIP_ERROR_INVALID_STRING_LENGTH; } - auto params = Platform::MakeUnique(); - VerifyOrReturnError(params != nullptr, CHIP_ERROR_NO_MEMORY); - - params->nodeId = nodeId; - params->setupPINCode = setupPINCode; - params->deviceRemotePort = deviceRemotePort; - - Platform::CopyString(params->ipAddrBuffer, sizeof(params->ipAddrBuffer), deviceRemoteIp); - - // Schedule work on the Matter thread - return DeviceLayer::PlatformMgr().ScheduleWork(OnPairDevice, reinterpret_cast(params.release())); -} + Platform::CopyString(mRemoteIpAddr, sizeof(mRemoteIpAddr), deviceRemoteIp); -void PairingManager::OnPairDevice(intptr_t context) -{ - Platform::UniquePtr params(reinterpret_cast(context)); - PairingManager & self = PairingManager::Instance(); + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId, setupPINCode, deviceRemotePort]() { + PairingManager & self = PairingManager::Instance(); - self.InitPairingCommand(); - self.mSetupPINCode = params->setupPINCode; + self.InitPairingCommand(); + self.mSetupPINCode = setupPINCode; - Inet::IPAddress address; - Inet::InterfaceId interfaceId; + Inet::IPAddress address; + Inet::InterfaceId interfaceId; - if (!ParseAddressWithInterface(params->ipAddrBuffer, address, interfaceId)) - { - ChipLogError(NotSpecified, "Invalid IP address: %s", params->ipAddrBuffer); - return; - } + if (!ParseAddressWithInterface(self.mRemoteIpAddr, address, interfaceId)) + { + ChipLogError(NotSpecified, "Invalid IP address: %s", self.mRemoteIpAddr); + return; + } - CHIP_ERROR err = self.Pair(params->nodeId, Transport::PeerAddress::UDP(address, params->deviceRemotePort, interfaceId)); - if (err != CHIP_NO_ERROR) - { - ChipLogError(NotSpecified, "Failed to pair device, error: %s", ErrorStr(err)); - } + CHIP_ERROR err = self.Pair(nodeId, Transport::PeerAddress::UDP(address, deviceRemotePort, interfaceId)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair device, error: %s", ErrorStr(err)); + } + }); } CHIP_ERROR PairingManager::UnpairDevice(NodeId nodeId) { - auto params = Platform::MakeUnique(); - VerifyOrReturnError(params != nullptr, CHIP_ERROR_NO_MEMORY); - - params->nodeId = nodeId; - - // Schedule work on the Matter thread - return DeviceLayer::PlatformMgr().ScheduleWork(OnUnpairDevice, reinterpret_cast(params.release())); -} - -void PairingManager::OnUnpairDevice(intptr_t context) -{ - Platform::UniquePtr params(reinterpret_cast(context)); - PairingManager & self = PairingManager::Instance(); + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId]() { + PairingManager & self = PairingManager::Instance(); - self.InitPairingCommand(); + self.InitPairingCommand(); - self.mCurrentFabricRemover = Platform::MakeUnique(self.mCommissioner); + self.mCurrentFabricRemover = Platform::MakeUnique(self.mCommissioner); - if (!self.mCurrentFabricRemover) - { - ChipLogError(NotSpecified, "Failed to unpair device, mCurrentFabricRemover is null"); - return; - } + if (!self.mCurrentFabricRemover) + { + ChipLogError(NotSpecified, "Failed to unpair device, mCurrentFabricRemover is null"); + return; + } - CHIP_ERROR err = self.mCurrentFabricRemover->RemoveCurrentFabric(params->nodeId, &self.mCurrentFabricRemoveCallback); - if (err != CHIP_NO_ERROR) - { - ChipLogError(NotSpecified, "Failed to unpair device, error: %s", ErrorStr(err)); - } + CHIP_ERROR err = self.mCurrentFabricRemover->RemoveCurrentFabric(nodeId, &self.mCurrentFabricRemoveCallback); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to unpair device, error: %s", ErrorStr(err)); + } + }); } diff --git a/examples/fabric-admin/device_manager/PairingManager.h b/examples/fabric-admin/device_manager/PairingManager.h index 563d129079d3f1..50e64f9f0ca67f 100644 --- a/examples/fabric-admin/device_manager/PairingManager.h +++ b/examples/fabric-admin/device_manager/PairingManager.h @@ -140,39 +140,6 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, CHIP_ERROR UnpairDevice(chip::NodeId nodeId); private: - struct CommissioningWindowParams - { - chip::NodeId nodeId; - chip::EndpointId endpointId; - uint16_t commissioningWindowTimeout; - uint32_t iteration; - uint16_t discriminator; - chip::Optional setupPIN; - uint8_t verifierBuffer[chip::Crypto::kSpake2p_VerifierSerialized_Length]; - chip::ByteSpan verifier; - uint8_t saltBuffer[chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length]; - chip::ByteSpan salt; - }; - - struct PairDeviceWithCodeParams - { - chip::NodeId nodeId; - char payloadBuffer[kMaxManualCodeLength + 1]; - }; - - struct PairDeviceParams - { - chip::NodeId nodeId; - uint32_t setupPINCode; - uint16_t deviceRemotePort; - char ipAddrBuffer[chip::Inet::IPAddress::kMaxStringLength]; - }; - - struct UnpairDeviceParams - { - chip::NodeId nodeId; - }; - // Constructors PairingManager(); PairingManager(const PairingManager &) = delete; @@ -202,14 +169,10 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, const chip::Credentials::DeviceAttestationVerifier::AttestationDeviceInfo & info, chip::Credentials::AttestationVerificationResult attestationResult) override; - static void OnOpenCommissioningWindow(intptr_t context); static void OnOpenCommissioningWindowResponse(void * context, chip::NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); static void OnOpenCommissioningWindowVerifierResponse(void * context, chip::NodeId deviceId, CHIP_ERROR status); static void OnCurrentFabricRemove(void * context, chip::NodeId remoteNodeId, CHIP_ERROR status); - static void OnPairDeviceWithCode(intptr_t context); - static void OnPairDevice(intptr_t context); - static void OnUnpairDevice(intptr_t context); // Private data members chip::Controller::DeviceCommissioner * mCommissioner = nullptr; @@ -219,12 +182,17 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, CommissioningDelegate * mCommissioningDelegate = nullptr; PairingDelegate * mPairingDelegate = nullptr; - chip::NodeId mNodeId = chip::kUndefinedNodeId; - uint16_t mDiscriminator = 0; - uint32_t mSetupPINCode = 0; - const char * mOnboardingPayload = nullptr; - bool mDeviceIsICD = false; + chip::NodeId mNodeId = chip::kUndefinedNodeId; + chip::ByteSpan mVerifier; + chip::ByteSpan mSalt; + uint16_t mDiscriminator = 0; + uint32_t mSetupPINCode = 0; + bool mDeviceIsICD = false; uint8_t mRandomGeneratedICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; + uint8_t mVerifierBuffer[chip::Crypto::kSpake2p_VerifierSerialized_Length]; + uint8_t mSaltBuffer[chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length]; + char mRemoteIpAddr[chip::Inet::IPAddress::kMaxStringLength]; + char mOnboardingPayload[kMaxManualCodeLength + 1]; chip::Optional mICDRegistration; chip::Optional mICDCheckInNodeId; From 386816bfebbbb3435110eeefdae9d678c0b372c0 Mon Sep 17 00:00:00 2001 From: crlonxp <88241281+crlonxp@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:47:53 +0800 Subject: [PATCH 10/39] Enable MRP in WiFi-PAF commissioning (#35500) * Enable MRP in WiFi-PAF commissioning Signed-off-by: Lo,Chin-Ran * Restyled by clang-format --------- Signed-off-by: Lo,Chin-Ran Co-authored-by: Restyled.io --- src/transport/SecureSession.h | 6 +++++- src/transport/UnauthenticatedSessionTable.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/transport/SecureSession.h b/src/transport/SecureSession.h index ba586a3095e3dd..574d5f40ccfe5a 100644 --- a/src/transport/SecureSession.h +++ b/src/transport/SecureSession.h @@ -158,7 +158,11 @@ class SecureSession : public Session, public ReferenceCounted Date: Mon, 7 Oct 2024 11:50:53 +0200 Subject: [PATCH 11/39] [Linux] Matter Linux Water Leak Detector Example (#35392) * [Linux] Matter Linux Water Leak Detector Example * Update README.md Remote Echo protocol section * Update water-leak-detector-app.zap * Symlinks * New sym links * Update README.md Fix typo * Create water-leak-detector-app.matter * Update water-leak-detector-app.matter Remove last line * Update README.md * Update water-leak-detector-app.matter * Update water-leak-detector-app.zap * Update water-leak-detector-app.matter * Update water-leak-detector-app.zap * Update water-leak-detector-app.matter * Delete examples/water-leak-detector-app/linux/README.md * Update targets.py to add WATER_LEAK_DETECTOR * Update host.py to add WATER_LEAK_DETECTOR * Update water-leak-detector-app.matter Fix ThreeLevelAutoEnum * Update all_targets_linux_x64.txt Add water-leak-detector --- examples/water-leak-detector-app/linux/.gn | 25 + .../water-leak-detector-app/linux/BUILD.gn | 64 + .../water-leak-detector-app/linux/args.gni | 28 + .../linux/build_overrides | 1 + .../linux/include/CHIPProjectAppConfig.h | 39 + .../water-leak-detector-app/linux/main.cpp | 53 + .../linux/third_party/connectedhomeip | 1 + .../water-leak-detector-common/BUILD.gn | 21 + .../water-leak-detector-app.matter | 1961 ++++++++++ .../water-leak-detector-app.zap | 3214 +++++++++++++++++ scripts/build/build/targets.py | 1 + scripts/build/builders/host.py | 6 + .../build/testdata/all_targets_linux_x64.txt | 2 +- 13 files changed, 5415 insertions(+), 1 deletion(-) create mode 100644 examples/water-leak-detector-app/linux/.gn create mode 100644 examples/water-leak-detector-app/linux/BUILD.gn create mode 100644 examples/water-leak-detector-app/linux/args.gni create mode 120000 examples/water-leak-detector-app/linux/build_overrides create mode 100644 examples/water-leak-detector-app/linux/include/CHIPProjectAppConfig.h create mode 100644 examples/water-leak-detector-app/linux/main.cpp create mode 120000 examples/water-leak-detector-app/linux/third_party/connectedhomeip create mode 100644 examples/water-leak-detector-app/water-leak-detector-common/BUILD.gn create mode 100644 examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter create mode 100644 examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.zap diff --git a/examples/water-leak-detector-app/linux/.gn b/examples/water-leak-detector-app/linux/.gn new file mode 100644 index 00000000000000..3b11e2ba2e62ee --- /dev/null +++ b/examples/water-leak-detector-app/linux/.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + import("//args.gni") +} diff --git a/examples/water-leak-detector-app/linux/BUILD.gn b/examples/water-leak-detector-app/linux/BUILD.gn new file mode 100644 index 00000000000000..c5caf26d8e480a --- /dev/null +++ b/examples/water-leak-detector-app/linux/BUILD.gn @@ -0,0 +1,64 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") + +import("${chip_root}/build/chip/tools.gni") +import("${chip_root}/src/app/common_flags.gni") +import("${chip_root}/third_party/imgui/imgui.gni") + +assert(chip_build_tools) + +config("includes") { + include_dirs = [ + ".", + "include", + ] +} + +executable("water-leak-detector-app") { + sources = [ + "include/CHIPProjectAppConfig.h", + "main.cpp", + ] + + deps = [ + "${chip_root}/examples/platform/linux:app-main", + "${chip_root}/examples/water-leak-detector-app/water-leak-detector-common", + "${chip_root}/src/lib", + ] + + if (chip_examples_enable_imgui_ui) { + deps += [ + "${chip_root}/examples/common/imgui_ui", + "${chip_root}/examples/common/imgui_ui/windows:boolean_state", + "${chip_root}/examples/common/imgui_ui/windows:occupancy_sensing", + "${chip_root}/examples/common/imgui_ui/windows:qrcode", + ] + } + + include_dirs = [ "include" ] + + cflags = [ "-Wconversion" ] + + output_dir = root_out_dir +} + +group("linux") { + deps = [ ":water-leak-detector-app" ] +} + +group("default") { + deps = [ ":linux" ] +} diff --git a/examples/water-leak-detector-app/linux/args.gni b/examples/water-leak-detector-app/linux/args.gni new file mode 100644 index 00000000000000..5be50537ddb52d --- /dev/null +++ b/examples/water-leak-detector-app/linux/args.gni @@ -0,0 +1,28 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# CHIPProjectConfig.h + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_system_project_config_include = "" + +chip_project_config_include_dirs = + [ "${chip_root}/examples/water-leak-detector-app/linux/include" ] +chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] +matter_enable_tracing_support = true diff --git a/examples/water-leak-detector-app/linux/build_overrides b/examples/water-leak-detector-app/linux/build_overrides new file mode 120000 index 00000000000000..e578e73312ebd1 --- /dev/null +++ b/examples/water-leak-detector-app/linux/build_overrides @@ -0,0 +1 @@ +../../build_overrides \ No newline at end of file diff --git a/examples/water-leak-detector-app/linux/include/CHIPProjectAppConfig.h b/examples/water-leak-detector-app/linux/include/CHIPProjectAppConfig.h new file mode 100644 index 00000000000000..14ec70af42cc43 --- /dev/null +++ b/examples/water-leak-detector-app/linux/include/CHIPProjectAppConfig.h @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +// include the CHIPProjectConfig from config/standalone +#include + +#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0 + +// Bulbs do not typically use this - enabled so we can use shell to discover commissioners +#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1 + +#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 + +#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 + +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0043 // Water Leak Detector + +#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_NAME 1 + +#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1 + +#define CHIP_DEVICE_CONFIG_DEVICE_NAME "Water Leak Detector" diff --git a/examples/water-leak-detector-app/linux/main.cpp b/examples/water-leak-detector-app/linux/main.cpp new file mode 100644 index 00000000000000..02a91b82cec6ca --- /dev/null +++ b/examples/water-leak-detector-app/linux/main.cpp @@ -0,0 +1,53 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED +#include +#include +#include +#include +#endif + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + +void ApplicationInit() {} + +void ApplicationShutdown() {} + +int main(int argc, char * argv[]) +{ + VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); + +#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED + example::Ui::ImguiUi ui; + + ui.AddWindow(std::make_unique()); + ui.AddWindow(std::make_unique(chip::EndpointId(1), "Water Leak Detector")); + + ChipLinuxAppMainLoop(&ui); +#else + ChipLinuxAppMainLoop(); +#endif + + return 0; +} diff --git a/examples/water-leak-detector-app/linux/third_party/connectedhomeip b/examples/water-leak-detector-app/linux/third_party/connectedhomeip new file mode 120000 index 00000000000000..c866b86874994d --- /dev/null +++ b/examples/water-leak-detector-app/linux/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../.. \ No newline at end of file diff --git a/examples/water-leak-detector-app/water-leak-detector-common/BUILD.gn b/examples/water-leak-detector-app/water-leak-detector-common/BUILD.gn new file mode 100644 index 00000000000000..47031e0dbc5344 --- /dev/null +++ b/examples/water-leak-detector-app/water-leak-detector-common/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("${chip_root}/src/app/chip_data_model.gni") + +chip_data_model("water-leak-detector-common") { + zap_file = "water-leak-detector-app.zap" + is_server = true +} diff --git a/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter b/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter new file mode 100644 index 00000000000000..b01d083abbac61 --- /dev/null +++ b/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter @@ -0,0 +1,1961 @@ +// This IDL was generated automatically by ZAP. +// It is for view/code review purposes only. + +enum AreaTypeTag : enum8 { + kAisle = 0; + kAttic = 1; + kBackDoor = 2; + kBackYard = 3; + kBalcony = 4; + kBallroom = 5; + kBathroom = 6; + kBedroom = 7; + kBorder = 8; + kBoxroom = 9; + kBreakfastRoom = 10; + kCarport = 11; + kCellar = 12; + kCloakroom = 13; + kCloset = 14; + kConservatory = 15; + kCorridor = 16; + kCraftRoom = 17; + kCupboard = 18; + kDeck = 19; + kDen = 20; + kDining = 21; + kDrawingRoom = 22; + kDressingRoom = 23; + kDriveway = 24; + kElevator = 25; + kEnsuite = 26; + kEntrance = 27; + kEntryway = 28; + kFamilyRoom = 29; + kFoyer = 30; + kFrontDoor = 31; + kFrontYard = 32; + kGameRoom = 33; + kGarage = 34; + kGarageDoor = 35; + kGarden = 36; + kGardenDoor = 37; + kGuestBathroom = 38; + kGuestBedroom = 39; + kGuestRestroom = 40; + kGuestRoom = 41; + kGym = 42; + kHallway = 43; + kHearthRoom = 44; + kKidsRoom = 45; + kKidsBedroom = 46; + kKitchen = 47; + kLarder = 48; + kLaundryRoom = 49; + kLawn = 50; + kLibrary = 51; + kLivingRoom = 52; + kLounge = 53; + kMediaTVRoom = 54; + kMudRoom = 55; + kMusicRoom = 56; + kNursery = 57; + kOffice = 58; + kOutdoorKitchen = 59; + kOutside = 60; + kPantry = 61; + kParkingLot = 62; + kParlor = 63; + kPatio = 64; + kPlayRoom = 65; + kPoolRoom = 66; + kPorch = 67; + kPrimaryBathroom = 68; + kPrimaryBedroom = 69; + kRamp = 70; + kReceptionRoom = 71; + kRecreationRoom = 72; + kRestroom = 73; + kRoof = 74; + kSauna = 75; + kScullery = 76; + kSewingRoom = 77; + kShed = 78; + kSideDoor = 79; + kSideYard = 80; + kSittingRoom = 81; + kSnug = 82; + kSpa = 83; + kStaircase = 84; + kSteamRoom = 85; + kStorageRoom = 86; + kStudio = 87; + kStudy = 88; + kSunRoom = 89; + kSwimmingPool = 90; + kTerrace = 91; + kUtilityRoom = 92; + kWard = 93; + kWorkshop = 94; +} + +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + +enum FloorSurfaceTag : enum8 { + kCarpet = 0; + kCeramic = 1; + kConcrete = 2; + kCork = 3; + kDeepCarpet = 4; + kDirt = 5; + kEngineeredWood = 6; + kGlass = 7; + kGrass = 8; + kHardwood = 9; + kLaminate = 10; + kLinoleum = 11; + kMat = 12; + kMetal = 13; + kPlastic = 14; + kPolishedConcrete = 15; + kRubber = 16; + kRug = 17; + kSand = 18; + kStone = 19; + kTatami = 20; + kTerrazzo = 21; + kTile = 22; + kVinyl = 23; +} + +enum LandmarkTag : enum8 { + kAirConditioner = 0; + kAirPurifier = 1; + kBackDoor = 2; + kBarStool = 3; + kBathMat = 4; + kBathtub = 5; + kBed = 6; + kBookshelf = 7; + kChair = 8; + kChristmasTree = 9; + kCoatRack = 10; + kCoffeeTable = 11; + kCookingRange = 12; + kCouch = 13; + kCountertop = 14; + kCradle = 15; + kCrib = 16; + kDesk = 17; + kDiningTable = 18; + kDishwasher = 19; + kDoor = 20; + kDresser = 21; + kLaundryDryer = 22; + kFan = 23; + kFireplace = 24; + kFreezer = 25; + kFrontDoor = 26; + kHighChair = 27; + kKitchenIsland = 28; + kLamp = 29; + kLitterBox = 30; + kMirror = 31; + kNightstand = 32; + kOven = 33; + kPetBed = 34; + kPetBowl = 35; + kPetCrate = 36; + kRefrigerator = 37; + kScratchingPost = 38; + kShoeRack = 39; + kShower = 40; + kSideDoor = 41; + kSink = 42; + kSofa = 43; + kStove = 44; + kTable = 45; + kToilet = 46; + kTrashCan = 47; + kLaundryWasher = 48; + kWindow = 49; + kWineCooler = 50; +} + +enum PositionTag : enum8 { + kLeft = 0; + kRight = 1; + kTop = 2; + kBottom = 3; + kMiddle = 4; + kRow = 5; + kColumn = 6; +} + +enum RelativePositionTag : enum8 { + kUnder = 0; + kNextTo = 1; + kAround = 2; + kOn = 3; + kAbove = 4; + kFrontOf = 5; + kBehind = 6; +} + +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +enum ThreeLevelAutoEnum : enum8 { + kLow = 0; + kMedium = 1; + kHigh = 2; + kAutomatic = 3; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + +struct LocationDescriptorStruct { + char_string<128> locationName = 0; + nullable int16s floorNumber = 1; + nullable AreaTypeTag areaType = 2; +} + +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + +/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ +cluster Identify = 3 { + revision 4; + + enum EffectIdentifierEnum : enum8 { + kBlink = 0; + kBreathe = 1; + kOkay = 2; + kChannelChange = 11; + kFinishEffect = 254; + kStopEffect = 255; + } + + enum EffectVariantEnum : enum8 { + kDefault = 0; + } + + enum IdentifyTypeEnum : enum8 { + kNone = 0; + kLightOutput = 1; + kVisibleIndicator = 2; + kAudibleBeep = 3; + kDisplay = 4; + kActuator = 5; + } + + attribute int16u identifyTime = 0; + readonly attribute IdentifyTypeEnum identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct IdentifyRequest { + int16u identifyTime = 0; + } + + request struct TriggerEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + EffectVariantEnum effectVariant = 1; + } + + /** Command description for Identify */ + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + /** Command description for TriggerEffect */ + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; +} + +/** Attributes and commands for group configuration and manipulation. */ +cluster Groups = 4 { + revision 4; + + bitmap Feature : bitmap32 { + kGroupNames = 0x1; + } + + bitmap NameSupportBitmap : bitmap8 { + kGroupNames = 0x80; + } + + readonly attribute NameSupportBitmap nameSupport = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AddGroupRequest { + group_id groupID = 0; + char_string<16> groupName = 1; + } + + response struct AddGroupResponse = 0 { + enum8 status = 0; + group_id groupID = 1; + } + + request struct ViewGroupRequest { + group_id groupID = 0; + } + + response struct ViewGroupResponse = 1 { + enum8 status = 0; + group_id groupID = 1; + char_string<16> groupName = 2; + } + + request struct GetGroupMembershipRequest { + group_id groupList[] = 0; + } + + response struct GetGroupMembershipResponse = 2 { + nullable int8u capacity = 0; + group_id groupList[] = 1; + } + + request struct RemoveGroupRequest { + group_id groupID = 0; + } + + response struct RemoveGroupResponse = 3 { + enum8 status = 0; + group_id groupID = 1; + } + + request struct AddGroupIfIdentifyingRequest { + group_id groupID = 0; + char_string<16> groupName = 1; + } + + /** Command description for AddGroup */ + fabric command access(invoke: manage) AddGroup(AddGroupRequest): AddGroupResponse = 0; + /** Command description for ViewGroup */ + fabric command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; + /** Command description for GetGroupMembership */ + fabric command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; + /** Command description for RemoveGroup */ + fabric command access(invoke: manage) RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; + /** Command description for RemoveAllGroups */ + fabric command access(invoke: manage) RemoveAllGroups(): DefaultSuccess = 4; + /** Command description for AddGroupIfIdentifying */ + fabric command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; +} + +/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ +cluster Descriptor = 29 { + revision 2; + + bitmap Feature : bitmap32 { + kTagList = 0x1; + } + + struct DeviceTypeStruct { + devtype_id deviceType = 0; + int16u revision = 1; + } + + struct SemanticTagStruct { + nullable vendor_id mfgCode = 0; + enum8 namespaceID = 1; + enum8 tag = 2; + optional nullable char_string label = 3; + } + + readonly attribute DeviceTypeStruct deviceTypeList[] = 0; + readonly attribute cluster_id serverList[] = 1; + readonly attribute cluster_id clientList[] = 2; + readonly attribute endpoint_no partsList[] = 3; + readonly attribute optional SemanticTagStruct tagList[] = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** The Access Control Cluster exposes a data model view of a + Node's Access Control List (ACL), which codifies the rules used to manage + and enforce Access Control for the Node's endpoints and their associated + cluster instances. */ +cluster AccessControl = 31 { + revision 2; + + enum AccessControlEntryAuthModeEnum : enum8 { + kPASE = 1; + kCASE = 2; + kGroup = 3; + } + + enum AccessControlEntryPrivilegeEnum : enum8 { + kView = 1; + kProxyView = 2; + kOperate = 3; + kManage = 4; + kAdminister = 5; + } + + enum AccessRestrictionTypeEnum : enum8 { + kAttributeAccessForbidden = 0; + kAttributeWriteForbidden = 1; + kCommandForbidden = 2; + kEventForbidden = 3; + } + + enum ChangeTypeEnum : enum8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + + bitmap Feature : bitmap32 { + kExtension = 0x1; + kManagedDevice = 0x2; + } + + struct AccessRestrictionStruct { + AccessRestrictionTypeEnum type = 0; + nullable int32u id = 1; + } + + struct CommissioningAccessRestrictionEntryStruct { + endpoint_no endpoint = 0; + cluster_id cluster = 1; + AccessRestrictionStruct restrictions[] = 2; + } + + fabric_scoped struct AccessRestrictionEntryStruct { + fabric_sensitive endpoint_no endpoint = 0; + fabric_sensitive cluster_id cluster = 1; + fabric_sensitive AccessRestrictionStruct restrictions[] = 2; + fabric_idx fabricIndex = 254; + } + + struct AccessControlTargetStruct { + nullable cluster_id cluster = 0; + nullable endpoint_no endpoint = 1; + nullable devtype_id deviceType = 2; + } + + fabric_scoped struct AccessControlEntryStruct { + fabric_sensitive AccessControlEntryPrivilegeEnum privilege = 1; + fabric_sensitive AccessControlEntryAuthModeEnum authMode = 2; + nullable fabric_sensitive int64u subjects[] = 3; + nullable fabric_sensitive AccessControlTargetStruct targets[] = 4; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct AccessControlExtensionStruct { + fabric_sensitive octet_string<128> data = 1; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlEntryChanged = 0 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlEntryStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlExtensionChanged = 1 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlExtensionStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 2 { + int64u token = 0; + optional long_char_string instruction = 1; + optional long_char_string ARLRequestFlowUrl = 2; + fabric_idx fabricIndex = 254; + } + + attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0; + attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute optional CommissioningAccessRestrictionEntryStruct commissioningARL[] = 5; + readonly attribute optional AccessRestrictionEntryStruct arl[] = 6; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ReviewFabricRestrictionsRequest { + CommissioningAccessRestrictionEntryStruct arl[] = 0; + } + + response struct ReviewFabricRestrictionsResponse = 1 { + int64u token = 0; + } + + /** This command signals to the service associated with the device vendor that the fabric administrator would like a review of the current restrictions on the accessing fabric. */ + fabric command access(invoke: administer) ReviewFabricRestrictions(ReviewFabricRestrictionsRequest): ReviewFabricRestrictionsResponse = 0; +} + +/** This cluster provides attributes and events for determining basic information about Nodes, which supports both + Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number, + which apply to the whole Node. Also allows setting user device information such as location. */ +cluster BasicInformation = 40 { + revision 3; + + enum ColorEnum : enum8 { + kBlack = 0; + kNavy = 1; + kGreen = 2; + kTeal = 3; + kMaroon = 4; + kPurple = 5; + kOlive = 6; + kGray = 7; + kBlue = 8; + kLime = 9; + kAqua = 10; + kRed = 11; + kFuchsia = 12; + kYellow = 13; + kWhite = 14; + kNickel = 15; + kChrome = 16; + kBrass = 17; + kCopper = 18; + kSilver = 19; + kGold = 20; + } + + enum ProductFinishEnum : enum8 { + kOther = 0; + kMatte = 1; + kSatin = 2; + kPolished = 3; + kRugged = 4; + kFabric = 5; + } + + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + + struct ProductAppearanceStruct { + ProductFinishEnum finish = 0; + nullable ColorEnum primaryColor = 1; + } + + critical event StartUp = 0 { + int32u softwareVersion = 0; + } + + critical event ShutDown = 1 { + } + + info event Leave = 2 { + fabric_idx fabricIndex = 0; + } + + info event ReachableChanged = 3 { + boolean reachableNewValue = 0; + } + + readonly attribute int16u dataModelRevision = 0; + readonly attribute char_string<32> vendorName = 1; + readonly attribute vendor_id vendorID = 2; + readonly attribute char_string<32> productName = 3; + readonly attribute int16u productID = 4; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; + readonly attribute int16u hardwareVersion = 7; + readonly attribute char_string<64> hardwareVersionString = 8; + readonly attribute int32u softwareVersion = 9; + readonly attribute char_string<64> softwareVersionString = 10; + readonly attribute optional char_string<16> manufacturingDate = 11; + readonly attribute optional char_string<32> partNumber = 12; + readonly attribute optional long_char_string<256> productURL = 13; + readonly attribute optional char_string<64> productLabel = 14; + readonly attribute optional char_string<32> serialNumber = 15; + attribute access(write: manage) optional boolean localConfigDisabled = 16; + readonly attribute optional boolean reachable = 17; + readonly attribute char_string<32> uniqueID = 18; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute optional ProductAppearanceStruct productAppearance = 20; + readonly attribute int32u specificationVersion = 21; + readonly attribute int16u maxPathsPerInvoke = 22; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + command MfgSpecificPing(): DefaultSuccess = 0; +} + +/** Nodes should be expected to be deployed to any and all regions of the world. These global regions + may have differing common languages, units of measurements, and numerical formatting + standards. As such, Nodes that visually or audibly convey information need a mechanism by which + they can be configured to use a user’s preferred language, units, etc */ +cluster LocalizationConfiguration = 43 { + revision 1; // NOTE: Default/not specifically set + + attribute access(write: manage) char_string<35> activeLocale = 0; + readonly attribute char_string supportedLocales[] = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */ +cluster PowerSource = 47 { + revision 1; // NOTE: Default/not specifically set + + enum BatApprovedChemistryEnum : enum16 { + kUnspecified = 0; + kAlkaline = 1; + kLithiumCarbonFluoride = 2; + kLithiumChromiumOxide = 3; + kLithiumCopperOxide = 4; + kLithiumIronDisulfide = 5; + kLithiumManganeseDioxide = 6; + kLithiumThionylChloride = 7; + kMagnesium = 8; + kMercuryOxide = 9; + kNickelOxyhydride = 10; + kSilverOxide = 11; + kZincAir = 12; + kZincCarbon = 13; + kZincChloride = 14; + kZincManganeseDioxide = 15; + kLeadAcid = 16; + kLithiumCobaltOxide = 17; + kLithiumIon = 18; + kLithiumIonPolymer = 19; + kLithiumIronPhosphate = 20; + kLithiumSulfur = 21; + kLithiumTitanate = 22; + kNickelCadmium = 23; + kNickelHydrogen = 24; + kNickelIron = 25; + kNickelMetalHydride = 26; + kNickelZinc = 27; + kSilverZinc = 28; + kSodiumIon = 29; + kSodiumSulfur = 30; + kZincBromide = 31; + kZincCerium = 32; + } + + enum BatChargeFaultEnum : enum8 { + kUnspecified = 0; + kAmbientTooHot = 1; + kAmbientTooCold = 2; + kBatteryTooHot = 3; + kBatteryTooCold = 4; + kBatteryAbsent = 5; + kBatteryOverVoltage = 6; + kBatteryUnderVoltage = 7; + kChargerOverVoltage = 8; + kChargerUnderVoltage = 9; + kSafetyTimeout = 10; + } + + enum BatChargeLevelEnum : enum8 { + kOK = 0; + kWarning = 1; + kCritical = 2; + } + + enum BatChargeStateEnum : enum8 { + kUnknown = 0; + kIsCharging = 1; + kIsAtFullCharge = 2; + kIsNotCharging = 3; + } + + enum BatCommonDesignationEnum : enum16 { + kUnspecified = 0; + kAAA = 1; + kAA = 2; + kC = 3; + kD = 4; + k4v5 = 5; + k6v0 = 6; + k9v0 = 7; + k12AA = 8; + kAAAA = 9; + kA = 10; + kB = 11; + kF = 12; + kN = 13; + kNo6 = 14; + kSubC = 15; + kA23 = 16; + kA27 = 17; + kBA5800 = 18; + kDuplex = 19; + k4SR44 = 20; + k523 = 21; + k531 = 22; + k15v0 = 23; + k22v5 = 24; + k30v0 = 25; + k45v0 = 26; + k67v5 = 27; + kJ = 28; + kCR123A = 29; + kCR2 = 30; + k2CR5 = 31; + kCRP2 = 32; + kCRV3 = 33; + kSR41 = 34; + kSR43 = 35; + kSR44 = 36; + kSR45 = 37; + kSR48 = 38; + kSR54 = 39; + kSR55 = 40; + kSR57 = 41; + kSR58 = 42; + kSR59 = 43; + kSR60 = 44; + kSR63 = 45; + kSR64 = 46; + kSR65 = 47; + kSR66 = 48; + kSR67 = 49; + kSR68 = 50; + kSR69 = 51; + kSR516 = 52; + kSR731 = 53; + kSR712 = 54; + kLR932 = 55; + kA5 = 56; + kA10 = 57; + kA13 = 58; + kA312 = 59; + kA675 = 60; + kAC41E = 61; + k10180 = 62; + k10280 = 63; + k10440 = 64; + k14250 = 65; + k14430 = 66; + k14500 = 67; + k14650 = 68; + k15270 = 69; + k16340 = 70; + kRCR123A = 71; + k17500 = 72; + k17670 = 73; + k18350 = 74; + k18500 = 75; + k18650 = 76; + k19670 = 77; + k25500 = 78; + k26650 = 79; + k32600 = 80; + } + + enum BatFaultEnum : enum8 { + kUnspecified = 0; + kOverTemp = 1; + kUnderTemp = 2; + } + + enum BatReplaceabilityEnum : enum8 { + kUnspecified = 0; + kNotReplaceable = 1; + kUserReplaceable = 2; + kFactoryReplaceable = 3; + } + + enum PowerSourceStatusEnum : enum8 { + kUnspecified = 0; + kActive = 1; + kStandby = 2; + kUnavailable = 3; + } + + enum WiredCurrentTypeEnum : enum8 { + kAC = 0; + kDC = 1; + } + + enum WiredFaultEnum : enum8 { + kUnspecified = 0; + kOverVoltage = 1; + kUnderVoltage = 2; + } + + bitmap Feature : bitmap32 { + kWired = 0x1; + kBattery = 0x2; + kRechargeable = 0x4; + kReplaceable = 0x8; + } + + struct BatChargeFaultChangeType { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + struct BatFaultChangeType { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + struct WiredFaultChangeType { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event WiredFaultChange = 0 { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event BatFaultChange = 1 { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + info event BatChargeFaultChange = 2 { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + readonly attribute PowerSourceStatusEnum status = 0; + readonly attribute int8u order = 1; + readonly attribute char_string<60> description = 2; + readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3; + readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4; + readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5; + readonly attribute optional nullable int32u wiredAssessedCurrent = 6; + readonly attribute optional int32u wiredNominalVoltage = 7; + readonly attribute optional int32u wiredMaximumCurrent = 8; + readonly attribute optional boolean wiredPresent = 9; + readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10; + readonly attribute optional nullable int32u batVoltage = 11; + readonly attribute optional nullable int8u batPercentRemaining = 12; + readonly attribute optional nullable int32u batTimeRemaining = 13; + readonly attribute optional BatChargeLevelEnum batChargeLevel = 14; + readonly attribute optional boolean batReplacementNeeded = 15; + readonly attribute optional BatReplaceabilityEnum batReplaceability = 16; + readonly attribute optional boolean batPresent = 17; + readonly attribute optional BatFaultEnum activeBatFaults[] = 18; + readonly attribute optional char_string<60> batReplacementDescription = 19; + readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20; + readonly attribute optional char_string<20> batANSIDesignation = 21; + readonly attribute optional char_string<20> batIECDesignation = 22; + readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23; + readonly attribute optional int32u batCapacity = 24; + readonly attribute optional int8u batQuantity = 25; + readonly attribute optional BatChargeStateEnum batChargeState = 26; + readonly attribute optional nullable int32u batTimeToFullCharge = 27; + readonly attribute optional boolean batFunctionalWhileCharging = 28; + readonly attribute optional nullable int32u batChargingCurrent = 29; + readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30; + readonly attribute endpoint_no endpointList[] = 31; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** This cluster is used to manage global aspects of the Commissioning flow. */ +cluster GeneralCommissioning = 48 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningErrorEnum : enum8 { + kOK = 0; + kValueOutsideRange = 1; + kInvalidAuthentication = 2; + kNoFailSafe = 3; + kBusyWithOtherAdmin = 4; + kRequiredTCNotAccepted = 5; + kTCAcknowledgementsNotReceived = 6; + kTCMinVersionNotMet = 7; + } + + enum RegulatoryLocationTypeEnum : enum8 { + kIndoor = 0; + kOutdoor = 1; + kIndoorOutdoor = 2; + } + + bitmap Feature : bitmap32 { + kTermsAndConditions = 0x1; + } + + struct BasicCommissioningInfo { + int16u failSafeExpiryLengthSeconds = 0; + int16u maxCumulativeFailsafeSeconds = 1; + } + + attribute access(write: administer) int64u breadcrumb = 0; + readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; + readonly attribute RegulatoryLocationTypeEnum regulatoryConfig = 2; + readonly attribute RegulatoryLocationTypeEnum locationCapability = 3; + readonly attribute boolean supportsConcurrentConnection = 4; + provisional readonly attribute access(read: administer) optional int16u TCAcceptedVersion = 5; + provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; + provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; + provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ArmFailSafeRequest { + int16u expiryLengthSeconds = 0; + int64u breadcrumb = 1; + } + + response struct ArmFailSafeResponse = 1 { + CommissioningErrorEnum errorCode = 0; + char_string<128> debugText = 1; + } + + request struct SetRegulatoryConfigRequest { + RegulatoryLocationTypeEnum newRegulatoryConfig = 0; + char_string<2> countryCode = 1; + int64u breadcrumb = 2; + } + + response struct SetRegulatoryConfigResponse = 3 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + response struct CommissioningCompleteResponse = 5 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + request struct SetTCAcknowledgementsRequest { + int16u TCVersion = 0; + bitmap16 TCUserResponse = 1; + } + + response struct SetTCAcknowledgementsResponse = 7 { + CommissioningErrorEnum errorCode = 0; + } + + /** Arm the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock */ + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + /** Set the regulatory configuration to be used during commissioning */ + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + /** Signals the Server that the Client has successfully completed all steps of Commissioning/Recofiguration needed during fail-safe period. */ + fabric command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; + /** This command sets the user acknowledgements received in the Enhanced Setup Flow Terms and Conditions into the node. */ + command access(invoke: administer) SetTCAcknowledgements(SetTCAcknowledgementsRequest): SetTCAcknowledgementsResponse = 6; +} + +/** Functionality to configure, enable, disable network credentials and access on a Matter device. */ +cluster NetworkCommissioning = 49 { + revision 1; // NOTE: Default/not specifically set + + enum NetworkCommissioningStatusEnum : enum8 { + kSuccess = 0; + kOutOfRange = 1; + kBoundsExceeded = 2; + kNetworkIDNotFound = 3; + kDuplicateNetworkID = 4; + kNetworkNotFound = 5; + kRegulatoryError = 6; + kAuthFailure = 7; + kUnsupportedSecurity = 8; + kOtherConnectionFailure = 9; + kIPV6Failed = 10; + kIPBindFailed = 11; + kUnknownError = 12; + } + + enum WiFiBandEnum : enum8 { + k2G4 = 0; + k3G65 = 1; + k5G = 2; + k6G = 3; + k60G = 4; + k1G = 5; + } + + bitmap Feature : bitmap32 { + kWiFiNetworkInterface = 0x1; + kThreadNetworkInterface = 0x2; + kEthernetNetworkInterface = 0x4; + kPerDeviceCredentials = 0x8; + } + + bitmap ThreadCapabilitiesBitmap : bitmap16 { + kIsBorderRouterCapable = 0x1; + kIsRouterCapable = 0x2; + kIsSleepyEndDeviceCapable = 0x4; + kIsFullThreadDevice = 0x8; + kIsSynchronizedSleepyEndDeviceCapable = 0x10; + } + + bitmap WiFiSecurityBitmap : bitmap8 { + kUnencrypted = 0x1; + kWEP = 0x2; + kWPAPersonal = 0x4; + kWPA2Personal = 0x8; + kWPA3Personal = 0x10; + kWPA3MatterPDC = 0x20; + } + + struct NetworkInfoStruct { + octet_string<32> networkID = 0; + boolean connected = 1; + optional nullable octet_string<20> networkIdentifier = 2; + optional nullable octet_string<20> clientIdentifier = 3; + } + + struct ThreadInterfaceScanResultStruct { + int16u panId = 0; + int64u extendedPanId = 1; + char_string<16> networkName = 2; + int16u channel = 3; + int8u version = 4; + octet_string<8> extendedAddress = 5; + int8s rssi = 6; + int8u lqi = 7; + } + + struct WiFiInterfaceScanResultStruct { + WiFiSecurityBitmap security = 0; + octet_string<32> ssid = 1; + octet_string<6> bssid = 2; + int16u channel = 3; + WiFiBandEnum wiFiBand = 4; + int8s rssi = 5; + } + + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfoStruct networks[] = 1; + readonly attribute optional int8u scanMaxTimeSeconds = 2; + readonly attribute optional int8u connectMaxTimeSeconds = 3; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatusEnum lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + provisional readonly attribute optional WiFiBandEnum supportedWiFiBands[] = 8; + provisional readonly attribute optional ThreadCapabilitiesBitmap supportedThreadFeatures = 9; + provisional readonly attribute optional int16u threadVersion = 10; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ScanNetworksRequest { + optional nullable octet_string<32> ssid = 0; + optional int64u breadcrumb = 1; + } + + response struct ScanNetworksResponse = 1 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + optional WiFiInterfaceScanResultStruct wiFiScanResults[] = 2; + optional ThreadInterfaceScanResultStruct threadScanResults[] = 3; + } + + request struct AddOrUpdateWiFiNetworkRequest { + octet_string<32> ssid = 0; + octet_string<64> credentials = 1; + optional int64u breadcrumb = 2; + optional octet_string<140> networkIdentity = 3; + optional octet_string<20> clientIdentifier = 4; + optional octet_string<32> possessionNonce = 5; + } + + request struct AddOrUpdateThreadNetworkRequest { + octet_string<254> operationalDataset = 0; + optional int64u breadcrumb = 1; + } + + request struct RemoveNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct NetworkConfigResponse = 5 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string<512> debugText = 1; + optional int8u networkIndex = 2; + optional octet_string<140> clientIdentity = 3; + optional octet_string<64> possessionSignature = 4; + } + + request struct ConnectNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct ConnectNetworkResponse = 7 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + nullable int32s errorValue = 2; + } + + request struct ReorderNetworkRequest { + octet_string<32> networkID = 0; + int8u networkIndex = 1; + optional int64u breadcrumb = 2; + } + + request struct QueryIdentityRequest { + octet_string<20> keyIdentifier = 0; + optional octet_string<32> possessionNonce = 1; + } + + response struct QueryIdentityResponse = 10 { + octet_string<140> identity = 0; + optional octet_string<64> possessionSignature = 1; + } + + /** Detemine the set of networks the device sees as available. */ + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + /** Add or update the credentials for a given Wi-Fi network. */ + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + /** Add or update the credentials for a given Thread network. */ + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + /** Remove the definition of a given network (including its credentials). */ + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + /** Connect to the specified network, using previously-defined credentials. */ + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + /** Modify the order in which networks will be presented in the Networks attribute. */ + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + /** Retrieve details about and optionally proof of possession of a network client identity. */ + command access(invoke: administer) QueryIdentity(QueryIdentityRequest): QueryIdentityResponse = 9; +} + +/** The cluster provides commands for retrieving unstructured diagnostic logs from a Node that may be used to aid in diagnostics. */ +cluster DiagnosticLogs = 50 { + revision 1; // NOTE: Default/not specifically set + + enum IntentEnum : enum8 { + kEndUserSupport = 0; + kNetworkDiag = 1; + kCrashLogs = 2; + } + + enum StatusEnum : enum8 { + kSuccess = 0; + kExhausted = 1; + kNoLogs = 2; + kBusy = 3; + kDenied = 4; + } + + enum TransferProtocolEnum : enum8 { + kResponsePayload = 0; + kBDX = 1; + } + + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RetrieveLogsRequestRequest { + IntentEnum intent = 0; + TransferProtocolEnum requestedProtocol = 1; + optional char_string<32> transferFileDesignator = 2; + } + + response struct RetrieveLogsResponse = 1 { + StatusEnum status = 0; + long_octet_string logContent = 1; + optional epoch_us UTCTimeStamp = 2; + optional systime_us timeSinceBoot = 3; + } + + /** Retrieving diagnostic logs from a Node */ + command RetrieveLogsRequest(RetrieveLogsRequestRequest): RetrieveLogsResponse = 0; +} + +/** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster GeneralDiagnostics = 51 { + revision 2; + + enum BootReasonEnum : enum8 { + kUnspecified = 0; + kPowerOnReboot = 1; + kBrownOutReset = 2; + kSoftwareWatchdogReset = 3; + kHardwareWatchdogReset = 4; + kSoftwareUpdateCompleted = 5; + kSoftwareReset = 6; + } + + enum HardwareFaultEnum : enum8 { + kUnspecified = 0; + kRadio = 1; + kSensor = 2; + kResettableOverTemp = 3; + kNonResettableOverTemp = 4; + kPowerSource = 5; + kVisualDisplayFault = 6; + kAudioOutputFault = 7; + kUserInterfaceFault = 8; + kNonVolatileMemoryError = 9; + kTamperDetected = 10; + } + + enum InterfaceTypeEnum : enum8 { + kUnspecified = 0; + kWiFi = 1; + kEthernet = 2; + kCellular = 3; + kThread = 4; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kHardwareFailure = 1; + kNetworkJammed = 2; + kConnectionFailed = 3; + } + + enum RadioFaultEnum : enum8 { + kUnspecified = 0; + kWiFiFault = 1; + kCellularFault = 2; + kThreadFault = 3; + kNFCFault = 4; + kBLEFault = 5; + kEthernetFault = 6; + } + + bitmap Feature : bitmap32 { + kDataModelTest = 0x1; + } + + struct NetworkInterface { + char_string<32> name = 0; + boolean isOperational = 1; + nullable boolean offPremiseServicesReachableIPv4 = 2; + nullable boolean offPremiseServicesReachableIPv6 = 3; + octet_string<8> hardwareAddress = 4; + octet_string IPv4Addresses[] = 5; + octet_string IPv6Addresses[] = 6; + InterfaceTypeEnum type = 7; + } + + critical event HardwareFaultChange = 0 { + HardwareFaultEnum current[] = 0; + HardwareFaultEnum previous[] = 1; + } + + critical event RadioFaultChange = 1 { + RadioFaultEnum current[] = 0; + RadioFaultEnum previous[] = 1; + } + + critical event NetworkFaultChange = 2 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + critical event BootReason = 3 { + BootReasonEnum bootReason = 0; + } + + readonly attribute NetworkInterface networkInterfaces[] = 0; + readonly attribute int16u rebootCount = 1; + readonly attribute optional int64u upTime = 2; + readonly attribute optional int32u totalOperationalHours = 3; + readonly attribute optional BootReasonEnum bootReason = 4; + readonly attribute optional HardwareFaultEnum activeHardwareFaults[] = 5; + readonly attribute optional RadioFaultEnum activeRadioFaults[] = 6; + readonly attribute optional NetworkFaultEnum activeNetworkFaults[] = 7; + readonly attribute boolean testEventTriggersEnabled = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct TestEventTriggerRequest { + octet_string<16> enableKey = 0; + int64u eventTrigger = 1; + } + + response struct TimeSnapshotResponse = 2 { + systime_ms systemTimeMs = 0; + nullable posix_ms posixTimeMs = 1; + } + + request struct PayloadTestRequestRequest { + octet_string<16> enableKey = 0; + int8u value = 1; + int16u count = 2; + } + + response struct PayloadTestResponse = 4 { + octet_string payload = 0; + } + + /** Provide a means for certification tests to trigger some test-plan-specific events */ + command access(invoke: manage) TestEventTrigger(TestEventTriggerRequest): DefaultSuccess = 0; + /** Take a snapshot of system time and epoch time. */ + command TimeSnapshot(): TimeSnapshotResponse = 1; + /** Request a variable length payload response. */ + command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; +} + +/** Commands to trigger a Node to allow a new Administrator to commission it. */ +cluster AdministratorCommissioning = 60 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningWindowStatusEnum : enum8 { + kWindowNotOpen = 0; + kEnhancedWindowOpen = 1; + kBasicWindowOpen = 2; + } + + enum StatusCode : enum8 { + kBusy = 2; + kPAKEParameterError = 3; + kWindowNotOpen = 4; + } + + bitmap Feature : bitmap32 { + kBasic = 0x1; + } + + readonly attribute CommissioningWindowStatusEnum windowStatus = 0; + readonly attribute nullable fabric_idx adminFabricIndex = 1; + readonly attribute nullable vendor_id adminVendorId = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OpenCommissioningWindowRequest { + int16u commissioningTimeout = 0; + octet_string PAKEPasscodeVerifier = 1; + int16u discriminator = 2; + int32u iterations = 3; + octet_string<32> salt = 4; + } + + request struct OpenBasicCommissioningWindowRequest { + int16u commissioningTimeout = 0; + } + + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using enhanced commissioning method. */ + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using basic commissioning method, if the node supports it. */ + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + /** This command is used by a current Administrator to instruct a Node to revoke any active Open Commissioning Window or Open Basic Commissioning Window command. */ + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; +} + +/** This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the associated Fabrics. */ +cluster OperationalCredentials = 62 { + revision 1; // NOTE: Default/not specifically set + + enum CertificateChainTypeEnum : enum8 { + kDACCertificate = 1; + kPAICertificate = 2; + } + + enum NodeOperationalCertStatusEnum : enum8 { + kOK = 0; + kInvalidPublicKey = 1; + kInvalidNodeOpId = 2; + kInvalidNOC = 3; + kMissingCsr = 4; + kTableFull = 5; + kInvalidAdminSubject = 6; + kFabricConflict = 9; + kLabelConflict = 10; + kInvalidFabricIndex = 11; + } + + fabric_scoped struct FabricDescriptorStruct { + octet_string<65> rootPublicKey = 1; + vendor_id vendorID = 2; + fabric_id fabricID = 3; + node_id nodeID = 4; + char_string<32> label = 5; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct NOCStruct { + fabric_sensitive octet_string noc = 1; + nullable fabric_sensitive octet_string icac = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; + readonly attribute FabricDescriptorStruct fabrics[] = 1; + readonly attribute int8u supportedFabrics = 2; + readonly attribute int8u commissionedFabrics = 3; + readonly attribute octet_string trustedRootCertificates[] = 4; + readonly attribute int8u currentFabricIndex = 5; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AttestationRequestRequest { + octet_string<32> attestationNonce = 0; + } + + response struct AttestationResponse = 1 { + octet_string<900> attestationElements = 0; + octet_string<64> attestationSignature = 1; + } + + request struct CertificateChainRequestRequest { + CertificateChainTypeEnum certificateType = 0; + } + + response struct CertificateChainResponse = 3 { + octet_string<600> certificate = 0; + } + + request struct CSRRequestRequest { + octet_string<32> CSRNonce = 0; + optional boolean isForUpdateNOC = 1; + } + + response struct CSRResponse = 5 { + octet_string NOCSRElements = 0; + octet_string attestationSignature = 1; + } + + request struct AddNOCRequest { + octet_string<400> NOCValue = 0; + optional octet_string<400> ICACValue = 1; + octet_string<16> IPKValue = 2; + int64u caseAdminSubject = 3; + vendor_id adminVendorId = 4; + } + + request struct UpdateNOCRequest { + octet_string NOCValue = 0; + optional octet_string ICACValue = 1; + } + + response struct NOCResponse = 8 { + NodeOperationalCertStatusEnum statusCode = 0; + optional fabric_idx fabricIndex = 1; + optional char_string<128> debugText = 2; + } + + request struct UpdateFabricLabelRequest { + char_string<32> label = 0; + } + + request struct RemoveFabricRequest { + fabric_idx fabricIndex = 0; + } + + request struct AddTrustedRootCertificateRequest { + octet_string rootCACertificate = 0; + } + + /** Sender is requesting attestation information from the receiver. */ + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + /** Sender is requesting a device attestation certificate from the receiver. */ + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + /** Sender is requesting a certificate signing request (CSR) from the receiver. */ + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + /** Sender is requesting to add the new node operational certificates. */ + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + /** Sender is requesting to update the node operational certificates. */ + fabric command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + /** This command SHALL be used by an Administrative Node to set the user-visible Label field for a given Fabric, as reflected by entries in the Fabrics attribute. */ + fabric command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + /** This command is used by Administrative Nodes to remove a given fabric index and delete all associated fabric-scoped data. */ + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + /** This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation. */ + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; +} + +/** The Group Key Management Cluster is the mechanism by which group keys are managed. */ +cluster GroupKeyManagement = 63 { + revision 1; // NOTE: Default/not specifically set + + enum GroupKeySecurityPolicyEnum : enum8 { + kTrustFirst = 0; + kCacheAndSync = 1; + } + + bitmap Feature : bitmap32 { + kCacheAndSync = 0x1; + } + + fabric_scoped struct GroupInfoMapStruct { + group_id groupId = 1; + endpoint_no endpoints[] = 2; + optional char_string<16> groupName = 3; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct GroupKeyMapStruct { + group_id groupId = 1; + int16u groupKeySetID = 2; + fabric_idx fabricIndex = 254; + } + + struct GroupKeySetStruct { + int16u groupKeySetID = 0; + GroupKeySecurityPolicyEnum groupKeySecurityPolicy = 1; + nullable octet_string<16> epochKey0 = 2; + nullable epoch_us epochStartTime0 = 3; + nullable octet_string<16> epochKey1 = 4; + nullable epoch_us epochStartTime1 = 5; + nullable octet_string<16> epochKey2 = 6; + nullable epoch_us epochStartTime2 = 7; + } + + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; + readonly attribute GroupInfoMapStruct groupTable[] = 1; + readonly attribute int16u maxGroupsPerFabric = 2; + readonly attribute int16u maxGroupKeysPerFabric = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct KeySetWriteRequest { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetReadRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadResponse = 2 { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetRemoveRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadAllIndicesResponse = 5 { + int16u groupKeySetIDs[] = 0; + } + + /** Write a new set of keys for the given key set id. */ + fabric command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + /** Read the keys for a given key set id. */ + fabric command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + /** Revoke a Root Key from a Group */ + fabric command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + /** Return the list of Group Key Sets associated with the accessing fabric */ + fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; +} + +/** This cluster provides an interface to a boolean state called StateValue. */ +cluster BooleanState = 69 { + revision 1; + + info event StateChange = 0 { + boolean stateValue = 0; + } + + readonly attribute boolean stateValue = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** This cluster is used to configure a boolean sensor. */ +cluster BooleanStateConfiguration = 128 { + revision 1; + + bitmap AlarmModeBitmap : bitmap8 { + kVisual = 0x1; + kAudible = 0x2; + } + + bitmap Feature : bitmap32 { + kVisual = 0x1; + kAudible = 0x2; + kAlarmSuppress = 0x4; + kSensitivityLevel = 0x8; + } + + bitmap SensorFaultBitmap : bitmap16 { + kGeneralFault = 0x1; + } + + info event AlarmsStateChanged = 0 { + AlarmModeBitmap alarmsActive = 0; + optional AlarmModeBitmap alarmsSuppressed = 1; + } + + info event SensorFault = 1 { + SensorFaultBitmap sensorFault = 0; + } + + attribute optional int8u currentSensitivityLevel = 0; + readonly attribute optional int8u supportedSensitivityLevels = 1; + readonly attribute optional int8u defaultSensitivityLevel = 2; + readonly attribute optional AlarmModeBitmap alarmsActive = 3; + readonly attribute optional AlarmModeBitmap alarmsSuppressed = 4; + readonly attribute optional AlarmModeBitmap alarmsEnabled = 5; + readonly attribute optional AlarmModeBitmap alarmsSupported = 6; + readonly attribute optional SensorFaultBitmap sensorFault = 7; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct SuppressAlarmRequest { + AlarmModeBitmap alarmsToSuppress = 0; + } + + request struct EnableDisableAlarmRequest { + AlarmModeBitmap alarmsToEnableDisable = 0; + } + + /** This command is used to suppress the specified alarm mode. */ + command SuppressAlarm(SuppressAlarmRequest): DefaultSuccess = 0; + /** This command is used to enable or disable the specified alarm mode. */ + command EnableDisableAlarm(EnableDisableAlarmRequest): DefaultSuccess = 1; +} + +endpoint 0 { + device type ma_rootdevice = 22, version 1; + + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster AccessControl { + emits event AccessControlEntryChanged; + emits event AccessControlExtensionChanged; + callback attribute acl; + callback attribute extension; + callback attribute subjectsPerAccessControlEntry; + callback attribute targetsPerAccessControlEntry; + callback attribute accessControlEntriesPerFabric; + callback attribute attributeList; + ram attribute featureMap default = 0; + callback attribute clusterRevision; + } + + server cluster BasicInformation { + emits event StartUp; + emits event ShutDown; + emits event Leave; + callback attribute dataModelRevision; + callback attribute vendorName; + callback attribute vendorID; + callback attribute productName; + callback attribute productID; + persist attribute nodeLabel; + callback attribute location; + callback attribute hardwareVersion; + callback attribute hardwareVersionString; + callback attribute softwareVersion; + callback attribute softwareVersionString; + callback attribute manufacturingDate; + callback attribute partNumber; + callback attribute productURL; + callback attribute productLabel; + callback attribute serialNumber; + persist attribute localConfigDisabled default = 0; + callback attribute uniqueID; + callback attribute capabilityMinima; + callback attribute specificationVersion; + callback attribute maxPathsPerInvoke; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + } + + server cluster LocalizationConfiguration { + ram attribute activeLocale; + callback attribute supportedLocales; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + + server cluster GeneralCommissioning { + ram attribute breadcrumb default = 0x0000000000000000; + callback attribute basicCommissioningInfo; + callback attribute regulatoryConfig; + callback attribute locationCapability; + callback attribute supportsConcurrentConnection; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 0x0001; + + handle command ArmFailSafe; + handle command ArmFailSafeResponse; + handle command SetRegulatoryConfig; + handle command SetRegulatoryConfigResponse; + handle command CommissioningComplete; + handle command CommissioningCompleteResponse; + } + + server cluster NetworkCommissioning { + ram attribute maxNetworks; + callback attribute networks; + ram attribute scanMaxTimeSeconds; + ram attribute connectMaxTimeSeconds; + ram attribute interfaceEnabled; + ram attribute lastNetworkingStatus; + ram attribute lastNetworkID; + ram attribute lastConnectErrorValue; + ram attribute featureMap default = 1; + ram attribute clusterRevision default = 0x0001; + + handle command ScanNetworks; + handle command ScanNetworksResponse; + handle command AddOrUpdateWiFiNetwork; + handle command AddOrUpdateThreadNetwork; + handle command RemoveNetwork; + handle command NetworkConfigResponse; + handle command ConnectNetwork; + handle command ConnectNetworkResponse; + handle command ReorderNetwork; + } + + server cluster DiagnosticLogs { + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command RetrieveLogsRequest; + handle command RetrieveLogsResponse; + } + + server cluster GeneralDiagnostics { + emits event BootReason; + callback attribute networkInterfaces; + callback attribute rebootCount; + callback attribute upTime; + callback attribute totalOperationalHours; + callback attribute bootReason; + callback attribute activeHardwareFaults; + callback attribute activeRadioFaults; + callback attribute activeNetworkFaults; + callback attribute testEventTriggersEnabled default = false; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command TestEventTrigger; + handle command TimeSnapshot; + handle command TimeSnapshotResponse; + } + + server cluster AdministratorCommissioning { + callback attribute windowStatus; + callback attribute adminFabricIndex; + callback attribute adminVendorId; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 0x0001; + + handle command OpenCommissioningWindow; + handle command OpenBasicCommissioningWindow; + handle command RevokeCommissioning; + } + + server cluster OperationalCredentials { + callback attribute NOCs; + callback attribute fabrics; + callback attribute supportedFabrics; + callback attribute commissionedFabrics; + callback attribute trustedRootCertificates; + callback attribute currentFabricIndex; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 0x0001; + + handle command AttestationRequest; + handle command AttestationResponse; + handle command CertificateChainRequest; + handle command CertificateChainResponse; + handle command CSRRequest; + handle command CSRResponse; + handle command AddNOC; + handle command UpdateNOC; + handle command NOCResponse; + handle command UpdateFabricLabel; + handle command RemoveFabric; + handle command AddTrustedRootCertificate; + } + + server cluster GroupKeyManagement { + callback attribute groupKeyMap; + callback attribute groupTable; + callback attribute maxGroupsPerFabric; + callback attribute maxGroupKeysPerFabric; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command KeySetWrite; + handle command KeySetRead; + handle command KeySetReadResponse; + handle command KeySetRemove; + handle command KeySetReadAllIndices; + handle command KeySetReadAllIndicesResponse; + } +} +endpoint 1 { + device type ma_powersource = 17, version 1; + device type ma_water_leak_detector = 67, version 1; + + + server cluster Identify { + ram attribute identifyTime default = 0x0; + ram attribute identifyType default = 0x0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + + handle command Identify; + handle command TriggerEffect; + } + + server cluster Groups { + ram attribute nameSupport; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 3; + + handle command AddGroup; + handle command AddGroupResponse; + handle command ViewGroup; + handle command ViewGroupResponse; + handle command GetGroupMembership; + handle command GetGroupMembershipResponse; + handle command RemoveGroup; + handle command RemoveGroupResponse; + handle command RemoveAllGroups; + handle command AddGroupIfIdentifying; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster PowerSource { + ram attribute status default = 1; + ram attribute order default = 1; + ram attribute description default = "Primary Battery"; + ram attribute batVoltage default = 4100; + ram attribute batPercentRemaining default = 95; + ram attribute batTimeRemaining default = 518400; + ram attribute batChargeLevel default = 0; + ram attribute batReplacementNeeded default = 0; + ram attribute batReplaceability default = 1; + ram attribute batPresent default = 1; + ram attribute batCapacity default = 350; + ram attribute batChargeState default = 4; + ram attribute batFunctionalWhileCharging default = 1; + callback attribute endpointList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + + server cluster BooleanState { + ram attribute stateValue; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + + server cluster BooleanStateConfiguration { + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } +} + + diff --git a/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.zap b/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.zap new file mode 100644 index 00000000000000..1dc7adb63ade21 --- /dev/null +++ b/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.zap @@ -0,0 +1,3214 @@ +{ + "fileFormat": 2, + "featureLevel": 103, + "creator": "zap", + "keyValuePairs": [ + { + "key": "commandDiscovery", + "value": "1" + }, + { + "key": "defaultResponsePolicy", + "value": "always" + }, + { + "key": "manufacturerCodes", + "value": "0x1002" + } + ], + "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", + "category": "matter", + "version": 1, + "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "category": "matter", + "version": "chip-v1" + } + ], + "endpointTypes": [ + { + "id": 1, + "name": "MA-rootdevice", + "deviceTypeRef": { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice" + }, + "deviceTypes": [ + { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice" + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 22 + ], + "deviceTypeName": "MA-rootdevice", + "deviceTypeCode": 22, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Access Control", + "code": 31, + "mfgCode": null, + "define": "ACCESS_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "ACL", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Extension", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "AccessControlEntryChanged", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "AccessControlExtensionChanged", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Basic Information", + "code": 40, + "mfgCode": null, + "define": "BASIC_INFORMATION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DataModelRevision", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NodeLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ManufacturingDate", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartNumber", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductURL", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "long_char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductLabel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SerialNumber", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LocalConfigDisabled", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "CapabilityMinimaStruct", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SpecificationVersion", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxPathsPerInvoke", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StartUp", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "ShutDown", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Leave", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Localization Configuration", + "code": 43, + "mfgCode": null, + "define": "LOCALIZATION_CONFIGURATION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "ActiveLocale", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedLocales", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ArmFailSafe", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ArmFailSafeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfig", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfigResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CommissioningComplete", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommissioningCompleteResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Breadcrumb", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BasicCommissioningInfo", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "BasicCommissioningInfo", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RegulatoryConfig", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LocationCapability", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportsConcurrentConnection", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddOrUpdateWiFiNetwork", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddOrUpdateThreadNetwork", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NetworkConfigResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ConnectNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ConnectNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ReorderNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "MaxNetworks", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Networks", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ScanMaxTimeSeconds", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ConnectMaxTimeSeconds", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "InterfaceEnabled", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkingStatus", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "NetworkCommissioningStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkID", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastConnectErrorValue", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Diagnostic Logs", + "code": 50, + "mfgCode": null, + "define": "DIAGNOSTIC_LOGS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "RetrieveLogsRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RetrieveLogsResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "TestEventTrigger", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshot", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshotResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NetworkInterfaces", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RebootCount", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TotalOperationalHours", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BootReason", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "BootReasonEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveHardwareFaults", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveRadioFaults", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaults", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TestEventTriggersEnabled", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "BootReason", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Administrator Commissioning", + "code": 60, + "mfgCode": null, + "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "OpenCommissioningWindow", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "OpenBasicCommissioningWindow", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RevokeCommissioning", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "WindowStatus", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "CommissioningWindowStatusEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminFabricIndex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "fabric_idx", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminVendorId", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AttestationRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AttestationResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CertificateChainRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CertificateChainResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CSRRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CSRResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddNOC", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "UpdateNOC", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NOCResponse", + "code": 8, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "UpdateFabricLabel", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveFabric", + "code": 10, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddTrustedRootCertificate", + "code": 11, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NOCs", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Fabrics", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SupportedFabrics", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CommissionedFabrics", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TrustedRootCertificates", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentFabricIndex", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "GroupKeyMap", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GroupTable", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + }, + { + "id": 2, + "name": "Anonymous Endpoint Type", + "deviceTypeRef": { + "code": 67, + "profileId": 259, + "label": "MA-water-leak-detector", + "name": "MA-water-leak-detector" + }, + "deviceTypes": [ + { + "code": 67, + "profileId": 259, + "label": "MA-water-leak-detector", + "name": "MA-water-leak-detector" + }, + { + "code": 17, + "profileId": 259, + "label": "MA-powersource", + "name": "MA-powersource" + } + ], + "deviceVersions": [ + 1, + 1 + ], + "deviceIdentifiers": [ + 67, + 17 + ], + "deviceTypeName": "MA-water-leak-detector", + "deviceTypeCode": 67, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdentifyTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "IdentifyType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "IdentifyTypeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AddGroup", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ViewGroup", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "GetGroupMembership", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "RemoveGroup", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "RemoveAllGroups", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddGroupIfIdentifying", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NameSupport", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "NameSupportBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Power Source", + "code": 47, + "mfgCode": null, + "define": "POWER_SOURCE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Status", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PowerSourceStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Order", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "Primary Battery", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatVoltage", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4100", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPercentRemaining", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "95", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatTimeRemaining", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "518400", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeLevel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "BatChargeLevelEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplacementNeeded", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplaceability", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "BatReplaceabilityEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPresent", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatCapacity", + "code": 24, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "350", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeState", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "BatChargeStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatFunctionalWhileCharging", + "code": 28, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EndpointList", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Boolean State", + "code": 69, + "mfgCode": null, + "define": "BOOLEAN_STATE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "StateValue", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Boolean State Configuration", + "code": 128, + "mfgCode": null, + "define": "BOOLEAN_STATE_CONFIGURATION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + } + ], + "endpoints": [ + { + "endpointTypeName": "MA-rootdevice", + "endpointTypeIndex": 0, + "profileId": 259, + "endpointId": 0, + "networkId": 0, + "parentEndpointIdentifier": null + }, + { + "endpointTypeName": "Anonymous Endpoint Type", + "endpointTypeIndex": 1, + "profileId": 259, + "endpointId": 1, + "networkId": 0, + "parentEndpointIdentifier": 0 + } + ] +} diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 8d1b30234cec87..0539af8bf6a1ba 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -146,6 +146,7 @@ def BuildHostTarget(): TargetPart('air-quality-sensor', app=HostApp.AIR_QUALITY_SENSOR), TargetPart('network-manager', app=HostApp.NETWORK_MANAGER), TargetPart('energy-management', app=HostApp.ENERGY_MANAGEMENT), + TargetPart('water-leak-detector', app=HostApp.WATER_LEAK_DETECTOR), ] if (HostBoard.NATIVE.PlatformName() == 'darwin'): diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 624bd9ad748cd4..a07064795a1c54 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -84,6 +84,7 @@ class HostApp(Enum): AIR_QUALITY_SENSOR = auto() NETWORK_MANAGER = auto() ENERGY_MANAGEMENT = auto() + WATER_LEAK_DETECTOR = auto() def ExamplePath(self): if self == HostApp.ALL_CLUSTERS: @@ -154,6 +155,8 @@ def ExamplePath(self): return 'network-manager-app/linux' elif self == HostApp.ENERGY_MANAGEMENT: return 'energy-management-app/linux' + elif self == HostApp.WATER_LEAK_DETECTOR: + return 'water-leak-detector/linux' else: raise Exception('Unknown app type: %r' % self) @@ -266,6 +269,9 @@ def OutputNames(self): elif self == HostApp.ENERGY_MANAGEMENT: yield 'chip-energy-management-app' yield 'chip-energy-management-app.map' + elif self == HostApp.WATER_LEAK_DETECTOR: + yield 'water-leak-detector-app' + yield 'water-leak-detector-app.map' else: raise Exception('Unknown app type: %r' % self) diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 93e375c857a83f..51d507072bacfd 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -9,7 +9,7 @@ efr32-{brd2704b,brd4316a,brd4317a,brd4318a,brd4319a,brd4186a,brd4187a,brd2601b,b esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,energy-management,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only][-tracing][-data-model-disabled][-data-model-enabled] genio-lighting-app linux-fake-tests[-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-pw-fuzztest][-coverage][-dmalloc][-clang] -linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,light-data-model-no-unique-id,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,fabric-admin,fabric-bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management}[-nodeps][-nlfaultinject][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-no-shell][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-pw-fuzztest][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event][-enable-dnssd-tests][-disable-dnssd-tests][-chip-casting-simplified][-data-model-check][-data-model-disabled][-data-model-enabled][-check-failure-die] +linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,light-data-model-no-unique-id,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,fabric-admin,fabric-bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management,water-leak-detector}[-nodeps][-nlfaultinject][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-no-shell][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-pw-fuzztest][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event][-enable-dnssd-tests][-disable-dnssd-tests][-chip-casting-simplified][-data-model-check][-data-model-disabled][-data-model-enabled][-check-failure-die] linux-x64-efr32-test-runner[-clang] imx-{chip-tool,lighting-app,thermostat,all-clusters-app,all-clusters-minimal-app,ota-provider-app}[-release] infineon-psoc6-{lock,light,all-clusters,all-clusters-minimal}[-ota][-updateimage][-trustm] From 1c2ad2e3ae5276a0b5aeb6239dad27ff64a67544 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Mon, 7 Oct 2024 17:47:18 +0200 Subject: [PATCH 12/39] =?UTF-8?q?[HotFix]=20Missing=20declaration=20in=20p?= =?UTF-8?q?rovisional=20water-leak-detector-app.m=E2=80=A6=20(#35938)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../water-leak-detector-common/water-leak-detector-app.matter | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter b/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter index b01d083abbac61..f2cc365f2b6b0a 100644 --- a/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter +++ b/examples/water-leak-detector-app/water-leak-detector-common/water-leak-detector-app.matter @@ -938,6 +938,7 @@ cluster GeneralCommissioning = 48 { provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; From 4ec17169be31148cfbbe5b88c3915de3eb2c7809 Mon Sep 17 00:00:00 2001 From: andyg-apple <113489604+andyg-apple@users.noreply.github.com> Date: Tue, 8 Oct 2024 07:39:14 +1300 Subject: [PATCH 13/39] WebRTC requestor cluster (#35910) * Added WebRTC Requestor cluster xml file and associated references * Generated using ./scripts/tools/zap_regen_all.py * Fixed command descriptions. * (re)Generated using ./scripts/tools/zap_regen_all.py * (re)Generated using ./scripts/tools/zap_regen_all.py --- .github/workflows/tests.yaml | 1 + docs/zap_clusters.md | 1 + scripts/rules.matterlint | 1 + .../chip/webrtc-requestor-cluster.xml | 62 ++ .../zcl/zcl-with-test-extensions.json | 1 + src/app/zap-templates/zcl/zcl.json | 1 + src/app/zap_cluster_list.json | 2 + .../data_model/controller-clusters.matter | 87 ++ .../chip/devicecontroller/ChipClusters.java | 328 ++++++ .../chip/devicecontroller/ChipStructs.java | 227 ++++ .../devicecontroller/ClusterIDMapping.java | 176 ++++ .../devicecontroller/ClusterInfoMapping.java | 210 ++++ .../devicecontroller/ClusterReadMapping.java | 82 ++ .../devicecontroller/ClusterWriteMapping.java | 2 + .../chip/devicecontroller/cluster/files.gni | 2 + ...ransportRequestorClusterICEServerStruct.kt | 106 ++ ...portRequestorClusterWebRTCSessionStruct.kt | 115 +++ .../WebRTCTransportRequestorCluster.kt | 873 ++++++++++++++++ .../java/matter/controller/cluster/files.gni | 3 + ...ransportRequestorClusterICEServerStruct.kt | 106 ++ ...portRequestorClusterWebRTCSessionStruct.kt | 115 +++ .../CHIPAttributeTLVValueDecoder.cpp | 250 +++++ .../CHIPEventTLVValueDecoder.cpp | 10 + .../python/chip/clusters/CHIPClusters.py | 86 ++ .../python/chip/clusters/Objects.py | 293 ++++++ .../MTRAttributeSpecifiedCheck.mm | 33 + .../MTRAttributeTLVValueDecoder.mm | 56 + .../CHIP/zap-generated/MTRBaseClusters.h | 118 +++ .../CHIP/zap-generated/MTRBaseClusters.mm | 353 +++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 16 + .../CHIP/zap-generated/MTRClusterNames.mm | 88 ++ .../CHIP/zap-generated/MTRClusters.h | 43 + .../CHIP/zap-generated/MTRClusters.mm | 147 +++ .../zap-generated/MTRCommandPayloadsObjc.h | 132 +++ .../zap-generated/MTRCommandPayloadsObjc.mm | 412 ++++++++ .../MTRCommandPayloads_Internal.h | 24 + .../zap-generated/MTRCommandTimedCheck.mm | 12 + .../zap-generated/MTREventTLVValueDecoder.mm | 15 + .../CHIP/zap-generated/MTRStructsObjc.h | 19 + .../CHIP/zap-generated/MTRStructsObjc.mm | 81 ++ .../zap-generated/attributes/Accessors.cpp | 100 ++ .../zap-generated/attributes/Accessors.h | 18 + .../app-common/zap-generated/callback.h | 67 ++ .../app-common/zap-generated/cluster-enums.h | 9 + .../zap-generated/cluster-objects.cpp | 207 ++++ .../zap-generated/cluster-objects.h | 253 +++++ .../app-common/zap-generated/ids/Attributes.h | 34 + .../app-common/zap-generated/ids/Clusters.h | 3 + .../app-common/zap-generated/ids/Commands.h | 22 + .../zap-generated/cluster/Commands.h | 242 +++++ .../cluster/logging/DataModelLogger.cpp | 43 + .../cluster/logging/EntryToText.cpp | 38 + .../zap-generated/cluster/Commands.h | 968 ++++++++++++++++++ 53 files changed, 6693 insertions(+) create mode 100644 src/app/zap-templates/zcl/data-model/chip/webrtc-requestor-cluster.xml create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/clusters/WebRTCTransportRequestorCluster.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 04aa91020a7d6d..c96c4ea023a59d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -199,6 +199,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/webrtc-requestor-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/webrtc-provider-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml \ diff --git a/docs/zap_clusters.md b/docs/zap_clusters.md index 1250a60b71302e..5803545d3e9533 100644 --- a/docs/zap_clusters.md +++ b/docs/zap_clusters.md @@ -130,6 +130,7 @@ Generally regenerate using one of: | 1295 | 0x50F | ContentControl | | 1296 | 0x510 | ContentAppObserver | | 1363 | 0x553 | WebRTCTransportProvider | +| 1364 | 0x554 | WebRTCTransportRequestor | | 1366 | 0x556 | Chime | | 1872 | 0x750 | EcosystemInformation | | 1873 | 0x751 | CommissionerControl | diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index 1573cc7065764e..b7ce7ef97541de 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -108,6 +108,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/webrtc-requestor-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/webrtc-provider-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml"; diff --git a/src/app/zap-templates/zcl/data-model/chip/webrtc-requestor-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/webrtc-requestor-cluster.xml new file mode 100644 index 00000000000000..557ebf8e7b3cba --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/webrtc-requestor-cluster.xml @@ -0,0 +1,62 @@ + + + + + + + Cameras + WebRTC Transport Requestor + 0x0554 + WEBRTC_TRANSPORT_REQUESTOR_CLUSTER + The WebRTC transport requestor cluster provides a way for stream consumers (e.g. Matter Stream Viewer) to establish a WebRTC connection with a stream provider. + true + true + + CurrentSessions + + This command provides the stream requestor with WebRTC session details. It is sent following the receipt of a SolicitOffer command or a re-Offer initiated by the Provider. + + + + + + + + This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer). It is the next command in the Offer/Answer flow to the ProvideOffer command. + + + + + + This command provides an ICE candidate to the stream requestor in a WebRTC session. + + + + + + This command notifies the stream requestor that the provider has ended the WebRTC session. + + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index e4c9a18e6c817b..61d46b64537a51 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -132,6 +132,7 @@ "water-heater-management-cluster.xml", "water-heater-mode-cluster.xml", "webrtc-provider-cluster.xml", + "webrtc-requestor-cluster.xml", "wifi-network-diagnostics-cluster.xml", "wifi-network-management-cluster.xml", "window-covering.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index b306dba2239540..f4e04ef1f2c830 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -126,6 +126,7 @@ "water-heater-management-cluster.xml", "water-heater-mode-cluster.xml", "webrtc-provider-cluster.xml", + "webrtc-requestor-cluster.xml", "wifi-network-diagnostics-cluster.xml", "wifi-network-management-cluster.xml", "window-covering.xml", diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index c240008e1c31c9..aab95321afc639 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -132,6 +132,7 @@ "WATER_HEATER_MANAGEMENT_CLUSTER": [], "WATER_HEATER_MODE_CLUSTER": [], "WEB_RTC_PROVIDER_CLUSTER": [], + "WEBRTC_REQUESTOR_CLUSTER": [], "WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [], "WINDOW_COVERING_CLUSTER": [] }, @@ -312,6 +313,7 @@ "LAUNDRY_WASHER_CONTROLS_CLUSTER": ["laundry-washer-controls-server"], "LAUNDRY_DRYER_CONTROLS_CLUSTER": ["laundry-dryer-controls-server"], "WEB_RTC_PROVIDER_CLUSTER": [], + "WEBRTC_REQUESTOR_CLUSTER": [], "WIFI_NETWORK_DIAGNOSTICS_CLUSTER": ["wifi-network-diagnostics-server"], "WIFI_NETWORK_MANAGEMENT_CLUSTER": ["wifi-network-management-server"], "WINDOW_COVERING_CLUSTER": ["window-covering-server"], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 78c5a89323af8d..07b98b17953af9 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -9531,6 +9531,93 @@ provisional cluster WebRTCTransportProvider = 1363 { command EndSession(EndSessionRequest): DefaultSuccess = 7; } +/** The WebRTC transport requestor cluster provides a way for stream consumers (e.g. Matter Stream Viewer) to establish a WebRTC connection with a stream provider. */ +cluster WebRTCTransportRequestor = 1364 { + revision 1; + + enum StreamTypeEnum : enum8 { + kInternal = 0; + kRecording = 1; + kAnalysis = 2; + kLiveView = 3; + } + + enum WebRTCEndReasonEnum : enum8 { + kIceFailed = 0; + kIceTimeout = 1; + kUserHangup = 2; + kUserBusy = 3; + kReplaced = 4; + kNoUserMedia = 5; + kInviteTimeout = 6; + kAnsweredElsewhere = 7; + kOutOfResources = 8; + kMediaTimeout = 9; + kLowPower = 10; + kUnknownReason = 11; + } + + bitmap WebRTCMetadataOptions : bitmap8 { + kDataTLV = 0x1; + } + + struct ICEServerStruct { + char_string urls[] = 1; + optional char_string username = 2; + optional char_string credential = 3; + optional int16u caid = 4; + } + + struct WebRTCSessionStruct { + int16u id = 1; + node_id peerNodeID = 2; + fabric_idx peerFabricIndex = 3; + StreamTypeEnum streamType = 4; + nullable int16u videoStreamID = 5; + nullable int16u audioStreamID = 6; + WebRTCMetadataOptions metadataOptions = 7; + } + + readonly attribute WebRTCSessionStruct currentSessions[] = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OfferRequest { + int16u webRTCSessionID = 0; + char_string sdp = 1; + optional ICEServerStruct ICEServers[] = 2; + optional char_string ICETransportPolicy = 3; + } + + request struct AnswerRequest { + int16u webRTCSessionID = 0; + char_string sdp = 1; + } + + request struct ICECandidateRequest { + int16u webRTCSessionID = 0; + char_string ICECandidate = 1; + } + + request struct EndRequest { + int16u webRTCSessionID = 0; + WebRTCEndReasonEnum reason = 1; + } + + /** This command provides the stream requestor with WebRTC session details. It is sent following the receipt of a SolicitOffer command or a re-Offer initiated by the Provider. */ + command Offer(OfferRequest): DefaultSuccess = 1; + /** This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer). It is the next command in the Offer/Answer flow to the ProvideOffer command. */ + command Answer(AnswerRequest): DefaultSuccess = 2; + /** This command provides an ICE candidate to the stream requestor in a WebRTC session. */ + command ICECandidate(ICECandidateRequest): DefaultSuccess = 3; + /** This command notifies the stream requestor that the provider has ended the WebRTC session. */ + command End(EndRequest): DefaultSuccess = 4; +} + /** This cluster provides facilities to configure and play Chime sounds, such as those used in a doorbell. */ provisional cluster Chime = 1366 { revision 1; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 3a92667fb6afa9..4104a75abb3fa5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -59965,6 +59965,334 @@ public void onSuccess(byte[] tlv) { } } + public static class WebRTCTransportRequestorCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1364L; + + private static final long CURRENT_SESSIONS_ATTRIBUTE_ID = 0L; + private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; + private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; + private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public WebRTCTransportRequestorCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void offer(DefaultClusterCallback callback, Integer webRTCSessionID, String sdp, Optional> ICEServers, Optional ICETransportPolicy) { + offer(callback, webRTCSessionID, sdp, ICEServers, ICETransportPolicy, 0); + } + + public void offer(DefaultClusterCallback callback, Integer webRTCSessionID, String sdp, Optional> ICEServers, Optional ICETransportPolicy, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long webRTCSessionIDFieldID = 0L; + BaseTLVType webRTCSessionIDtlvValue = new UIntType(webRTCSessionID); + elements.add(new StructElement(webRTCSessionIDFieldID, webRTCSessionIDtlvValue)); + + final long sdpFieldID = 1L; + BaseTLVType sdptlvValue = new StringType(sdp); + elements.add(new StructElement(sdpFieldID, sdptlvValue)); + + final long ICEServersFieldID = 2L; + BaseTLVType ICEServerstlvValue = ICEServers.map((nonOptionalICEServers) -> ArrayType.generateArrayType(nonOptionalICEServers, (elementnonOptionalICEServers) -> elementnonOptionalICEServers.encodeTlv())).orElse(new EmptyType()); + elements.add(new StructElement(ICEServersFieldID, ICEServerstlvValue)); + + final long ICETransportPolicyFieldID = 3L; + BaseTLVType ICETransportPolicytlvValue = ICETransportPolicy.map((nonOptionalICETransportPolicy) -> new StringType(nonOptionalICETransportPolicy)).orElse(new EmptyType()); + elements.add(new StructElement(ICETransportPolicyFieldID, ICETransportPolicytlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void answer(DefaultClusterCallback callback, Integer webRTCSessionID, String sdp) { + answer(callback, webRTCSessionID, sdp, 0); + } + + public void answer(DefaultClusterCallback callback, Integer webRTCSessionID, String sdp, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + final long webRTCSessionIDFieldID = 0L; + BaseTLVType webRTCSessionIDtlvValue = new UIntType(webRTCSessionID); + elements.add(new StructElement(webRTCSessionIDFieldID, webRTCSessionIDtlvValue)); + + final long sdpFieldID = 1L; + BaseTLVType sdptlvValue = new StringType(sdp); + elements.add(new StructElement(sdpFieldID, sdptlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void ICECandidate(DefaultClusterCallback callback, Integer webRTCSessionID, String ICECandidate) { + ICECandidate(callback, webRTCSessionID, ICECandidate, 0); + } + + public void ICECandidate(DefaultClusterCallback callback, Integer webRTCSessionID, String ICECandidate, int timedInvokeTimeoutMs) { + final long commandId = 3L; + + ArrayList elements = new ArrayList<>(); + final long webRTCSessionIDFieldID = 0L; + BaseTLVType webRTCSessionIDtlvValue = new UIntType(webRTCSessionID); + elements.add(new StructElement(webRTCSessionIDFieldID, webRTCSessionIDtlvValue)); + + final long ICECandidateFieldID = 1L; + BaseTLVType ICECandidatetlvValue = new StringType(ICECandidate); + elements.add(new StructElement(ICECandidateFieldID, ICECandidatetlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void end(DefaultClusterCallback callback, Integer webRTCSessionID, Integer reason) { + end(callback, webRTCSessionID, reason, 0); + } + + public void end(DefaultClusterCallback callback, Integer webRTCSessionID, Integer reason, int timedInvokeTimeoutMs) { + final long commandId = 4L; + + ArrayList elements = new ArrayList<>(); + final long webRTCSessionIDFieldID = 0L; + BaseTLVType webRTCSessionIDtlvValue = new UIntType(webRTCSessionID); + elements.add(new StructElement(webRTCSessionIDFieldID, webRTCSessionIDtlvValue)); + + final long reasonFieldID = 1L; + BaseTLVType reasontlvValue = new UIntType(reason); + elements.add(new StructElement(reasonFieldID, reasontlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface CurrentSessionsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readCurrentSessionsAttribute( + CurrentSessionsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_SESSIONS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_SESSIONS_ATTRIBUTE_ID, true); + } + + public void subscribeCurrentSessionsAttribute( + CurrentSessionsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_SESSIONS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_SESSIONS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class ChimeCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1366L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 4c04d0ec0eb056..88684160d1ed81 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -12951,6 +12951,233 @@ public String toString() { return output.toString(); } } +public static class WebRTCTransportRequestorClusterICEServerStruct { + public ArrayList urls; + public Optional username; + public Optional credential; + public Optional caid; + private static final long URLS_ID = 1L; + private static final long USERNAME_ID = 2L; + private static final long CREDENTIAL_ID = 3L; + private static final long CAID_ID = 4L; + + public WebRTCTransportRequestorClusterICEServerStruct( + ArrayList urls, + Optional username, + Optional credential, + Optional caid + ) { + this.urls = urls; + this.username = username; + this.credential = credential; + this.caid = caid; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(URLS_ID, ArrayType.generateArrayType(urls, (elementurls) -> new StringType(elementurls)))); + values.add(new StructElement(USERNAME_ID, username.map((nonOptionalusername) -> new StringType(nonOptionalusername)).orElse(new EmptyType()))); + values.add(new StructElement(CREDENTIAL_ID, credential.map((nonOptionalcredential) -> new StringType(nonOptionalcredential)).orElse(new EmptyType()))); + values.add(new StructElement(CAID_ID, caid.map((nonOptionalcaid) -> new UIntType(nonOptionalcaid)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static WebRTCTransportRequestorClusterICEServerStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + ArrayList urls = null; + Optional username = Optional.empty(); + Optional credential = Optional.empty(); + Optional caid = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == URLS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + urls = castingValue.map((elementcastingValue) -> elementcastingValue.value(String.class)); + } + } else if (element.contextTagNum() == USERNAME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + username = Optional.of(castingValue.value(String.class)); + } + } else if (element.contextTagNum() == CREDENTIAL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + credential = Optional.of(castingValue.value(String.class)); + } + } else if (element.contextTagNum() == CAID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + caid = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new WebRTCTransportRequestorClusterICEServerStruct( + urls, + username, + credential, + caid + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("WebRTCTransportRequestorClusterICEServerStruct {\n"); + output.append("\turls: "); + output.append(urls); + output.append("\n"); + output.append("\tusername: "); + output.append(username); + output.append("\n"); + output.append("\tcredential: "); + output.append(credential); + output.append("\n"); + output.append("\tcaid: "); + output.append(caid); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class WebRTCTransportRequestorClusterWebRTCSessionStruct { + public Integer id; + public Long peerNodeID; + public Integer peerFabricIndex; + public Integer streamType; + public @Nullable Integer videoStreamID; + public @Nullable Integer audioStreamID; + public Integer metadataOptions; + private static final long ID_ID = 1L; + private static final long PEER_NODE_ID_ID = 2L; + private static final long PEER_FABRIC_INDEX_ID = 3L; + private static final long STREAM_TYPE_ID = 4L; + private static final long VIDEO_STREAM_ID_ID = 5L; + private static final long AUDIO_STREAM_ID_ID = 6L; + private static final long METADATA_OPTIONS_ID = 7L; + + public WebRTCTransportRequestorClusterWebRTCSessionStruct( + Integer id, + Long peerNodeID, + Integer peerFabricIndex, + Integer streamType, + @Nullable Integer videoStreamID, + @Nullable Integer audioStreamID, + Integer metadataOptions + ) { + this.id = id; + this.peerNodeID = peerNodeID; + this.peerFabricIndex = peerFabricIndex; + this.streamType = streamType; + this.videoStreamID = videoStreamID; + this.audioStreamID = audioStreamID; + this.metadataOptions = metadataOptions; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ID_ID, new UIntType(id))); + values.add(new StructElement(PEER_NODE_ID_ID, new UIntType(peerNodeID))); + values.add(new StructElement(PEER_FABRIC_INDEX_ID, new UIntType(peerFabricIndex))); + values.add(new StructElement(STREAM_TYPE_ID, new UIntType(streamType))); + values.add(new StructElement(VIDEO_STREAM_ID_ID, videoStreamID != null ? new UIntType(videoStreamID) : new NullType())); + values.add(new StructElement(AUDIO_STREAM_ID_ID, audioStreamID != null ? new UIntType(audioStreamID) : new NullType())); + values.add(new StructElement(METADATA_OPTIONS_ID, new UIntType(metadataOptions))); + + return new StructType(values); + } + + public static WebRTCTransportRequestorClusterWebRTCSessionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer id = null; + Long peerNodeID = null; + Integer peerFabricIndex = null; + Integer streamType = null; + @Nullable Integer videoStreamID = null; + @Nullable Integer audioStreamID = null; + Integer metadataOptions = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + id = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == PEER_NODE_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + peerNodeID = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == PEER_FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + peerFabricIndex = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == STREAM_TYPE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + streamType = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == VIDEO_STREAM_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + videoStreamID = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == AUDIO_STREAM_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + audioStreamID = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == METADATA_OPTIONS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + metadataOptions = castingValue.value(Integer.class); + } + } + } + return new WebRTCTransportRequestorClusterWebRTCSessionStruct( + id, + peerNodeID, + peerFabricIndex, + streamType, + videoStreamID, + audioStreamID, + metadataOptions + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("WebRTCTransportRequestorClusterWebRTCSessionStruct {\n"); + output.append("\tid: "); + output.append(id); + output.append("\n"); + output.append("\tpeerNodeID: "); + output.append(peerNodeID); + output.append("\n"); + output.append("\tpeerFabricIndex: "); + output.append(peerFabricIndex); + output.append("\n"); + output.append("\tstreamType: "); + output.append(streamType); + output.append("\n"); + output.append("\tvideoStreamID: "); + output.append(videoStreamID); + output.append("\n"); + output.append("\taudioStreamID: "); + output.append(audioStreamID); + output.append("\n"); + output.append("\tmetadataOptions: "); + output.append(metadataOptions); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ChimeClusterChimeSoundStruct { public Integer chimeID; public String name; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 113c958fadfbd9..28a415a3008fc1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -382,6 +382,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == WebRTCTransportProvider.ID) { return new WebRTCTransportProvider(); } + if (clusterId == WebRTCTransportRequestor.ID) { + return new WebRTCTransportRequestor(); + } if (clusterId == Chime.ID) { return new Chime(); } @@ -17076,6 +17079,179 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class WebRTCTransportRequestor implements BaseCluster { + public static final long ID = 1364L; + public long getID() { + return ID; + } + + public enum Attribute { + CurrentSessions(0L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + Offer(1L), + Answer(2L), + ICECandidate(3L), + End(4L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum OfferCommandField {WebRTCSessionID(0),Sdp(1),ICEServers(2),ICETransportPolicy(3),; + private final int id; + OfferCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static OfferCommandField value(int id) throws NoSuchFieldError { + for (OfferCommandField field : OfferCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum AnswerCommandField {WebRTCSessionID(0),Sdp(1),; + private final int id; + AnswerCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static AnswerCommandField value(int id) throws NoSuchFieldError { + for (AnswerCommandField field : AnswerCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum ICECandidateCommandField {WebRTCSessionID(0),ICECandidate(1),; + private final int id; + ICECandidateCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static ICECandidateCommandField value(int id) throws NoSuchFieldError { + for (ICECandidateCommandField field : ICECandidateCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum EndCommandField {WebRTCSessionID(0),Reason(1),; + private final int id; + EndCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static EndCommandField value(int id) throws NoSuchFieldError { + for (EndCommandField field : EndCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class Chime implements BaseCluster { public static final long ID = 1366L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 295ada1c577b89..27dda463b3b0f3 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -20153,6 +20153,111 @@ public void onError(Exception ex) { } } + public static class DelegatedWebRTCTransportRequestorClusterCurrentSessionsAttributeCallback implements ChipClusters.WebRTCTransportRequestorCluster.CurrentSessionsAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWebRTCTransportRequestorClusterGeneratedCommandListAttributeCallback implements ChipClusters.WebRTCTransportRequestorCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWebRTCTransportRequestorClusterAcceptedCommandListAttributeCallback implements ChipClusters.WebRTCTransportRequestorCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWebRTCTransportRequestorClusterEventListAttributeCallback implements ChipClusters.WebRTCTransportRequestorCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWebRTCTransportRequestorClusterAttributeListAttributeCallback implements ChipClusters.WebRTCTransportRequestorCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedChimeClusterInstalledChimeSoundsAttributeCallback implements ChipClusters.ChimeCluster.InstalledChimeSoundsAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -22598,6 +22703,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.WebRTCTransportProviderCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("webRTCTransportProvider", webRTCTransportProviderClusterInfo); + ClusterInfo webRTCTransportRequestorClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.WebRTCTransportRequestorCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("webRTCTransportRequestor", webRTCTransportRequestorClusterInfo); + ClusterInfo chimeClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.ChimeCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("chime", chimeClusterInfo); @@ -22744,6 +22853,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("webRTCTransportProvider", webRTCTransportProviderClusterInteractionInfoMap); + Map webRTCTransportRequestorClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map webRTCTransportRequestorofferCommandParams = new LinkedHashMap(); + + CommandParameterInfo webRTCTransportRequestorofferwebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class); + webRTCTransportRequestorofferCommandParams.put("webRTCSessionID",webRTCTransportRequestorofferwebRTCSessionIDCommandParameterInfo); + + CommandParameterInfo webRTCTransportRequestoroffersdpCommandParameterInfo = new CommandParameterInfo("sdp", String.class, String.class); + webRTCTransportRequestorofferCommandParams.put("sdp",webRTCTransportRequestoroffersdpCommandParameterInfo); + + + CommandParameterInfo webRTCTransportRequestorofferICETransportPolicyCommandParameterInfo = new CommandParameterInfo("ICETransportPolicy", Optional.class, String.class); + webRTCTransportRequestorofferCommandParams.put("ICETransportPolicy",webRTCTransportRequestorofferICETransportPolicyCommandParameterInfo); + InteractionInfo webRTCTransportRequestorofferInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster) + .offer((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("webRTCSessionID") + , (String) + commandArguments.get("sdp") + , (Optional>) + commandArguments.get("ICEServers") + , (Optional) + commandArguments.get("ICETransportPolicy") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + webRTCTransportRequestorofferCommandParams + ); + webRTCTransportRequestorClusterInteractionInfoMap.put("offer", webRTCTransportRequestorofferInteractionInfo); + + Map webRTCTransportRequestoranswerCommandParams = new LinkedHashMap(); + + CommandParameterInfo webRTCTransportRequestoranswerwebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class); + webRTCTransportRequestoranswerCommandParams.put("webRTCSessionID",webRTCTransportRequestoranswerwebRTCSessionIDCommandParameterInfo); + + CommandParameterInfo webRTCTransportRequestoranswersdpCommandParameterInfo = new CommandParameterInfo("sdp", String.class, String.class); + webRTCTransportRequestoranswerCommandParams.put("sdp",webRTCTransportRequestoranswersdpCommandParameterInfo); + InteractionInfo webRTCTransportRequestoranswerInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster) + .answer((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("webRTCSessionID") + , (String) + commandArguments.get("sdp") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + webRTCTransportRequestoranswerCommandParams + ); + webRTCTransportRequestorClusterInteractionInfoMap.put("answer", webRTCTransportRequestoranswerInteractionInfo); + + Map webRTCTransportRequestorICECandidateCommandParams = new LinkedHashMap(); + + CommandParameterInfo webRTCTransportRequestorICECandidatewebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class); + webRTCTransportRequestorICECandidateCommandParams.put("webRTCSessionID",webRTCTransportRequestorICECandidatewebRTCSessionIDCommandParameterInfo); + + CommandParameterInfo webRTCTransportRequestorICECandidateICECandidateCommandParameterInfo = new CommandParameterInfo("ICECandidate", String.class, String.class); + webRTCTransportRequestorICECandidateCommandParams.put("ICECandidate",webRTCTransportRequestorICECandidateICECandidateCommandParameterInfo); + InteractionInfo webRTCTransportRequestorICECandidateInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster) + .ICECandidate((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("webRTCSessionID") + , (String) + commandArguments.get("ICECandidate") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + webRTCTransportRequestorICECandidateCommandParams + ); + webRTCTransportRequestorClusterInteractionInfoMap.put("ICECandidate", webRTCTransportRequestorICECandidateInteractionInfo); + + Map webRTCTransportRequestorendCommandParams = new LinkedHashMap(); + + CommandParameterInfo webRTCTransportRequestorendwebRTCSessionIDCommandParameterInfo = new CommandParameterInfo("webRTCSessionID", Integer.class, Integer.class); + webRTCTransportRequestorendCommandParams.put("webRTCSessionID",webRTCTransportRequestorendwebRTCSessionIDCommandParameterInfo); + + CommandParameterInfo webRTCTransportRequestorendreasonCommandParameterInfo = new CommandParameterInfo("reason", Integer.class, Integer.class); + webRTCTransportRequestorendCommandParams.put("reason",webRTCTransportRequestorendreasonCommandParameterInfo); + InteractionInfo webRTCTransportRequestorendInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster) + .end((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("webRTCSessionID") + , (Integer) + commandArguments.get("reason") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + webRTCTransportRequestorendCommandParams + ); + webRTCTransportRequestorClusterInteractionInfoMap.put("end", webRTCTransportRequestorendInteractionInfo); + + commandMap.put("webRTCTransportRequestor", webRTCTransportRequestorClusterInteractionInfoMap); + Map chimeClusterInteractionInfoMap = new LinkedHashMap<>(); Map chimeplayChimeSoundCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 4da39ee6450bd1..41df5ac5c85aff 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -18328,6 +18328,87 @@ private static Map readWebRTCTransportProviderInteracti return result; } + private static Map readWebRTCTransportRequestorInteractionInfo() { + Map result = new LinkedHashMap<>();Map readWebRTCTransportRequestorCurrentSessionsCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorCurrentSessionsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readCurrentSessionsAttribute( + (ChipClusters.WebRTCTransportRequestorCluster.CurrentSessionsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWebRTCTransportRequestorClusterCurrentSessionsAttributeCallback(), + readWebRTCTransportRequestorCurrentSessionsCommandParams + ); + result.put("readCurrentSessionsAttribute", readWebRTCTransportRequestorCurrentSessionsAttributeInteractionInfo); + Map readWebRTCTransportRequestorGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.WebRTCTransportRequestorCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWebRTCTransportRequestorClusterGeneratedCommandListAttributeCallback(), + readWebRTCTransportRequestorGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readWebRTCTransportRequestorGeneratedCommandListAttributeInteractionInfo); + Map readWebRTCTransportRequestorAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.WebRTCTransportRequestorCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWebRTCTransportRequestorClusterAcceptedCommandListAttributeCallback(), + readWebRTCTransportRequestorAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readWebRTCTransportRequestorAcceptedCommandListAttributeInteractionInfo); + Map readWebRTCTransportRequestorEventListCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readEventListAttribute( + (ChipClusters.WebRTCTransportRequestorCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWebRTCTransportRequestorClusterEventListAttributeCallback(), + readWebRTCTransportRequestorEventListCommandParams + ); + result.put("readEventListAttribute", readWebRTCTransportRequestorEventListAttributeInteractionInfo); + Map readWebRTCTransportRequestorAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readAttributeListAttribute( + (ChipClusters.WebRTCTransportRequestorCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWebRTCTransportRequestorClusterAttributeListAttributeCallback(), + readWebRTCTransportRequestorAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readWebRTCTransportRequestorAttributeListAttributeInteractionInfo); + Map readWebRTCTransportRequestorFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readWebRTCTransportRequestorFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readWebRTCTransportRequestorFeatureMapAttributeInteractionInfo); + Map readWebRTCTransportRequestorClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readWebRTCTransportRequestorClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WebRTCTransportRequestorCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWebRTCTransportRequestorClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readWebRTCTransportRequestorClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readChimeInteractionInfo() { Map result = new LinkedHashMap<>();Map readChimeInstalledChimeSoundsCommandParams = new LinkedHashMap(); InteractionInfo readChimeInstalledChimeSoundsAttributeInteractionInfo = new InteractionInfo( @@ -19882,6 +19963,7 @@ public Map> getReadAttributeMap() { put("contentControl", readContentControlInteractionInfo()); put("contentAppObserver", readContentAppObserverInteractionInfo()); put("webRTCTransportProvider", readWebRTCTransportProviderInteractionInfo()); + put("webRTCTransportRequestor", readWebRTCTransportRequestorInteractionInfo()); put("chime", readChimeInteractionInfo()); put("ecosystemInformation", readEcosystemInformationInteractionInfo()); put("commissionerControl", readCommissionerControlInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 0d561c36e77174..b2ffaac83a4110 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -3474,6 +3474,8 @@ public Map> getWriteAttributeMap() { writeAttributeMap.put("contentAppObserver", writeContentAppObserverInteractionInfo); Map writeWebRTCTransportProviderInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("webRTCTransportProvider", writeWebRTCTransportProviderInteractionInfo); + Map writeWebRTCTransportRequestorInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("webRTCTransportRequestor", writeWebRTCTransportRequestorInteractionInfo); Map writeChimeInteractionInfo = new LinkedHashMap<>(); Map writeChimeActiveChimeIDCommandParams = new LinkedHashMap(); CommandParameterInfo chimeactiveChimeIDCommandParameterInfo = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 6187cfbe7c2d44..115bbe53cb3c6d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -162,6 +162,8 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportProviderClusterICEServerStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportProviderClusterWebRTCSessionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt", ] eventstructs_sources = [ diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt new file mode 100644 index 00000000000000..4c249b90b16fa9 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt @@ -0,0 +1,106 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WebRTCTransportRequestorClusterICEServerStruct( + val urls: List, + val username: Optional, + val credential: Optional, + val caid: Optional, +) { + override fun toString(): String = buildString { + append("WebRTCTransportRequestorClusterICEServerStruct {\n") + append("\turls : $urls\n") + append("\tusername : $username\n") + append("\tcredential : $credential\n") + append("\tcaid : $caid\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + startArray(ContextSpecificTag(TAG_URLS)) + for (item in urls.iterator()) { + put(AnonymousTag, item) + } + endArray() + if (username.isPresent) { + val optusername = username.get() + put(ContextSpecificTag(TAG_USERNAME), optusername) + } + if (credential.isPresent) { + val optcredential = credential.get() + put(ContextSpecificTag(TAG_CREDENTIAL), optcredential) + } + if (caid.isPresent) { + val optcaid = caid.get() + put(ContextSpecificTag(TAG_CAID), optcaid) + } + endStructure() + } + } + + companion object { + private const val TAG_URLS = 1 + private const val TAG_USERNAME = 2 + private const val TAG_CREDENTIAL = 3 + private const val TAG_CAID = 4 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WebRTCTransportRequestorClusterICEServerStruct { + tlvReader.enterStructure(tlvTag) + val urls = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_URLS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getString(AnonymousTag)) + } + tlvReader.exitContainer() + } + val username = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_USERNAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_USERNAME))) + } else { + Optional.empty() + } + val credential = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CREDENTIAL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_CREDENTIAL))) + } else { + Optional.empty() + } + val caid = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CAID))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_CAID))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return WebRTCTransportRequestorClusterICEServerStruct(urls, username, credential, caid) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt new file mode 100644 index 00000000000000..40c666bbd69dea --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt @@ -0,0 +1,115 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WebRTCTransportRequestorClusterWebRTCSessionStruct( + val id: UInt, + val peerNodeID: ULong, + val peerFabricIndex: UInt, + val streamType: UInt, + val videoStreamID: UInt?, + val audioStreamID: UInt?, + val metadataOptions: UInt, +) { + override fun toString(): String = buildString { + append("WebRTCTransportRequestorClusterWebRTCSessionStruct {\n") + append("\tid : $id\n") + append("\tpeerNodeID : $peerNodeID\n") + append("\tpeerFabricIndex : $peerFabricIndex\n") + append("\tstreamType : $streamType\n") + append("\tvideoStreamID : $videoStreamID\n") + append("\taudioStreamID : $audioStreamID\n") + append("\tmetadataOptions : $metadataOptions\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ID), id) + put(ContextSpecificTag(TAG_PEER_NODE_ID), peerNodeID) + put(ContextSpecificTag(TAG_PEER_FABRIC_INDEX), peerFabricIndex) + put(ContextSpecificTag(TAG_STREAM_TYPE), streamType) + if (videoStreamID != null) { + put(ContextSpecificTag(TAG_VIDEO_STREAM_ID), videoStreamID) + } else { + putNull(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + } + if (audioStreamID != null) { + put(ContextSpecificTag(TAG_AUDIO_STREAM_ID), audioStreamID) + } else { + putNull(ContextSpecificTag(TAG_AUDIO_STREAM_ID)) + } + put(ContextSpecificTag(TAG_METADATA_OPTIONS), metadataOptions) + endStructure() + } + } + + companion object { + private const val TAG_ID = 1 + private const val TAG_PEER_NODE_ID = 2 + private const val TAG_PEER_FABRIC_INDEX = 3 + private const val TAG_STREAM_TYPE = 4 + private const val TAG_VIDEO_STREAM_ID = 5 + private const val TAG_AUDIO_STREAM_ID = 6 + private const val TAG_METADATA_OPTIONS = 7 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): WebRTCTransportRequestorClusterWebRTCSessionStruct { + tlvReader.enterStructure(tlvTag) + val id = tlvReader.getUInt(ContextSpecificTag(TAG_ID)) + val peerNodeID = tlvReader.getULong(ContextSpecificTag(TAG_PEER_NODE_ID)) + val peerFabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_PEER_FABRIC_INDEX)) + val streamType = tlvReader.getUInt(ContextSpecificTag(TAG_STREAM_TYPE)) + val videoStreamID = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + null + } + val audioStreamID = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_AUDIO_STREAM_ID)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AUDIO_STREAM_ID)) + null + } + val metadataOptions = tlvReader.getUInt(ContextSpecificTag(TAG_METADATA_OPTIONS)) + + tlvReader.exitContainer() + + return WebRTCTransportRequestorClusterWebRTCSessionStruct( + id, + peerNodeID, + peerFabricIndex, + streamType, + videoStreamID, + audioStreamID, + metadataOptions, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/WebRTCTransportRequestorCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/WebRTCTransportRequestorCluster.kt new file mode 100644 index 00000000000000..2d5f7d8ed57797 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/WebRTCTransportRequestorCluster.kt @@ -0,0 +1,873 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WebRTCTransportRequestorCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class CurrentSessionsAttribute( + val value: List + ) + + sealed class CurrentSessionsAttributeSubscriptionState { + data class Success(val value: List) : + CurrentSessionsAttributeSubscriptionState() + + data class Error(val exception: Exception) : CurrentSessionsAttributeSubscriptionState() + + object SubscriptionEstablished : CurrentSessionsAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun offer( + webRTCSessionID: UShort, + sdp: String, + ICEServers: List?, + ICETransportPolicy: String?, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 1u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_WEB_RTC_SESSION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_WEB_RTC_SESSION_ID_REQ), webRTCSessionID) + + val TAG_SDP_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SDP_REQ), sdp) + + val TAG_ICE_SERVERS_REQ: Int = 2 + ICEServers?.let { + tlvWriter.startArray(ContextSpecificTag(TAG_ICE_SERVERS_REQ)) + for (item in ICEServers.iterator()) { + item.toTlv(AnonymousTag, tlvWriter) + } + tlvWriter.endArray() + } + + val TAG_ICE_TRANSPORT_POLICY_REQ: Int = 3 + ICETransportPolicy?.let { + tlvWriter.put(ContextSpecificTag(TAG_ICE_TRANSPORT_POLICY_REQ), ICETransportPolicy) + } + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun answer(webRTCSessionID: UShort, sdp: String, timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 2u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_WEB_RTC_SESSION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_WEB_RTC_SESSION_ID_REQ), webRTCSessionID) + + val TAG_SDP_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SDP_REQ), sdp) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun ICECandidate( + webRTCSessionID: UShort, + ICECandidate: String, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 3u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_WEB_RTC_SESSION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_WEB_RTC_SESSION_ID_REQ), webRTCSessionID) + + val TAG_ICE_CANDIDATE_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_ICE_CANDIDATE_REQ), ICECandidate) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun end(webRTCSessionID: UShort, reason: UByte, timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 4u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_WEB_RTC_SESSION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_WEB_RTC_SESSION_ID_REQ), webRTCSessionID) + + val TAG_REASON_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_REASON_REQ), reason) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + } + + suspend fun readCurrentSessionsAttribute(): CurrentSessionsAttribute { + val ATTRIBUTE_ID: UInt = 0u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Currentsessions attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(WebRTCTransportRequestorClusterWebRTCSessionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return CurrentSessionsAttribute(decodedValue) + } + + suspend fun subscribeCurrentSessionsAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CurrentSessionsAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Currentsessions attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + WebRTCTransportRequestorClusterWebRTCSessionStruct.fromTlv( + AnonymousTag, + tlvReader, + ) + ) + } + tlvReader.exitContainer() + } + + emit(CurrentSessionsAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(CurrentSessionsAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + GeneratedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AcceptedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + EventListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AttributeListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(WebRTCTransportRequestorCluster::class.java.name) + const val CLUSTER_ID: UInt = 1364u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 6a7e5b317e3fee..73e0a1190a0ac4 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -162,6 +162,8 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportProviderClusterICEServerStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportProviderClusterWebRTCSessionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt", ] matter_eventstructs_sources = [ @@ -373,6 +375,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterManagementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WebRTCTransportProviderCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WebRTCTransportRequestorCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkDiagnosticsCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkManagementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WindowCoveringCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt new file mode 100644 index 00000000000000..c7b5e5ef27000d --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterICEServerStruct.kt @@ -0,0 +1,106 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WebRTCTransportRequestorClusterICEServerStruct( + val urls: List, + val username: Optional, + val credential: Optional, + val caid: Optional, +) { + override fun toString(): String = buildString { + append("WebRTCTransportRequestorClusterICEServerStruct {\n") + append("\turls : $urls\n") + append("\tusername : $username\n") + append("\tcredential : $credential\n") + append("\tcaid : $caid\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + startArray(ContextSpecificTag(TAG_URLS)) + for (item in urls.iterator()) { + put(AnonymousTag, item) + } + endArray() + if (username.isPresent) { + val optusername = username.get() + put(ContextSpecificTag(TAG_USERNAME), optusername) + } + if (credential.isPresent) { + val optcredential = credential.get() + put(ContextSpecificTag(TAG_CREDENTIAL), optcredential) + } + if (caid.isPresent) { + val optcaid = caid.get() + put(ContextSpecificTag(TAG_CAID), optcaid) + } + endStructure() + } + } + + companion object { + private const val TAG_URLS = 1 + private const val TAG_USERNAME = 2 + private const val TAG_CREDENTIAL = 3 + private const val TAG_CAID = 4 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WebRTCTransportRequestorClusterICEServerStruct { + tlvReader.enterStructure(tlvTag) + val urls = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_URLS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getString(AnonymousTag)) + } + tlvReader.exitContainer() + } + val username = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_USERNAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_USERNAME))) + } else { + Optional.empty() + } + val credential = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CREDENTIAL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_CREDENTIAL))) + } else { + Optional.empty() + } + val caid = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CAID))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_CAID))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return WebRTCTransportRequestorClusterICEServerStruct(urls, username, credential, caid) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt new file mode 100644 index 00000000000000..9c572a4097ce6d --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/WebRTCTransportRequestorClusterWebRTCSessionStruct.kt @@ -0,0 +1,115 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WebRTCTransportRequestorClusterWebRTCSessionStruct( + val id: UShort, + val peerNodeID: ULong, + val peerFabricIndex: UByte, + val streamType: UByte, + val videoStreamID: UShort?, + val audioStreamID: UShort?, + val metadataOptions: UByte, +) { + override fun toString(): String = buildString { + append("WebRTCTransportRequestorClusterWebRTCSessionStruct {\n") + append("\tid : $id\n") + append("\tpeerNodeID : $peerNodeID\n") + append("\tpeerFabricIndex : $peerFabricIndex\n") + append("\tstreamType : $streamType\n") + append("\tvideoStreamID : $videoStreamID\n") + append("\taudioStreamID : $audioStreamID\n") + append("\tmetadataOptions : $metadataOptions\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ID), id) + put(ContextSpecificTag(TAG_PEER_NODE_ID), peerNodeID) + put(ContextSpecificTag(TAG_PEER_FABRIC_INDEX), peerFabricIndex) + put(ContextSpecificTag(TAG_STREAM_TYPE), streamType) + if (videoStreamID != null) { + put(ContextSpecificTag(TAG_VIDEO_STREAM_ID), videoStreamID) + } else { + putNull(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + } + if (audioStreamID != null) { + put(ContextSpecificTag(TAG_AUDIO_STREAM_ID), audioStreamID) + } else { + putNull(ContextSpecificTag(TAG_AUDIO_STREAM_ID)) + } + put(ContextSpecificTag(TAG_METADATA_OPTIONS), metadataOptions) + endStructure() + } + } + + companion object { + private const val TAG_ID = 1 + private const val TAG_PEER_NODE_ID = 2 + private const val TAG_PEER_FABRIC_INDEX = 3 + private const val TAG_STREAM_TYPE = 4 + private const val TAG_VIDEO_STREAM_ID = 5 + private const val TAG_AUDIO_STREAM_ID = 6 + private const val TAG_METADATA_OPTIONS = 7 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): WebRTCTransportRequestorClusterWebRTCSessionStruct { + tlvReader.enterStructure(tlvTag) + val id = tlvReader.getUShort(ContextSpecificTag(TAG_ID)) + val peerNodeID = tlvReader.getULong(ContextSpecificTag(TAG_PEER_NODE_ID)) + val peerFabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_PEER_FABRIC_INDEX)) + val streamType = tlvReader.getUByte(ContextSpecificTag(TAG_STREAM_TYPE)) + val videoStreamID = + if (!tlvReader.isNull()) { + tlvReader.getUShort(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_VIDEO_STREAM_ID)) + null + } + val audioStreamID = + if (!tlvReader.isNull()) { + tlvReader.getUShort(ContextSpecificTag(TAG_AUDIO_STREAM_ID)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AUDIO_STREAM_ID)) + null + } + val metadataOptions = tlvReader.getUByte(ContextSpecificTag(TAG_METADATA_OPTIONS)) + + tlvReader.exitContainer() + + return WebRTCTransportRequestorClusterWebRTCSessionStruct( + id, + peerNodeID, + peerFabricIndex, + streamType, + videoStreamID, + audioStreamID, + metadataOptions, + ) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 9e5c2620cfb295..19f3f8d3ed8efb 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -42486,6 +42486,256 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::WebRTCTransportRequestor::Id: { + using namespace app::Clusters::WebRTCTransportRequestor; + switch (aPath.mAttributeId) + { + case Attributes::CurrentSessions::Id: { + using TypeInfo = Attributes::CurrentSessions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_id; + std::string newElement_0_idClassName = "java/lang/Integer"; + std::string newElement_0_idCtorSignature = "(I)V"; + jint jninewElement_0_id = static_cast(entry_0.id); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_idClassName.c_str(), newElement_0_idCtorSignature.c_str(), jninewElement_0_id, newElement_0_id); + jobject newElement_0_peerNodeID; + std::string newElement_0_peerNodeIDClassName = "java/lang/Long"; + std::string newElement_0_peerNodeIDCtorSignature = "(J)V"; + jlong jninewElement_0_peerNodeID = static_cast(entry_0.peerNodeID); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_peerNodeIDClassName.c_str(), + newElement_0_peerNodeIDCtorSignature.c_str(), + jninewElement_0_peerNodeID, newElement_0_peerNodeID); + jobject newElement_0_peerFabricIndex; + std::string newElement_0_peerFabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_peerFabricIndexCtorSignature = "(I)V"; + jint jninewElement_0_peerFabricIndex = static_cast(entry_0.peerFabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_peerFabricIndexClassName.c_str(), newElement_0_peerFabricIndexCtorSignature.c_str(), + jninewElement_0_peerFabricIndex, newElement_0_peerFabricIndex); + jobject newElement_0_streamType; + std::string newElement_0_streamTypeClassName = "java/lang/Integer"; + std::string newElement_0_streamTypeCtorSignature = "(I)V"; + jint jninewElement_0_streamType = static_cast(entry_0.streamType); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_streamTypeClassName.c_str(), + newElement_0_streamTypeCtorSignature.c_str(), + jninewElement_0_streamType, newElement_0_streamType); + jobject newElement_0_videoStreamID; + if (entry_0.videoStreamID.IsNull()) + { + newElement_0_videoStreamID = nullptr; + } + else + { + std::string newElement_0_videoStreamIDClassName = "java/lang/Integer"; + std::string newElement_0_videoStreamIDCtorSignature = "(I)V"; + jint jninewElement_0_videoStreamID = static_cast(entry_0.videoStreamID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_videoStreamIDClassName.c_str(), newElement_0_videoStreamIDCtorSignature.c_str(), + jninewElement_0_videoStreamID, newElement_0_videoStreamID); + } + jobject newElement_0_audioStreamID; + if (entry_0.audioStreamID.IsNull()) + { + newElement_0_audioStreamID = nullptr; + } + else + { + std::string newElement_0_audioStreamIDClassName = "java/lang/Integer"; + std::string newElement_0_audioStreamIDCtorSignature = "(I)V"; + jint jninewElement_0_audioStreamID = static_cast(entry_0.audioStreamID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_audioStreamIDClassName.c_str(), newElement_0_audioStreamIDCtorSignature.c_str(), + jninewElement_0_audioStreamID, newElement_0_audioStreamID); + } + jobject newElement_0_metadataOptions; + std::string newElement_0_metadataOptionsClassName = "java/lang/Integer"; + std::string newElement_0_metadataOptionsCtorSignature = "(I)V"; + jint jninewElement_0_metadataOptions = static_cast(entry_0.metadataOptions.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_metadataOptionsClassName.c_str(), newElement_0_metadataOptionsCtorSignature.c_str(), + jninewElement_0_metadataOptions, newElement_0_metadataOptions); + + jclass webRTCSessionStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$WebRTCTransportRequestorClusterWebRTCSessionStruct", + webRTCSessionStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$WebRTCTransportRequestorClusterWebRTCSessionStruct"); + return nullptr; + } + + jmethodID webRTCSessionStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, webRTCSessionStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/" + "Integer;Ljava/lang/Integer;)V", + &webRTCSessionStructStructCtor_1); + if (err != CHIP_NO_ERROR || webRTCSessionStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$WebRTCTransportRequestorClusterWebRTCSessionStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(webRTCSessionStructStructClass_1, webRTCSessionStructStructCtor_1, newElement_0_id, + newElement_0_peerNodeID, newElement_0_peerFabricIndex, newElement_0_streamType, + newElement_0_videoStreamID, newElement_0_audioStreamID, newElement_0_metadataOptions); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::Chime::Id: { using namespace app::Clusters::Chime; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 9da4b9690ecdb6..45f23441804336 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -8258,6 +8258,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::WebRTCTransportRequestor::Id: { + using namespace app::Clusters::WebRTCTransportRequestor; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::Chime::Id: { using namespace app::Clusters::Chime; switch (aPath.mEventId) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index b2a0bb09b37885..e0aec013942a4b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -13135,6 +13135,90 @@ class ChipClusters: }, }, } + _WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_INFO = { + "clusterName": "WebRTCTransportRequestor", + "clusterId": 0x00000554, + "commands": { + 0x00000001: { + "commandId": 0x00000001, + "commandName": "Offer", + "args": { + "webRTCSessionID": "int", + "sdp": "str", + "ICEServers": "ICEServerStruct", + "ICETransportPolicy": "str", + }, + }, + 0x00000002: { + "commandId": 0x00000002, + "commandName": "Answer", + "args": { + "webRTCSessionID": "int", + "sdp": "str", + }, + }, + 0x00000003: { + "commandId": 0x00000003, + "commandName": "ICECandidate", + "args": { + "webRTCSessionID": "int", + "ICECandidate": "str", + }, + }, + 0x00000004: { + "commandId": 0x00000004, + "commandName": "End", + "args": { + "webRTCSessionID": "int", + "reason": "int", + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "CurrentSessions", + "attributeId": 0x00000000, + "type": "", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _CHIME_CLUSTER_INFO = { "clusterName": "Chime", "clusterId": 0x00000556, @@ -14454,6 +14538,7 @@ class ChipClusters: 0x0000050F: _CONTENT_CONTROL_CLUSTER_INFO, 0x00000510: _CONTENT_APP_OBSERVER_CLUSTER_INFO, 0x00000553: _WEB_RTC_TRANSPORT_PROVIDER_CLUSTER_INFO, + 0x00000554: _WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_INFO, 0x00000556: _CHIME_CLUSTER_INFO, 0x00000750: _ECOSYSTEM_INFORMATION_CLUSTER_INFO, 0x00000751: _COMMISSIONER_CONTROL_CLUSTER_INFO, @@ -14581,6 +14666,7 @@ class ChipClusters: "ContentControl": _CONTENT_CONTROL_CLUSTER_INFO, "ContentAppObserver": _CONTENT_APP_OBSERVER_CLUSTER_INFO, "WebRTCTransportProvider": _WEB_RTC_TRANSPORT_PROVIDER_CLUSTER_INFO, + "WebRTCTransportRequestor": _WEB_RTC_TRANSPORT_REQUESTOR_CLUSTER_INFO, "Chime": _CHIME_CLUSTER_INFO, "EcosystemInformation": _ECOSYSTEM_INFORMATION_CLUSTER_INFO, "CommissionerControl": _COMMISSIONER_CONTROL_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index b36c5b9cae9b0a..2daa5e799b6589 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -157,6 +157,7 @@ "ContentControl", "ContentAppObserver", "WebRTCTransportProvider", + "WebRTCTransportRequestor", "Chime", "EcosystemInformation", "CommissionerControl", @@ -46904,6 +46905,298 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 +@dataclass +class WebRTCTransportRequestor(Cluster): + id: typing.ClassVar[int] = 0x00000554 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="currentSessions", Tag=0x00000000, Type=typing.List[WebRTCTransportRequestor.Structs.WebRTCSessionStruct]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + currentSessions: 'typing.List[WebRTCTransportRequestor.Structs.WebRTCSessionStruct]' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class StreamTypeEnum(MatterIntEnum): + kInternal = 0x00 + kRecording = 0x01 + kAnalysis = 0x02 + kLiveView = 0x03 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 4, + + class WebRTCEndReasonEnum(MatterIntEnum): + kIceFailed = 0x00 + kIceTimeout = 0x01 + kUserHangup = 0x02 + kUserBusy = 0x03 + kReplaced = 0x04 + kNoUserMedia = 0x05 + kInviteTimeout = 0x06 + kAnsweredElsewhere = 0x07 + kOutOfResources = 0x08 + kMediaTimeout = 0x09 + kLowPower = 0x0A + kUnknownReason = 0x0B + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 12, + + class Bitmaps: + class WebRTCMetadataOptions(IntFlag): + kDataTLV = 0x1 + + class Structs: + @dataclass + class ICEServerStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="urls", Tag=1, Type=typing.List[str]), + ClusterObjectFieldDescriptor(Label="username", Tag=2, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="credential", Tag=3, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="caid", Tag=4, Type=typing.Optional[uint]), + ]) + + urls: 'typing.List[str]' = field(default_factory=lambda: []) + username: 'typing.Optional[str]' = None + credential: 'typing.Optional[str]' = None + caid: 'typing.Optional[uint]' = None + + @dataclass + class WebRTCSessionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="id", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="peerNodeID", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="peerFabricIndex", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="streamType", Tag=4, Type=WebRTCTransportRequestor.Enums.StreamTypeEnum), + ClusterObjectFieldDescriptor(Label="videoStreamID", Tag=5, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="audioStreamID", Tag=6, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="metadataOptions", Tag=7, Type=uint), + ]) + + id: 'uint' = 0 + peerNodeID: 'uint' = 0 + peerFabricIndex: 'uint' = 0 + streamType: 'WebRTCTransportRequestor.Enums.StreamTypeEnum' = 0 + videoStreamID: 'typing.Union[Nullable, uint]' = NullValue + audioStreamID: 'typing.Union[Nullable, uint]' = NullValue + metadataOptions: 'uint' = 0 + + class Commands: + @dataclass + class Offer(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000554 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="webRTCSessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="sdp", Tag=1, Type=str), + ClusterObjectFieldDescriptor(Label="ICEServers", Tag=2, Type=typing.Optional[typing.List[WebRTCTransportRequestor.Structs.ICEServerStruct]]), + ClusterObjectFieldDescriptor(Label="ICETransportPolicy", Tag=3, Type=typing.Optional[str]), + ]) + + webRTCSessionID: 'uint' = 0 + sdp: 'str' = "" + ICEServers: 'typing.Optional[typing.List[WebRTCTransportRequestor.Structs.ICEServerStruct]]' = None + ICETransportPolicy: 'typing.Optional[str]' = None + + @dataclass + class Answer(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000554 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="webRTCSessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="sdp", Tag=1, Type=str), + ]) + + webRTCSessionID: 'uint' = 0 + sdp: 'str' = "" + + @dataclass + class ICECandidate(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000554 + command_id: typing.ClassVar[int] = 0x00000003 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="webRTCSessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="ICECandidate", Tag=1, Type=str), + ]) + + webRTCSessionID: 'uint' = 0 + ICECandidate: 'str' = "" + + @dataclass + class End(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000554 + command_id: typing.ClassVar[int] = 0x00000004 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="webRTCSessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="reason", Tag=1, Type=WebRTCTransportRequestor.Enums.WebRTCEndReasonEnum), + ]) + + webRTCSessionID: 'uint' = 0 + reason: 'WebRTCTransportRequestor.Enums.WebRTCEndReasonEnum' = 0 + + class Attributes: + @dataclass + class CurrentSessions(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[WebRTCTransportRequestor.Structs.WebRTCSessionStruct]) + + value: 'typing.List[WebRTCTransportRequestor.Structs.WebRTCSessionStruct]' = field(default_factory=lambda: []) + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000554 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass class Chime(Cluster): id: typing.ClassVar[int] = 0x00000556 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 51a423a4ad741c..a3d3649fb1de17 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -5945,6 +5945,36 @@ static BOOL AttributeIsSpecifiedInWebRTCTransportProviderCluster(AttributeId aAt } } } +static BOOL AttributeIsSpecifiedInWebRTCTransportRequestorCluster(AttributeId aAttributeId) +{ + using namespace Clusters::WebRTCTransportRequestor; + switch (aAttributeId) { + case Attributes::CurrentSessions::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInChimeCluster(AttributeId aAttributeId) { using namespace Clusters::Chime; @@ -6717,6 +6747,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::WebRTCTransportProvider::Id: { return AttributeIsSpecifiedInWebRTCTransportProviderCluster(aAttributeId); } + case Clusters::WebRTCTransportRequestor::Id: { + return AttributeIsSpecifiedInWebRTCTransportRequestorCluster(aAttributeId); + } case Clusters::Chime::Id: { return AttributeIsSpecifiedInChimeCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 907bda8ba854b8..686b92c333f6ee 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -16963,6 +16963,59 @@ static id _Nullable DecodeAttributeValueForWebRTCTransportProviderCluster(Attrib *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForWebRTCTransportRequestorCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WebRTCTransportRequestor; + switch (aAttributeId) { + case Attributes::CurrentSessions::Id: { + using TypeInfo = Attributes::CurrentSessions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRWebRTCTransportRequestorClusterWebRTCSessionStruct * newElement_0; + newElement_0 = [MTRWebRTCTransportRequestorClusterWebRTCSessionStruct new]; + newElement_0.id = [NSNumber numberWithUnsignedShort:entry_0.id]; + newElement_0.peerNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.peerNodeID]; + newElement_0.peerFabricIndex = [NSNumber numberWithUnsignedChar:entry_0.peerFabricIndex]; + newElement_0.streamType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.streamType)]; + if (entry_0.videoStreamID.IsNull()) { + newElement_0.videoStreamID = nil; + } else { + newElement_0.videoStreamID = [NSNumber numberWithUnsignedShort:entry_0.videoStreamID.Value()]; + } + if (entry_0.audioStreamID.IsNull()) { + newElement_0.audioStreamID = nil; + } else { + newElement_0.audioStreamID = [NSNumber numberWithUnsignedShort:entry_0.audioStreamID.Value()]; + } + newElement_0.metadataOptions = [NSNumber numberWithUnsignedChar:entry_0.metadataOptions.Raw()]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForChimeCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::Chime; @@ -19142,6 +19195,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::WebRTCTransportProvider::Id: { return DecodeAttributeValueForWebRTCTransportProviderCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::WebRTCTransportRequestor::Id: { + return DecodeAttributeValueForWebRTCTransportRequestorCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::Chime::Id: { return DecodeAttributeValueForChimeCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 264434027d09ca..8f23fc159f2ad1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -14860,6 +14860,98 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster WebRTC Transport Requestor + * + * The WebRTC transport requestor cluster provides a way for stream consumers (e.g. Matter Stream Viewer) to establish a WebRTC connection with a stream provider. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterWebRTCTransportRequestor : MTRGenericBaseCluster + +/** + * Command Offer + * + * This command provides the stream requestor with WebRTC session details. It is sent following the receipt of a SolicitOffer command or a re-Offer initiated by the Provider. + */ +- (void)offerWithParams:(MTRWebRTCTransportRequestorClusterOfferParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command Answer + * + * This command provides the stream requestor with the WebRTC session details (i.e. Session ID and SDP answer). It is the next command in the Offer/Answer flow to the ProvideOffer command. + */ +- (void)answerWithParams:(MTRWebRTCTransportRequestorClusterAnswerParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command ICECandidate + * + * This command provides an ICE candidate to the stream requestor in a WebRTC session. + */ +- (void)ICECandidateWithParams:(MTRWebRTCTransportRequestorClusterICECandidateParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command End + * + * This command notifies the stream requestor that the provider has ended the WebRTC session. + */ +- (void)endWithParams:(MTRWebRTCTransportRequestorClusterEndParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCurrentSessionsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCurrentSessionsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCurrentSessionsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterWebRTCTransportRequestor (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Chime * @@ -20304,6 +20396,32 @@ typedef NS_OPTIONS(uint8_t, MTRWebRTCTransportProviderWebRTCMetadataOptions) { MTRWebRTCTransportProviderWebRTCMetadataOptionsDataTLV MTR_PROVISIONALLY_AVAILABLE = 0x1, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRWebRTCTransportRequestorStreamType) { + MTRWebRTCTransportRequestorStreamTypeInternal MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRWebRTCTransportRequestorStreamTypeRecording MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRWebRTCTransportRequestorStreamTypeAnalysis MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRWebRTCTransportRequestorStreamTypeLiveView MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRWebRTCTransportRequestorWebRTCEndReason) { + MTRWebRTCTransportRequestorWebRTCEndReasonIceFailed MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRWebRTCTransportRequestorWebRTCEndReasonIceTimeout MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRWebRTCTransportRequestorWebRTCEndReasonUserHangup MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRWebRTCTransportRequestorWebRTCEndReasonUserBusy MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRWebRTCTransportRequestorWebRTCEndReasonReplaced MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRWebRTCTransportRequestorWebRTCEndReasonNoUserMedia MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRWebRTCTransportRequestorWebRTCEndReasonInviteTimeout MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRWebRTCTransportRequestorWebRTCEndReasonAnsweredElsewhere MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRWebRTCTransportRequestorWebRTCEndReasonOutOfResources MTR_PROVISIONALLY_AVAILABLE = 0x08, + MTRWebRTCTransportRequestorWebRTCEndReasonMediaTimeout MTR_PROVISIONALLY_AVAILABLE = 0x09, + MTRWebRTCTransportRequestorWebRTCEndReasonLowPower MTR_PROVISIONALLY_AVAILABLE = 0x0A, + MTRWebRTCTransportRequestorWebRTCEndReasonUnknownReason MTR_PROVISIONALLY_AVAILABLE = 0x0B, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTRWebRTCTransportRequestorWebRTCMetadataOptions) { + MTRWebRTCTransportRequestorWebRTCMetadataOptionsDataTLV MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_OPTIONS(uint32_t, MTRCommissionerControlSupportedDeviceCategoryBitmap) { MTRCommissionerControlSupportedDeviceCategoryBitmapFabricSynchronization MTR_PROVISIONALLY_AVAILABLE = 0x1, } MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 64af2975122bcc..80e36303d3057e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -102498,6 +102498,359 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterWebRTCTransportRequestor + +- (void)offerWithParams:(MTRWebRTCTransportRequestorClusterOfferParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterOfferParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::Offer::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)answerWithParams:(MTRWebRTCTransportRequestorClusterAnswerParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterAnswerParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::Answer::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)ICECandidateWithParams:(MTRWebRTCTransportRequestorClusterICECandidateParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterICECandidateParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::ICECandidate::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)endWithParams:(MTRWebRTCTransportRequestorClusterEndParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterEndParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::End::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeCurrentSessionsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::CurrentSessions::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCurrentSessionsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::CurrentSessions::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCurrentSessionsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::CurrentSessions::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WebRTCTransportRequestor::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterChime - (void)playChimeSoundWithCompletion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 95b11357679936..fdefd1f503b080 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -198,6 +198,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeContentControlID MTR_PROVISIONALLY_AVAILABLE = 0x0000050F, MTRClusterIDTypeContentAppObserverID MTR_PROVISIONALLY_AVAILABLE = 0x00000510, MTRClusterIDTypeWebRTCTransportProviderID MTR_PROVISIONALLY_AVAILABLE = 0x00000553, + MTRClusterIDTypeWebRTCTransportRequestorID MTR_PROVISIONALLY_AVAILABLE = 0x00000554, MTRClusterIDTypeChimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000556, MTRClusterIDTypeEcosystemInformationID MTR_PROVISIONALLY_AVAILABLE = 0x00000750, MTRClusterIDTypeCommissionerControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000751, @@ -4750,6 +4751,15 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterWebRTCTransportProviderAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterWebRTCTransportProviderAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster WebRTCTransportRequestor attributes + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeCurrentSessionsID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster Chime attributes MTRAttributeIDTypeClusterChimeAttributeInstalledChimeSoundsID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterChimeAttributeActiveChimeIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -6963,6 +6973,12 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterWebRTCTransportProviderCommandProvideICECandidateID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, MTRCommandIDTypeClusterWebRTCTransportProviderCommandEndSessionID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + // Cluster WebRTCTransportRequestor commands + MTRCommandIDTypeClusterWebRTCTransportRequestorCommandOfferID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterWebRTCTransportRequestorCommandAnswerID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRCommandIDTypeClusterWebRTCTransportRequestorCommandICECandidateID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRCommandIDTypeClusterWebRTCTransportRequestorCommandEndID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + // Cluster Chime commands MTRCommandIDTypeClusterChimeCommandPlayChimeSoundID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index b9be1f665de912..f69444d9a1b402 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -372,6 +372,9 @@ case MTRClusterIDTypeWebRTCTransportProviderID: result = @"WebRTCTransportProvider"; break; + case MTRClusterIDTypeWebRTCTransportRequestorID: + result = @"WebRTCTransportRequestor"; + break; case MTRClusterIDTypeChimeID: result = @"Chime"; break; @@ -8185,6 +8188,45 @@ } break; + case MTRClusterIDTypeWebRTCTransportRequestorID: + + switch (attributeID) { + + // Cluster WebRTCTransportRequestor attributes + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeCurrentSessionsID: + result = @"CurrentSessions"; + break; + + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + break; + case MTRClusterIDTypeChimeID: switch (attributeID) { @@ -10990,6 +11032,32 @@ } break; + case MTRClusterIDTypeWebRTCTransportRequestorID: + + switch (commandID) { + + case MTRCommandIDTypeClusterWebRTCTransportRequestorCommandOfferID: + result = @"Offer"; + break; + + case MTRCommandIDTypeClusterWebRTCTransportRequestorCommandAnswerID: + result = @"Answer"; + break; + + case MTRCommandIDTypeClusterWebRTCTransportRequestorCommandICECandidateID: + result = @"ICECandidate"; + break; + + case MTRCommandIDTypeClusterWebRTCTransportRequestorCommandEndID: + result = @"End"; + break; + + default: + result = [NSString stringWithFormat:@"", commandID]; + break; + } + break; + case MTRClusterIDTypeChimeID: switch (commandID) { @@ -12620,6 +12688,16 @@ } break; + case MTRClusterIDTypeWebRTCTransportRequestorID: + + switch (commandID) { + + default: + result = [NSString stringWithFormat:@"", commandID]; + break; + } + break; + case MTRClusterIDTypeChimeID: switch (commandID) { @@ -14391,6 +14469,16 @@ } break; + case MTRClusterIDTypeWebRTCTransportRequestorID: + + switch (eventID) { + + default: + result = [NSString stringWithFormat:@"", eventID]; + break; + } + break; + case MTRClusterIDTypeChimeID: switch (eventID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 401e76bda1b2e5..4988732fe8dae1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -6870,6 +6870,49 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster WebRTC Transport Requestor + * The WebRTC transport requestor cluster provides a way for stream consumers (e.g. Matter Stream Viewer) to establish a WebRTC connection with a stream provider. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterWebRTCTransportRequestor : MTRGenericCluster + +- (void)offerWithParams:(MTRWebRTCTransportRequestorClusterOfferParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)answerWithParams:(MTRWebRTCTransportRequestorClusterAnswerParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)ICECandidateWithParams:(MTRWebRTCTransportRequestorClusterICECandidateParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)endWithParams:(MTRWebRTCTransportRequestorClusterEndParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCurrentSessionsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterWebRTCTransportRequestor (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Chime * This cluster provides facilities to configure and play Chime sounds, such as those used in a doorbell. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index cdae93833c2710..2c8bf9015fd9e8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -19728,6 +19728,153 @@ - (void)endSessionWithParams:(MTRWebRTCTransportProviderClusterEndSessionParams @end +@implementation MTRClusterWebRTCTransportRequestor + +- (void)offerWithParams:(MTRWebRTCTransportRequestorClusterOfferParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterOfferParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::Offer::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)answerWithParams:(MTRWebRTCTransportRequestorClusterAnswerParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterAnswerParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::Answer::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)ICECandidateWithParams:(MTRWebRTCTransportRequestorClusterICECandidateParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterICECandidateParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::ICECandidate::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)endWithParams:(MTRWebRTCTransportRequestorClusterEndParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWebRTCTransportRequestorClusterEndParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WebRTCTransportRequestor::Commands::End::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:nil + queue:self.callbackQueue + completion:responseHandler]; +} + +- (NSDictionary * _Nullable)readAttributeCurrentSessionsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeCurrentSessionsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWebRTCTransportRequestorID) attributeID:@(MTRAttributeIDTypeClusterWebRTCTransportRequestorAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterChime - (void)playChimeSoundWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 2aeb25d7a6d520..63cbb1735676f6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -11063,6 +11063,138 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWebRTCTransportRequestorClusterOfferParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull webRTCSessionID MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSString * _Nonnull sdp MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSArray * _Nullable iceServers MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSString * _Nullable iceTransportPolicy MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWebRTCTransportRequestorClusterAnswerParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull webRTCSessionID MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSString * _Nonnull sdp MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWebRTCTransportRequestorClusterICECandidateParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull webRTCSessionID MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSString * _Nonnull iceCandidate MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWebRTCTransportRequestorClusterEndParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull webRTCSessionID MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull reason MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRChimeClusterPlayChimeSoundParams : NSObject /** diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index a922f5831581bc..aaddab1b686a23 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -32189,6 +32189,418 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRWebRTCTransportRequestorClusterOfferParams +- (instancetype)init +{ + if (self = [super init]) { + + _webRTCSessionID = @(0); + + _sdp = @""; + + _iceServers = nil; + + _iceTransportPolicy = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRWebRTCTransportRequestorClusterOfferParams alloc] init]; + + other.webRTCSessionID = self.webRTCSessionID; + other.sdp = self.sdp; + other.iceServers = self.iceServers; + other.iceTransportPolicy = self.iceTransportPolicy; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: webRTCSessionID:%@; sdp:%@; iceServers:%@; iceTransportPolicy:%@; >", NSStringFromClass([self class]), _webRTCSessionID, _sdp, _iceServers, _iceTransportPolicy]; + return descriptionString; +} + +@end + +@implementation MTRWebRTCTransportRequestorClusterOfferParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.webRTCSessionID = self.webRTCSessionID.unsignedShortValue; + } + { + encodableStruct.sdp = AsCharSpan(self.sdp); + } + { + if (self.iceServers != nil) { + auto & definedValue_0 = encodableStruct.ICEServers.Emplace(); + { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (self.iceServers.count != 0) { + auto * listHolder_1 = new ListHolder(self.iceServers.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < self.iceServers.count; ++i_1) { + if (![self.iceServers[i_1] isKindOfClass:[MTRWebRTCTransportRequestorClusterICEServerStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_1 = (MTRWebRTCTransportRequestorClusterICEServerStruct *) self.iceServers[i_1]; + { + using ListType_3 = std::remove_reference_tmList[i_1].urls)>; + using ListMemberType_3 = ListMemberTypeGetter::Type; + if (element_1.urls.count != 0) { + auto * listHolder_3 = new ListHolder(element_1.urls.count); + if (listHolder_3 == nullptr || listHolder_3->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_3); + for (size_t i_3 = 0; i_3 < element_1.urls.count; ++i_3) { + if (![element_1.urls[i_3] isKindOfClass:[NSString class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_3 = (NSString *) element_1.urls[i_3]; + listHolder_3->mList[i_3] = AsCharSpan(element_3); + } + listHolder_1->mList[i_1].urls = ListType_3(listHolder_3->mList, element_1.urls.count); + } else { + listHolder_1->mList[i_1].urls = ListType_3(); + } + } + if (element_1.username != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].username.Emplace(); + definedValue_3 = AsCharSpan(element_1.username); + } + if (element_1.credential != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].credential.Emplace(); + definedValue_3 = AsCharSpan(element_1.credential); + } + if (element_1.caid != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].caid.Emplace(); + definedValue_3 = element_1.caid.unsignedShortValue; + } + } + definedValue_0 = ListType_1(listHolder_1->mList, self.iceServers.count); + } else { + definedValue_0 = ListType_1(); + } + } + } + } + { + if (self.iceTransportPolicy != nil) { + auto & definedValue_0 = encodableStruct.ICETransportPolicy.Emplace(); + definedValue_0 = AsCharSpan(self.iceTransportPolicy); + } + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRWebRTCTransportRequestorClusterAnswerParams +- (instancetype)init +{ + if (self = [super init]) { + + _webRTCSessionID = @(0); + + _sdp = @""; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRWebRTCTransportRequestorClusterAnswerParams alloc] init]; + + other.webRTCSessionID = self.webRTCSessionID; + other.sdp = self.sdp; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: webRTCSessionID:%@; sdp:%@; >", NSStringFromClass([self class]), _webRTCSessionID, _sdp]; + return descriptionString; +} + +@end + +@implementation MTRWebRTCTransportRequestorClusterAnswerParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.webRTCSessionID = self.webRTCSessionID.unsignedShortValue; + } + { + encodableStruct.sdp = AsCharSpan(self.sdp); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRWebRTCTransportRequestorClusterICECandidateParams +- (instancetype)init +{ + if (self = [super init]) { + + _webRTCSessionID = @(0); + + _iceCandidate = @""; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRWebRTCTransportRequestorClusterICECandidateParams alloc] init]; + + other.webRTCSessionID = self.webRTCSessionID; + other.iceCandidate = self.iceCandidate; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: webRTCSessionID:%@; iceCandidate:%@; >", NSStringFromClass([self class]), _webRTCSessionID, _iceCandidate]; + return descriptionString; +} + +@end + +@implementation MTRWebRTCTransportRequestorClusterICECandidateParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.webRTCSessionID = self.webRTCSessionID.unsignedShortValue; + } + { + encodableStruct.ICECandidate = AsCharSpan(self.iceCandidate); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + +@implementation MTRWebRTCTransportRequestorClusterEndParams +- (instancetype)init +{ + if (self = [super init]) { + + _webRTCSessionID = @(0); + + _reason = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRWebRTCTransportRequestorClusterEndParams alloc] init]; + + other.webRTCSessionID = self.webRTCSessionID; + other.reason = self.reason; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: webRTCSessionID:%@; reason:%@; >", NSStringFromClass([self class]), _webRTCSessionID, _reason]; + return descriptionString; +} + +@end + +@implementation MTRWebRTCTransportRequestorClusterEndParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.webRTCSessionID = self.webRTCSessionID.unsignedShortValue; + } + { + encodableStruct.reason = static_cast>(self.reason.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRChimeClusterPlayChimeSoundParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index 144ee696afc63a..b6345356d4daac 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -2074,6 +2074,30 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRWebRTCTransportRequestorClusterOfferParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWebRTCTransportRequestorClusterAnswerParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWebRTCTransportRequestorClusterICECandidateParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWebRTCTransportRequestorClusterEndParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRChimeClusterPlayChimeSoundParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index 91f69fd4e1f192..c330d2bb0d1748 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -1133,6 +1133,15 @@ static BOOL CommandNeedsTimedInvokeInWebRTCTransportProviderCluster(AttributeId } } } +static BOOL CommandNeedsTimedInvokeInWebRTCTransportRequestorCluster(AttributeId aAttributeId) +{ + using namespace Clusters::WebRTCTransportRequestor; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInChimeCluster(AttributeId aAttributeId) { using namespace Clusters::Chime; @@ -1533,6 +1542,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::WebRTCTransportProvider::Id: { return CommandNeedsTimedInvokeInWebRTCTransportProviderCluster(commandID); } + case Clusters::WebRTCTransportRequestor::Id: { + return CommandNeedsTimedInvokeInWebRTCTransportRequestorCluster(commandID); + } case Clusters::Chime::Id: { return CommandNeedsTimedInvokeInChimeCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 5a10da85b1be79..0ef12bcbba5df1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -4555,6 +4555,18 @@ static id _Nullable DecodeEventPayloadForWebRTCTransportProviderCluster(EventId *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForWebRTCTransportRequestorCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WebRTCTransportRequestor; + switch (aEventId) { + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForChimeCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::Chime; @@ -5160,6 +5172,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::WebRTCTransportProvider::Id: { return DecodeEventPayloadForWebRTCTransportProviderCluster(aPath.mEventId, aReader, aError); } + case Clusters::WebRTCTransportRequestor::Id: { + return DecodeEventPayloadForWebRTCTransportRequestorCluster(aPath.mEventId, aReader, aError); + } case Clusters::Chime::Id: { return DecodeEventPayloadForChimeCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index bb93511dbf43f9..fa103214b8e20d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -2136,6 +2136,25 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull metadataOptions MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWebRTCTransportRequestorClusterICEServerStruct : NSObject +@property (nonatomic, copy) NSArray * _Nonnull urls MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nullable username MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nullable credential MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable caid MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWebRTCTransportRequestorClusterWebRTCSessionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull id MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull peerNodeID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull peerFabricIndex MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull streamType MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable videoStreamID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable audioStreamID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull metadataOptions MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRChimeClusterChimeSoundStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull chimeID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 6ba439eb02727a..e8153706aa6b53 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -8849,6 +8849,87 @@ - (NSString *)description @end +@implementation MTRWebRTCTransportRequestorClusterICEServerStruct +- (instancetype)init +{ + if (self = [super init]) { + + _urls = [NSArray array]; + + _username = nil; + + _credential = nil; + + _caid = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRWebRTCTransportRequestorClusterICEServerStruct alloc] init]; + + other.urls = self.urls; + other.username = self.username; + other.credential = self.credential; + other.caid = self.caid; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: urls:%@; username:%@; credential:%@; caid:%@; >", NSStringFromClass([self class]), _urls, _username, _credential, _caid]; + return descriptionString; +} + +@end + +@implementation MTRWebRTCTransportRequestorClusterWebRTCSessionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _id = @(0); + + _peerNodeID = @(0); + + _peerFabricIndex = @(0); + + _streamType = @(0); + + _videoStreamID = nil; + + _audioStreamID = nil; + + _metadataOptions = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRWebRTCTransportRequestorClusterWebRTCSessionStruct alloc] init]; + + other.id = self.id; + other.peerNodeID = self.peerNodeID; + other.peerFabricIndex = self.peerFabricIndex; + other.streamType = self.streamType; + other.videoStreamID = self.videoStreamID; + other.audioStreamID = self.audioStreamID; + other.metadataOptions = self.metadataOptions; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: id:%@; peerNodeID:%@; peerFabricIndex:%@; streamType:%@; videoStreamID:%@; audioStreamID:%@; metadataOptions:%@; >", NSStringFromClass([self class]), _id, _peerNodeID, _peerFabricIndex, _streamType, _videoStreamID, _audioStreamID, _metadataOptions]; + return descriptionString; +} + +@end + @implementation MTRChimeClusterChimeSoundStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index f6a64990ad7f1a..3141e1562abb14 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -37405,6 +37405,106 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +namespace Attributes { + +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::WebRTCTransportRequestor::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::WebRTCTransportRequestor::Id, Id), + EmberAfWriteDataInput(writable, ZCL_BITMAP32_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::WebRTCTransportRequestor::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::WebRTCTransportRequestor::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::WebRTCTransportRequestor::Id, Id), + EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); +} + +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::WebRTCTransportRequestor::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WebRTCTransportRequestor + namespace Chime { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 327355fb0370aa..30641f2c4dd8c8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -5659,6 +5659,24 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar } // namespace Attributes } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +namespace Attributes { + +namespace FeatureMap { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WebRTCTransportRequestor + namespace Chime { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 791d9c0ca8cfcb..61bd0a4962b36d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -623,6 +623,11 @@ void emberAfContentAppObserverClusterInitCallback(chip::EndpointId endpoint); */ void emberAfWebRTCTransportProviderClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWebRTCTransportRequestorClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -5215,6 +5220,44 @@ chip::Protocols::InteractionModel::Status MatterWebRTCTransportProviderClusterSe */ void emberAfWebRTCTransportProviderClusterServerTickCallback(chip::EndpointId endpoint); +// +// WebRTC Transport Requestor Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWebRTCTransportRequestorClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterWebRTCTransportRequestorClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWebRTCTransportRequestorClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterWebRTCTransportRequestorClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterWebRTCTransportRequestorClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfWebRTCTransportRequestorClusterServerTickCallback(chip::EndpointId endpoint); + // // Chime Cluster // @@ -6674,6 +6717,30 @@ bool emberAfWebRTCTransportProviderClusterProvideICECandidateCallback( bool emberAfWebRTCTransportProviderClusterEndSessionCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::WebRTCTransportProvider::Commands::EndSession::DecodableType & commandData); +/** + * @brief WebRTC Transport Requestor Cluster Offer Command callback (from client) + */ +bool emberAfWebRTCTransportRequestorClusterOfferCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::DecodableType & commandData); +/** + * @brief WebRTC Transport Requestor Cluster Answer Command callback (from client) + */ +bool emberAfWebRTCTransportRequestorClusterAnswerCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::DecodableType & commandData); +/** + * @brief WebRTC Transport Requestor Cluster ICECandidate Command callback (from client) + */ +bool emberAfWebRTCTransportRequestorClusterICECandidateCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::DecodableType & commandData); +/** + * @brief WebRTC Transport Requestor Cluster End Command callback (from client) + */ +bool emberAfWebRTCTransportRequestorClusterEndCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::WebRTCTransportRequestor::Commands::End::DecodableType & commandData); /** * @brief Chime Cluster PlayChimeSound Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 8a53e03c838589..8829a72561edbe 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -5457,6 +5457,15 @@ using WebRTCEndReasonEnum = Clusters::detail::WebRTCEndReasonEnum; using WebRTCMetadataOptions = Clusters::detail::WebRTCMetadataOptions; } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { + +using StreamTypeEnum = Clusters::detail::StreamTypeEnum; + +using WebRTCEndReasonEnum = Clusters::detail::WebRTCEndReasonEnum; + +using WebRTCMetadataOptions = Clusters::detail::WebRTCMetadataOptions; +} // namespace WebRTCTransportRequestor + namespace Chime {} // namespace Chime namespace EcosystemInformation {} // namespace EcosystemInformation diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 7c024f24f4ec5f..05164fb2f75da8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -28967,6 +28967,206 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre namespace Events {} // namespace Events } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +namespace Structs {} // namespace Structs + +namespace Commands { +namespace Offer { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kWebRTCSessionID), webRTCSessionID); + encoder.Encode(to_underlying(Fields::kSdp), sdp); + encoder.Encode(to_underlying(Fields::kICEServers), ICEServers); + encoder.Encode(to_underlying(Fields::kICETransportPolicy), ICETransportPolicy); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWebRTCSessionID)) + { + err = DataModel::Decode(reader, webRTCSessionID); + } + else if (__context_tag == to_underlying(Fields::kSdp)) + { + err = DataModel::Decode(reader, sdp); + } + else if (__context_tag == to_underlying(Fields::kICEServers)) + { + err = DataModel::Decode(reader, ICEServers); + } + else if (__context_tag == to_underlying(Fields::kICETransportPolicy)) + { + err = DataModel::Decode(reader, ICETransportPolicy); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace Offer. +namespace Answer { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kWebRTCSessionID), webRTCSessionID); + encoder.Encode(to_underlying(Fields::kSdp), sdp); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWebRTCSessionID)) + { + err = DataModel::Decode(reader, webRTCSessionID); + } + else if (__context_tag == to_underlying(Fields::kSdp)) + { + err = DataModel::Decode(reader, sdp); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace Answer. +namespace ICECandidate { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kWebRTCSessionID), webRTCSessionID); + encoder.Encode(to_underlying(Fields::kICECandidate), ICECandidate); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWebRTCSessionID)) + { + err = DataModel::Decode(reader, webRTCSessionID); + } + else if (__context_tag == to_underlying(Fields::kICECandidate)) + { + err = DataModel::Decode(reader, ICECandidate); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ICECandidate. +namespace End { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kWebRTCSessionID), webRTCSessionID); + encoder.Encode(to_underlying(Fields::kReason), reason); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWebRTCSessionID)) + { + err = DataModel::Decode(reader, webRTCSessionID); + } + else if (__context_tag == to_underlying(Fields::kReason)) + { + err = DataModel::Decode(reader, reason); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace End. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::CurrentSessions::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, currentSessions); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events {} // namespace Events + +} // namespace WebRTCTransportRequestor namespace Chime { namespace Structs { @@ -32997,6 +33197,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::WebRTCTransportRequestor::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::Chime::Id: { switch (aCommand) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 0df61a58857171..19baf37416b889 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -41683,6 +41683,259 @@ struct TypeInfo }; } // namespace Attributes } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +namespace Structs { +namespace ICEServerStruct = Clusters::detail::Structs::ICEServerStruct; +namespace WebRTCSessionStruct = Clusters::detail::Structs::WebRTCSessionStruct; +} // namespace Structs + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace Offer { +struct Type; +struct DecodableType; +} // namespace Offer + +namespace Answer { +struct Type; +struct DecodableType; +} // namespace Answer + +namespace ICECandidate { +struct Type; +struct DecodableType; +} // namespace ICECandidate + +namespace End { +struct Type; +struct DecodableType; +} // namespace End + +} // namespace Commands + +namespace Commands { +namespace Offer { +enum class Fields : uint8_t +{ + kWebRTCSessionID = 0, + kSdp = 1, + kICEServers = 2, + kICETransportPolicy = 3, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::Offer::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + chip::CharSpan sdp; + Optional> ICEServers; + Optional ICETransportPolicy; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::Offer::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + chip::CharSpan sdp; + Optional> ICEServers; + Optional ICETransportPolicy; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace Offer +namespace Answer { +enum class Fields : uint8_t +{ + kWebRTCSessionID = 0, + kSdp = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::Answer::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + chip::CharSpan sdp; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::Answer::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + chip::CharSpan sdp; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace Answer +namespace ICECandidate { +enum class Fields : uint8_t +{ + kWebRTCSessionID = 0, + kICECandidate = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ICECandidate::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + chip::CharSpan ICECandidate; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::ICECandidate::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + chip::CharSpan ICECandidate; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ICECandidate +namespace End { +enum class Fields : uint8_t +{ + kWebRTCSessionID = 0, + kReason = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::End::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + WebRTCEndReasonEnum reason = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::End::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + uint16_t webRTCSessionID = static_cast(0); + WebRTCEndReasonEnum reason = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace End +} // namespace Commands + +namespace Attributes { + +namespace CurrentSessions { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::WebRTCTransportRequestor::Structs::WebRTCSessionStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::WebRTCTransportRequestor::Structs::WebRTCSessionStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentSessions::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CurrentSessions +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::WebRTCTransportRequestor::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::CurrentSessions::TypeInfo::DecodableType currentSessions; + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace WebRTCTransportRequestor namespace Chime { namespace Structs { namespace ChimeSoundStruct { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 80159cd4772296..88942771fa85b7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -7351,6 +7351,40 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +namespace Attributes { + +namespace CurrentSessions { +static constexpr AttributeId Id = 0x00000000; +} // namespace CurrentSessions + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WebRTCTransportRequestor + namespace Chime { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index 9c0523e865443d..f7139e275606c9 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -379,6 +379,9 @@ static constexpr ClusterId Id = 0x00000510; namespace WebRTCTransportProvider { static constexpr ClusterId Id = 0x00000553; } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +static constexpr ClusterId Id = 0x00000554; +} // namespace WebRTCTransportRequestor namespace Chime { static constexpr ClusterId Id = 0x00000556; } // namespace Chime diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 49e738a1aceba1..da67d0d99931fe 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1837,6 +1837,28 @@ static constexpr CommandId Id = 0x00000007; } // namespace Commands } // namespace WebRTCTransportProvider +namespace WebRTCTransportRequestor { +namespace Commands { + +namespace Offer { +static constexpr CommandId Id = 0x00000001; +} // namespace Offer + +namespace Answer { +static constexpr CommandId Id = 0x00000002; +} // namespace Answer + +namespace ICECandidate { +static constexpr CommandId Id = 0x00000003; +} // namespace ICECandidate + +namespace End { +static constexpr CommandId Id = 0x00000004; +} // namespace End + +} // namespace Commands +} // namespace WebRTCTransportRequestor + namespace Chime { namespace Commands { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 388af146a08761..1bbecf1c4bb1ff 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -153,6 +153,7 @@ | ContentControl | 0x050F | | ContentAppObserver | 0x0510 | | WebRTCTransportProvider | 0x0553 | +| WebRTCTransportRequestor | 0x0554 | | Chime | 0x0556 | | EcosystemInformation | 0x0750 | | CommissionerControl | 0x0751 | @@ -13881,6 +13882,186 @@ class WebRTCTransportProviderEndSession : public ClusterCommand chip::app::Clusters::WebRTCTransportProvider::Commands::EndSession::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster WebRTCTransportRequestor | 0x0554 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Offer | 0x01 | +| * Answer | 0x02 | +| * ICECandidate | 0x03 | +| * End | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CurrentSessions | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command Offer + */ +class WebRTCTransportRequestorOffer : public ClusterCommand +{ +public: + WebRTCTransportRequestorOffer(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("offer", credsIssuerConfig), mComplex_ICEServers(&mRequest.ICEServers) + { + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); + AddArgument("Sdp", &mRequest.sdp); + AddArgument("ICEServers", &mComplex_ICEServers, "", Argument::kOptional); + AddArgument("ICETransportPolicy", &mRequest.ICETransportPolicy); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Type mRequest; + TypedComplexArgument>> + mComplex_ICEServers; +}; + +/* + * Command Answer + */ +class WebRTCTransportRequestorAnswer : public ClusterCommand +{ +public: + WebRTCTransportRequestorAnswer(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("answer", credsIssuerConfig) + { + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); + AddArgument("Sdp", &mRequest.sdp); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Type mRequest; +}; + +/* + * Command ICECandidate + */ +class WebRTCTransportRequestorICECandidate : public ClusterCommand +{ +public: + WebRTCTransportRequestorICECandidate(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("icecandidate", credsIssuerConfig) + { + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); + AddArgument("ICECandidate", &mRequest.ICECandidate); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Type mRequest; +}; + +/* + * Command End + */ +class WebRTCTransportRequestorEnd : public ClusterCommand +{ +public: + WebRTCTransportRequestorEnd(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("end", credsIssuerConfig) + { + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); + AddArgument("Reason", 0, UINT8_MAX, &mRequest.reason); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster Chime | 0x0556 | |------------------------------------------------------------------------------| @@ -26523,6 +26704,66 @@ void registerClusterWebRTCTransportProvider(Commands & commands, CredentialIssue commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterWebRTCTransportRequestor(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::WebRTCTransportRequestor; + + const char * clusterName = "WebRTCTransportRequestor"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "current-sessions", Attributes::CurrentSessions::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "current-sessions", Attributes::CurrentSessions::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "current-sessions", Attributes::CurrentSessions::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterChime(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::Chime; @@ -27452,6 +27693,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterContentControl(commands, credsIssuerConfig); registerClusterContentAppObserver(commands, credsIssuerConfig); registerClusterWebRTCTransportProvider(commands, credsIssuerConfig); + registerClusterWebRTCTransportRequestor(commands, credsIssuerConfig); registerClusterChime(commands, credsIssuerConfig); registerClusterEcosystemInformation(commands, credsIssuerConfig); registerClusterCommissionerControl(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 917ba818bcae5f..c6682c0350a921 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -18118,6 +18118,49 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case WebRTCTransportRequestor::Id: { + switch (path.mAttributeId) + { + case WebRTCTransportRequestor::Attributes::CurrentSessions::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::WebRTCTransportRequestor::Structs::WebRTCSessionStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CurrentSessions", 1, value); + } + case WebRTCTransportRequestor::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WebRTCTransportRequestor::Id); + } + case WebRTCTransportRequestor::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WebRTCTransportRequestor::Id); + } + case WebRTCTransportRequestor::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case WebRTCTransportRequestor::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WebRTCTransportRequestor::Id); + } + case WebRTCTransportRequestor::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case WebRTCTransportRequestor::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case Chime::Id: { switch (path.mAttributeId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index cbf31dc81d313b..1ff61d2e84c63b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -261,6 +261,8 @@ char const * ClusterIdToText(chip::ClusterId id) return "ContentAppObserver"; case chip::app::Clusters::WebRTCTransportProvider::Id: return "WebRTCTransportProvider"; + case chip::app::Clusters::WebRTCTransportRequestor::Id: + return "WebRTCTransportRequestor"; case chip::app::Clusters::Chime::Id: return "Chime"; case chip::app::Clusters::EcosystemInformation::Id: @@ -4402,6 +4404,27 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "Unknown"; } } + case chip::app::Clusters::WebRTCTransportRequestor::Id: { + switch (id) + { + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::CurrentSessions::Id: + return "CurrentSessions"; + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WebRTCTransportRequestor::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } case chip::app::Clusters::Chime::Id: { switch (id) { @@ -5770,6 +5793,21 @@ char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id return "Unknown"; } } + case chip::app::Clusters::WebRTCTransportRequestor::Id: { + switch (id) + { + case chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Id: + return "Offer"; + case chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Id: + return "Answer"; + case chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Id: + return "ICECandidate"; + case chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Id: + return "End"; + default: + return "Unknown"; + } + } case chip::app::Clusters::Chime::Id: { switch (id) { diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index a2c25c2f474aba..29dc7b342ae764 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -155,6 +155,7 @@ | ContentControl | 0x050F | | ContentAppObserver | 0x0510 | | WebRTCTransportProvider | 0x0553 | +| WebRTCTransportRequestor | 0x0554 | | Chime | 0x0556 | | EcosystemInformation | 0x0750 | | CommissionerControl | 0x0751 | @@ -161231,6 +161232,915 @@ class SubscribeAttributeWebRTCTransportProviderClusterRevision : public Subscrib } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster WebRTCTransportRequestor | 0x0554 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Offer | 0x01 | +| * Answer | 0x02 | +| * ICECandidate | 0x03 | +| * End | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * CurrentSessions | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command Offer + */ +class WebRTCTransportRequestorOffer : public ClusterCommand { +public: + WebRTCTransportRequestorOffer() + : ClusterCommand("offer") + , mComplex_ICEServers(&mRequest.ICEServers) + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Sdp", &mRequest.sdp); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("ICEServers", &mComplex_ICEServers); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("ICETransportPolicy", &mRequest.ICETransportPolicy); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWebRTCTransportRequestorClusterOfferParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.sdp = [[NSString alloc] initWithBytes:mRequest.sdp.data() length:mRequest.sdp.size() encoding:NSUTF8StringEncoding]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.ICEServers.HasValue()) { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + for (auto & entry_1 : mRequest.ICEServers.Value()) { + MTRWebRTCTransportRequestorClusterICEServerStruct * newElement_1; + newElement_1 = [MTRWebRTCTransportRequestorClusterICEServerStruct new]; + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + for (auto & entry_3 : entry_1.urls) { + NSString * newElement_3; + newElement_3 = [[NSString alloc] initWithBytes:entry_3.data() length:entry_3.size() encoding:NSUTF8StringEncoding]; + [array_3 addObject:newElement_3]; + } + newElement_1.urls = array_3; + } + if (entry_1.username.HasValue()) { + newElement_1.username = [[NSString alloc] initWithBytes:entry_1.username.Value().data() length:entry_1.username.Value().size() encoding:NSUTF8StringEncoding]; + } else { + newElement_1.username = nil; + } + if (entry_1.credential.HasValue()) { + newElement_1.credential = [[NSString alloc] initWithBytes:entry_1.credential.Value().data() length:entry_1.credential.Value().size() encoding:NSUTF8StringEncoding]; + } else { + newElement_1.credential = nil; + } + if (entry_1.caid.HasValue()) { + newElement_1.caid = [NSNumber numberWithUnsignedShort:entry_1.caid.Value()]; + } else { + newElement_1.caid = nil; + } + [array_1 addObject:newElement_1]; + } + params.iceServers = array_1; + } + } else { + params.iceServers = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.ICETransportPolicy.HasValue()) { + params.iceTransportPolicy = [[NSString alloc] initWithBytes:mRequest.ICETransportPolicy.Value().data() length:mRequest.ICETransportPolicy.Value().size() encoding:NSUTF8StringEncoding]; + } else { + params.iceTransportPolicy = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster offerWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Type mRequest; + TypedComplexArgument>> mComplex_ICEServers; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command Answer + */ +class WebRTCTransportRequestorAnswer : public ClusterCommand { +public: + WebRTCTransportRequestorAnswer() + : ClusterCommand("answer") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Sdp", &mRequest.sdp); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWebRTCTransportRequestorClusterAnswerParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.sdp = [[NSString alloc] initWithBytes:mRequest.sdp.data() length:mRequest.sdp.size() encoding:NSUTF8StringEncoding]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster answerWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command ICECandidate + */ +class WebRTCTransportRequestorICECandidate : public ClusterCommand { +public: + WebRTCTransportRequestorICECandidate() + : ClusterCommand("icecandidate") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("ICECandidate", &mRequest.ICECandidate); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWebRTCTransportRequestorClusterICECandidateParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.iceCandidate = [[NSString alloc] initWithBytes:mRequest.ICECandidate.data() length:mRequest.ICECandidate.size() encoding:NSUTF8StringEncoding]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster ICECandidateWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command End + */ +class WebRTCTransportRequestorEnd : public ClusterCommand { +public: + WebRTCTransportRequestorEnd() + : ClusterCommand("end") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Reason", 0, UINT8_MAX, &mRequest.reason); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWebRTCTransportRequestorClusterEndParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.reason = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.reason)]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster endWithParams:params completion: + ^(NSError * _Nullable error) { + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CurrentSessions + */ +class ReadWebRTCTransportRequestorCurrentSessions : public ReadAttribute { +public: + ReadWebRTCTransportRequestorCurrentSessions() + : ReadAttribute("current-sessions") + { + } + + ~ReadWebRTCTransportRequestorCurrentSessions() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::CurrentSessions::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCurrentSessionsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.CurrentSessions response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor CurrentSessions read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorCurrentSessions : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorCurrentSessions() + : SubscribeAttribute("current-sessions") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorCurrentSessions() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::CurrentSessions::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCurrentSessionsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.CurrentSessions response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GeneratedCommandList + */ +class ReadWebRTCTransportRequestorGeneratedCommandList : public ReadAttribute { +public: + ReadWebRTCTransportRequestorGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadWebRTCTransportRequestorGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AcceptedCommandList + */ +class ReadWebRTCTransportRequestorAcceptedCommandList : public ReadAttribute { +public: + ReadWebRTCTransportRequestorAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadWebRTCTransportRequestorAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute EventList + */ +class ReadWebRTCTransportRequestorEventList : public ReadAttribute { +public: + ReadWebRTCTransportRequestorEventList() + : ReadAttribute("event-list") + { + } + + ~ReadWebRTCTransportRequestorEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorEventList : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AttributeList + */ +class ReadWebRTCTransportRequestorAttributeList : public ReadAttribute { +public: + ReadWebRTCTransportRequestorAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadWebRTCTransportRequestorAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute FeatureMap + */ +class ReadWebRTCTransportRequestorFeatureMap : public ReadAttribute { +public: + ReadWebRTCTransportRequestorFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadWebRTCTransportRequestorFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ClusterRevision + */ +class ReadWebRTCTransportRequestorClusterRevision : public ReadAttribute { +public: + ReadWebRTCTransportRequestorClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadWebRTCTransportRequestorClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WebRTCTransportRequestor ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWebRTCTransportRequestorClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeWebRTCTransportRequestorClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeWebRTCTransportRequestorClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WebRTCTransportRequestor.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -185201,6 +186111,63 @@ void registerClusterWebRTCTransportProvider(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterWebRTCTransportRequestor(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::WebRTCTransportRequestor; + + const char * clusterName = "WebRTCTransportRequestor"; + + commands_list clusterCommands = { + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterChime(Commands & commands) { #if MTR_ENABLE_PROVISIONAL @@ -185900,6 +186867,7 @@ void registerClusters(Commands & commands) registerClusterContentControl(commands); registerClusterContentAppObserver(commands); registerClusterWebRTCTransportProvider(commands); + registerClusterWebRTCTransportRequestor(commands); registerClusterChime(commands); registerClusterEcosystemInformation(commands); registerClusterCommissionerControl(commands); From b559f1765838a6f991bf5bc12dec4429e22cf35f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 7 Oct 2024 15:59:41 -0400 Subject: [PATCH 14/39] Move some Matter.framework server APIs used only with concrete controllers to the concrete controller class. (#35943) These APIs are never used for XPC controllers, and the base class implementation does not really make sense. --- .../Framework/CHIP/MTRDeviceController.mm | 37 ------------------- .../CHIP/MTRDeviceController_Concrete.h | 18 +++++++++ .../CHIP/MTRDeviceController_Internal.h | 18 --------- 3 files changed, 18 insertions(+), 55 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index a1872c302081bf..32f42944e7e8af 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -691,43 +691,6 @@ - (void)downloadLogFromNodeWithID:(NSNumber *)nodeID }); } -- (NSArray *)accessGrantsForClusterPath:(MTRClusterPath *)clusterPath -{ - assertChipStackLockedByCurrentThread(); - - for (MTRServerEndpoint * endpoint in _serverEndpoints) { - if ([clusterPath.endpoint isEqual:endpoint.endpointID]) { - return [endpoint matterAccessGrantsForCluster:clusterPath.cluster]; - } - } - - // Nothing matched, no grants. - return @[]; -} - -- (nullable NSNumber *)neededReadPrivilegeForClusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID -{ - assertChipStackLockedByCurrentThread(); - - for (MTRServerEndpoint * endpoint in _serverEndpoints) { - for (MTRServerCluster * cluster in endpoint.serverClusters) { - if (![cluster.clusterID isEqual:clusterID]) { - continue; - } - - for (MTRServerAttribute * attr in cluster.attributes) { - if (![attr.attributeID isEqual:attributeID]) { - continue; - } - - return @(attr.requiredReadPrivilege); - } - } - } - - return nil; -} - #ifdef DEBUG + (void)forceLocalhostAdvertisingOnly { diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h index e0820d57e0f88c..5df5f501b13b8d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h @@ -17,6 +17,7 @@ #import +#import #import #import #import @@ -131,6 +132,23 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)operationalInstanceAdded:(NSNumber *)nodeID; +/** + * Get the access grants that apply for the given cluster path. + */ +- (NSArray *)accessGrantsForClusterPath:(MTRClusterPath *)clusterPath; + +/** + * Get the privilege level needed to read the given attribute. There's no + * endpoint provided because the expectation is that this information is the + * same for all cluster instances. + * + * Returns nil if we have no such attribute defined on any endpoint, otherwise + * one of MTRAccessControlEntry* constants wrapped in NSNumber. + * + * Only called on the Matter queue. + */ +- (nullable NSNumber *)neededReadPrivilegeForClusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID; + @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h index 958e7914b1dd3a..00609d917763ed 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h @@ -20,7 +20,6 @@ */ #import -#import #import // for MTRClusterPath #import "MTRDeviceConnectionBridge.h" // For MTRInternalDeviceConnectionCallback @@ -210,23 +209,6 @@ NS_ASSUME_NONNULL_BEGIN queue:(dispatch_queue_t)queue completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion; -/** - * Get the access grants that apply for the given cluster path. - */ -- (NSArray *)accessGrantsForClusterPath:(MTRClusterPath *)clusterPath; - -/** - * Get the privilege level needed to read the given attribute. There's no - * endpoint provided because the expectation is that this information is the - * same for all cluster instances. - * - * Returns nil if we have no such attribute defined on any endpoint, otherwise - * one of MTRAccessControlEntry* constants wrapped in NSNumber. - * - * Only called on the Matter queue. - */ -- (nullable NSNumber *)neededReadPrivilegeForClusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID; - #pragma mark - Device-specific data and SDK access // DeviceController will act as a central repository for this opaque dictionary that MTRDevice manages - (MTRDevice *)deviceForNodeID:(NSNumber *)nodeID; From 55e2a3f89526c69c06b5ec09220a61d68bbf4d59 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 7 Oct 2024 16:21:47 -0400 Subject: [PATCH 15/39] Remove PASE verifier computation overrides from MTRDeviceController_Concrete. (#35945) The base class implements these selectors already, and its implementation is perfectly fine. --- .../CHIP/MTRDeviceController_Concrete.mm | 29 ------------------- .../CHIP/MTRDeviceController_Internal.h | 2 -- 2 files changed, 31 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm index cb86c5d2db044f..92d04cd5f3d3d1 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm @@ -1231,30 +1231,6 @@ - (BOOL)setOperationalCertificateIssuer:(nullable id)delegate queue:(dispatch_queue_t)queue { auto * delegateShim = [[MTRDevicePairingDelegateShim alloc] initWithDelegate:delegate]; diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h index 00609d917763ed..84a8b536ec54e8 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h @@ -247,8 +247,6 @@ static NSString * const kDeviceControllerErrorKeyAllocation = @"Generating new o static NSString * const kDeviceControllerErrorCSRValidation = @"Extracting public key from CSR failed"; static NSString * const kDeviceControllerErrorGetCommissionee = @"Failure obtaining device being commissioned"; static NSString * const kDeviceControllerErrorGetAttestationChallenge = @"Failure getting attestation challenge"; -static NSString * const kDeviceControllerErrorSpake2pVerifierGenerationFailed = @"PASE verifier generation failed"; -static NSString * const kDeviceControllerErrorSpake2pVerifierSerializationFailed = @"PASE verifier serialization failed"; static NSString * const kDeviceControllerErrorCDCertStoreInit = @"Init failure while initializing Certificate Declaration Signing Keys store"; NS_ASSUME_NONNULL_END From 3adf99ef53ada8ab70c9ee3cb167537973c3c5c5 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 7 Oct 2024 17:20:36 -0400 Subject: [PATCH 16/39] Add a size-display script for binaries. (#35942) * Add a size-display script for binaries. I am currently looking to investigate sizes of our code given the CodegenDataModel work, so adding a script that can display a nice treemap of things received from NM. It is generally hacked-up to display ok data for matter binaries. (i.e. it splits emberAf and Matter as separate entities). It is currently a best-effort. * Restyled by autopep8 * Restyled by isort * Support some zoom and better parenting * Restyled by autopep8 * Update parenting and fix up auto-format * Fix up call suffixes if they contain namespaces * Remove debug print, fix up vtable and thunk * Allow stripping of entire sections - the C section is large and generally not that useful * Strip C by default * Undo default strip: we likely should show the full size because C libs are non-trivial in size --------- Co-authored-by: Restyled.io --- scripts/tools/file_size_from_nm.py | 432 +++++++++++++++++++++++++++++ 1 file changed, 432 insertions(+) create mode 100755 scripts/tools/file_size_from_nm.py diff --git a/scripts/tools/file_size_from_nm.py b/scripts/tools/file_size_from_nm.py new file mode 100755 index 00000000000000..a5d53b26dced19 --- /dev/null +++ b/scripts/tools/file_size_from_nm.py @@ -0,0 +1,432 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Displays a treemap code size as read by `nm` over a binary +# +# Example call: +# +# scripts/tools/file_size_from_nm.py \ +# --max-depth 5 \ +# out/nrf-nrf52840dk-light-data-model-enabled/nrfconnect/zephyr/zephyr.elf +# + +# Requires: +# click +# cxxfilt +# coloredlogs +# pandas +# plotly + +import logging +import subprocess +from dataclasses import dataclass +from enum import Enum, auto +from pathlib import Path +from typing import Optional + +import click +import coloredlogs +import cxxfilt +import plotly.express as px +import plotly.graph_objects as go + +# Supported log levels, mapping string values required for argument +# parsing into logging constants +__LOG_LEVELS__ = { + "debug": logging.DEBUG, + "info": logging.INFO, + "warn": logging.WARN, + "fatal": logging.FATAL, +} + + +class ChartStyle(Enum): + TREE_MAP = auto() + SUNBURST = auto() + + +__CHART_STYLES__ = { + "treemap": ChartStyle.TREE_MAP, + "sunburst": ChartStyle.SUNBURST, +} + + +@dataclass +class Symbol: + name: str + symbol_type: str + offset: int + size: int + + +def tree_display_name(name: str) -> list[str]: + """ + Convert the given name from NM into a tree path. + + It splits the name by C++ namespaces, however it also specifically handles + 'emberAf' prefixes to make them common and uses 'vtable for' information + """ + + name = cxxfilt.demangle(name) + + if name.startswith("non-virtual thunk to "): + name = name[21:] + if name.startswith("vtable for "): + name = name[11:] + + # These are C-style methods really, we have no top-level namespaces named + # like this but still want to see these differently + for special_prefix in {"emberAf", "Matter"}: + if name.startswith(special_prefix): + return [special_prefix, name] + + # If the first element contains a space, it is either within `<>` for templates or it means it is a + # separator of the type. Try to find the type separator + # + # Logic: + # - try to find the first space OUTSIDE <> and before '(' + space_pos = 0 + indent = 0 + type_prefix = "" + while space_pos < len(name): + c = name[space_pos] + if c == "<": + indent += 1 + elif c == ">": + indent -= 1 + elif c == " " and indent == 0: + # FOUND A SPACE, move it to the last + type_prefix = name[:space_pos] + " " + space_pos += 1 + name = name[space_pos:] + break + elif c == "(" and indent == 0: + # a bracket not within templates means we are done! + break + space_pos += 1 + + # completely skip any arguments ... i.e. anything after ( + brace_pos = 0 + indent = 0 + type_suffix = "" + while brace_pos < len(name): + c = name[brace_pos] + if c == "<": + indent += 1 + elif c == ">": + indent -= 1 + elif c == "(" and indent == 0: + # FOUND A SPACE, move it to the last + type_suffix = name[brace_pos:] + name = name[:brace_pos] + break + brace_pos += 1 + + # name may be split by namespace and looks like foo::bar::baz + # HOWEVER for templates we want to split foo::Bar::Baz into + # [foo, Bar::Baz] + # + # General way things look like: + # TYPE FUNC # notice the space + # CONSTRUCTOR() + result = [] + while "::" in name: + ns_idx = name.find("::") + less_idx = name.find("<") + if less_idx >= 0 and ns_idx > less_idx: + # at this point, we have to find the matched `>` for this, assuming there ARE + # nested `>` entries, including multiple of them + pos = less_idx + 1 + indent = 1 + while indent > 0: + if name[pos] == ">": + indent -= 1 + elif name[pos] == "<": + indent += 1 + pos += 1 + if pos == len(name): + break + result.append(name[:pos]) + name = name[pos:] + if name.startswith("::"): + name = name[2:] + else: + result.append(name[:ns_idx]) + ns_idx += 2 + name = name[ns_idx:] + result.append(type_prefix + name + type_suffix) + + if len(result) == 1: + if result[0].startswith("ot"): # Show openthread methods a bit grouped + result = ["ot"] + result + return ["C"] + result + + return result + + +# TO run the test, install pytest and do +# pytest file_size_from_nm.py +def test_tree_display_name(): + assert tree_display_name("fooBar") == ["C", "fooBar"] + assert tree_display_name("emberAfTest") == ["emberAf", "emberAfTest"] + assert tree_display_name("MatterSomeCall") == ["Matter", "MatterSomeCall"] + assert tree_display_name("chip::Some::Constructor()") == [ + "chip", + "Some", + "Constructor()", + ] + + assert tree_display_name("chip::Some::Constructor(int arg1, int arg2)") == [ + "chip", + "Some", + "Constructor(int arg1, int arg2)", + ] + + assert tree_display_name( + "chip::Some::Constructor(int arg1, int arg2)" + ) == [ + "chip", + "Some", + "Constructor(int arg1, int arg2)", + ] + + assert tree_display_name("void my::function::call()") == [ + "my", + "function", + "void call()", + ] + assert tree_display_name("chip::ChipError my::function::call()") == [ + "my", + "function", + "chip::ChipError call()", + ] + assert tree_display_name("chip::test::baz my::function::call()") == [ + "my", + "function", + "chip::test::baz call()", + ] + assert tree_display_name( + "chip::test::baz my::function::call()" + ) == [ + "my", + "function", + "chip::test::baz call()", + ] + assert tree_display_name( + "chip::app::CommandIsFabricScoped(unsigned int, unsigned int)" + ) == ["chip", "app", "CommandIsFabricScoped(unsigned int, unsigned int)"] + assert tree_display_name("chip::app::AdvertiseAsOperational()") == [ + "chip", + "app", + "AdvertiseAsOperational()", + ] + + assert tree_display_name( + "void foo::bar::method(my::arg name, other::arg::type)" + ) == ["foo", "bar", "void method(my::arg name, other::arg::type)"] + + +def build_treemap( + name: str, + symbols: list[Symbol], + style: ChartStyle, + max_depth: int, + zoom: Optional[str], + strip: Optional[str], +): + # A treemap is based on parents (with title) + + # Naming rules: + # namespaces/prefixes are "::(::)" + # Actual names will be parented by their suffixes + + root = f"FILE: {name}" + if zoom: + root = root + f" (FILTER: {zoom})" + data: dict[str, list] = dict(name=[root], parent=[""], size=[0], hover=[""]) + + known_parents: set[str] = set() + total_sizes: dict = {} + + for symbol in symbols: + tree_name = tree_display_name(symbol.name) + + if zoom is not None: + partial = "" + # try to filter out the tree name. If it contains the zoom item, keep it, otherwise discard + while tree_name and partial != zoom: + partial += "::" + tree_name[0] + tree_name = tree_name[1:] + if not tree_name: + continue + + if strip is not None: + partial = "" + for part_name in tree_name: + partial = "::" + part_name + if partial == strip: + break + if partial == strip: + continue + + partial = "" + for name in tree_name[:-1]: + next_value = partial + "::" + name + if next_value not in known_parents: + known_parents.add(next_value) + data["name"].append(next_value) + data["parent"].append(partial if partial else root) + data["size"].append(0) + data["hover"].append(next_value) + total_sizes[next_value] = total_sizes.get(next_value, 0) + symbol.size + partial = next_value + + # the name MUST be added + data["name"].append(cxxfilt.demangle(symbol.name)) + data["parent"].append(partial if partial else root) + data["size"].append(symbol.size) + data["hover"].append(f"{symbol.name} of type {symbol.symbol_type}") + + for idx, label in enumerate(data["name"]): + if data["size"][idx] == 0: + data["hover"][idx] = f"{label}: {total_sizes.get(label, 0)}" + + if style == ChartStyle.TREE_MAP: + fig = go.Figure( + go.Treemap( + labels=data["name"], + parents=data["parent"], + values=data["size"], + textinfo="label+value+percent parent", + hovertext=data["hover"], + maxdepth=max_depth, + ) + ) + else: + fig = px.sunburst( + data, + names="name", + parents="parent", + values="size", + maxdepth=max_depth, + ) + + fig.update_traces(root_color="lightgray") + fig.show() + + +@click.command() +@click.option( + "--log-level", + default="INFO", + show_default=True, + type=click.Choice(list(__LOG_LEVELS__.keys()), case_sensitive=False), + help="Determines the verbosity of script output.", +) +@click.option( + "--display-type", + default="TREEMAP", + show_default=True, + type=click.Choice(list(__CHART_STYLES__.keys()), case_sensitive=False), + help="Style of the chart", +) +@click.option( + "--max-depth", + default=4, + show_default=True, + type=int, + help="Display depth by default", +) +@click.option( + "--zoom", + default=None, + help="Zoom in the graph to ONLY the specified path as root (e.g. ::chip::app)", +) +@click.option( + "--strip", + default=None, + help="Strip out a tree subset (e.g. ::C)", +) +@click.argument("elf-file", type=Path) +def main( + log_level, + elf_file: Path, + display_type: str, + max_depth: int, + zoom: Optional[str], + strip: Optional[str], +): + log_fmt = "%(asctime)s %(levelname)-7s %(message)s" + coloredlogs.install(level=__LOG_LEVELS__[log_level], fmt=log_fmt) + + items = subprocess.check_output( + [ + "nm", + "--print-size", + "--size-sort", # Filters out empty entries + "--radix=d", + elf_file.absolute().as_posix(), + ] + ).decode("utf8") + + symbols = [] + + # OUTPUT FORMAT: + # + for line in items.split("\n"): + if not line.strip(): + continue + offset, size, t, name = line.split(" ") + + size = int(size, 10) + offset = int(offset, 10) + + if t in { + # Text section + "t", + "T", + # Weak defines + "w", + "W", + # Initialized data + "d", + "D", + # Readonly + "r", + "R", + # Weak object + "v", + "V", + }: + logging.debug("Found %s of size %d", name, size) + symbols.append(Symbol(name=name, symbol_type=t, offset=offset, size=size)) + elif t in { + # BSS - 0-initialized, not code + "b", + "B", + }: + pass + else: + logging.error("SKIPPING SECTION %s", t) + + build_treemap( + elf_file.name, symbols, __CHART_STYLES__[display_type], max_depth, zoom, strip + ) + + +if __name__ == "__main__": + main(auto_envvar_prefix="CHIP") From 3a7c922137297ed196cc3411eef0827694aab68d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 7 Oct 2024 17:23:24 -0400 Subject: [PATCH 17/39] Fix handling of controllerNodeID on non-concrete controllers. (#35946) There isn't actually a _cppCommissioner on the base controller, so that implementation made no sense. In practice, the XPC and concrete controller just have different implementations here, and the base should not try to implement anything. Also fixes the concrete implementation to avoid a sync dispatch by caching the value (which should be immutable) during startup and removes the unnecessary controllerNodeId override from the concrete controller: the base class handles that backwards compat shim already. --- .../Framework/CHIP/MTRDeviceController.mm | 12 +++--------- .../CHIP/MTRDeviceController_Concrete.mm | 19 ++----------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 32f42944e7e8af..63fb3b5668a01f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -318,16 +318,10 @@ - (void)shutdown // Subclass hook; nothing to do. } -- (NSNumber *)controllerNodeID +- (nullable NSNumber *)controllerNodeID { - auto block = ^NSNumber * { return @(self->_cppCommissioner->GetNodeId()); }; - - NSNumber * nodeID = [self syncRunOnWorkQueueWithReturnValue:block error:nil]; - if (!nodeID) { - MTR_LOG_ERROR("%@ A controller has no node id if it has not been started", self); - } - - return nodeID; + MTR_ABSTRACT_METHOD(); + return nil; } - (BOOL)setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm index 92d04cd5f3d3d1..cae4103d0f2ffd 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm @@ -141,6 +141,7 @@ @implementation MTRDeviceController_Concrete { @synthesize commissionableBrowser = _commissionableBrowser; @synthesize concurrentSubscriptionPool = _concurrentSubscriptionPool; @synthesize storageBehaviorConfiguration = _storageBehaviorConfiguration; +@synthesize controllerNodeID = _controllerNodeID; - (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters error:(NSError * __autoreleasing *)error @@ -729,6 +730,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams self->_storedFabricIndex = fabricIdx; self->_storedCompressedFabricID = _cppCommissioner->GetCompressedFabricId(); + self->_controllerNodeID = @(_cppCommissioner->GetNodeId()); chip::Crypto::P256PublicKey rootPublicKey; if (_cppCommissioner->GetRootPublicKey(rootPublicKey) == CHIP_NO_ERROR) { @@ -793,18 +795,6 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams return YES; } -- (NSNumber *)controllerNodeID -{ - auto block = ^NSNumber * { return @(self->_cppCommissioner->GetNodeId()); }; - - NSNumber * nodeID = [self syncRunOnWorkQueueWithReturnValue:block error:nil]; - if (!nodeID) { - MTR_LOG_ERROR("%@ A controller has no node id if it has not been started", self); - } - - return nodeID; -} - static inline void emitMetricForSetupPayload(MTRSetupPayload * payload) { MATTER_LOG_METRIC(kMetricDeviceVendorID, [payload.vendorID unsignedIntValue]); @@ -1712,11 +1702,6 @@ - (instancetype)initWithIssuer:(id)nocChainIssuer; @implementation MTRDeviceController_Concrete (Deprecated) -- (NSNumber *)controllerNodeId -{ - return self.controllerNodeID; -} - - (nullable NSData *)fetchAttestationChallengeForDeviceId:(uint64_t)deviceId { return [self attestationChallengeForDeviceID:@(deviceId)]; From 7fd3d5938a4fad78c386ebd3e033193003207bcf Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 7 Oct 2024 17:39:12 -0400 Subject: [PATCH 18/39] Clean up asyncGetCommissionerOnMatterQueue on MTRDeviceController. (#35947) MTROperationalCredentialsDelegate always works with a concrete controller. Make that explicit. At that point, asyncGetCommissionerOnMatterQueue can only get called on an MTRDeviceController from and MTRBaseDevice that was created for an XPC controller. Having that just fail out is perfectly reasonable. --- .../Framework/CHIP/MTRDeviceController.mm | 25 ++----------------- src/darwin/Framework/CHIP/MTRDevice_XPC.mm | 1 - .../CHIP/MTROperationalCredentialsDelegate.h | 6 ++--- .../CHIP/MTROperationalCredentialsDelegate.mm | 8 +++--- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 63fb3b5668a01f..0bfe6f45f4b256 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -43,7 +43,6 @@ #import "MTRLogging_Internal.h" #import "MTRMetricKeys.h" #import "MTRMetricsCollector.h" -#import "MTROperationalCredentialsDelegate.h" #import "MTRP256KeypairBridge.h" #import "MTRPersistentStorageDelegateBridge.h" #import "MTRServerEndpoint_Internal.h" @@ -124,7 +123,6 @@ @implementation MTRDeviceController { chip::Credentials::PartialDACVerifier * _partialDACVerifier; chip::Credentials::DefaultDACVerifier * _defaultDACVerifier; MTRDeviceControllerDelegateBridge * _deviceControllerDelegateBridge; - MTROperationalCredentialsDelegate * _operationalCredentialsDelegate; MTRDeviceAttestationDelegateBridge * _deviceAttestationDelegateBridge; os_unfair_lock _underlyingDeviceMapLock; MTRCommissionableBrowser * _commissionableBrowser; @@ -586,27 +584,8 @@ - (MTRTransportType)sessionTransportTypeForDevice:(MTRBaseDevice *)device - (void)asyncGetCommissionerOnMatterQueue:(void (^)(chip::Controller::DeviceCommissioner *))block errorHandler:(nullable MTRDeviceErrorHandler)errorHandler { - { - NSError * error; - if (![self checkIsRunning:&error]) { - if (errorHandler != nil) { - errorHandler(error); - } - return; - } - } - - dispatch_async(_chipWorkQueue, ^{ - NSError * error; - if (![self checkIsRunning:&error]) { - if (errorHandler != nil) { - errorHandler(error); - } - return; - } - - block(self->_cppCommissioner); - }); + MTR_ABSTRACT_METHOD(); + errorHandler([MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); } - (void)asyncDispatchToMatterQueue:(dispatch_block_t)block errorHandler:(nullable MTRDeviceErrorHandler)errorHandler diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm index d7a4574f918b76..5165e3ad26c3f4 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -49,7 +49,6 @@ #import "MTRLogging_Internal.h" #import "MTRMetricKeys.h" #import "MTRMetricsCollector.h" -#import "MTROperationalCredentialsDelegate.h" #import "MTRP256KeypairBridge.h" #import "MTRPersistentStorageDelegateBridge.h" #import "MTRServerEndpoint_Internal.h" diff --git a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h index 63499f024bb277..928c80ba85a0cb 100644 --- a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h +++ b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h @@ -20,7 +20,7 @@ #import #import -#import "MTRDeviceController.h" +#import "MTRDeviceController_Concrete.h" #import "MTRError_Internal.h" #import "MTRKeypair.h" #import "MTROperationalCertificateIssuer.h" @@ -38,7 +38,7 @@ class MTROperationalCredentialsDelegate : public chip::Controller::OperationalCr public: using ChipP256KeypairPtr = chip::Crypto::P256Keypair *; - MTROperationalCredentialsDelegate(MTRDeviceController * deviceController); + MTROperationalCredentialsDelegate(MTRDeviceController_Concrete * deviceController); ~MTROperationalCredentialsDelegate() {} CHIP_ERROR Init(ChipP256KeypairPtr nocSigner, NSData * ipk, NSData * rootCert, NSData * _Nullable icaCert); @@ -147,7 +147,7 @@ class MTROperationalCredentialsDelegate : public chip::Controller::OperationalCr NSData * _Nullable mRootCert; NSData * _Nullable mIntermediateCert; - MTRDeviceController * __weak mWeakController; + MTRDeviceController_Concrete * __weak mWeakController; chip::Controller::DeviceCommissioner * _Nullable mCppCommissioner = nullptr; id _Nullable mOperationalCertificateIssuer; dispatch_queue_t _Nullable mOperationalCertificateIssuerQueue; diff --git a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm index fa280c81e63bab..673e4df12b2714 100644 --- a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm +++ b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm @@ -42,7 +42,7 @@ using namespace Credentials; using namespace Crypto; -MTROperationalCredentialsDelegate::MTROperationalCredentialsDelegate(MTRDeviceController * deviceController) +MTROperationalCredentialsDelegate::MTROperationalCredentialsDelegate(MTRDeviceController_Concrete * deviceController) : mWeakController(deviceController) { } @@ -129,7 +129,7 @@ VerifyOrReturnError(mCppCommissioner != nullptr, CHIP_ERROR_INCORRECT_STATE); - MTRDeviceController * strongController = mWeakController; + MTRDeviceController_Concrete * strongController = mWeakController; VerifyOrReturnError(strongController != nil, CHIP_ERROR_INCORRECT_STATE); mOnNOCCompletionCallback = onCompletion; @@ -168,14 +168,14 @@ certificationDeclaration:AsData(certificationDeclarationSpan) firmwareInfo:firmwareInfo]; - MTRDeviceController * __weak weakController = mWeakController; + MTRDeviceController_Concrete * __weak weakController = mWeakController; dispatch_async(mOperationalCertificateIssuerQueue, ^{ [mOperationalCertificateIssuer issueOperationalCertificateForRequest:csrInfo attestationInfo:attestationInfo controller:strongController completion:^(MTROperationalCertificateChain * _Nullable chain, NSError * _Nullable error) { - MTRDeviceController * strongController = weakController; + MTRDeviceController_Concrete * strongController = weakController; if (strongController == nil || !strongController.isRunning) { // No longer safe to touch "this" return; From 52a5589b11f534e8e6c75465a4c5942ec4500a36 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:56:15 -0400 Subject: [PATCH 19/39] Fix efr32 test_driver build and make sure the linkerfile matches the target board (#35952) --- src/test_driver/efr32/BUILD.gn | 11 +++++++++++ src/test_driver/efr32/args.gni | 8 -------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 0d10cb8d76a475..1fc16ed47f4d52 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -61,6 +61,16 @@ efr32_sdk("sdk") { ] } +config("efr32_ldflags") { + _ldscript = + "${chip_root}/examples/platform/silabs/ldscripts/${silabs_family}.ld" + + ldflags = [ + "-T" + rebase_path(_ldscript, root_build_dir), + "-Wl,--no-warn-rwx-segment", + ] +} + # This is the test runner. `pw_test` will dep this for each `silabs_executable` target. source_set("efr32_test_main") { defines = [ "PW_RPC_ENABLED" ] @@ -103,6 +113,7 @@ source_set("efr32_test_main") { ] include_dirs = [ "${chip_root}/examples/common/pigweed/efr32" ] + public_configs = [ ":efr32_ldflags" ] } # This target is referred to by BuildRoot in scripts/build/builders/efr32.py, as well as the example in README.md. diff --git a/src/test_driver/efr32/args.gni b/src/test_driver/efr32/args.gni index f7f52398a5889e..35be5dd63e3870 100644 --- a/src/test_driver/efr32/args.gni +++ b/src/test_driver/efr32/args.gni @@ -15,9 +15,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni") -import("${chip_root}/examples/platform/silabs/args.gni") import("${chip_root}/src/platform/silabs/efr32/args.gni") -import("${chip_root}/third_party/silabs/silabs_board.gni") # silabs_family silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") @@ -46,9 +44,3 @@ pw_unit_test_MAIN = "//:efr32_test_main" # Additional variables needed by silabs_executable that must be passed in to pw_test. test_executable_output_name = "matter-silabs-device_tests-" test_executable_output_name_suffix = ".out" -_ldscript = - "${chip_root}/examples/platform/silabs/ldscripts/${silabs_family}.ld" -test_executable_ldflags = [ - "-T" + rebase_path(_ldscript, root_build_dir), - "-Wl,--no-warn-rwx-segment", -] From 07a28ac0bed1c54843f73590a15b09c661733969 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 7 Oct 2024 20:29:39 -0400 Subject: [PATCH 20/39] One more decouple from ember from src/app and ensure we can compile without `ember-compatibility-functions.cpp` (#35919) * Add ability to skip compiling of ember-compatibility-functions * Fix build and make sure that CI will validate a data-model-enabled build * Restyle * Fix compilation * Restyled by clang-format * Typo fix * Fix includes * Rename method to something that seems a bit clearer * Fix pwrpc usage to use datamodel interface * Restyle * Remove todo * Update for attribute is list to support not know value * Update src/app/WriteHandler.h Co-authored-by: Boris Zbarsky --------- Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- .github/workflows/examples-linux-arm.yaml | 2 +- .../common/pigweed/rpc_services/Attributes.h | 38 ++++++++++++++++ src/app/WriteHandler.cpp | 44 ++++++++++++++----- src/app/WriteHandler.h | 6 +++ src/app/chip_data_model.cmake | 14 +++++- src/app/chip_data_model.gni | 6 ++- 6 files changed, 95 insertions(+), 15 deletions(-) diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index ee226b12dc2881..7000082f03e32e 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -65,7 +65,7 @@ jobs: --target linux-arm64-chip-tool-nodeps-ipv6only \ --target linux-arm64-lock-clang \ --target linux-arm64-minmdns-clang \ - --target linux-arm64-light-rpc-ipv6only-clang \ + --target linux-arm64-light-data-model-enabled-rpc-ipv6only-clang \ --target linux-arm64-thermostat-no-ble-clang \ --target linux-arm64-lit-icd-no-ble-clang \ --target linux-arm64-fabric-admin-clang-rpc \ diff --git a/examples/common/pigweed/rpc_services/Attributes.h b/examples/common/pigweed/rpc_services/Attributes.h index e246c5361bd281..3ff1200be2edeb 100644 --- a/examples/common/pigweed/rpc_services/Attributes.h +++ b/examples/common/pigweed/rpc_services/Attributes.h @@ -22,6 +22,7 @@ #include "pigweed/rpc_services/internal/StatusUtils.h" #include +#include #include #include #include @@ -32,6 +33,13 @@ #include #include +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#include +#include +#include +#include +#endif + namespace chip { namespace rpc { @@ -202,7 +210,37 @@ class Attributes : public pw_rpc::nanopb::Attributes::Service writer.Init(tlvBuffer); PW_TRY(ChipErrorToPwStatus(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outer))); PW_TRY(ChipErrorToPwStatus(attributeReports.Init(&writer, kReportContextTag))); + +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + // TODO: this assumes a singleton data model provider + app::DataModel::Provider * provider = app::InteractionModelEngine::GetInstance()->GetDataModelProvider(); + + app::DataModel::ReadAttributeRequest request; + request.path = path; + request.operationFlags.Set(app::DataModel::OperationFlags::kInternal); + request.subjectDescriptor = subjectDescriptor; + + std::optional info = provider->GetClusterInfo(path); + if (!info.has_value()) + { + return ::pw::Status::NotFound(); + } + + app::AttributeValueEncoder encoder(attributeReports, subjectDescriptor, path, info->dataVersion, + false /* isFabricFiltered */, nullptr /* attributeEncodingState */); + app::DataModel::ActionReturnStatus result = provider->ReadAttribute(request, encoder); + + if (!result.IsSuccess()) + { + app::DataModel::ActionReturnStatus::StringStorage storage; + ChipLogError(Support, "Failed to read data: %s", result.c_str(storage)); + return ::pw::Status::Internal(); + } + +#else PW_TRY(ChipErrorToPwStatus(app::ReadSingleClusterData(subjectDescriptor, false, path, attributeReports, nullptr))); +#endif + attributeReports.EndOfContainer(); PW_TRY(ChipErrorToPwStatus(writer.EndContainer(outer))); PW_TRY(ChipErrorToPwStatus(writer.Finalize())); diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index 5050cbbee2fcb5..d2fde339304f8f 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include @@ -41,8 +43,7 @@ namespace chip { namespace app { using namespace Protocols::InteractionModel; -using Status = Protocols::InteractionModel::Status; -constexpr uint8_t kListAttributeType = 0x48; +using Status = Protocols::InteractionModel::Status; CHIP_ERROR WriteHandler::Init(DataModel::Provider * apProvider, WriteHandlerDelegate * apWriteHandlerDelegate) { @@ -79,6 +80,30 @@ void WriteHandler::Close() MoveToState(State::Uninitialized); } +std::optional WriteHandler::IsListAttributePath(const ConcreteAttributePath & path) +{ +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + VerifyOrReturnValue(mDataModelProvider != nullptr, std::nullopt, + ChipLogError(DataManagement, "Null data model while checking attribute properties.")); + + auto info = mDataModelProvider->GetAttributeInfo(path); + if (!info.has_value()) + { + return std::nullopt; + } + + return info->flags.Has(DataModel::AttributeQualityFlags::kListAttribute); +#else + constexpr uint8_t kListAttributeType = 0x48; + const auto attributeMetadata = GetAttributeMetadata(path); + if (attributeMetadata == nullptr) + { + return std::nullopt; + } + return (attributeMetadata->attributeType == kListAttributeType); +#endif +} + Status WriteHandler::HandleWriteRequestMessage(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload, bool aIsTimedWrite) { @@ -317,10 +342,7 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData err = element.GetData(&dataReader); SuccessOrExit(err); - const auto attributeMetadata = GetAttributeMetadata(dataAttributePath); - bool currentAttributeIsList = (attributeMetadata != nullptr && attributeMetadata->attributeType == kListAttributeType); - - if (!dataAttributePath.IsListOperation() && currentAttributeIsList) + if (!dataAttributePath.IsListOperation() && IsListAttributePath(dataAttributePath).value_or(false)) { dataAttributePath.mListOp = ConcreteDataAttributePath::ListOperation::ReplaceAll; } @@ -446,7 +468,7 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut mProcessingAttributePath, mStateFlags.Has(StateBits::kProcessingAttributeIsList), dataAttributePath); bool shouldReportListWriteBegin = false; // This will be set below. - const EmberAfAttributeMetadata * attributeMetadata = nullptr; + std::optional isListAttribute = std::nullopt; while (iterator->Next(mapping)) { @@ -460,11 +482,11 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut // Try to get the metadata from for the attribute from one of the expanded endpoints (it doesn't really matter which // endpoint we pick, as long as it's valid) and update the path info according to it and recheck if we need to report // list write begin. - if (attributeMetadata == nullptr) + if (!isListAttribute.has_value()) { - attributeMetadata = GetAttributeMetadata(dataAttributePath); - bool currentAttributeIsList = - (attributeMetadata != nullptr && attributeMetadata->attributeType == kListAttributeType); + isListAttribute = IsListAttributePath(dataAttributePath); + bool currentAttributeIsList = isListAttribute.value_or(false); + if (!dataAttributePath.IsListOperation() && currentAttributeIsList) { dataAttributePath.mListOp = ConcreteDataAttributePath::ListOperation::ReplaceAll; diff --git a/src/app/WriteHandler.h b/src/app/WriteHandler.h index fe63e028b8dfee..33c068b8cd02ea 100644 --- a/src/app/WriteHandler.h +++ b/src/app/WriteHandler.h @@ -189,6 +189,12 @@ class WriteHandler : public Messaging::ExchangeDelegate CHIP_ERROR WriteClusterData(const Access::SubjectDescriptor & aSubject, const ConcreteDataAttributePath & aPath, TLV::TLVReader & aData); + /// Checks whether the given path corresponds to a list attribute + /// Return values: + /// true/false: valid attribute path, known if list or not + /// std::nulloptr - path not available/valid, unknown if attribute is a list or not + std::optional IsListAttributePath(const ConcreteAttributePath & path); + Messaging::ExchangeHolder mExchangeCtx; WriteResponseMessage::Builder mWriteResponseBuilder; Optional mProcessingAttributePath; diff --git a/src/app/chip_data_model.cmake b/src/app/chip_data_model.cmake index e2d05adb01e4a1..11db6d4ec6c97b 100644 --- a/src/app/chip_data_model.cmake +++ b/src/app/chip_data_model.cmake @@ -70,12 +70,17 @@ endfunction() # function(chip_configure_data_model APP_TARGET) set(SCOPE PRIVATE) - cmake_parse_arguments(ARG "" "SCOPE;ZAP_FILE;IDL" "EXTERNAL_CLUSTERS" ${ARGN}) + set(ADD_EMBER_INTERFACE_FILES TRUE) + cmake_parse_arguments(ARG "SKIP_EMBER_INTERFACE" "SCOPE;ZAP_FILE;IDL" "EXTERNAL_CLUSTERS" ${ARGN}) if(ARG_SCOPE) set(SCOPE ${ARG_SCOPE}) endif() + if(ARG_SKIP_EMBER_INTERFACE) + set(ADD_EMBER_INTERFACE_FILES FALSE) + endif() + # CMAKE data model auto-includes the server side implementation target_sources(${APP_TARGET} ${SCOPE} ${CHIP_APP_BASE_DIR}/server/AclStorage.cpp @@ -159,7 +164,6 @@ function(chip_configure_data_model APP_TARGET) ${CHIP_APP_BASE_DIR}/util/attribute-table.cpp ${CHIP_APP_BASE_DIR}/util/binding-table.cpp ${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp - ${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp ${CHIP_APP_BASE_DIR}/util/ember-global-attribute-access-interface.cpp ${CHIP_APP_BASE_DIR}/util/ember-io-storage.cpp ${CHIP_APP_BASE_DIR}/util/generic-callback-stubs.cpp @@ -169,4 +173,10 @@ function(chip_configure_data_model APP_TARGET) ${APP_GEN_FILES} ${APP_TEMPLATES_GEN_FILES} ) + + if(ADD_EMBER_INTERFACE_FILES) + target_sources(${APP_TARGET} ${SCOPE} + ${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp + ) + endif() endfunction() diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 42b221c1a98836..cc998948d835e7 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -209,11 +209,15 @@ template("chip_data_model") { "${_app_root}/util/DataModelHandler.cpp", "${_app_root}/util/attribute-storage.cpp", "${_app_root}/util/attribute-table.cpp", - "${_app_root}/util/ember-compatibility-functions.cpp", "${_app_root}/util/ember-global-attribute-access-interface.cpp", "${_app_root}/util/ember-io-storage.cpp", "${_app_root}/util/util.cpp", ] + + if (chip_use_data_model_interface != "enabled") { + # This applies to "check" or "disabled" (i.e. use ember-only or use ember for double-checking) + sources += [ "${_app_root}/util/ember-compatibility-functions.cpp" ] + } } if (defined(invoker.zap_file)) { From 43e447c73a352296cf5c02417c2fdf900061e058 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Mon, 7 Oct 2024 18:03:14 -0700 Subject: [PATCH 21/39] [Fabric-Bridge] Replace ScheduleWork with ScheduleLambda (#35949) * [Fabric-Bridge] Replace ScheduleWork with ScheduleLambda * Restyled by whitespace * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../src/BridgedDevice.cpp | 109 ++++++------------ 1 file changed, 38 insertions(+), 71 deletions(-) diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp index 02bdfbdbcbf75f..7d588112997570 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp +++ b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp @@ -24,78 +24,31 @@ #include #include -namespace { - -struct ActiveChangeEventWorkData -{ - chip::EndpointId mEndpointId; - uint32_t mPromisedActiveDuration; -}; - -struct ReportAttributeChangedWorkData -{ - chip::EndpointId mEndpointId; - bool mWindowChanged = false; - bool mFabricIndexChanged = false; - bool mVendorChanged = false; -}; - -void ActiveChangeEventWork(intptr_t arg) -{ - ActiveChangeEventWorkData * data = reinterpret_cast(arg); - - chip::app::Clusters::BridgedDeviceBasicInformation::Events::ActiveChanged::Type event{}; - event.promisedActiveDuration = data->mPromisedActiveDuration; - chip::EventNumber eventNumber = 0; - - CHIP_ERROR err = chip::app::LogEvent(event, data->mEndpointId, eventNumber); - if (err != CHIP_NO_ERROR) - { - ChipLogProgress(NotSpecified, "LogEvent for ActiveChanged failed %s", err.AsString()); - } - chip::Platform::Delete(data); -} - -void ReportAttributeChangedWork(intptr_t arg) -{ - ReportAttributeChangedWorkData * data = reinterpret_cast(arg); - - if (data->mWindowChanged) - { - MatterReportingAttributeChangeCallback(data->mEndpointId, chip::app::Clusters::AdministratorCommissioning::Id, - chip::app::Clusters::AdministratorCommissioning::Attributes::WindowStatus::Id); - } - if (data->mFabricIndexChanged) - { - MatterReportingAttributeChangeCallback(data->mEndpointId, chip::app::Clusters::AdministratorCommissioning::Id, - chip::app::Clusters::AdministratorCommissioning::Attributes::AdminFabricIndex::Id); - } - if (data->mVendorChanged) - { - MatterReportingAttributeChangeCallback(data->mEndpointId, chip::app::Clusters::AdministratorCommissioning::Id, - chip::app::Clusters::AdministratorCommissioning::Attributes::AdminVendorId::Id); - } - chip::Platform::Delete(data); -} - -} // namespace - +using namespace chip; using namespace chip::app::Clusters::Actions; -BridgedDevice::BridgedDevice(chip::ScopedNodeId scopedNodeId) +BridgedDevice::BridgedDevice(ScopedNodeId scopedNodeId) { mReachable = false; mScopedNodeId = scopedNodeId; - mEndpointId = chip::kInvalidEndpointId; + mEndpointId = kInvalidEndpointId; } void BridgedDevice::LogActiveChangeEvent(uint32_t promisedActiveDurationMs) { - ActiveChangeEventWorkData * workdata = chip::Platform::New(); - workdata->mEndpointId = mEndpointId; - workdata->mPromisedActiveDuration = promisedActiveDurationMs; - - chip::DeviceLayer::PlatformMgr().ScheduleWork(ActiveChangeEventWork, reinterpret_cast(workdata)); + EndpointId endpointId = mEndpointId; + + DeviceLayer::SystemLayer().ScheduleLambda([endpointId, promisedActiveDurationMs]() { + app::Clusters::BridgedDeviceBasicInformation::Events::ActiveChanged::Type event{}; + event.promisedActiveDuration = promisedActiveDurationMs; + EventNumber eventNumber = 0; + + CHIP_ERROR err = app::LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "LogEvent for ActiveChanged failed %s", err.AsString()); + } + }); } void BridgedDevice::SetReachable(bool reachable) @@ -114,15 +67,29 @@ void BridgedDevice::SetReachable(bool reachable) void BridgedDevice::SetAdminCommissioningAttributes(const AdminCommissioningAttributes & aAdminCommissioningAttributes) { - ReportAttributeChangedWorkData * workdata = chip::Platform::New(); - - workdata->mEndpointId = mEndpointId; - workdata->mWindowChanged = + EndpointId endpointId = mEndpointId; + bool windowChanged = (aAdminCommissioningAttributes.commissioningWindowStatus != mAdminCommissioningAttributes.commissioningWindowStatus); - workdata->mFabricIndexChanged = - (aAdminCommissioningAttributes.openerFabricIndex != mAdminCommissioningAttributes.openerFabricIndex); - workdata->mVendorChanged = (aAdminCommissioningAttributes.openerVendorId != mAdminCommissioningAttributes.openerVendorId); + bool fabricIndexChanged = (aAdminCommissioningAttributes.openerFabricIndex != mAdminCommissioningAttributes.openerFabricIndex); + bool vendorChanged = (aAdminCommissioningAttributes.openerVendorId != mAdminCommissioningAttributes.openerVendorId); mAdminCommissioningAttributes = aAdminCommissioningAttributes; - chip::DeviceLayer::PlatformMgr().ScheduleWork(ReportAttributeChangedWork, reinterpret_cast(workdata)); + + DeviceLayer::SystemLayer().ScheduleLambda([endpointId, windowChanged, fabricIndexChanged, vendorChanged]() { + if (windowChanged) + { + MatterReportingAttributeChangeCallback(endpointId, app::Clusters::AdministratorCommissioning::Id, + app::Clusters::AdministratorCommissioning::Attributes::WindowStatus::Id); + } + if (fabricIndexChanged) + { + MatterReportingAttributeChangeCallback(endpointId, app::Clusters::AdministratorCommissioning::Id, + app::Clusters::AdministratorCommissioning::Attributes::AdminFabricIndex::Id); + } + if (vendorChanged) + { + MatterReportingAttributeChangeCallback(endpointId, app::Clusters::AdministratorCommissioning::Id, + app::Clusters::AdministratorCommissioning::Attributes::AdminVendorId::Id); + } + }); } From 9fc8386905947eb29b7e162c296330fd8454a317 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Mon, 7 Oct 2024 21:50:27 -0400 Subject: [PATCH 22/39] [ICD] Make optional spec checks mandatory with the launch of LongIdleTime ICDs (#35956) * Remove optional spec check * Add static_assert for the slow poll config for SIT ICDs * Add missing include * fix restyler error * fix spacing * Remove client build flag since it is not used --- config/esp32/components/chip/CMakeLists.txt | 3 --- config/esp32/components/chip/Kconfig | 9 +------ config/nrfconnect/chip-module/CMakeLists.txt | 1 - .../enabling_icd_on_ti_devices.md | 3 --- .../contact-sensor-app/nxp/k32w0/args.gni | 1 - .../contact-sensor-app/nxp/k32w1/args.gni | 1 - .../contact-sensor-app/nxp/mcxw71/args.gni | 1 - .../silabs/build_for_wifi_args.gni | 1 - examples/lit-icd-app/silabs/openthread.gni | 1 - examples/lock-app/nxp/k32w1/args.gni | 1 - examples/lock-app/nxp/mcxw71/args.gni | 1 - .../silabs/build_for_wifi_args.gni | 1 - .../smoke-co-alarm-app/silabs/openthread.gni | 1 - src/app/icd/icd.gni | 8 ------ src/app/icd/server/BUILD.gn | 1 - src/app/icd/server/ICDConfigurationData.cpp | 8 +++--- src/app/icd/server/ICDConfigurationData.h | 26 +++++++++++-------- src/app/icd/server/ICDManager.cpp | 3 --- 18 files changed, 20 insertions(+), 51 deletions(-) diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index f7685cf760a7a3..fde62765dda808 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -143,9 +143,6 @@ endif() if(CONFIG_ENABLE_ICD_SERVER) chip_gn_arg_append("chip_enable_icd_server" "true") - if(CONFIG_ICD_ENFORCE_SIT_SLOW_POLL_LIMIT) - chip_gn_arg_append("icd_enforce_sit_slow_poll_limit" "true") - endif() if(CONFIG_ICD_REPORT_ON_ACTIVE_MODE) chip_gn_arg_append("chip_icd_report_on_active_mode" "true") endif() diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index 5c36284f072cd4..c61ac770a608ff 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -32,7 +32,7 @@ menu "CHIP Core" default 8 help The maximum number of simultaneously active CHIP exchange contexts. - + An exchange context object is used to track the state of an ongoing CHIP message exchange (conversation) with a peer, e.g. a cloud service, a mobile application, or another device. @@ -410,13 +410,6 @@ menu "CHIP Device Layer" help Enables or Disables ICD server - config ICD_ENFORCE_SIT_SLOW_POLL_LIMIT - bool "Enforce SIT Slow Polling Max value to 15 seconds" - depends on ENABLE_ICD_SERVER - default n - help - Set to true to enforce SIT Slow Polling Max value to 15seconds - config ICD_REPORT_ON_ACTIVE_MODE bool "Emit a report on entering active mode" depends on ENABLE_ICD_SERVER diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 3896ed6be7d9ad..b3180fdc1b391f 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -156,7 +156,6 @@ if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_dsls" CONFIG_CHIP_ICD_DSLS_SUPPORT) - matter_add_gn_arg_bool ("icd_enforce_sit_slow_poll_limit" TRUE) endif() if (CONFIG_CHIP_FACTORY_DATA OR CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND) diff --git a/docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md b/docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md index 50495a601e3fad..b024b90b40dd86 100644 --- a/docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md +++ b/docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md @@ -24,9 +24,6 @@ Trigger Support, set the following parameter to true: chip_enable_icd_lit = true ``` -TI examples have only been tested with the ICD Server configuration. To enable -the client configuration, set `chip_enable_icd_client` to true. - Persistent subscriptions allow devices to attempt resuming existing subscriptions following a device reset. To enable persistent subscriptions, set the following parameter to true: diff --git a/examples/contact-sensor-app/nxp/k32w0/args.gni b/examples/contact-sensor-app/nxp/k32w0/args.gni index 1709f1da735d5d..f4b68ae740c40c 100644 --- a/examples/contact-sensor-app/nxp/k32w0/args.gni +++ b/examples/contact-sensor-app/nxp/k32w0/args.gni @@ -28,7 +28,6 @@ chip_generate_link_map_file = true chip_enable_icd_server = true chip_enable_icd_lit = false -icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/contact-sensor-app/nxp/k32w1/args.gni b/examples/contact-sensor-app/nxp/k32w1/args.gni index 98372f4b8261e4..e5654bdbc707c6 100644 --- a/examples/contact-sensor-app/nxp/k32w1/args.gni +++ b/examples/contact-sensor-app/nxp/k32w1/args.gni @@ -32,7 +32,6 @@ chip_with_lwip = false chip_enable_icd_server = true chip_enable_icd_lit = false chip_enable_icd_dsls = false -icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/contact-sensor-app/nxp/mcxw71/args.gni b/examples/contact-sensor-app/nxp/mcxw71/args.gni index 72634a2308d04b..6e6015933d6cf2 100644 --- a/examples/contact-sensor-app/nxp/mcxw71/args.gni +++ b/examples/contact-sensor-app/nxp/mcxw71/args.gni @@ -30,7 +30,6 @@ chip_with_lwip = false chip_enable_icd_server = true chip_enable_icd_lit = false -icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/lit-icd-app/silabs/build_for_wifi_args.gni b/examples/lit-icd-app/silabs/build_for_wifi_args.gni index 56cd70b217e81e..6ef009e9064d75 100644 --- a/examples/lit-icd-app/silabs/build_for_wifi_args.gni +++ b/examples/lit-icd-app/silabs/build_for_wifi_args.gni @@ -29,7 +29,6 @@ sl_enable_test_event_trigger = true chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true -icd_enforce_sit_slow_poll_limit = true chip_enable_icd_lit = true # ICD Matter Configuration flags diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index b12529c2cab39a..e84e7be8ed1292 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -32,7 +32,6 @@ sl_enable_test_event_trigger = true chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true -icd_enforce_sit_slow_poll_limit = true chip_icd_report_on_active_mode = true chip_enable_icd_lit = true diff --git a/examples/lock-app/nxp/k32w1/args.gni b/examples/lock-app/nxp/k32w1/args.gni index e0c41d1e34f870..b7a2d790efb3e2 100644 --- a/examples/lock-app/nxp/k32w1/args.gni +++ b/examples/lock-app/nxp/k32w1/args.gni @@ -30,7 +30,6 @@ chip_with_lwip = false chip_enable_icd_server = true chip_enable_icd_lit = false -icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/lock-app/nxp/mcxw71/args.gni b/examples/lock-app/nxp/mcxw71/args.gni index 761b050b80cbec..1a0940c96aabdb 100644 --- a/examples/lock-app/nxp/mcxw71/args.gni +++ b/examples/lock-app/nxp/mcxw71/args.gni @@ -30,7 +30,6 @@ chip_with_lwip = false chip_enable_icd_server = true chip_enable_icd_lit = false -icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni b/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni index 0619082413530d..e5097f8a1d82b7 100644 --- a/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni +++ b/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni @@ -28,7 +28,6 @@ sl_enable_test_event_trigger = true chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true -icd_enforce_sit_slow_poll_limit = true chip_enable_icd_lit = true # ICD Matter Configuration flags diff --git a/examples/smoke-co-alarm-app/silabs/openthread.gni b/examples/smoke-co-alarm-app/silabs/openthread.gni index 845b2220b4570a..f2a7ab6ed78434 100644 --- a/examples/smoke-co-alarm-app/silabs/openthread.gni +++ b/examples/smoke-co-alarm-app/silabs/openthread.gni @@ -32,7 +32,6 @@ sl_enable_test_event_trigger = true chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true -icd_enforce_sit_slow_poll_limit = true chip_icd_report_on_active_mode = true chip_enable_icd_lit = true diff --git a/src/app/icd/icd.gni b/src/app/icd/icd.gni index ed3fd0518f5858..b7fef896f53b3c 100644 --- a/src/app/icd/icd.gni +++ b/src/app/icd/icd.gni @@ -14,23 +14,15 @@ declare_args() { # Matter SDK Configuration flag to enable ICD server functionality - # TODO - Add Specifics when the design is refined chip_enable_icd_server = false chip_enable_icd_lit = false - # Matter SDK Configuration flag to enable ICD client functionality - # TODO - Add Specifics when the design is refined - chip_enable_icd_client = false - # Matter SDK Configuration flag to make the ICD manager emit a report on entering active mode chip_icd_report_on_active_mode = false icd_max_notification_subscribers = 1 - # Set to true to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) - icd_enforce_sit_slow_poll_limit = false - # Set to true if device supports dynamic switching from SIT to LIT operating modes (DSLS) chip_enable_icd_dsls = false } diff --git a/src/app/icd/server/BUILD.gn b/src/app/icd/server/BUILD.gn index e1967c23f52f90..bef9a0730abdc7 100644 --- a/src/app/icd/server/BUILD.gn +++ b/src/app/icd/server/BUILD.gn @@ -39,7 +39,6 @@ buildconfig_header("icd-server-buildconfig") { "CHIP_CONFIG_ENABLE_ICD_DSLS=${chip_enable_icd_dsls}", "ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_icd_report_on_active_mode}", "ICD_MAX_NOTIFICATION_SUBSCRIBERS=${icd_max_notification_subscribers}", - "ICD_ENFORCE_SIT_SLOW_POLL_LIMIT=${icd_enforce_sit_slow_poll_limit}", ] visibility = [ ":icd-server-config" ] diff --git a/src/app/icd/server/ICDConfigurationData.cpp b/src/app/icd/server/ICDConfigurationData.cpp index cfd2325671ea0f..44d78bfadf4e2f 100644 --- a/src/app/icd/server/ICDConfigurationData.cpp +++ b/src/app/icd/server/ICDConfigurationData.cpp @@ -16,7 +16,6 @@ */ #include "ICDConfigurationData.h" -#include #include namespace chip { @@ -25,15 +24,16 @@ ICDConfigurationData ICDConfigurationData::instance; System::Clock::Milliseconds32 ICDConfigurationData::GetSlowPollingInterval() { -#if ICD_ENFORCE_SIT_SLOW_POLL_LIMIT - // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. +#if CHIP_CONFIG_ENABLE_ICD_LIT + // When in SIT mode, the slow poll interval SHALL NOT be greater than the SIT mode polling threshold, per spec. // This is important for ICD device configured for LIT operation but currently operating as a SIT // due to a lack of client registration if (mICDMode == ICDMode::SIT && mSlowPollingInterval > kSITPollingThreshold) { return kSITPollingThreshold; } -#endif +#endif // CHIP_CONFIG_ENABLE_ICD_LIT + return mSlowPollingInterval; } diff --git a/src/app/icd/server/ICDConfigurationData.h b/src/app/icd/server/ICDConfigurationData.h index 0d6e17e55efca2..4d2597ef260355 100644 --- a/src/app/icd/server/ICDConfigurationData.h +++ b/src/app/icd/server/ICDConfigurationData.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include @@ -77,14 +78,11 @@ class ICDConfigurationData System::Clock::Seconds32 GetMaximumCheckInBackoff() { return mMaximumCheckInBackOff; } /** - * If ICD_ENFORCE_SIT_SLOW_POLL_LIMIT is set to 0, function will always return the configured Slow Polling interval - * (CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL). - * - * If ICD_ENFORCE_SIT_SLOW_POLL_LIMIT is set to 1, the returned value will depend on the devices operating mode. + * The returned value will depend on the devices operating mode. * If ICDMode == SIT && the configured slow poll interval is superior to the maximum threshold (15s), the function will return - * the threshold (15s). If ICDMode == SIT but the configured slow poll interval is equal or inferior to the threshold, the - * function will the return the configured slow poll interval. If ICDMode == LIT, the function will return the configured slow - * poll interval. + * the threshold kSITPollingThreshold (<= 15s). If ICDMode == SIT but the configured slow poll interval is equal or inferior to + * the threshold, the function will the return the configured slow poll interval. If ICDMode == LIT, the function will return + * the configured slow poll interval. * * @return System::Clock::Milliseconds32 */ @@ -158,12 +156,18 @@ class ICDConfigurationData "Spec requires the MaximumCheckInBackOff to be equal or superior to the IdleModeDuration"); System::Clock::Seconds32 mMaximumCheckInBackOff = System::Clock::Seconds32(CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF_SEC); - // SIT ICDs should have a SlowPollingThreshold shorter than or equal to 15s (spec 9.16.1.5) - static_assert((CHIP_DEVICE_CONFIG_ICD_SIT_SLOW_POLL_LIMIT).count() <= 15000, + // SIT ICDs SHALL have a SlowPollingThreshold shorter than or equal to 15s (spec 9.16.1.5) + static constexpr System::Clock::Milliseconds32 kSitIcdSlowPollMaximum = System::Clock::Milliseconds32(15000); + static_assert((CHIP_DEVICE_CONFIG_ICD_SIT_SLOW_POLL_LIMIT).count() <= kSitIcdSlowPollMaximum.count(), "Spec requires the maximum slow poll interval for the SIT device to be smaller or equal than 15 s."); static constexpr System::Clock::Milliseconds32 kSITPollingThreshold = CHIP_DEVICE_CONFIG_ICD_SIT_SLOW_POLL_LIMIT; - System::Clock::Milliseconds32 mSlowPollingInterval = CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL; - System::Clock::Milliseconds32 mFastPollingInterval = CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL; + +#if CHIP_CONFIG_ENABLE_ICD_LIT == 0 + static_assert((CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL <= kSitIcdSlowPollMaximum), + "LIT support is required for slow polling intervals superior to 15 seconds"); +#endif + System::Clock::Milliseconds32 mSlowPollingInterval = CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL; + System::Clock::Milliseconds32 mFastPollingInterval = CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL; ICDMode mICDMode = ICDMode::SIT; }; diff --git a/src/app/icd/server/ICDManager.cpp b/src/app/icd/server/ICDManager.cpp index 3e89af1e1613a5..ba349b22b972a5 100644 --- a/src/app/icd/server/ICDManager.cpp +++ b/src/app/icd/server/ICDManager.cpp @@ -80,9 +80,6 @@ void ICDManager::Init() VerifyOrDieWithMsg(ICDConfigurationData::GetInstance().GetMinLitActiveModeThreshold() <= ICDConfigurationData::GetInstance().GetActiveModeThreshold(), AppServer, "The minimum ActiveModeThreshold value for a LIT ICD is 5 seconds."); - // Disabling check until LIT support is compelte - // VerifyOrDieWithMsg((GetSlowPollingInterval() <= GetSITPollingThreshold()) , AppServer, - // "LIT support is required for slow polling intervals superior to 15 seconds"); } #endif // CHIP_CONFIG_ENABLE_ICD_LIT From 9a148aba0fc2e25dd429fc209c3f6b73f0662f04 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Mon, 7 Oct 2024 19:15:38 -0700 Subject: [PATCH 23/39] [java]fix errorcode in GetConnectedDeviceCallbackForTestJni (#35958) --- src/controller/java/AndroidCallbacks-ForTestJNI.cpp | 2 +- .../GetConnectedDeviceCallbackForTestJni.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controller/java/AndroidCallbacks-ForTestJNI.cpp b/src/controller/java/AndroidCallbacks-ForTestJNI.cpp index 568e0ee8474c9a..1657aef819183c 100644 --- a/src/controller/java/AndroidCallbacks-ForTestJNI.cpp +++ b/src/controller/java/AndroidCallbacks-ForTestJNI.cpp @@ -43,7 +43,7 @@ JNI_METHOD(void, GetConnectedDeviceCallbackForTestJni, onDeviceConnected) } JNI_METHOD(void, GetConnectedDeviceCallbackForTestJni, onDeviceConnectionFailure) -(JNIEnv * env, jobject self, jlong callbackHandle, jint errorCode) +(JNIEnv * env, jobject self, jlong callbackHandle, jlong errorCode) { GetConnectedDeviceCallback * connectedDeviceCallback = reinterpret_cast(callbackHandle); VerifyOrReturn(connectedDeviceCallback != nullptr, ChipLogError(Controller, "GetConnectedDeviceCallbackJni handle is nullptr")); diff --git a/src/controller/java/src/chip/devicecontroller/GetConnectedDeviceCallbackForTestJni.java b/src/controller/java/src/chip/devicecontroller/GetConnectedDeviceCallbackForTestJni.java index a3321af6d30bbf..bd1343387aa45c 100644 --- a/src/controller/java/src/chip/devicecontroller/GetConnectedDeviceCallbackForTestJni.java +++ b/src/controller/java/src/chip/devicecontroller/GetConnectedDeviceCallbackForTestJni.java @@ -37,9 +37,9 @@ public void onDeviceConnected(GetConnectedDeviceCallbackJni callback) { private native void onDeviceConnected(long callbackHandle, long messagingContextHandle); - public void onDeviceConnectionFailure(GetConnectedDeviceCallbackJni callback, int errorCode) { + public void onDeviceConnectionFailure(GetConnectedDeviceCallbackJni callback, long errorCode) { onDeviceConnectionFailure(callback.getCallbackHandle(), errorCode); } - private native void onDeviceConnectionFailure(long callbackHandle, int errorCode); + private native void onDeviceConnectionFailure(long callbackHandle, long errorCode); } From cec1887241c19d3ab6cd8e23ad8e1c283fcb2723 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Mon, 7 Oct 2024 19:58:22 -0700 Subject: [PATCH 24/39] Fix android batch command test (#35954) --- .../pairing/PairOnNetworkLongImExtendableInvokeCommand.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt index 0b1a2ab7467f5c..be1af1d62c0818 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImExtendableInvokeCommand.kt @@ -75,6 +75,7 @@ class PairOnNetworkLongImExtendableInvokeCommand( ) { setFailure("invoke failure with incorrect status") } + responseCount++ } if (clusterId == CLUSTER_ID_TEST && commandId == TEST_ADD_ARGUMENT_RSP_COMMAND) { @@ -89,8 +90,8 @@ class PairOnNetworkLongImExtendableInvokeCommand( if (status != null) { setFailure("invoke failure with incorrect status") } + responseCount++ } - responseCount++ } override fun onNoResponse(noInvokeResponseData: NoInvokeResponseData) { @@ -126,7 +127,7 @@ class PairOnNetworkLongImExtendableInvokeCommand( val element1: InvokeElement = InvokeElement.newInstance( - /* endpointId= */ 0, + /* endpointId= */ 1, CLUSTER_ID_IDENTIFY, IDENTIFY_COMMAND, tlvWriter1.getEncoded(), From 6ced85218f29e52d6671787a3ba1966d4470bf9f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 8 Oct 2024 00:30:53 -0400 Subject: [PATCH 25/39] Make function argument a reference, to avoid passing in struct data around (#35950) * Make function argument a reference, to avoid passing in struct data around * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../codegen-data-model-provider/CodegenDataModelProvider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp b/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp index 972e0565131dd6..7f7b7e14b8b752 100644 --- a/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp +++ b/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp @@ -318,7 +318,7 @@ bool operator==(const DataModel::DeviceTypeEntry & a, const EmberAfDeviceType & /// - index == types.size() // i.e. not found or there is no next /// /// hintWherePreviousMayBe represents a search hint where previous may exist. -unsigned FindNextDeviceTypeIndex(Span types, const DataModel::DeviceTypeEntry previous, +unsigned FindNextDeviceTypeIndex(Span types, const DataModel::DeviceTypeEntry & previous, unsigned hintWherePreviousMayBe) { if (hintWherePreviousMayBe < types.size()) From 9ccc52e00227070fddbb8485abe4767c7b324f01 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 8 Oct 2024 00:45:10 -0400 Subject: [PATCH 26/39] Remove a test-only method from base MTRDeviceController. (#35944) This is only used with concrete controllers from tests, and is already implemented by MTRDeviceController_Concrete. Also removes a test-only class method from MTRDeviceController_Concrete that MTRDeviceController already implements (and has to keep implementing, since the tests use it on MTRDeviceController itself, not an instance). --- src/darwin/Framework/CHIP/MTRDeviceController.mm | 12 ------------ .../Framework/CHIP/MTRDeviceController_Concrete.mm | 9 --------- 2 files changed, 21 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 0bfe6f45f4b256..fb13db9b006bc1 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -441,18 +441,6 @@ - (void)removeDevice:(MTRDevice *)device } } -#ifdef DEBUG -- (NSDictionary *)unitTestGetDeviceAttributeCounts -{ - std::lock_guard lock(*self.deviceMapLock); - NSMutableDictionary * deviceAttributeCounts = [NSMutableDictionary dictionary]; - for (NSNumber * nodeID in _nodeIDToDeviceMap) { - deviceAttributeCounts[nodeID] = @([[_nodeIDToDeviceMap objectForKey:nodeID] unitTestAttributeCount]); - } - return deviceAttributeCounts; -} -#endif - - (BOOL)setOperationalCertificateIssuer:(nullable id)operationalCertificateIssuer queue:(nullable dispatch_queue_t)queue { diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm index cae4103d0f2ffd..47c373ac884188 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm @@ -1679,15 +1679,6 @@ - (nullable NSNumber *)neededReadPrivilegeForClusterID:(NSNumber *)clusterID att return nil; } -#ifdef DEBUG -+ (void)forceLocalhostAdvertisingOnly -{ - auto interfaceIndex = chip::Inet::InterfaceId::PlatformType(kDNSServiceInterfaceIndexLocalOnly); - auto interfaceId = chip::Inet::InterfaceId(interfaceIndex); - chip::app::DnssdServer::Instance().SetInterfaceId(interfaceId); -} -#endif // DEBUG - @end /** From 0d78b5f037e580a670b7327ad463654e8df92601 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 8 Oct 2024 02:45:48 -0400 Subject: [PATCH 27/39] Fix attribute-table logs to not log strings as %p. (#35941) Fixes https://github.com/project-chip/connectedhomeip/issues/35928 --- src/app/util/attribute-table.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 0d68701b6389b4..40e690b1defb12 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -342,8 +342,8 @@ Status emAfWriteAttribute(const ConcreteAttributePath & path, const EmberAfWrite // if we dont support that attribute if (metadata == nullptr) { - ChipLogProgress(Zcl, "%p ep %x clus " ChipLogFormatMEI " attr " ChipLogFormatMEI " not supported", - "WRITE ERR: ", path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); + ChipLogProgress(Zcl, "WRITE ERR: ep %x clus " ChipLogFormatMEI " attr " ChipLogFormatMEI " not supported", path.mEndpointId, + ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); return status; } @@ -352,13 +352,13 @@ Status emAfWriteAttribute(const ConcreteAttributePath & path, const EmberAfWrite { if (input.dataType != metadata->attributeType) { - ChipLogProgress(Zcl, "%p invalid data type", "WRITE ERR: "); + ChipLogProgress(Zcl, "WRITE ERR: invalid data type"); return Status::InvalidDataType; } if (metadata->IsReadOnly()) { - ChipLogProgress(Zcl, "%p attr not writable", "WRITE ERR: "); + ChipLogProgress(Zcl, "WRITE ERR: attr not writable"); return Status::UnsupportedWrite; } } From 4c4970a48f79575487928e927e123df722712f37 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 8 Oct 2024 02:47:38 -0400 Subject: [PATCH 28/39] Documentation: getting started - changing examples (#35929) * Documentation: getting started - changing examples Add a new documentation file that shows how to change, re-gen and recompile examples. * Add to index * Fix spelling --- docs/getting_started/changing_examples.md | 64 +++++++++++++++++++++++ docs/getting_started/index.md | 5 +- 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 docs/getting_started/changing_examples.md diff --git a/docs/getting_started/changing_examples.md b/docs/getting_started/changing_examples.md new file mode 100644 index 00000000000000..611610ce43fb59 --- /dev/null +++ b/docs/getting_started/changing_examples.md @@ -0,0 +1,64 @@ +# Changing Examples + +The composition of most examples in the SDK is static and code generated. + +The tool used to describe and change the composition of an example is called +ZAP. More information about ZAP and a walk-through of the tool can be found in +the [ZAP introduction](./zap.md). The composition of the device is captured in a +.zap file, which is readable by the ZAP tool. This is then compiled into a +human-readable .matter file, which is used to build the static features of the +example. + +To change the composition of a device example, you need to + +1. Change the zap file to implement your desired changes +2. Run the code generation tool to generate the .matter file +3. Re-build the example + +## Changing the zap file in an example + +Most examples in the SDK keep the .zap file in a sub-directory called +example-name-common (ex. lighting-common). To load an existing .zap file into +the ZAP tool, from the chip-root use + +``` +./scripts/tools/zap/run_zaptool.sh +``` + +For example, to make changes to the lighting app, use: + +``` +./scripts/tools/zap/run_zaptool.sh examples/lighting-app/lighting-common/lighting-app.zap +``` + +This will open the ZAP GUI tool, which can be used to change the endpoint +composition, clusters, features, attributes, commands and events exposed by the +device. + +Details of how to use the tool can be found in the [ZAP Introduction](./zap.md). + +## Running code generation + +To compile the .matter file for use in building, use: + +``` +./scripts/tools/zap/generate.py +``` + +For example, for changes to the lighting app, use: + +``` +./scripts/tools/zap/generate.py examples/lighting-app/lighting-common/lighting-app.zap +``` + +If there are changes to many .zap files, the following script can be used to +recompile the .zap files for all the examples and the controller. + +``` + ./scripts/tools/zap_regen_all.py +``` + +## Rebuilding the example + +After generating the .matter file, re-build the example. Instructions for +building examples are given in [Building your first example](./first_example.md) diff --git a/docs/getting_started/index.md b/docs/getting_started/index.md index ea881141ff43ec..098f047ed75393 100644 --- a/docs/getting_started/index.md +++ b/docs/getting_started/index.md @@ -12,5 +12,6 @@ The following docs are a brief introduction to SDK development. ``` - [Running your first example](./first_example.md) -- [SDK Basics](./SDKBasics.md) -- [ZAP](./zap.md) +- [Changing examples](./changing_examples.md) +- [SDK Architecture Introduction](./SDKBasics.md) +- [ZAP Introduction](./zap.md) From 1dadbe433c3587a7a55800f03b88e7f00310000a Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Tue, 8 Oct 2024 05:15:32 -0400 Subject: [PATCH 29/39] Add missing feature map bit (#35915) (#35961) * Add missing feature map bit * Generation From 9b34d55917bf345c28e88f6a01395a8ae8b8956d Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Tue, 8 Oct 2024 15:18:59 +0200 Subject: [PATCH 30/39] Fix --int-arg, --bool-arg, etc options parsing (#35249) * Fix --int-arg, --bool-arg, etc options parsing * Update CI arguments * Convert to YAML * Support mixed arguments type: multi and append * Restyled by isort --------- Co-authored-by: Restyled.io --- src/python_testing/TC_ACE_1_4.py | 14 +++++----- src/python_testing/TC_EWATERHTR_2_1.py | 27 ++++++++++++++----- src/python_testing/TC_RVCCLEANM_2_1.py | 25 ++++++++++++----- src/python_testing/TC_RVCRUNM_2_1.py | 25 ++++++++++++----- src/python_testing/TC_RVCRUNM_2_2.py | 25 ++++++++++++----- .../TestMatterTestingSupport.py | 20 +++++++++++++- src/python_testing/matter_testing_support.py | 15 ++++++----- 7 files changed, 110 insertions(+), 41 deletions(-) diff --git a/src/python_testing/TC_ACE_1_4.py b/src/python_testing/TC_ACE_1_4.py index 9344b0bd3e9876..4d6e00ec1c2898 100644 --- a/src/python_testing/TC_ACE_1_4.py +++ b/src/python_testing/TC_ACE_1_4.py @@ -22,18 +22,20 @@ # test-runner-runs: # run1: # app: ${ALL_CLUSTERS_APP} -# factoryreset: true -# quiet: true # app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # script-args: > # --storage-path admin_storage.json # --commissioning-method on-network # --discriminator 1234 # --passcode 20202021 -# --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 -# --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff +# --int-arg PIXIT.ACE.APPENDPOINT:1 +# --int-arg PIXIT.ACE.APPDEVTYPEID:0x0100 +# --string-arg PIXIT.ACE.APPCLUSTER:OnOff +# --string-arg PIXIT.ACE.APPATTRIBUTE:OnOff # --trace-to json:${TRACE_TEST_JSON}.json # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factoryreset: true +# quiet: true # === END CI TEST ARGUMENTS === import sys @@ -45,8 +47,8 @@ # This test requires several additional command line arguments # run with -# --int-arg PIXIT.ACE.ENDPOINT: PIXIT.ACE.APPDEVTYPE: -# --string-arg PIXIT.ACE.APPCLUSTER: PIXIT.ACE.APPATTRIBUTE: +# --int-arg PIXIT.ACE.ENDPOINT: --int-arg PIXIT.ACE.APPDEVTYPE: +# --string-arg PIXIT.ACE.APPCLUSTER: --string-arg PIXIT.ACE.APPATTRIBUTE: def str_to_cluster(str): diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index e9ae195f98566c..8ee466a547bfc0 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -19,12 +19,27 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 --application water-heater -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# test-runner-runs: +# run1: +# app: ${ENERGY_MANAGEMENT_APP} +# app-args: > +# --discriminator 1234 +# --KVS kvs1 +# --trace-to json:${TRACE_APP}.json +# --enable-key 000102030405060708090a0b0c0d0e0f +# --featureSet 0x03 +# --application water-heater +# script-args: > +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --hex-arg enableKey:000102030405060708090a0b0c0d0e0f +# --endpoint 1 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factoryreset: true +# quiet: true # === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_RVCCLEANM_2_1.py b/src/python_testing/TC_RVCCLEANM_2_1.py index 8e5013ad4c2dbd..c9b8362eb227fd 100644 --- a/src/python_testing/TC_RVCCLEANM_2_1.py +++ b/src/python_testing/TC_RVCCLEANM_2_1.py @@ -19,12 +19,23 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${CHIP_RVC_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2 +# test-runner-runs: +# run1: +# app: ${CHIP_RVC_APP} +# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# script-args: > +# --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 +# --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_OK:2 +# --endpoint 1 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factoryreset: true +# quiet: true # === END CI TEST ARGUMENTS === import logging @@ -35,7 +46,7 @@ # This test requires several additional command line arguments # run with -# --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_OK: PIXIT.RVCCLEANM.MODE_CHANGE_FAIL: +# --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_OK: --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL: class TC_RVCCLEANM_2_1(MatterBaseTest): diff --git a/src/python_testing/TC_RVCRUNM_2_1.py b/src/python_testing/TC_RVCRUNM_2_1.py index 2693cb041a16b9..d3da69a6faf9a3 100644 --- a/src/python_testing/TC_RVCRUNM_2_1.py +++ b/src/python_testing/TC_RVCRUNM_2_1.py @@ -19,12 +19,23 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${CHIP_RVC_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2 +# test-runner-runs: +# run1: +# app: ${CHIP_RVC_APP} +# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# script-args: > +# --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --endpoint 1 +# --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 +# --int-arg PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factoryreset: true +# quiet: true # === END CI TEST ARGUMENTS === import logging @@ -35,7 +46,7 @@ # This test requires several additional command line arguments # run with -# --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK: PIXIT.RVCRUNM.MODE_CHANGE_FAIL: +# --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK: --int-arg PIXIT.RVCRUNM.MODE_CHANGE_FAIL: # For running in CI, it is expected that OK=0 and FAIL=2 diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index 3a2ce23ea2ef20..0eefcc20a92a6a 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -19,12 +19,23 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${CHIP_RVC_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2 +# test-runner-runs: +# run1: +# app: ${CHIP_RVC_APP} +# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# script-args: > +# --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --endpoint 1 +# --int-arg PIXIT.RVCRUNM.MODE_A:1 +# --int-arg PIXIT.RVCRUNM.MODE_B:2 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factoryreset: true +# quiet: true # === END CI TEST ARGUMENTS === import enum @@ -35,7 +46,7 @@ # This test requires several additional command line arguments. # Run the test with -# --int-arg PIXIT.RVCRUNM.MODE_A: PIXIT.RVCRUNM.MODE_B: +# --int-arg PIXIT.RVCRUNM.MODE_A: --int-arg PIXIT.RVCRUNM.MODE_B: class RvcStatusEnum(enum.IntEnum): diff --git a/src/python_testing/TestMatterTestingSupport.py b/src/python_testing/TestMatterTestingSupport.py index d2a259f154adc6..08c3e830d21271 100644 --- a/src/python_testing/TestMatterTestingSupport.py +++ b/src/python_testing/TestMatterTestingSupport.py @@ -24,7 +24,7 @@ from chip.clusters.Types import Nullable, NullValue from chip.tlv import uint from matter_testing_support import (MatterBaseTest, async_test_body, compare_time, default_matter_test_main, - get_wait_seconds_from_set_time, type_matches, utc_time_in_matter_epoch) + get_wait_seconds_from_set_time, parse_matter_test_args, type_matches, utc_time_in_matter_epoch) from mobly import asserts, signals from pics_support import parse_pics, parse_pics_xml from taglist_and_topology_test_support import (TagProblem, create_device_type_list_for_root, create_device_type_lists, @@ -629,6 +629,24 @@ def test_xml_pics(self): self.pics_assert('BINFO.S.A0014', False) self.pics_assert('PICSDOESNOTEXIST', False) + def test_parse_matter_test_args(self): + args = [ + # Verify that values are appended to a single argument + "--int-arg", "PIXIT.TEST.DEC:42", + "--int-arg", "PIXIT.TEST.HEX:0x1234", + # Verify that multiple values can be passed for a single argument + "--string-arg", "PIXIT.TEST.STR.MULTI.1:foo", "PIXIT.TEST.STR.MULTI.2:bar", + # Verify JSON parsing + "--json-arg", "PIXIT.TEST.JSON:{\"key\":\"value\"}", + ] + + parsed = parse_matter_test_args(args) + asserts.assert_equal(parsed.global_test_params.get("PIXIT.TEST.DEC"), 42) + asserts.assert_equal(parsed.global_test_params.get("PIXIT.TEST.HEX"), 0x1234) + asserts.assert_equal(parsed.global_test_params.get("PIXIT.TEST.STR.MULTI.1"), "foo") + asserts.assert_equal(parsed.global_test_params.get("PIXIT.TEST.STR.MULTI.2"), "bar") + asserts.assert_equal(parsed.global_test_params.get("PIXIT.TEST.JSON"), {"key": "value"}) + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 92cde9edb6011d..2e153a37dec551 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -38,6 +38,7 @@ from datetime import datetime, timedelta, timezone from enum import Enum, IntFlag from functools import partial +from itertools import chain from typing import Any, Iterable, List, Optional, Tuple from chip.tlv import float32, uint @@ -1842,7 +1843,7 @@ def convert_args_to_matter_config(args: argparse.Namespace) -> MatterTestConfig: all_global_args = [] argsets = [item for item in (args.int_arg, args.float_arg, args.string_arg, args.json_arg, args.hex_arg, args.bool_arg) if item is not None] - for argset in argsets: + for argset in chain.from_iterable(argsets): all_global_args.extend(argset) config.global_test_params = {} @@ -1954,17 +1955,17 @@ def parse_matter_test_args(argv: Optional[List[str]] = None) -> MatterTestConfig help='Path to chip-tool credentials file root') args_group = parser.add_argument_group(title="Config arguments", description="Test configuration global arguments set") - args_group.add_argument('--int-arg', nargs='*', type=int_named_arg, metavar="NAME:VALUE", + args_group.add_argument('--int-arg', nargs='*', action='append', type=int_named_arg, metavar="NAME:VALUE", help="Add a named test argument for an integer as hex or decimal (e.g. -2 or 0xFFFF_1234)") - args_group.add_argument('--bool-arg', nargs='*', type=bool_named_arg, metavar="NAME:VALUE", + args_group.add_argument('--bool-arg', nargs='*', action='append', type=bool_named_arg, metavar="NAME:VALUE", help="Add a named test argument for an boolean value (e.g. true/false or 0/1)") - args_group.add_argument('--float-arg', nargs='*', type=float_named_arg, metavar="NAME:VALUE", + args_group.add_argument('--float-arg', nargs='*', action='append', type=float_named_arg, metavar="NAME:VALUE", help="Add a named test argument for a floating point value (e.g. -2.1 or 6.022e23)") - args_group.add_argument('--string-arg', nargs='*', type=str_named_arg, metavar="NAME:VALUE", + args_group.add_argument('--string-arg', nargs='*', action='append', type=str_named_arg, metavar="NAME:VALUE", help="Add a named test argument for a string value") - args_group.add_argument('--json-arg', nargs='*', type=json_named_arg, metavar="NAME:VALUE", + args_group.add_argument('--json-arg', nargs='*', action='append', type=json_named_arg, metavar="NAME:VALUE", help="Add a named test argument for JSON stored as a list or dict") - args_group.add_argument('--hex-arg', nargs='*', type=bytes_as_hex_named_arg, metavar="NAME:VALUE", + args_group.add_argument('--hex-arg', nargs='*', action='append', type=bytes_as_hex_named_arg, metavar="NAME:VALUE", help="Add a named test argument for an octet string in hex (e.g. 0011cafe or 00:11:CA:FE)") if not argv: From 6034c87bd1145f267d53565f5593e4234e405908 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Tue, 8 Oct 2024 15:32:33 +0200 Subject: [PATCH 31/39] Add TC_BRBINFO_4_1 to CI (#35940) * Use async sleep instead of blocking one * Keep AppServer wrapper class in chip.testing.tasks * Fix typos * Arguments for CI workflow * Require dut_fsa_stdin_pipe options in CI run * Start ICD server on CI run * Read all attributes defined in test plan * Wrap ICD server with IcdAppServerSubprocess * Move app testing wrappers to chip.testing.apps * Add TODO for fixing imports in unit test * Restyled by isort * Remove test from exception list --------- Co-authored-by: Restyled.io --- src/python_testing/TC_BRBINFO_4_1.py | 218 ++++++++++-------- src/python_testing/TC_CCTRL_2_2.py | 8 +- src/python_testing/TC_CCTRL_2_3.py | 8 +- src/python_testing/TC_ECOINFO_2_1.py | 8 +- src/python_testing/TC_ECOINFO_2_2.py | 8 +- src/python_testing/TC_MCORE_FS_1_1.py | 28 +-- src/python_testing/TC_MCORE_FS_1_2.py | 18 +- src/python_testing/TC_MCORE_FS_1_3.py | 8 +- src/python_testing/TC_MCORE_FS_1_4.py | 16 +- src/python_testing/TC_MCORE_FS_1_5.py | 18 +- src/python_testing/execute_python_tests.py | 1 - .../matter_testing_infrastructure/BUILD.gn | 1 + .../chip/testing/apps.py | 69 ++++++ .../chip/testing/test_tasks.py | 4 + 14 files changed, 260 insertions(+), 153 deletions(-) create mode 100644 src/python_testing/matter_testing_infrastructure/chip/testing/apps.py diff --git a/src/python_testing/TC_BRBINFO_4_1.py b/src/python_testing/TC_BRBINFO_4_1.py index 32dd541d66f676..f0c194ac2bd7f1 100644 --- a/src/python_testing/TC_BRBINFO_4_1.py +++ b/src/python_testing/TC_BRBINFO_4_1.py @@ -15,22 +15,44 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: +# run1: +# app: examples/fabric-admin/scripts/fabric-sync-app.py +# app-args: --app-admin=${FABRIC_ADMIN_APP} --app-bridge=${FABRIC_BRIDGE_APP} --stdin-pipe=dut-fsa-stdin --discriminator=1234 +# app-ready-pattern: "Successfully opened pairing window on the device" +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --string-arg th_icd_server_app_path:${LIT_ICD_APP} dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factoryreset: true +# quiet: true +# === END CI TEST ARGUMENTS === + # This test requires a TH_ICD_SERVER application. Please specify with --string-arg th_icd_server_app_path: # TH_ICD_SERVER must support following arguments: --secured-device-port --discriminator --passcode --KVS # E.g: python3 src/python_testing/TC_BRBINFO_4_1.py --commissioning-method on-network --qr-code MT:-24J042C00KA0648G00 \ # --string-arg th_icd_server_app_path:out/linux-x64-lit-icd/lit-icd-app +import asyncio import logging import os import queue -import signal -import subprocess -import time -import uuid +import random +import tempfile import chip.clusters as Clusters from chip import ChipDeviceCtrl from chip.interaction_model import InteractionModelError, Status +from chip.testing.apps import IcdAppServerSubprocess from matter_testing_support import MatterBaseTest, SimpleEventCallback, TestStep, async_test_body, default_matter_test_main from mobly import asserts @@ -40,13 +62,6 @@ class TC_BRBINFO_4_1(MatterBaseTest): - # - # Class Helper functions - # - - async def _read_attribute_expect_success(self, endpoint, cluster, attribute, node_id): - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute, node_id=node_id) - # This test has some manual steps and also multiple sleeps >= 30 seconds. Test typically runs under 3 mins, # so 6 minutes is more than enough. @property @@ -58,7 +73,7 @@ def desc_TC_BRBINFO_4_1(self) -> str: return "[TC_BRBINFO_4_1] Verification of KeepActive Command [DUT-Server]" def steps_TC_BRBINFO_4_1(self) -> list[TestStep]: - steps = [ + return [ TestStep("0", "DUT commissioned and preconditions", is_commissioning=True), TestStep("1", "TH reads from the ICD the A_IDLE_MODE_DURATION, A_ACTIVE_MODE_DURATION, and ACTIVE_MODE_THRESHOLD attributes"), TestStep("2", "Setting up subscribe to ActiveChange event"), @@ -77,16 +92,16 @@ def steps_TC_BRBINFO_4_1(self) -> list[TestStep]: TestStep("15", "Send KeepActive command with shortest TimeoutMs value while TH_ICD is prevented from sending check-ins"), TestStep("16", "Wait 15 seconds then send second KeepActive command with double the TimeoutMs value of the previous step"), TestStep("17", "TH allows TH_ICD to resume sending check-ins after timeout from step 15 expired but before second timeout from step 16 still valid"), - TestStep("18", "Wait for TH_ICD to check into TH, then confirm we have received new event from DUT")] - return steps + TestStep("18", "Wait for TH_ICD to check into TH, then confirm we have received new event from DUT"), + ] - def _ask_for_vendor_commissioniong_ux_operation(self, discriminator, setupPinCode, setupManualCode, setupQRCode): + def _ask_for_vendor_commissioning_ux_operation(self, discriminator, setupPinCode, setupManualCode, setupQRCode): self.wait_for_user_input( prompt_msg=f"Using the DUT vendor's provided interface, commission the ICD device using the following parameters:\n" f"- discriminator: {discriminator}\n" f"- setupPinCode: {setupPinCode}\n" f"- setupQRCode: {setupQRCode}\n" - f"- setupManualcode: {setupManualCode}\n" + f"- setupManualCode: {setupManualCode}\n" f"If using FabricSync Admin test app, you may type:\n" f">>> pairing onnetwork 111 {setupPinCode} --icd-registration true") @@ -117,81 +132,88 @@ async def _get_dynamic_endpoint(self) -> int: @async_test_body async def setup_class(self): + super().setup_class() + # These steps are not explicitly, but they help identify the dynamically added endpoint # The second part of this process happens on _get_dynamic_endpoint() - root_part_list = await self.read_single_attribute_check_success(cluster=Clusters.Descriptor, attribute=Clusters.Descriptor.Attributes.PartsList, endpoint=_ROOT_ENDPOINT_ID) + root_part_list = await self.read_single_attribute_check_success( + cluster=Clusters.Descriptor, + attribute=Clusters.Descriptor.Attributes.PartsList, + endpoint=_ROOT_ENDPOINT_ID) self.set_of_dut_endpoints_before_adding_device = set(root_part_list) - super().setup_class() self._active_change_event_subscription = None - self.app_process = None - self.app_process_paused = False - app = self.user_params.get("th_icd_server_app_path", None) - if not app: - asserts.fail('This test requires a TH_ICD_SERVER app. Specify app path with --string-arg th_icd_server_app_path:') - - self.kvs = f'kvs_{str(uuid.uuid4())}' - discriminator = 3850 - passcode = 20202021 - cmd = [app] - cmd.extend(['--secured-device-port', str(5543)]) - cmd.extend(['--discriminator', str(discriminator)]) - cmd.extend(['--passcode', str(passcode)]) - cmd.extend(['--KVS', self.kvs]) + self.th_icd_server = None + self.storage = None - logging.info("Starting ICD Server App") - self.app_process = subprocess.Popen(cmd) - logging.info("ICD started") - time.sleep(3) + th_icd_server_app = self.user_params.get("th_icd_server_app_path", None) + if not th_icd_server_app: + asserts.fail('This test requires a TH_ICD_SERVER app. Specify app path with --string-arg th_icd_server_app_path:') + if not os.path.exists(th_icd_server_app): + asserts.fail(f'The path {th_icd_server_app} does not exist') + + # Create a temporary storage directory for keeping KVS files. + self.storage = tempfile.TemporaryDirectory(prefix=self.__class__.__name__) + logging.info("Temporary storage directory: %s", self.storage.name) + + if self.is_pics_sdk_ci_only: + # Get the named pipe path for the DUT_FSA app input from the user params. + dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe") + if not dut_fsa_stdin_pipe: + asserts.fail("CI setup requires --string-arg dut_fsa_stdin_pipe:") + self.dut_fsa_stdin = open(dut_fsa_stdin_pipe, "w") + + self.th_icd_server_port = 5543 + self.th_icd_server_discriminator = random.randint(0, 4095) + self.th_icd_server_passcode = 20202021 + + # Start the TH_ICD_SERVER app. + self.th_icd_server = IcdAppServerSubprocess( + th_icd_server_app, + storage_dir=self.storage.name, + port=self.th_icd_server_port, + discriminator=self.th_icd_server_discriminator, + passcode=self.th_icd_server_passcode) + self.th_icd_server.start( + expected_output="Server initialization complete", + timeout=30) logging.info("Commissioning of ICD to fabric one (TH)") self.icd_nodeid = 1111 self.default_controller.EnableICDRegistration(self.default_controller.GenerateICDRegistrationParameters()) - await self.default_controller.CommissionOnNetwork(nodeId=self.icd_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) + await self.default_controller.CommissionOnNetwork( + nodeId=self.icd_nodeid, + setupPinCode=self.th_icd_server_passcode, + filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, + filter=self.th_icd_server_discriminator) logging.info("Commissioning of ICD to fabric two (DUT)") params = await self.openCommissioningWindow(dev_ctrl=self.default_controller, node_id=self.icd_nodeid) - self._ask_for_vendor_commissioniong_ux_operation(params.randomDiscriminator, params.commissioningParameters.setupPinCode, - params.commissioningParameters.setupManualCode, params.commissioningParameters.setupQRCode) + if not self.is_pics_sdk_ci_only: + self._ask_for_vendor_commissioning_ux_operation( + params.randomDiscriminator, + params.commissioningParameters.setupPinCode, + params.commissioningParameters.setupManualCode, + params.commissioningParameters.setupQRCode) + else: + self.dut_fsa_stdin.write( + f"pairing onnetwork 2 {params.commissioningParameters.setupPinCode} --icd-registration true\n") + self.dut_fsa_stdin.flush() + # Wait for the commissioning to complete. + await asyncio.sleep(5) def teardown_class(self): if self._active_change_event_subscription is not None: self._active_change_event_subscription.Shutdown() self._active_change_event_subscription = None - - # In case the th_icd_server_app_path does not exist, then we failed the test - # and there is nothing to remove - if self.app_process is not None: - self.resume_th_icd_server(check_state=False) - logging.warning("Stopping app with SIGTERM") - self.app_process.send_signal(signal.SIGTERM.value) - self.app_process.wait() - - if os.path.exists(self.kvs): - os.remove(self.kvs) - + if self.th_icd_server is not None: + self.th_icd_server.terminate() + if self.storage is not None: + self.storage.cleanup() super().teardown_class() - def pause_th_icd_server(self, check_state): - if check_state: - asserts.assert_false(self.app_process_paused, "ICD TH Server unexpectedly is already paused") - if self.app_process_paused: - return - # stops (halts) the ICD server process by sending a SIGTOP signal - self.app_process.send_signal(signal.SIGSTOP.value) - self.app_process_paused = True - - def resume_th_icd_server(self, check_state): - if check_state: - asserts.assert_true(self.app_process_paused, "ICD TH Server unexpectedly is already running") - if not self.app_process_paused: - return - # resumes (continues) the ICD server process by sending a SIGCONT signal - self.app_process.send_signal(signal.SIGCONT.value) - self.app_process_paused = False - # # BRBINFO 4.1 Test Body # @@ -210,34 +232,42 @@ async def test_TC_BRBINFO_4_1(self): self.step("0") logging.info("Ensuring DUT is commissioned to TH") - # Confirms commissioning of DUT on TH as it reads its fature map - await self._read_attribute_expect_success( - _ROOT_ENDPOINT_ID, - basic_info_cluster, - basic_info_attributes.FeatureMap, - self.dut_node_id + # Confirms commissioning of DUT on TH as it reads its feature map + await self.read_single_attribute_check_success( + endpoint=_ROOT_ENDPOINT_ID, + cluster=basic_info_cluster, + attribute=basic_info_attributes.FeatureMap, + node_id=self.dut_node_id, ) logging.info("Ensuring ICD is commissioned to TH") self.step("1") - idle_mode_duration_s = await self._read_attribute_expect_success( - _ROOT_ENDPOINT_ID, - icdm_cluster, - icdm_attributes.IdleModeDuration, - self.icd_nodeid + idle_mode_duration_s = await self.read_single_attribute_check_success( + endpoint=_ROOT_ENDPOINT_ID, + cluster=icdm_cluster, + attribute=icdm_attributes.IdleModeDuration, + node_id=self.icd_nodeid, ) logging.info(f"IdleModeDurationS: {idle_mode_duration_s}") - active_mode_duration_ms = await self._read_attribute_expect_success( - _ROOT_ENDPOINT_ID, - icdm_cluster, - icdm_attributes.ActiveModeDuration, - self.icd_nodeid + active_mode_duration_ms = await self.read_single_attribute_check_success( + endpoint=_ROOT_ENDPOINT_ID, + cluster=icdm_cluster, + attribute=icdm_attributes.ActiveModeDuration, + node_id=self.icd_nodeid, ) logging.info(f"ActiveModeDurationMs: {active_mode_duration_ms}") + active_mode_threshold_ms = await self.read_single_attribute_check_success( + endpoint=_ROOT_ENDPOINT_ID, + cluster=icdm_cluster, + attribute=icdm_attributes.ActiveModeThreshold, + node_id=self.icd_nodeid, + ) + logging.info(f"ActiveModeThresholdMs: {active_mode_threshold_ms}") + self.step("2") event = brb_info_cluster.Events.ActiveChanged self.q = queue.Queue() @@ -292,7 +322,7 @@ async def test_TC_BRBINFO_4_1(self): asserts.assert_equal(self.q.qsize(), 0, "Unexpected event received from DUT") self.step("9") - self.pause_th_icd_server(check_state=True) + self.th_icd_server.pause() # sends 3x keep active commands stay_active_duration_ms = 2000 keep_active_timeout_ms = 60000 @@ -304,7 +334,7 @@ async def test_TC_BRBINFO_4_1(self): await self._send_keep_active_command(stay_active_duration_ms, keep_active_timeout_ms, dynamic_endpoint_id) self.step("10") - self.resume_th_icd_server(check_state=True) + self.th_icd_server.resume() await self.default_controller.WaitForActive(self.icd_nodeid, timeoutSeconds=wait_for_icd_checkin_timeout_s, stayActiveDurationMs=5000) promised_active_duration_ms = await self._wait_for_active_changed_event(timeout_s=wait_for_dut_event_subscription_s) asserts.assert_equal(self.q.qsize(), 0, "More than one event received from DUT") @@ -314,14 +344,14 @@ async def test_TC_BRBINFO_4_1(self): asserts.assert_equal(self.q.qsize(), 0, "More than one event received from DUT") self.step("12") - self.pause_th_icd_server(check_state=True) + self.th_icd_server.pause() stay_active_duration_ms = 2000 keep_active_timeout_ms = 30000 await self._send_keep_active_command(stay_active_duration_ms, keep_active_timeout_ms, dynamic_endpoint_id) self.step("13") - time.sleep(30) - self.resume_th_icd_server(check_state=True) + await asyncio.sleep(30) + self.th_icd_server.resume() self.step("14") await self.default_controller.WaitForActive(self.icd_nodeid, timeoutSeconds=wait_for_icd_checkin_timeout_s, stayActiveDurationMs=5000) @@ -329,20 +359,20 @@ async def test_TC_BRBINFO_4_1(self): asserts.assert_equal(self.q.qsize(), 0, "Unexpected event received from DUT") self.step("15") - self.pause_th_icd_server(check_state=True) + self.th_icd_server.pause() stay_active_duration_ms = 2000 keep_active_timeout_ms = 30000 await self._send_keep_active_command(stay_active_duration_ms, keep_active_timeout_ms, dynamic_endpoint_id) self.step("16") - time.sleep(15) + await asyncio.sleep(15) stay_active_duration_ms = 2000 keep_active_timeout_ms = 60000 await self._send_keep_active_command(stay_active_duration_ms, keep_active_timeout_ms, dynamic_endpoint_id) self.step("17") - time.sleep(15) - self.resume_th_icd_server(check_state=True) + await asyncio.sleep(15) + self.th_icd_server.resume() self.step("18") await self.default_controller.WaitForActive(self.icd_nodeid, timeoutSeconds=wait_for_icd_checkin_timeout_s, stayActiveDurationMs=5000) diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index 4b6f80017096ff..ea2918fcc0b346 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -49,10 +49,10 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl from chip.interaction_model import InteractionModelError, Status +from chip.testing.apps import AppServerSubprocess from matter_testing_support import (MatterBaseTest, TestStep, async_test_body, default_matter_test_main, has_cluster, run_if_endpoint_matches) from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer class TC_CCTRL_2_2(MatterBaseTest): @@ -79,13 +79,15 @@ async def setup_class(self): self.th_server_passcode = 20202021 # Start the TH_SERVER app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) logging.info("Commissioning from separate fabric") diff --git a/src/python_testing/TC_CCTRL_2_3.py b/src/python_testing/TC_CCTRL_2_3.py index 15f7304dab27cb..c5ccaa837737b2 100644 --- a/src/python_testing/TC_CCTRL_2_3.py +++ b/src/python_testing/TC_CCTRL_2_3.py @@ -49,10 +49,10 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl from chip.interaction_model import InteractionModelError, Status +from chip.testing.apps import AppServerSubprocess from matter_testing_support import (MatterBaseTest, TestStep, async_test_body, default_matter_test_main, has_cluster, run_if_endpoint_matches) from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer class TC_CCTRL_2_3(MatterBaseTest): @@ -79,13 +79,15 @@ async def setup_class(self): self.th_server_passcode = 20202021 # Start the TH_SERVER app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) logging.info("Commissioning from separate fabric") diff --git a/src/python_testing/TC_ECOINFO_2_1.py b/src/python_testing/TC_ECOINFO_2_1.py index f3f22bb99c7f37..cd966e4c145398 100644 --- a/src/python_testing/TC_ECOINFO_2_1.py +++ b/src/python_testing/TC_ECOINFO_2_1.py @@ -46,10 +46,10 @@ import chip.clusters as Clusters from chip.clusters.Types import NullValue from chip.interaction_model import Status +from chip.testing.apps import AppServerSubprocess from chip.tlv import uint from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer class TC_ECOINFO_2_1(MatterBaseTest): @@ -95,13 +95,15 @@ async def _setup_ci_prerequisites(self): self.th_server_passcode = 20202021 # Start the server app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) # Add some server to the DUT_FSA's Aggregator/Bridge. self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_passcode}\n") diff --git a/src/python_testing/TC_ECOINFO_2_2.py b/src/python_testing/TC_ECOINFO_2_2.py index 96fa2cd4d00eb3..41d7fc07709d86 100644 --- a/src/python_testing/TC_ECOINFO_2_2.py +++ b/src/python_testing/TC_ECOINFO_2_2.py @@ -45,9 +45,9 @@ import chip.clusters as Clusters from chip.interaction_model import Status +from chip.testing.apps import AppServerSubprocess from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer _DEVICE_TYPE_AGGREGGATOR = 0x000E @@ -94,13 +94,15 @@ def _setup_ci_prerequisites(self): self.th_server_passcode = 20202021 # Start the server app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) def steps_TC_ECOINFO_2_2(self) -> list[TestStep]: return [ diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index 8e43d611065f0a..c30c1ec1b246b3 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -47,31 +47,11 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl -from chip.testing.tasks import Subprocess +from chip.testing.apps import AppServerSubprocess from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts -class AppServer(Subprocess): - """Wrapper class for starting an application server in a subprocess.""" - - # Prefix for log messages from the application server. - PREFIX = b"[SERVER]" - - def __init__(self, app: str, storage_dir: str, discriminator: int, passcode: int, port: int = 5540): - storage_kvs_dir = tempfile.mkstemp(dir=storage_dir, prefix="kvs-app-")[1] - # Start the server application with dedicated KVS storage. - super().__init__(app, "--KVS", storage_kvs_dir, - '--secured-device-port', str(port), - "--discriminator", str(discriminator), - "--passcode", str(passcode), - output_cb=lambda line, is_stderr: self.PREFIX + line) - - def start(self): - # Start process and block until it prints the expected output. - super().start(expected_output="Server initialization complete") - - class TC_MCORE_FS_1_1(MatterBaseTest): @async_test_body @@ -96,13 +76,15 @@ async def setup_class(self): self.th_server_passcode = 20202021 # Start the TH_SERVER app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) logging.info("Commissioning from separate fabric") # Create a second controller on a new fabric to communicate to the server diff --git a/src/python_testing/TC_MCORE_FS_1_2.py b/src/python_testing/TC_MCORE_FS_1_2.py index 6cd1c85bac206e..f7e88870ddc3a6 100644 --- a/src/python_testing/TC_MCORE_FS_1_2.py +++ b/src/python_testing/TC_MCORE_FS_1_2.py @@ -50,10 +50,10 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl +from chip.testing.apps import AppServerSubprocess from ecdsa.curves import NIST256p from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer from TC_SC_3_6 import AttributeChangeAccumulator # Length of `w0s` and `w1s` elements @@ -97,9 +97,11 @@ async def setup_class(self): self.storage = tempfile.TemporaryDirectory(prefix=self.__class__.__name__) logging.info("Temporary storage directory: %s", self.storage.name) - # Get the named pipe path for the DUT_FSA app input from the user params. - dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe", None) - if dut_fsa_stdin_pipe is not None: + if self.is_pics_sdk_ci_only: + # Get the named pipe path for the DUT_FSA app input from the user params. + dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe") + if not dut_fsa_stdin_pipe: + asserts.fail("CI setup requires --string-arg dut_fsa_stdin_pipe:") self.dut_fsa_stdin = open(dut_fsa_stdin_pipe, "w") self.th_server_port = th_server_port @@ -111,13 +113,15 @@ async def setup_class(self): passcode=20202021) # Start the TH_SERVER app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_setup_params.discriminator, passcode=self.th_server_setup_params.passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) def teardown_class(self): if self._partslist_subscription is not None: @@ -135,7 +139,7 @@ def _ask_for_vendor_commissioning_ux_operation(self, setup_params: _SetupParamet f"- discriminator: {setup_params.discriminator}\n" f"- setupPinCode: {setup_params.passcode}\n" f"- setupQRCode: {setup_params.setup_qr_code}\n" - f"- setupManualcode: {setup_params.manual_code}\n" + f"- setupManualCode: {setup_params.manual_code}\n" f"If using FabricSync Admin test app, you may type:\n" f">>> pairing onnetwork 111 {setup_params.passcode}") diff --git a/src/python_testing/TC_MCORE_FS_1_3.py b/src/python_testing/TC_MCORE_FS_1_3.py index 49dc89386c644e..7dcca366a408ab 100644 --- a/src/python_testing/TC_MCORE_FS_1_3.py +++ b/src/python_testing/TC_MCORE_FS_1_3.py @@ -50,9 +50,9 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl from chip.interaction_model import Status +from chip.testing.apps import AppServerSubprocess from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer class TC_MCORE_FS_1_3(MatterBaseTest): @@ -84,13 +84,15 @@ def setup_class(self): self.th_server_passcode = 20202021 # Start the TH_SERVER_NO_UID app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) def teardown_class(self): if self.th_server is not None: diff --git a/src/python_testing/TC_MCORE_FS_1_4.py b/src/python_testing/TC_MCORE_FS_1_4.py index c365b4e9b92b51..90d1960649d766 100644 --- a/src/python_testing/TC_MCORE_FS_1_4.py +++ b/src/python_testing/TC_MCORE_FS_1_4.py @@ -49,10 +49,10 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl from chip.interaction_model import Status +from chip.testing.apps import AppServerSubprocess from chip.testing.tasks import Subprocess from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer class FabricSyncApp(Subprocess): @@ -160,9 +160,11 @@ def setup_class(self): vendor_id=0xFFF1) self.th_fsa_controller.start() - # Get the named pipe path for the DUT_FSA app input from the user params. - dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe", None) - if dut_fsa_stdin_pipe is not None: + if self.is_pics_sdk_ci_only: + # Get the named pipe path for the DUT_FSA app input from the user params. + dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe") + if not dut_fsa_stdin_pipe: + asserts.fail("CI setup requires --string-arg dut_fsa_stdin_pipe:") self.dut_fsa_stdin = open(dut_fsa_stdin_pipe, "w") self.th_server_port = 5544 @@ -170,13 +172,15 @@ def setup_class(self): self.th_server_passcode = 20202022 # Start the TH_SERVER_NO_UID app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_discriminator, passcode=self.th_server_passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) def teardown_class(self): if self.th_fsa_controller is not None: diff --git a/src/python_testing/TC_MCORE_FS_1_5.py b/src/python_testing/TC_MCORE_FS_1_5.py index d4f408a2ce307f..9b7e32b1d92d5c 100755 --- a/src/python_testing/TC_MCORE_FS_1_5.py +++ b/src/python_testing/TC_MCORE_FS_1_5.py @@ -50,10 +50,10 @@ import chip.clusters as Clusters from chip import ChipDeviceCtrl +from chip.testing.apps import AppServerSubprocess from ecdsa.curves import NIST256p from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts -from TC_MCORE_FS_1_1 import AppServer from TC_SC_3_6 import AttributeChangeAccumulator # Length of `w0s` and `w1s` elements @@ -98,9 +98,11 @@ async def setup_class(self): self.storage = tempfile.TemporaryDirectory(prefix=self.__class__.__name__) logging.info("Temporary storage directory: %s", self.storage.name) - # Get the named pipe path for the DUT_FSA app input from the user params. - dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe", None) - if dut_fsa_stdin_pipe is not None: + if self.is_pics_sdk_ci_only: + # Get the named pipe path for the DUT_FSA app input from the user params. + dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe") + if not dut_fsa_stdin_pipe: + asserts.fail("CI setup requires --string-arg dut_fsa_stdin_pipe:") self.dut_fsa_stdin = open(dut_fsa_stdin_pipe, "w") self.th_server_port = th_server_port @@ -112,13 +114,15 @@ async def setup_class(self): passcode=20202021) # Start the TH_SERVER app. - self.th_server = AppServer( + self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, discriminator=self.th_server_setup_params.discriminator, passcode=self.th_server_setup_params.passcode) - self.th_server.start() + self.th_server.start( + expected_output="Server initialization complete", + timeout=30) def teardown_class(self): if self._partslist_subscription is not None: @@ -139,7 +143,7 @@ def _ask_for_vendor_commissioning_ux_operation(self, setup_params: _SetupParamet f"- discriminator: {setup_params.discriminator}\n" f"- setupPinCode: {setup_params.passcode}\n" f"- setupQRCode: {setup_params.setup_qr_code}\n" - f"- setupManualcode: {setup_params.manual_code}\n" + f"- setupManualCode: {setup_params.manual_code}\n" f"If using FabricSync Admin test app, you may type:\n" f">>> pairing onnetwork 111 {setup_params.passcode}") diff --git a/src/python_testing/execute_python_tests.py b/src/python_testing/execute_python_tests.py index f316d49e255dba..4e678211c5ddce 100644 --- a/src/python_testing/execute_python_tests.py +++ b/src/python_testing/execute_python_tests.py @@ -66,7 +66,6 @@ def main(search_directory, env_file): "TC_TMP_2_1.py", # src/python_testing/test_testing/test_TC_TMP_2_1.py is the Unit test of this test "TC_OCC_3_1.py", # There are CI issues for the test cases that implements manually controlling sensor device for the occupancy state ON/OFF change "TC_OCC_3_2.py", # There are CI issues for the test cases that implements manually controlling sensor device for the occupancy state ON/OFF change - "TC_BRBINFO_4_1.py", # This test requires a TH_ICD_SERVER application, hence not ready run with CI "TestCommissioningTimeSync.py", # Code/Test not being used or not shared code for any other tests "TestConformanceSupport.py", # Unit test - does not run against an app "TestChoiceConformanceSupport.py", # Unit test - does not run against an app diff --git a/src/python_testing/matter_testing_infrastructure/BUILD.gn b/src/python_testing/matter_testing_infrastructure/BUILD.gn index c8d54fb0084c92..41bbcef22b8c2e 100644 --- a/src/python_testing/matter_testing_infrastructure/BUILD.gn +++ b/src/python_testing/matter_testing_infrastructure/BUILD.gn @@ -30,6 +30,7 @@ pw_python_package("chip-testing") { sources = [ "chip/testing/__init__.py", + "chip/testing/apps.py", "chip/testing/metadata.py", "chip/testing/tasks.py", ] diff --git a/src/python_testing/matter_testing_infrastructure/chip/testing/apps.py b/src/python_testing/matter_testing_infrastructure/chip/testing/apps.py new file mode 100644 index 00000000000000..af56efc3d58ff5 --- /dev/null +++ b/src/python_testing/matter_testing_infrastructure/chip/testing/apps.py @@ -0,0 +1,69 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import signal +import tempfile + +from .tasks import Subprocess + + +class AppServerSubprocess(Subprocess): + """Wrapper class for starting an application server in a subprocess.""" + + # Prefix for log messages from the application server. + PREFIX = b"[SERVER]" + + def __init__(self, app: str, storage_dir: str, discriminator: int, + passcode: int, port: int = 5540): + self.kvs_fd, kvs_path = tempfile.mkstemp(dir=storage_dir, prefix="kvs-app-") + # Start the server application with dedicated KVS storage. + super().__init__(app, "--KVS", kvs_path, + '--secured-device-port', str(port), + "--discriminator", str(discriminator), + "--passcode", str(passcode), + output_cb=lambda line, is_stderr: self.PREFIX + line) + + def __del__(self): + # Do not leak KVS file descriptor. + os.close(self.kvs_fd) + + +class IcdAppServerSubprocess(AppServerSubprocess): + """Wrapper class for starting an ICD application server in a subprocess.""" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.paused = False + + def pause(self, check_state: bool = True): + if check_state and self.paused: + raise ValueError("ICD TH Server unexpectedly is already paused") + if not self.paused: + # Stop (halt) the ICD server process by sending a SIGTOP signal. + self.p.send_signal(signal.SIGSTOP) + self.paused = True + + def resume(self, check_state: bool = True): + if check_state and not self.paused: + raise ValueError("ICD TH Server unexpectedly is already running") + if self.paused: + # Resume (continue) the ICD server process by sending a SIGCONT signal. + self.p.send_signal(signal.SIGCONT) + self.paused = False + + def terminate(self): + # Make sure the ICD server process is not paused before terminating it. + self.resume(check_state=False) + super().terminate() diff --git a/src/python_testing/matter_testing_infrastructure/chip/testing/test_tasks.py b/src/python_testing/matter_testing_infrastructure/chip/testing/test_tasks.py index 5e91a89cf68581..051d571d79086c 100644 --- a/src/python_testing/matter_testing_infrastructure/chip/testing/test_tasks.py +++ b/src/python_testing/matter_testing_infrastructure/chip/testing/test_tasks.py @@ -14,6 +14,10 @@ import unittest +# TODO: Allow to use relative imports or imports from chip.testing package. Then, +# rename "tasks" module to "subprocess", because it would be more descriptive. +# Unfortunately, current way of importing clashes with the subprocess module +# from the Python standard library. from tasks import Subprocess From bd8803a9522ce766a07ac9d843bdaea2f53d306a Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 8 Oct 2024 15:36:25 +0200 Subject: [PATCH 32/39] [darwin-framework-tool] Automatically check for leaks on shutdown if enable_leak_checking is true (#35936) --- examples/darwin-framework-tool/BUILD.gn | 8 +++ .../darwin-framework-tool/debug/LeakChecker.h | 28 ++++++++ .../debug/LeakChecker.mm | 70 +++++++++++++++++++ examples/darwin-framework-tool/main.mm | 5 +- .../Matter.xcodeproj/project.pbxproj | 16 +++++ 5 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 examples/darwin-framework-tool/debug/LeakChecker.h create mode 100644 examples/darwin-framework-tool/debug/LeakChecker.mm diff --git a/examples/darwin-framework-tool/BUILD.gn b/examples/darwin-framework-tool/BUILD.gn index 665dccf4848df4..2c202475a70ea9 100644 --- a/examples/darwin-framework-tool/BUILD.gn +++ b/examples/darwin-framework-tool/BUILD.gn @@ -43,6 +43,9 @@ declare_args() { # Disable generating compiler database by default generate_compilation_database = false + + # Enable automatic leak checks before the application exits + enable_leak_checking = false } sdk = "macosx" @@ -219,6 +222,7 @@ executable("darwin-framework-tool") { "commands/provider/OTASoftwareUpdateInteractive.mm", "commands/storage/Commands.h", "commands/storage/StorageManagementCommand.mm", + "debug/LeakChecker.mm", "logging/logging.mm", "main.mm", ] @@ -280,6 +284,10 @@ executable("darwin-framework-tool") { defines += [ "MTR_ENABLE_PROVISIONAL=1" ] } + if (enable_leak_checking) { + defines += [ "DFT_ENABLE_LEAK_CHECKING=1" ] + } + public_configs = [ ":config" ] output_dir = root_out_dir diff --git a/examples/darwin-framework-tool/debug/LeakChecker.h b/examples/darwin-framework-tool/debug/LeakChecker.h new file mode 100644 index 00000000000000..c83ed64910cbbc --- /dev/null +++ b/examples/darwin-framework-tool/debug/LeakChecker.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +/* + * This function performs a memory leak check if the build flag `enable_leak_checking` is set to true + * If leaks are detected, it overrides the provided exit code with `EXIT_FAILURE`. + * + * @param exitCode The initial exit code to return if no leaks are detected or if leak checking is disabled. + * @return `EXIT_FAILURE` if leaks are detected and leak checking is enabled; otherwise, the original `exitCode`. + */ +int ConditionalLeaksCheck(int exitCode); diff --git a/examples/darwin-framework-tool/debug/LeakChecker.mm b/examples/darwin-framework-tool/debug/LeakChecker.mm new file mode 100644 index 00000000000000..72a441420abc22 --- /dev/null +++ b/examples/darwin-framework-tool/debug/LeakChecker.mm @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "LeakChecker.h" + +#import +#include // For getpid() + +@interface LeakChecker : NSObject +- (BOOL)hasMemoryLeaks; +@end + +@implementation LeakChecker + +- (BOOL)hasMemoryLeaks +{ + pid_t pid = getpid(); + auto * pidString = [NSString stringWithFormat:@"%d", pid]; + + auto * task = [[NSTask alloc] init]; + task.launchPath = @"/usr/bin/leaks"; + task.arguments = @[ pidString ]; + + auto * pipe = [NSPipe pipe]; + task.standardOutput = pipe; + task.standardError = pipe; + + NSFileHandle * fileHandle = [pipe fileHandleForReading]; + [task launch]; + [task waitUntilExit]; + + int exitCode = [task terminationStatus]; + if (exitCode) { + NSData * data = [fileHandle readDataToEndOfFile]; + NSString * output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + NSLog(@"%@", output); + return YES; + } + + return NO; +} + +@end + +int ConditionalLeaksCheck(int exitCode) +{ +#ifdef DFT_ENABLE_LEAK_CHECKING + auto * leakChecker = [[LeakChecker alloc] init]; + if ([leakChecker hasMemoryLeaks]) { + return EXIT_FAILURE; + } +#endif // DFT_ENABLE_LEAK_CHECKING + + return exitCode; +} diff --git a/examples/darwin-framework-tool/main.mm b/examples/darwin-framework-tool/main.mm index 5f31cb6abf1cd1..ad31cfe32ee1cc 100644 --- a/examples/darwin-framework-tool/main.mm +++ b/examples/darwin-framework-tool/main.mm @@ -18,6 +18,7 @@ #import +#import "debug/LeakChecker.h" #import "logging/logging.h" #include "commands/bdx/Commands.h" @@ -35,6 +36,7 @@ int main(int argc, const char * argv[]) { + int exitCode = EXIT_SUCCESS; @autoreleasepool { dft::logging::Setup(); @@ -49,6 +51,7 @@ int main(int argc, const char * argv[]) registerCommandsStorage(commands); registerCommandsConfiguration(commands); registerClusters(commands); - return commands.Run(argc, (char **) argv); + exitCode = commands.Run(argc, (char **) argv); } + return ConditionalLeaksCheck(exitCode); } diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index afc1df19338b46..8a39c63440f9ab 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -373,6 +373,8 @@ B4E262172AA0CF2000DBA5BC /* RemoteDataModelLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = B4E262132AA0C7A300DBA5BC /* RemoteDataModelLogger.h */; }; B4E2621B2AA0D02000DBA5BC /* SleepCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = B4E262192AA0D01D00DBA5BC /* SleepCommand.mm */; }; B4E2621E2AA0D02D00DBA5BC /* WaitForCommissioneeCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = B4E2621C2AA0D02A00DBA5BC /* WaitForCommissioneeCommand.mm */; }; + B4F773CA2CB54B61008C6B23 /* LeakChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = B4F773C72CB54B61008C6B23 /* LeakChecker.h */; }; + B4F773CB2CB54B61008C6B23 /* LeakChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = B4F773C82CB54B61008C6B23 /* LeakChecker.mm */; }; B4FCD56A2B5EDBD300832859 /* MTRDiagnosticLogsType.h in Headers */ = {isa = PBXBuildFile; fileRef = B4FCD5692B5EDBD300832859 /* MTRDiagnosticLogsType.h */; settings = {ATTRIBUTES = (Public, ); }; }; B4FCD5702B603A6300832859 /* Commands.h in Headers */ = {isa = PBXBuildFile; fileRef = B4FCD56D2B603A6300832859 /* Commands.h */; }; B4FCD5712B603A6300832859 /* DownloadLogCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B4FCD56E2B603A6300832859 /* DownloadLogCommand.h */; }; @@ -818,6 +820,8 @@ B4E262132AA0C7A300DBA5BC /* RemoteDataModelLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteDataModelLogger.h; sourceTree = ""; }; B4E262192AA0D01D00DBA5BC /* SleepCommand.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SleepCommand.mm; sourceTree = ""; }; B4E2621C2AA0D02A00DBA5BC /* WaitForCommissioneeCommand.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WaitForCommissioneeCommand.mm; sourceTree = ""; }; + B4F773C72CB54B61008C6B23 /* LeakChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeakChecker.h; sourceTree = ""; }; + B4F773C82CB54B61008C6B23 /* LeakChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LeakChecker.mm; sourceTree = ""; }; B4FCD5692B5EDBD300832859 /* MTRDiagnosticLogsType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDiagnosticLogsType.h; sourceTree = ""; }; B4FCD56D2B603A6300832859 /* Commands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Commands.h; sourceTree = ""; }; B4FCD56E2B603A6300832859 /* DownloadLogCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadLogCommand.h; sourceTree = ""; }; @@ -874,6 +878,7 @@ 037C3CA82991A44B00B7EEE2 /* darwin-framework-tool */ = { isa = PBXGroup; children = ( + B4F773C92CB54B61008C6B23 /* debug */, 039145E02993102B00257B3E /* main.mm */, 03F430A52994100000166449 /* controller */, 039547092992DB02006D42A8 /* editline */, @@ -1543,6 +1548,15 @@ path = delay; sourceTree = ""; }; + B4F773C92CB54B61008C6B23 /* debug */ = { + isa = PBXGroup; + children = ( + B4F773C72CB54B61008C6B23 /* LeakChecker.h */, + B4F773C82CB54B61008C6B23 /* LeakChecker.mm */, + ); + path = debug; + sourceTree = ""; + }; B4FCD56C2B603A6300832859 /* bdx */ = { isa = PBXGroup; children = ( @@ -1594,6 +1608,7 @@ 037C3DAF2991BD4F00B7EEE2 /* DeviceControllerDelegateBridge.h in Headers */, B4FCD5712B603A6300832859 /* DownloadLogCommand.h in Headers */, 037C3DC32991BD5100B7EEE2 /* Commands.h in Headers */, + B4F773CA2CB54B61008C6B23 /* LeakChecker.h in Headers */, 037C3DB82991BD5000B7EEE2 /* ClusterCommandBridge.h in Headers */, 037C3DC82991BD5100B7EEE2 /* CHIPToolKeypair.h in Headers */, 037C3DB52991BD5000B7EEE2 /* WriteAttributeCommandBridge.h in Headers */, @@ -1900,6 +1915,7 @@ 03F430A82994112B00166449 /* editline.c in Sources */, 03F430AA2994113500166449 /* sysunix.c in Sources */, B45373BF2A9FEA9100807602 /* adopt.c in Sources */, + B4F773CB2CB54B61008C6B23 /* LeakChecker.mm in Sources */, B45373D12A9FEB0C00807602 /* alloc.c in Sources */, B45373DD2A9FEB5300807602 /* base64-decode.c in Sources */, B45373D22A9FEB0C00807602 /* buflist.c in Sources */, From 18fafa5db6aee17d47bea5d0d8a5bb9ec90c6beb Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 8 Oct 2024 11:19:09 -0400 Subject: [PATCH 33/39] DM XMLs: Remove a couple of clusters/DTs not in 0.9 (#35937) --- .../clusters/DemandResponseLoadControl.xml | 453 ------------------ data_model/1.4/clusters/EnergyCalendar.xml | 287 ----------- data_model/1.4/clusters/Humidistat.xml | 283 ----------- data_model/1.4/clusters/cluster_ids.json | 3 - data_model/1.4/device_types/EnergyTariff.xml | 64 --- .../1.4/device_types/EnergyTariffCalendar.xml | 64 --- .../device_types/HumidifierDehumidifier.xml | 63 --- 7 files changed, 1217 deletions(-) delete mode 100644 data_model/1.4/clusters/DemandResponseLoadControl.xml delete mode 100644 data_model/1.4/clusters/EnergyCalendar.xml delete mode 100644 data_model/1.4/clusters/Humidistat.xml delete mode 100644 data_model/1.4/device_types/EnergyTariff.xml delete mode 100644 data_model/1.4/device_types/EnergyTariffCalendar.xml delete mode 100644 data_model/1.4/device_types/HumidifierDehumidifier.xml diff --git a/data_model/1.4/clusters/DemandResponseLoadControl.xml b/data_model/1.4/clusters/DemandResponseLoadControl.xml deleted file mode 100644 index 1acd1ea26c6088..00000000000000 --- a/data_model/1.4/clusters/DemandResponseLoadControl.xml +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/EnergyCalendar.xml b/data_model/1.4/clusters/EnergyCalendar.xml deleted file mode 100644 index 2ba93203618609..00000000000000 --- a/data_model/1.4/clusters/EnergyCalendar.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/Humidistat.xml b/data_model/1.4/clusters/Humidistat.xml deleted file mode 100644 index 1af54698489d31..00000000000000 --- a/data_model/1.4/clusters/Humidistat.xml +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/cluster_ids.json b/data_model/1.4/clusters/cluster_ids.json index 9de2f243b377d6..687bbc32298a3c 100644 --- a/data_model/1.4/clusters/cluster_ids.json +++ b/data_model/1.4/clusters/cluster_ids.json @@ -64,11 +64,9 @@ "144": "Electrical Power Measurement", "145": "Electrical Energy Measurement", "148": "Water Heater Management", - "150": "Demand Response Load Control", "151": "Messages", "152": "Device Energy Management", "153": "Energy EVSE", - "154": "Energy Calendar", "155": "Energy Preference", "156": "Power Topology", "157": "Energy EVSE Mode", @@ -81,7 +79,6 @@ "513": "Thermostat", "514": "Fan Control", "516": "Thermostat User Interface Configuration", - "517": "Humidistat", "768": "Color Control", "769": "Ballast Configuration", "1024": "Illuminance Measurement", diff --git a/data_model/1.4/device_types/EnergyTariff.xml b/data_model/1.4/device_types/EnergyTariff.xml deleted file mode 100644 index 887bfa420d8fd8..00000000000000 --- a/data_model/1.4/device_types/EnergyTariff.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/device_types/EnergyTariffCalendar.xml b/data_model/1.4/device_types/EnergyTariffCalendar.xml deleted file mode 100644 index 70d74b7239f41c..00000000000000 --- a/data_model/1.4/device_types/EnergyTariffCalendar.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/device_types/HumidifierDehumidifier.xml b/data_model/1.4/device_types/HumidifierDehumidifier.xml deleted file mode 100644 index 973919635fb4ae..00000000000000 --- a/data_model/1.4/device_types/HumidifierDehumidifier.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - \ No newline at end of file From ccd45b0a8c3a4bef7a5ae468ddf5edb758f6d292 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 8 Oct 2024 11:32:25 -0400 Subject: [PATCH 34/39] Add restyled workflow (#35967) * Add restyled workflow * Update pullapprove to look at the restyle workflow * Update comment * Use same checkout command as the rest of the scripts --------- Co-authored-by: Andrei Litvin --- .github/workflows/restyled.yml | 35 +++ .pullapprove.yml | 478 ++++++++++++++++----------------- 2 files changed, 274 insertions(+), 239 deletions(-) create mode 100644 .github/workflows/restyled.yml diff --git a/.github/workflows/restyled.yml b/.github/workflows/restyled.yml new file mode 100644 index 00000000000000..9174483ecb7069 --- /dev/null +++ b/.github/workflows/restyled.yml @@ -0,0 +1,35 @@ +name: Restyled + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + restyled: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: restyled-io/actions/setup@v4 + - id: restyler + uses: restyled-io/actions/run@v4 + with: + fail-on-differences: true + + - if: | + !cancelled() && + steps.restyler.outputs.success == 'true' && + github.event.pull_request.head.repo.full_name == github.repository + uses: peter-evans/create-pull-request@v6 + with: + base: ${{ steps.restyler.outputs.restyled-base }} + branch: ${{ steps.restyler.outputs.restyled-head }} + title: ${{ steps.restyler.outputs.restyled-title }} + body: ${{ steps.restyler.outputs.restyled-body }} + labels: "restyled" + reviewers: ${{ github.event.pull_request.user.login }} + delete-branch: true diff --git a/.pullapprove.yml b/.pullapprove.yml index 83d7b70b34eb65..c8564b7cbf8276 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -8,257 +8,257 @@ github_api_version: "shadow-cat-preview" ############################################################ overrides: - - if: "'hotfix' in labels" - status: success - explanation: "Hotfix label added, bypassing reviews" + - if: "'hotfix' in labels" + status: success + explanation: "Hotfix label added, bypassing reviews" - ############################################################ - # Draft PRs - ############################################################ - - if: "draft" - status: pending - explanation: "PR is draft, pending review" + ############################################################ + # Draft PRs + ############################################################ + - if: "draft" + status: pending + explanation: "PR is draft, pending review" - ############################################################ - # License Checks - ############################################################ - - if: "'*license/cla*' not in statuses.successful" - status: pending - explanation: "CLA must be agreed to by all contributors" + ############################################################ + # License Checks + ############################################################ + - if: "'*license/cla*' not in statuses.successful" + status: pending + explanation: "CLA must be agreed to by all contributors" - ############################################################ - # Conditions to Skip Review - ############################################################ - - if: "base.ref != 'master'" - status: success - explanation: "Review not required unless merging to master" + ############################################################ + # Conditions to Skip Review + ############################################################ + - if: "base.ref != 'master'" + status: success + explanation: "Review not required unless merging to master" - ############################################################ - # Required status checks - ############################################################ - - if: "'*restyle*' not in statuses.successful" - status: failure - explanation: "Style must be inline before reviewing can be complete" + ############################################################ + # Required status checks + ############################################################ + - if: "'*restyled*' not in statuses.successful" + status: failure + explanation: "Restyled workflow must be successful" - ############################################################ - # Require Issues - ############################################################ - # disabling until we have PRs up to date - # - if: "'*issue*' not in statuses.successful" - # status: failure - # explanation: "An issue is required for all PRs" + ############################################################ + # Require Issues + ############################################################ + # disabling until we have PRs up to date + # - if: "'*issue*' not in statuses.successful" + # status: failure + # explanation: "An issue is required for all PRs" - ############################################################ - # Fast tracking - ############################################################ - - if: "'fast track' in labels" - status: success - explanation: "PR has been fast tracked, bypassing reviews" + ############################################################ + # Fast tracking + ############################################################ + - if: "'fast track' in labels" + status: success + explanation: "PR has been fast tracked, bypassing reviews" ############################################################ # Notifications ############################################################ notifications: - ############################################################ - # New contributors - ############################################################ - - when: pull_request.opened - if: "author_association == 'FIRST_TIME_CONTRIBUTOR'" - comment: | - Hey @{{ author }}, thanks for the PR! The review will start once - the tests and CI checks have passed. If they don't, please review - the logs and try to fix the issues (ask for help if you can't - figure it out). A reviewer will be assigned once the tests are - passing and they'll walk you through getting the PR finished - and merged. + ############################################################ + # New contributors + ############################################################ + - when: pull_request.opened + if: "author_association == 'FIRST_TIME_CONTRIBUTOR'" + comment: | + Hey @{{ author }}, thanks for the PR! The review will start once + the tests and CI checks have passed. If they don't, please review + the logs and try to fix the issues (ask for help if you can't + figure it out). A reviewer will be assigned once the tests are + passing and they'll walk you through getting the PR finished + and merged. groups: - ############################################################ - # Shared Reviewer Groups - ############################################################ - shared-reviewers-amazon: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-amazon] - reviews: - request: 0 # Do not auto-add - shared-reviewers-apple: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-apple] - reviews: - request: 0 # Do not auto-add - shared-reviewers-bosch: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-bosch] - reviews: - request: 0 # Do not auto-add - shared-reviewers-comcast: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-comcast] - reviews: - request: 0 # Do not auto-add - shared-reviewers-dyson: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-dyson] - reviews: - request: 0 # Do not auto-add - shared-reviewers-espressif: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-espressif] - reviews: - request: 0 # Do not auto-add - shared-reviewers-google: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-google] - reviews: - request: 0 # Do not auto-add - shared-reviewers-grundfos: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-grundfos] - reviews: - request: 0 # Do not auto-add - shared-reviewers-irobot: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-irobot] - reviews: - request: 0 # Do not auto-add - shared-reviewers-lg: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-lg] - reviews: - request: 0 # Do not auto-add - shared-reviewers-logitech: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-logitech] - reviews: - request: 0 # Requested to be only on demand - shared-reviewers-nordic: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-nordic] - reviews: - request: 0 # Do not auto-add - shared-reviewers-nxp: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-nxp] - reviews: - request: 0 # Do not auto-add - shared-reviewers-samsung: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-samsung] - reviews: - request: 0 # Do not auto-add - shared-reviewers-eve: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-eve] - reviews: - request: 0 # Do not auto-add - # shared-reviewers-signify disabled for now, because the reviewers-signify - # team is empty and pullapprove seems to mis-handle that badly and treats - # _all_ reviewers as being in this group. - # - # See https://github.com/dropseed/pullapprove/issues/71 - # - # shared-reviewers-signify: - # type: optional - # conditions: - # - files.include('*') - # reviewers: - # teams: [reviewers-signify] - # reviews: - # request: 0 # Do not auto-add - shared-reviewers-silabs: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-silabs] - reviews: - request: 0 # Do not auto-add - shared-reviewers-somfy: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-somfy] - reviews: - request: 0 # Do not auto-add - shared-reviewers-tcl: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-tcl] - reviews: - request: 0 # Do not auto-add - shared-reviewers-qorvo: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-qorvo] - reviews: - request: 0 # Do not auto-add + ############################################################ + # Shared Reviewer Groups + ############################################################ + shared-reviewers-amazon: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-amazon] + reviews: + request: 0 # Do not auto-add + shared-reviewers-apple: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-apple] + reviews: + request: 0 # Do not auto-add + shared-reviewers-bosch: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-bosch] + reviews: + request: 0 # Do not auto-add + shared-reviewers-comcast: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-comcast] + reviews: + request: 0 # Do not auto-add + shared-reviewers-dyson: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-dyson] + reviews: + request: 0 # Do not auto-add + shared-reviewers-espressif: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-espressif] + reviews: + request: 0 # Do not auto-add + shared-reviewers-google: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-google] + reviews: + request: 0 # Do not auto-add + shared-reviewers-grundfos: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-grundfos] + reviews: + request: 0 # Do not auto-add + shared-reviewers-irobot: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-irobot] + reviews: + request: 0 # Do not auto-add + shared-reviewers-lg: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-lg] + reviews: + request: 0 # Do not auto-add + shared-reviewers-logitech: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-logitech] + reviews: + request: 0 # Requested to be only on demand + shared-reviewers-nordic: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-nordic] + reviews: + request: 0 # Do not auto-add + shared-reviewers-nxp: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-nxp] + reviews: + request: 0 # Do not auto-add + shared-reviewers-samsung: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-samsung] + reviews: + request: 0 # Do not auto-add + shared-reviewers-eve: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-eve] + reviews: + request: 0 # Do not auto-add + # shared-reviewers-signify disabled for now, because the reviewers-signify + # team is empty and pullapprove seems to mis-handle that badly and treats + # _all_ reviewers as being in this group. + # + # See https://github.com/dropseed/pullapprove/issues/71 + # + # shared-reviewers-signify: + # type: optional + # conditions: + # - files.include('*') + # reviewers: + # teams: [reviewers-signify] + # reviews: + # request: 0 # Do not auto-add + shared-reviewers-silabs: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-silabs] + reviews: + request: 0 # Do not auto-add + shared-reviewers-somfy: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-somfy] + reviews: + request: 0 # Do not auto-add + shared-reviewers-tcl: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-tcl] + reviews: + request: 0 # Do not auto-add + shared-reviewers-qorvo: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-qorvo] + reviews: + request: 0 # Do not auto-add - ############################################################ - # Base Required Reviewers - ############################################################ - required-reviewers: - description: > - [Required - Reviewers](https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#review-requirements) - This is the main group of required reviews for general pull - requests. - type: required - requirements: - - len(groups.approved.include('shared-reviewers-*')) >= 2 - reviews: - required: 0 - labels: - approved: "review - approved" - pending: "review - pending" - rejected: "review - changed requested" + ############################################################ + # Base Required Reviewers + ############################################################ + required-reviewers: + description: > + [Required + Reviewers](https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#review-requirements) + This is the main group of required reviews for general pull + requests. + type: required + requirements: + - len(groups.approved.include('shared-reviewers-*')) >= 2 + reviews: + required: 0 + labels: + approved: "review - approved" + pending: "review - pending" + rejected: "review - changed requested" From f7600dffd911f3e1ab080dda00ff3aa0a8a545fb Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 8 Oct 2024 11:43:28 -0400 Subject: [PATCH 35/39] Fix mis-quote in pullapprove (#35968) Co-authored-by: Andrei Litvin --- .pullapprove.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pullapprove.yml b/.pullapprove.yml index c8564b7cbf8276..30ebc463432806 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -36,7 +36,7 @@ overrides: ############################################################ # Required status checks ############################################################ - - if: "'*restyled*' not in statuses.successful" + - if: "*restyled*' not in statuses.successful" status: failure explanation: "Restyled workflow must be successful" From ca70de28d578deeca0ad75783f54aeea070619c5 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 8 Oct 2024 11:47:36 -0400 Subject: [PATCH 36/39] Use check runs for checking restyle workflow (#35969) * Fix mis-quote in pullapprove * Another fix * Move the check in check_runs --------- Co-authored-by: Andrei Litvin --- .pullapprove.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pullapprove.yml b/.pullapprove.yml index 30ebc463432806..8a81d7da1e60f0 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -36,7 +36,7 @@ overrides: ############################################################ # Required status checks ############################################################ - - if: "*restyled*' not in statuses.successful" + - if: "'restyled' not in check_runs.successful" status: failure explanation: "Restyled workflow must be successful" From 7c68210af5303f16e74c3736ee8ee01cfbea734c Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 8 Oct 2024 12:04:26 -0400 Subject: [PATCH 37/39] Remove restyle check in pullapprove: moved this requirement to the branch security (#35970) Co-authored-by: Andrei Litvin --- .pullapprove.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.pullapprove.yml b/.pullapprove.yml index 8a81d7da1e60f0..81267526ee8e21 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -33,13 +33,6 @@ overrides: status: success explanation: "Review not required unless merging to master" - ############################################################ - # Required status checks - ############################################################ - - if: "'restyled' not in check_runs.successful" - status: failure - explanation: "Restyled workflow must be successful" - ############################################################ # Require Issues ############################################################ From 0a2e58d0fe2b4d64b7501d42e9c062bc16bfb303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Tomkiel?= Date: Tue, 8 Oct 2024 18:19:59 +0200 Subject: [PATCH 38/39] [devcontainer] Add icecc cluster compilation (#35502) * Add script to start/stop iceccd * Add icecc and ccache * Add ninja-jobs flag * Restyled by whitespace * Restyled by isort * Allow ninja-jobs to be 0 * Fix icecc.sh * Add ninja_jobs to non-GN targets * Add better env var description Co-authored-by: Arkadiusz Bokowy * Restyled by autopep8 * Fix formatting * Restyled by isort --------- Co-authored-by: Restyled.io Co-authored-by: Arkadiusz Bokowy --- .devcontainer/Dockerfile | 11 ++++++++++ scripts/build/build/__init__.py | 8 ++++--- scripts/build/build/target.py | 3 ++- scripts/build/build_examples.py | 13 ++++++++--- scripts/build/builders/ameba.py | 8 +++++-- scripts/build/builders/android.py | 7 +++++- scripts/build/builders/gn.py | 2 ++ scripts/build/builders/host.py | 9 +++++++- scripts/build/builders/nrf.py | 8 +++++-- scripts/build/builders/telink.py | 3 +++ scripts/icecc.sh | 36 +++++++++++++++++++++++++++++++ 11 files changed, 95 insertions(+), 13 deletions(-) create mode 100755 scripts/icecc.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 386253bb609e8e..3d2c6295f88f0c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -37,6 +37,7 @@ RUN apt-get update \ valgrind \ docker.io \ iputils-ping \ + icecc \ && : RUN groupadd -g $USER_GID $USERNAME \ @@ -80,3 +81,13 @@ ENV TIZEN_ROOTFS /tizen_rootfs # Fast Model GDB plugins path for debugging support ENV FAST_MODEL_PLUGINS_PATH /opt/FastModelsPortfolio_11.16/plugins/Linux64_GCC-9.3 + +# Set up ccache as a pigweed command launcher when using the scripts/build/build_examples.py +# script. Also, set up icecc as the command prefix for ccache. Such setup allows to benefit +# from compilation caching and distributed compilation at the same time. +# +# NOTE: In order to use distributed compilation with icecc, one should run +# "scripts/icecc.sh start" before starting the build. +ENV CHIP_PW_COMMAND_LAUNCHER ccache +ENV CCACHE_PREFIX icecc +ENV PATH /usr/lib/ccache:$PATH diff --git a/scripts/build/build/__init__.py b/scripts/build/build/__init__.py index c363f6c3266f84..5f3cbbab362904 100644 --- a/scripts/build/build/__init__.py +++ b/scripts/build/build/__init__.py @@ -4,9 +4,10 @@ from enum import Enum, auto from typing import Sequence -from .targets import BUILD_TARGETS from builders.builder import BuilderOptions +from .targets import BUILD_TARGETS + class BuildSteps(Enum): GENERATED = auto() @@ -18,11 +19,12 @@ class Context: to generate make/ninja instructions and to compile. """ - def __init__(self, runner, repository_path: str, output_prefix: str): + def __init__(self, runner, repository_path: str, output_prefix: str, ninja_jobs: int): self.builders = [] self.runner = runner self.repository_path = repository_path self.output_prefix = output_prefix + self.ninja_jobs = ninja_jobs self.completed_steps = set() def SetupBuilders(self, targets: Sequence[str], options: BuilderOptions): @@ -36,7 +38,7 @@ def SetupBuilders(self, targets: Sequence[str], options: BuilderOptions): found = False for choice in BUILD_TARGETS: builder = choice.Create(target, self.runner, self.repository_path, - self.output_prefix, options) + self.output_prefix, self.ninja_jobs, options) if builder: self.builders.append(builder) found = True diff --git a/scripts/build/build/target.py b/scripts/build/build/target.py index 7f1716170178a8..78e4599fb51b75 100644 --- a/scripts/build/build/target.py +++ b/scripts/build/build/target.py @@ -389,7 +389,7 @@ def StringIntoTargetParts(self, value: str): return _StringIntoParts(value, suffix, self.fixed_targets, self.modifiers) def Create(self, name: str, runner, repository_path: str, output_prefix: str, - builder_options: BuilderOptions): + ninja_jobs: int, builder_options: BuilderOptions): parts = self.StringIntoTargetParts(name) @@ -406,6 +406,7 @@ def Create(self, name: str, runner, repository_path: str, output_prefix: str, builder.target = self builder.identifier = name builder.output_dir = os.path.join(output_prefix, name) + builder.ninja_jobs = ninja_jobs builder.chip_dir = os.path.abspath(repository_path) builder.options = builder_options diff --git a/scripts/build/build_examples.py b/scripts/build/build_examples.py index e1f37fca797d7f..171c788c058424 100755 --- a/scripts/build/build_examples.py +++ b/scripts/build/build_examples.py @@ -104,6 +104,13 @@ def ValidateTargetNames(context, parameter, values): default='./out', type=click.Path(file_okay=False, resolve_path=True), help='Prefix for the generated file output.') +@click.option( + '--ninja-jobs', + type=int, + is_flag=False, + flag_value=0, + default=None, + help='Number of ninja jobs') @click.option( '--pregen-dir', default=None, @@ -136,8 +143,8 @@ def ValidateTargetNames(context, parameter, values): 'for using ccache when building examples.')) @click.pass_context def main(context, log_level, target, enable_link_map_file, repo, - out_prefix, pregen_dir, clean, dry_run, dry_run_output, enable_flashbundle, - no_log_timestamps, pw_command_launcher): + out_prefix, ninja_jobs, pregen_dir, clean, dry_run, dry_run_output, + enable_flashbundle, no_log_timestamps, pw_command_launcher): # Ensures somewhat pretty logging of what is going on log_fmt = '%(asctime)s %(levelname)-7s %(message)s' if no_log_timestamps: @@ -161,7 +168,7 @@ def main(context, log_level, target, enable_link_map_file, repo, logging.info('Building targets: %s', CommaSeparate(requested_targets)) context.obj = build.Context( - repository_path=repo, output_prefix=out_prefix, runner=runner) + repository_path=repo, output_prefix=out_prefix, ninja_jobs=ninja_jobs, runner=runner) context.obj.SetupBuilders(targets=requested_targets, options=BuilderOptions( enable_link_map_file=enable_link_map_file, enable_flashbundle=enable_flashbundle, diff --git a/scripts/build/builders/ameba.py b/scripts/build/builders/ameba.py index 802ce1f73cbe62..a4b3338b0cb3ad 100644 --- a/scripts/build/builders/ameba.py +++ b/scripts/build/builders/ameba.py @@ -85,8 +85,12 @@ def generate(self): title='Generating ' + self.identifier) def _build(self): - self._Execute(['ninja', '-C', self.output_dir], - title='Building ' + self.identifier) + cmd = ['ninja', '-C', self.output_dir] + + if self.ninja_jobs is not None: + cmd.append('-j' + str(self.ninja_jobs)) + + self._Execute(cmd, title='Building ' + self.identifier) def build_outputs(self): yield BuilderOutput( diff --git a/scripts/build/builders/android.py b/scripts/build/builders/android.py index 94d3a566a63877..3f640177f190ad 100644 --- a/scripts/build/builders/android.py +++ b/scripts/build/builders/android.py @@ -466,8 +466,13 @@ def _build(self): title="Building APP " + self.identifier, ) else: + cmd = ["ninja", "-C", self.output_dir] + + if self.ninja_jobs is not None: + cmd.append('-j' + str(self.ninja_jobs)) + self._Execute( - ["ninja", "-C", self.output_dir], + cmd, title="Building JNI " + self.identifier, ) diff --git a/scripts/build/builders/gn.py b/scripts/build/builders/gn.py index d2b09f393c1597..6d9385bd4fc2aa 100644 --- a/scripts/build/builders/gn.py +++ b/scripts/build/builders/gn.py @@ -95,6 +95,8 @@ def _build(self): self.PreBuildCommand() cmd = ['ninja', '-C', self.output_dir] + if self.ninja_jobs is not None: + cmd.append('-j' + str(self.ninja_jobs)) if self.build_command: cmd.append(self.build_command) diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index a07064795a1c54..8d209d6d29bf3f 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -570,7 +570,14 @@ def generate(self): def PreBuildCommand(self): if self.app == HostApp.TESTS and self.use_coverage: - self._Execute(['ninja', '-C', self.output_dir, 'default'], title="Build-only") + cmd = ['ninja', '-C', self.output_dir] + + if self.ninja_jobs is not None: + cmd.append('-j' + str(self.ninja_jobs)) + + cmd.append('default') + + self._Execute(cmd, title="Build-only") self._Execute(['lcov', '--initial', '--capture', '--directory', os.path.join(self.output_dir, 'obj'), '--exclude', os.path.join(self.chip_dir, '**/tests/*'), '--exclude', os.path.join(self.chip_dir, 'zzz_generated/*'), diff --git a/scripts/build/builders/nrf.py b/scripts/build/builders/nrf.py index 5fbc417ffe2c13..b94a695359752c 100644 --- a/scripts/build/builders/nrf.py +++ b/scripts/build/builders/nrf.py @@ -215,8 +215,12 @@ def generate(self): def _build(self): logging.info('Compiling NrfConnect at %s', self.output_dir) - self._Execute(['ninja', '-C', self.output_dir], - title='Building ' + self.identifier) + cmd = ['ninja', '-C', self.output_dir] + + if self.ninja_jobs is not None: + cmd.append('-j' + str(self.ninja_jobs)) + + self._Execute(cmd, title='Building ' + self.identifier) if self.app == NrfApp.UNIT_TESTS: # Note: running zephyr/zephyr.elf has the same result except it creates diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index 6ac4c30ca241f5..2badbce4d131eb 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -238,6 +238,9 @@ def _build(self): cmd = self.get_cmd_prefixes() + ("ninja -C %s" % self.output_dir) + if self.ninja_jobs is not None: + cmd += " -j%s" % str(self.ninja_jobs) + self._Execute(['bash', '-c', cmd], title='Building ' + self.identifier) def build_outputs(self): diff --git a/scripts/icecc.sh b/scripts/icecc.sh new file mode 100755 index 00000000000000..54783a4874b186 --- /dev/null +++ b/scripts/icecc.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This scripts starts or stops the iceccd. +# It's meant to be use within devcontainer. + +if [ "$1" = "start" ]; then + IFS='.' read -ra PARTS <<<"$HOSTNAME" + if iceccd -d -m 0 -N "devcontainer-${PARTS[0]}"; then + echo "iceccd started" + else + echo "Failed to start iceccd" + fi +fi + +if [ "$1" = "stop" ]; then + if pkill icecc; then + echo "iceccd stopped" + else + echo "Failed to stop iceccd" + fi +fi From 4a21a8dcc6307d4f2d2777f61abe15d01a4c0322 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 8 Oct 2024 20:53:04 +0200 Subject: [PATCH 39/39] [AllClusters] If opened multiple times and something fails in Init, closing the app with Ctrl^C makes it crashes (#35844) * [InteractionModelEngine] Add some checks to Shutdown to prevent crashing if someone calls Shutdown before Init * [CommissioningWindowManager] Ensure Shutdown does nothing if Init has not been called --- src/app/InteractionModelEngine.cpp | 6 ++++++ src/app/InteractionModelEngine.h | 8 ++++++++ src/app/server/CommissioningWindowManager.cpp | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index b122333ac27a17..59888feaf916b7 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -89,6 +89,7 @@ CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeM VerifyOrReturnError(apExchangeMgr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(reportScheduler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + mState = State::kInitializing; mpExchangeMgr = apExchangeMgr; mpFabricTable = apFabricTable; mpCASESessionMgr = apCASESessionMgr; @@ -111,11 +112,14 @@ CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeM ChipLogError(InteractionModel, "WARNING └────────────────────────────────────────────────────"); #endif + mState = State::kInitialized; return CHIP_NO_ERROR; } void InteractionModelEngine::Shutdown() { + VerifyOrReturn(State::kUninitialized != mState); + mpExchangeMgr->GetSessionManager()->SystemLayer()->CancelTimer(ResumeSubscriptionsTimerCallback, this); // TODO: individual object clears the entire command handler interface registry. @@ -187,6 +191,8 @@ void InteractionModelEngine::Shutdown() // // mpFabricTable = nullptr; // mpExchangeMgr = nullptr; + + mState = State::kUninitialized; } uint32_t InteractionModelEngine::GetNumActiveReadHandlers() const diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index ba0a099bb7bdb8..b52b4eb451fc5c 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -713,6 +713,14 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, DataModel::Provider * mDataModelProvider = nullptr; Messaging::ExchangeContext * mCurrentExchange = nullptr; + enum class State : uint8_t + { + kUninitialized, // The object has not been initialized. + kInitializing, // Initial setup is in progress (e.g. setting up mpExchangeMgr). + kInitialized // The object has been fully initialized and is ready for use. + }; + State mState = State::kUninitialized; + // Changes the current exchange context of a InteractionModelEngine to a given context class CurrentExchangeValueScope { diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 110a729d8f1b87..2a8611ba345949 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -111,6 +111,8 @@ void CommissioningWindowManager::OnPlatformEvent(const DeviceLayer::ChipDeviceEv void CommissioningWindowManager::Shutdown() { + VerifyOrReturn(nullptr != mServer); + StopAdvertisement(/* aShuttingDown = */ true); ResetState();