From 265748191973a761a4ff7a7a59921676a2aa8f84 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 18 May 2021 03:40:58 +0200 Subject: [PATCH] Chip tool operational credentials cluster fix (#6873) * Update templates to get chip-tool working with the operation credentials cluster * Update gen/ folders --- examples/chip-tool/chip-tool.zap | 196 ++++++++++-------- .../chip-tool/commands/clusters/Commands.h | 145 +++++++++++-- .../chip-tool/gen/CHIPClientCallbacks.cpp | 101 +++++++-- examples/chip-tool/gen/CHIPClientCallbacks.h | 5 + examples/chip-tool/gen/CHIPClusters.cpp | 64 ++++++ examples/chip-tool/gen/CHIPClusters.h | 7 + .../chip-tool/gen/IMClusterCommandHandler.cpp | 167 +++++++++++++++ .../chip-tool/gen/call-command-handler.cpp | 94 +++++++++ examples/chip-tool/gen/callback.h | 16 ++ examples/chip-tool/gen/endpoint_config.h | 6 +- examples/chip-tool/templates/commands.zapt | 32 +-- .../zap-templates/common/ClustersHelper.js | 27 +++ .../app/CHIPClientCallbacks-src.zapt | 5 + .../zap-templates/templates/chip/helper.js | 8 - .../python/gen/CHIPClientCallbacks.cpp | 78 ++++--- .../CHIP/gen/CHIPClientCallbacks.cpp | 63 ++++-- .../Framework/CHIP/gen/CHIPClustersObjc.mm | 12 +- .../CHIP/templates/CHIPClustersObjc-src.zapt | 4 +- 18 files changed, 826 insertions(+), 204 deletions(-) diff --git a/examples/chip-tool/chip-tool.zap b/examples/chip-tool/chip-tool.zap index 3507459c7d090a..e057b0430b7873 100644 --- a/examples/chip-tool/chip-tool.zap +++ b/examples/chip-tool/chip-tool.zap @@ -1510,6 +1510,88 @@ } ] }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "name": "NetworkInterfaces", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RebootCount", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Thread Network Diagnostics", "code": 53, @@ -2462,88 +2544,6 @@ } ] }, - { - "name": "General Diagnostics", - "code": 51, - "mfgCode": null, - "define": "GENERAL_DIAGNOSTICS_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "client", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0001", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, - { - "name": "General Diagnostics", - "code": 51, - "mfgCode": null, - "define": "GENERAL_DIAGNOSTICS_CLUSTER", - "side": "server", - "enabled": 0, - "commands": [], - "attributes": [ - { - "name": "NetworkInterfaces", - "code": 0, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "RebootCount", - "code": 1, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0001", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, { "name": "Switch", "code": 59, @@ -2657,6 +2657,22 @@ "incoming": 1, "outgoing": 1 }, + { + "name": "OpCSRRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddOpCert", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, { "name": "UpdateFabricLabel", "code": 9, @@ -2715,6 +2731,22 @@ "source": "server", "incoming": 1, "outgoing": 1 + }, + { + "name": "OpCSRResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "OpCertResponse", + "code": 8, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 } ], "attributes": [ diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index a5b097a2b65ee4..58dfc19852a7ba 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -116,12 +116,7 @@ static void OnInt64sAttributeResponse(void * context, int64_t value) static void OnStringAttributeResponse(void * context, const chip::ByteSpan value) { - char * str = (char *) malloc(value.size() * sizeof(char)); - memmove(str, value.data(), value.size()); - str[value.size()] = '\0'; - free(str); - - ChipLogProgress(chipTool, "String attribute Response: %s (%" PRIu16 ")", str, strlen(str)); + ChipLogProgress(chipTool, "String attribute Response: %zu", value.size()); ModelCommand * command = reinterpret_cast(context); command->SetCommandExitStatus(true); @@ -575,6 +570,25 @@ static void OnNetworkCommissioningClusterUpdateWiFiNetworkResponse(void * contex command->SetCommandExitStatus(true); } +static void OnOperationalCredentialsClusterOpCSRResponse(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce, + chip::ByteSpan VendorReserved1, chip::ByteSpan VendorReserved2, + chip::ByteSpan VendorReserved3, chip::ByteSpan Signature) +{ + ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCSRResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnOperationalCredentialsClusterOpCertResponse(void * context, uint8_t StatusCode, uint64_t FabricIndex, + uint8_t * DebugText) +{ + ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCertResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnOperationalCredentialsClusterSetFabricResponse(void * context, chip::FabricId FabricId) { ChipLogProgress(chipTool, "OperationalCredentialsClusterSetFabricResponse"); @@ -682,7 +696,7 @@ static void OnAudioOutputAudioOutputListListAttributeResponse(void * context, ui ChipLogProgress(chipTool, "AudioOutputInfo[%lu]:", i); ChipLogProgress(chipTool, " index: %" PRIu8 "", entries[i].index); ChipLogProgress(chipTool, " outputType: %" PRIu8 "", entries[i].outputType); - ChipLogProgress(chipTool, " name: %s", entries[i].name); + ChipLogProgress(Zcl, " name: %zu", entries[i].name.size()); } ModelCommand * command = reinterpret_cast(context); @@ -695,7 +709,7 @@ static void OnContentLaunchAcceptsHeaderListListAttributeResponse(void * context for (uint16_t i = 0; i < count; i++) { - ChipLogProgress(chipTool, "OCTET_STRING[%lu]: %s", i, entries[i]); + ChipLogProgress(Zcl, " : %zu", entries[i].size()); } ModelCommand * command = reinterpret_cast(context); @@ -777,7 +791,7 @@ static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse(void * co for (uint16_t i = 0; i < count; i++) { ChipLogProgress(chipTool, "NetworkInterfaceType[%lu]:", i); - ChipLogProgress(chipTool, " Name: %s", entries[i].Name); + ChipLogProgress(Zcl, " Name: %zu", entries[i].Name.size()); ChipLogProgress(chipTool, " FabricConnected: %" PRIu8 "", entries[i].FabricConnected); ChipLogProgress(chipTool, " OffPremiseServicesReachableIPv4: %" PRIu8 "", entries[i].OffPremiseServicesReachableIPv4); ChipLogProgress(chipTool, " OffPremiseServicesReachableIPv6: %" PRIu8 "", entries[i].OffPremiseServicesReachableIPv6); @@ -814,7 +828,7 @@ static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, u ChipLogProgress(chipTool, "GroupKey[%lu]:", i); ChipLogProgress(chipTool, " VendorId: %" PRIu16 "", entries[i].VendorId); ChipLogProgress(chipTool, " GroupKeyIndex: %" PRIu16 "", entries[i].GroupKeyIndex); - ChipLogProgress(chipTool, " GroupKeyRoot: %s", entries[i].GroupKeyRoot); + ChipLogProgress(Zcl, " GroupKeyRoot: %zu", entries[i].GroupKeyRoot.size()); ChipLogProgress(chipTool, " GroupKeyEpochStartTime: %" PRIu64 "", entries[i].GroupKeyEpochStartTime); ChipLogProgress(chipTool, " GroupKeySecurityPolicy: %" PRIu8 "", entries[i].GroupKeySecurityPolicy); } @@ -832,8 +846,8 @@ static void OnMediaInputMediaInputListListAttributeResponse(void * context, uint ChipLogProgress(chipTool, "MediaInputInfo[%lu]:", i); ChipLogProgress(chipTool, " index: %" PRIu8 "", entries[i].index); ChipLogProgress(chipTool, " inputType: %" PRIu8 "", entries[i].inputType); - ChipLogProgress(chipTool, " name: %s", entries[i].name); - ChipLogProgress(chipTool, " description: %s", entries[i].description); + ChipLogProgress(Zcl, " name: %zu", entries[i].name.size()); + ChipLogProgress(Zcl, " description: %zu", entries[i].description.size()); } ModelCommand * command = reinterpret_cast(context); @@ -865,9 +879,9 @@ static void OnTvChannelTvChannelListListAttributeResponse(void * context, uint16 ChipLogProgress(chipTool, "TvChannelInfo[%lu]:", i); ChipLogProgress(chipTool, " majorNumber: %" PRIu16 "", entries[i].majorNumber); ChipLogProgress(chipTool, " minorNumber: %" PRIu16 "", entries[i].minorNumber); - ChipLogProgress(chipTool, " name: %s", entries[i].name); - ChipLogProgress(chipTool, " callSign: %s", entries[i].callSign); - ChipLogProgress(chipTool, " affiliateCallSign: %s", entries[i].affiliateCallSign); + ChipLogProgress(Zcl, " name: %zu", entries[i].name.size()); + ChipLogProgress(Zcl, " callSign: %zu", entries[i].callSign.size()); + ChipLogProgress(Zcl, " affiliateCallSign: %zu", entries[i].affiliateCallSign.size()); } ModelCommand * command = reinterpret_cast(context); @@ -883,7 +897,7 @@ static void OnTargetNavigatorTargetNavigatorListListAttributeResponse(void * con { ChipLogProgress(chipTool, "NavigateTargetTargetInfo[%lu]:", i); ChipLogProgress(chipTool, " identifier: %" PRIu8 "", entries[i].identifier); - ChipLogProgress(chipTool, " name: %s", entries[i].name); + ChipLogProgress(Zcl, " name: %zu", entries[i].name.size()); } ModelCommand * command = reinterpret_cast(context); @@ -909,7 +923,7 @@ static void OnTestClusterListOctetStringListAttributeResponse(void * context, ui for (uint16_t i = 0; i < count; i++) { - ChipLogProgress(chipTool, "OCTET_STRING[%lu]: %s", i, entries[i]); + ChipLogProgress(Zcl, " : %zu", entries[i].size()); } ModelCommand * command = reinterpret_cast(context); @@ -924,7 +938,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte { ChipLogProgress(chipTool, "TestListStructOctet[%lu]:", i); ChipLogProgress(chipTool, " fabricIndex: %" PRIu64 "", entries[i].fabricIndex); - ChipLogProgress(chipTool, " operationalCert: %s", entries[i].operationalCert); + ChipLogProgress(Zcl, " operationalCert: %zu", entries[i].operationalCert.size()); } ModelCommand * command = reinterpret_cast(context); @@ -10803,6 +10817,8 @@ class ReadOnOffClusterRevision : public ModelCommand | Cluster OperationalCredentials | 0x003E | |------------------------------------------------------------------------------| | Commands: | | +| * AddOpCert | 0x06 | +| * OpCSRRequest | 0x04 | | * RemoveAllFabrics | 0x0B | | * RemoveFabric | 0x0A | | * SetFabric | 0x00 | @@ -10813,6 +10829,88 @@ class ReadOnOffClusterRevision : public ModelCommand | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ +/* + * Command AddOpCert + */ +class OperationalCredentialsAddOpCert : public ModelCommand +{ +public: + OperationalCredentialsAddOpCert() : ModelCommand("add-op-cert") + { + AddArgument("noc", &mNoc); + AddArgument("iCACertificate", &mICACertificate); + AddArgument("iPKValue", &mIPKValue); + AddArgument("caseAdminNode", 0, UINT64_MAX, &mCaseAdminNode); + AddArgument("adminVendorId", 0, UINT16_MAX, &mAdminVendorId); + ModelCommand::AddArguments(); + } + ~OperationalCredentialsAddOpCert() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003E) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, endpointId); + return cluster.AddOpCert( + onSuccessCallback->Cancel(), onFailureCallback->Cancel(), chip::ByteSpan(chip::Uint8::from_char(mNoc), strlen(mNoc)), + chip::ByteSpan(chip::Uint8::from_char(mICACertificate), strlen(mICACertificate)), + chip::ByteSpan(chip::Uint8::from_char(mIPKValue), strlen(mIPKValue)), mCaseAdminNode, mAdminVendorId); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnOperationalCredentialsClusterOpCertResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mNoc; + char * mICACertificate; + char * mIPKValue; + chip::NodeId mCaseAdminNode; + uint16_t mAdminVendorId; +}; + +/* + * Command OpCSRRequest + */ +class OperationalCredentialsOpCSRRequest : public ModelCommand +{ +public: + OperationalCredentialsOpCSRRequest() : ModelCommand("op-csrrequest") + { + AddArgument("cSRNonce", &mCSRNonce); + ModelCommand::AddArguments(); + } + ~OperationalCredentialsOpCSRRequest() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003E) command (0x04) on endpoint %" PRIu16, endpointId); + + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, endpointId); + return cluster.OpCSRRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mCSRNonce), strlen(mCSRNonce))); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnOperationalCredentialsClusterOpCSRResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mCSRNonce; +}; + /* * Command RemoveAllFabrics */ @@ -10871,8 +10969,9 @@ class OperationalCredentialsRemoveFabric : public ModelCommand } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnOperationalCredentialsClusterOpCertResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); chip::FabricId mFabricId; @@ -10943,8 +11042,9 @@ class OperationalCredentialsUpdateFabricLabel : public ModelCommand } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnOperationalCredentialsClusterOpCertResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); char * mLabel; @@ -15345,6 +15445,7 @@ void registerClusterOperationalCredentials(Commands & commands) const char * clusterName = "OperationalCredentials"; commands_list clusterCommands = { + make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.cpp b/examples/chip-tool/gen/CHIPClientCallbacks.cpp index cb0fa6c0356806..e27275b3589809 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.cpp +++ b/examples/chip-tool/gen/CHIPClientCallbacks.cpp @@ -1194,7 +1194,8 @@ bool emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16 bool emberAfAccountLoginClusterGetSetupPINResponseCallback(chip::app::Command * commandObj, uint8_t * setupPIN) { ChipLogProgress(Zcl, "GetSetupPINResponse:"); - ChipLogProgress(Zcl, " setupPIN: %s", setupPIN); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " setupPIN: %.*s", setupPIN.size(), setupPIN.data()); GET_CLUSTER_RESPONSE_CALLBACKS("AccountLoginClusterGetSetupPINResponseCallback"); @@ -1208,7 +1209,8 @@ bool emberAfApplicationLauncherClusterLaunchAppResponseCallback(chip::app::Comma { ChipLogProgress(Zcl, "LaunchAppResponse:"); LogStatus(status); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); GET_CLUSTER_RESPONSE_CALLBACKS("ApplicationLauncherClusterLaunchAppResponseCallback"); @@ -1230,7 +1232,8 @@ bool emberAfContentLaunchClusterLaunchContentResponseCallback(chip::app::Command uint8_t contentLaunchStatus) { ChipLogProgress(Zcl, "LaunchContentResponse:"); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); ChipLogProgress(Zcl, " contentLaunchStatus: %" PRIu8 "", contentLaunchStatus); GET_CLUSTER_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchContentResponseCallback"); @@ -1245,7 +1248,8 @@ bool emberAfContentLaunchClusterLaunchURLResponseCallback(chip::app::Command * c uint8_t contentLaunchStatus) { ChipLogProgress(Zcl, "LaunchURLResponse:"); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); ChipLogProgress(Zcl, " contentLaunchStatus: %" PRIu8 "", contentLaunchStatus); GET_CLUSTER_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchURLResponseCallback"); @@ -1441,7 +1445,8 @@ bool emberAfDoorLockClusterGetLogRecordResponseCallback(chip::app::Command * com ChipLogProgress(Zcl, " source: %" PRIu8 "", source); ChipLogProgress(Zcl, " eventIdOrAlarmCode: %" PRIu8 "", eventIdOrAlarmCode); ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); - ChipLogProgress(Zcl, " pin: %s", pin); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " pin: %.*s", pin.size(), pin.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetLogRecordResponseCallback"); @@ -1458,7 +1463,8 @@ bool emberAfDoorLockClusterGetPinResponseCallback(chip::app::Command * commandOb ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); ChipLogProgress(Zcl, " userStatus: %" PRIu8 "", userStatus); ChipLogProgress(Zcl, " userType: %" PRIu8 "", userType); - ChipLogProgress(Zcl, " pin: %s", pin); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " pin: %.*s", pin.size(), pin.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetPinResponseCallback"); @@ -1475,7 +1481,8 @@ bool emberAfDoorLockClusterGetRfidResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); ChipLogProgress(Zcl, " userStatus: %" PRIu8 "", userStatus); ChipLogProgress(Zcl, " userType: %" PRIu8 "", userType); - ChipLogProgress(Zcl, " rfid: %s", rfid); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " rfid: %.*s", rfid.size(), rfid.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetRfidResponseCallback"); @@ -1749,7 +1756,8 @@ bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Co { ChipLogProgress(Zcl, "ArmFailSafeResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterArmFailSafeResponseCallback"); @@ -1764,7 +1772,8 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chi { ChipLogProgress(Zcl, "CommissioningCompleteResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterCommissioningCompleteResponseCallback"); @@ -1779,7 +1788,8 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(chip: { ChipLogProgress(Zcl, "SetRegulatoryConfigResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterSetRegulatoryConfigResponseCallback"); @@ -1855,7 +1865,8 @@ bool emberAfGroupsClusterViewGroupResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, "ViewGroupResponse:"); LogStatus(status); ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " groupName: %s", groupName); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " groupName: %.*s", groupName.size(), groupName.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GroupsClusterViewGroupResponseCallback"); @@ -2055,7 +2066,8 @@ bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(chip::ap { ChipLogProgress(Zcl, "AddThreadNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddThreadNetworkResponseCallback"); @@ -2070,7 +2082,8 @@ bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(chip::app: { ChipLogProgress(Zcl, "AddWiFiNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddWiFiNetworkResponseCallback"); @@ -2085,7 +2098,8 @@ bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(chip::app: { ChipLogProgress(Zcl, "DisableNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterDisableNetworkResponseCallback"); @@ -2100,7 +2114,8 @@ bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(chip::app:: { ChipLogProgress(Zcl, "EnableNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterEnableNetworkResponseCallback"); @@ -2115,7 +2130,8 @@ bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(chip::app:: { ChipLogProgress(Zcl, "RemoveNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterRemoveNetworkResponseCallback"); @@ -2132,7 +2148,8 @@ bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( { ChipLogProgress(Zcl, "ScanNetworksResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); ChipLogProgress(Zcl, " wifiScanResults: %p", wifiScanResults); ChipLogProgress(Zcl, " threadScanResults: %p", threadScanResults); @@ -2149,7 +2166,8 @@ bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(chip: { ChipLogProgress(Zcl, "UpdateThreadNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateThreadNetworkResponseCallback"); @@ -2164,7 +2182,8 @@ bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::a { ChipLogProgress(Zcl, "UpdateWiFiNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback"); @@ -2174,6 +2193,44 @@ bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::a return true; } +bool emberAfOperationalCredentialsClusterOpCSRResponseCallback(chip::app::Command * commandObj, chip::ByteSpan CSR, + chip::ByteSpan CSRNonce, chip::ByteSpan VendorReserved1, + chip::ByteSpan VendorReserved2, chip::ByteSpan VendorReserved3, + chip::ByteSpan Signature) +{ + ChipLogProgress(Zcl, "OpCSRResponse:"); + ChipLogProgress(Zcl, " CSR: %zu", CSR.size()); + ChipLogProgress(Zcl, " CSRNonce: %zu", CSRNonce.size()); + ChipLogProgress(Zcl, " VendorReserved1: %zu", VendorReserved1.size()); + ChipLogProgress(Zcl, " VendorReserved2: %zu", VendorReserved2.size()); + ChipLogProgress(Zcl, " VendorReserved3: %zu", VendorReserved3.size()); + ChipLogProgress(Zcl, " Signature: %zu", Signature.size()); + + GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterOpCSRResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, CSR, CSRNonce, VendorReserved1, VendorReserved2, VendorReserved3, Signature); + return true; +} + +bool emberAfOperationalCredentialsClusterOpCertResponseCallback(chip::app::Command * commandObj, uint8_t StatusCode, + uint64_t FabricIndex, uint8_t * DebugText) +{ + ChipLogProgress(Zcl, "OpCertResponse:"); + ChipLogProgress(Zcl, " StatusCode: %" PRIu8 "", StatusCode); + ChipLogProgress(Zcl, " FabricIndex: %" PRIu64 "", FabricIndex); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " DebugText: %.*s", DebugText.size(), DebugText.data()); + + GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterOpCertResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, StatusCode, FabricIndex, DebugText); + return true; +} + bool emberAfOperationalCredentialsClusterSetFabricResponseCallback(chip::app::Command * commandObj, chip::FabricId FabricId) { ChipLogProgress(Zcl, "SetFabricResponse:"); @@ -2317,7 +2374,8 @@ bool emberAfScenesClusterViewSceneResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); ChipLogProgress(Zcl, " transitionTime: %" PRIu16 "", transitionTime); - ChipLogProgress(Zcl, " sceneName: %s", sceneName); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " sceneName: %.*s", sceneName.size(), sceneName.data()); ChipLogProgress(Zcl, " extensionFieldSets: %p", extensionFieldSets); GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterViewSceneResponseCallback"); @@ -2356,7 +2414,8 @@ bool emberAfTargetNavigatorClusterNavigateTargetResponseCallback(chip::app::Comm { ChipLogProgress(Zcl, "NavigateTargetResponse:"); LogStatus(status); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); GET_CLUSTER_RESPONSE_CALLBACKS("TargetNavigatorClusterNavigateTargetResponseCallback"); diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.h b/examples/chip-tool/gen/CHIPClientCallbacks.h index 1ab470a9a0f591..4208858a9a3a6b 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.h +++ b/examples/chip-tool/gen/CHIPClientCallbacks.h @@ -117,6 +117,11 @@ typedef void (*NetworkCommissioningClusterUpdateThreadNetworkResponseCallback)(v uint8_t * debugText); typedef void (*NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*OperationalCredentialsClusterOpCSRResponseCallback)(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce, + chip::ByteSpan VendorReserved1, chip::ByteSpan VendorReserved2, + chip::ByteSpan VendorReserved3, chip::ByteSpan Signature); +typedef void (*OperationalCredentialsClusterOpCertResponseCallback)(void * context, uint8_t StatusCode, uint64_t FabricIndex, + uint8_t * DebugText); typedef void (*OperationalCredentialsClusterSetFabricResponseCallback)(void * context, chip::FabricId FabricId); typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId); typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId, diff --git a/examples/chip-tool/gen/CHIPClusters.cpp b/examples/chip-tool/gen/CHIPClusters.cpp index ecbf04d48ac64d..7a4a11497f9851 100644 --- a/examples/chip-tool/gen/CHIPClusters.cpp +++ b/examples/chip-tool/gen/CHIPClusters.cpp @@ -4298,6 +4298,70 @@ CHIP_ERROR OnOffCluster::ReadAttributeClusterRevision(Callback::Cancelable * onS } // OperationalCredentials Cluster Commands +CHIP_ERROR OperationalCredentialsCluster::AddOpCert(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan noc, + chip::ByteSpan iCACertificate, chip::ByteSpan iPKValue, + chip::NodeId caseAdminNode, uint16_t adminVendorId) +{ + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + if (mpCommandSender == nullptr) + { + ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&mpCommandSender)); + } + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kAddOpCertCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + ReturnErrorOnFailure(mpCommandSender->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = mpCommandSender->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // noc: octetString + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), noc)); + // iCACertificate: octetString + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), iCACertificate)); + // iPKValue: octetString + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), iPKValue)); + // caseAdminNode: nodeId + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), caseAdminNode)); + // adminVendorId: int16u + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), adminVendorId)); + + ReturnErrorOnFailure(mpCommandSender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(mpCommandSender, onSuccessCallback, onFailureCallback); + + return mDevice->SendCommands(mpCommandSender); +} + +CHIP_ERROR OperationalCredentialsCluster::OpCSRRequest(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, chip::ByteSpan cSRNonce) +{ + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + if (mpCommandSender == nullptr) + { + ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->NewCommandSender(&mpCommandSender)); + } + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kOpCSRRequestCommandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + ReturnErrorOnFailure(mpCommandSender->PrepareCommand(&cmdParams)); + + TLV::TLVWriter * writer = mpCommandSender->GetCommandDataElementTLVWriter(); + uint8_t argSeqNumber = 0; + // cSRNonce: octetString + ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), cSRNonce)); + + ReturnErrorOnFailure(mpCommandSender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(mpCommandSender, onSuccessCallback, onFailureCallback); + + return mDevice->SendCommands(mpCommandSender); +} + CHIP_ERROR OperationalCredentialsCluster::RemoveAllFabrics(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { diff --git a/examples/chip-tool/gen/CHIPClusters.h b/examples/chip-tool/gen/CHIPClusters.h index d8bb39b9417ca2..c884f043f68237 100644 --- a/examples/chip-tool/gen/CHIPClusters.h +++ b/examples/chip-tool/gen/CHIPClusters.h @@ -831,6 +831,11 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase ~OperationalCredentialsCluster() {} // Cluster Commands + CHIP_ERROR AddOpCert(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan noc, + chip::ByteSpan iCACertificate, chip::ByteSpan iPKValue, chip::NodeId caseAdminNode, + uint16_t adminVendorId); + CHIP_ERROR OpCSRRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::ByteSpan cSRNonce); CHIP_ERROR RemoveAllFabrics(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR RemoveFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::FabricId fabricId, chip::NodeId nodeId, uint16_t vendorId); @@ -844,6 +849,8 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); private: + static constexpr CommandId kAddOpCertCommandId = 0x06; + static constexpr CommandId kOpCSRRequestCommandId = 0x04; static constexpr CommandId kRemoveAllFabricsCommandId = 0x0B; static constexpr CommandId kRemoveFabricCommandId = 0x0A; static constexpr CommandId kSetFabricCommandId = 0x00; diff --git a/examples/chip-tool/gen/IMClusterCommandHandler.cpp b/examples/chip-tool/gen/IMClusterCommandHandler.cpp index 3c6b0baa16e0a7..cbed2c29f0f3f2 100644 --- a/examples/chip-tool/gen/IMClusterCommandHandler.cpp +++ b/examples/chip-tool/gen/IMClusterCommandHandler.cpp @@ -4024,6 +4024,173 @@ void DispatchClientCommand(app::Command * apCommandObj, CommandId aCommandId, En { switch (aCommandId) { + case ZCL_OP_CSR_RESPONSE_COMMAND_ID: { + expectArgumentCount = 6; + chip::ByteSpan CSR; + chip::ByteSpan CSRNonce; + chip::ByteSpan VendorReserved1; + chip::ByteSpan VendorReserved2; + chip::ByteSpan VendorReserved3; + chip::ByteSpan Signature; + bool argExists[6]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 6) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + CSR = chip::ByteSpan(data, aDataTlv.GetLength()); + } + break; + case 1: { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + CSRNonce = chip::ByteSpan(data, aDataTlv.GetLength()); + } + break; + case 2: { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + VendorReserved1 = chip::ByteSpan(data, aDataTlv.GetLength()); + } + break; + case 3: { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + VendorReserved2 = chip::ByteSpan(data, aDataTlv.GetLength()); + } + break; + case 4: { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + VendorReserved3 = chip::ByteSpan(data, aDataTlv.GetLength()); + } + break; + case 5: { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + Signature = chip::ByteSpan(data, aDataTlv.GetLength()); + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != TLVUnpackError) + { + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + wasHandled = emberAfOperationalCredentialsClusterOpCSRResponseCallback(apCommandObj, CSR, CSRNonce, VendorReserved1, + VendorReserved2, VendorReserved3, Signature); + } + break; + } + case ZCL_OP_CERT_RESPONSE_COMMAND_ID: { + expectArgumentCount = 3; + uint8_t StatusCode; + uint64_t FabricIndex; + const uint8_t * DebugText; + bool argExists[3]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 3) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + TLVUnpackError = aDataTlv.Get(StatusCode); + break; + case 1: + TLVUnpackError = aDataTlv.Get(FabricIndex); + break; + case 2: + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(DebugText); + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != TLVUnpackError) + { + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + wasHandled = emberAfOperationalCredentialsClusterOpCertResponseCallback(apCommandObj, StatusCode, FabricIndex, + const_cast(DebugText)); + } + break; + } case ZCL_SET_FABRIC_RESPONSE_COMMAND_ID: { expectArgumentCount = 1; chip::FabricId FabricId; diff --git a/examples/chip-tool/gen/call-command-handler.cpp b/examples/chip-tool/gen/call-command-handler.cpp index e311c1a61639e2..db604e46305e83 100644 --- a/examples/chip-tool/gen/call-command-handler.cpp +++ b/examples/chip-tool/gen/call-command-handler.cpp @@ -1452,6 +1452,100 @@ EmberAfStatus emberAfOperationalCredentialsClusterClientCommandParse(EmberAfClus { switch (cmd->commandId) { + case ZCL_OP_CSR_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + chip::ByteSpan CSR; + chip::ByteSpan CSRNonce; + chip::ByteSpan VendorReserved1; + chip::ByteSpan VendorReserved2; + chip::ByteSpan VendorReserved3; + chip::ByteSpan Signature; + + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + { + uint8_t * rawData = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + CSR = chip::ByteSpan(rawData + 1u, emberAfStringLength(rawData)); + } + payloadOffset = static_cast(payloadOffset + CSR.size() + 1u); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + { + uint8_t * rawData = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + CSRNonce = chip::ByteSpan(rawData + 1u, emberAfStringLength(rawData)); + } + payloadOffset = static_cast(payloadOffset + CSRNonce.size() + 1u); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + { + uint8_t * rawData = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + VendorReserved1 = chip::ByteSpan(rawData + 1u, emberAfStringLength(rawData)); + } + payloadOffset = static_cast(payloadOffset + VendorReserved1.size() + 1u); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + { + uint8_t * rawData = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + VendorReserved2 = chip::ByteSpan(rawData + 1u, emberAfStringLength(rawData)); + } + payloadOffset = static_cast(payloadOffset + VendorReserved2.size() + 1u); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + { + uint8_t * rawData = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + VendorReserved3 = chip::ByteSpan(rawData + 1u, emberAfStringLength(rawData)); + } + payloadOffset = static_cast(payloadOffset + VendorReserved3.size() + 1u); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + { + uint8_t * rawData = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + Signature = chip::ByteSpan(rawData + 1u, emberAfStringLength(rawData)); + } + + wasHandled = emberAfOperationalCredentialsClusterOpCSRResponseCallback(nullptr, CSR, CSRNonce, VendorReserved1, + VendorReserved2, VendorReserved3, Signature); + break; + } + case ZCL_OP_CERT_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t StatusCode; + uint64_t FabricIndex; + uint8_t * DebugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + StatusCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 8) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + FabricIndex = emberAfGetInt64u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 8); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + DebugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfOperationalCredentialsClusterOpCertResponseCallback(nullptr, StatusCode, FabricIndex, DebugText); + break; + } case ZCL_SET_FABRIC_RESPONSE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; chip::FabricId FabricId; diff --git a/examples/chip-tool/gen/callback.h b/examples/chip-tool/gen/callback.h index 4346d57d3b4d66..14c42177d8cd16 100644 --- a/examples/chip-tool/gen/callback.h +++ b/examples/chip-tool/gen/callback.h @@ -2985,6 +2985,22 @@ bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(chip: bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText); +/** + * @brief Operational Credentials Cluster OpCSRResponse Command callback + */ + +bool emberAfOperationalCredentialsClusterOpCSRResponseCallback(chip::app::Command * commandObj, chip::ByteSpan CSR, + chip::ByteSpan CSRNonce, chip::ByteSpan VendorReserved1, + chip::ByteSpan VendorReserved2, chip::ByteSpan VendorReserved3, + chip::ByteSpan Signature); + +/** + * @brief Operational Credentials Cluster OpCertResponse Command callback + */ + +bool emberAfOperationalCredentialsClusterOpCertResponseCallback(chip::app::Command * commandObj, uint8_t StatusCode, + uint64_t FabricIndex, uint8_t * DebugText); + /** * @brief Operational Credentials Cluster SetFabricResponse Command callback */ diff --git a/examples/chip-tool/gen/endpoint_config.h b/examples/chip-tool/gen/endpoint_config.h index 0473d4be51bd73..57af6697733737 100644 --- a/examples/chip-tool/gen/endpoint_config.h +++ b/examples/chip-tool/gen/endpoint_config.h @@ -326,7 +326,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (192) +#define EMBER_AF_GENERATED_COMMAND_COUNT (196) #define GENERATED_COMMANDS \ { \ \ @@ -414,6 +414,10 @@ /* Endpoint: 1, Cluster: Operational Credentials (client) */ \ { 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \ { 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \ + { 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \ + { 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \ + { 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \ + { 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \ { 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \ { 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \ { 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \ diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index c053e55a804992..a2c116735f2c88 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -99,25 +99,19 @@ static void OnInt64sAttributeResponse(void * context, int64_t value) static void OnStringAttributeResponse(void * context, const chip::ByteSpan value) { - char * str = (char *)malloc(value.size() * sizeof(char)); - memmove(str, value.data(), value.size()); - str[value.size()] = '\0'; - free(str); - - ChipLogProgress(chipTool, "String attribute Response: %s (%" PRIu16 ")", str, strlen(str)); + ChipLogProgress(chipTool, "String attribute Response: %zu", value.size()); ModelCommand * command = reinterpret_cast(context); command->SetCommandExitStatus(true); } -{{#all_user_clusters}} -{{#if (isClient side) }} +{{#chip_client_clusters}} {{#if (user_cluster_has_enabled_command name side)}} {{#all_user_cluster_commands}} {{#if (isStrEqual clusterName parent.name)}} {{#if (isCommandAvailable parent.side incoming outgoing commandSource name)}} {{#if (isStrEndsWith name "Response")}} -static void On{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}(void * context{{#zcl_command_arguments}}{{#unless (isStrEqual label "status")}}, {{asUnderlyingZclType type}} {{asSymbol label}}{{/unless}}{{/zcl_command_arguments}}) +static void On{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}(void * context{{#zcl_command_arguments}}{{#unless (isStrEqual label "status")}}, {{#if (isOctetString type)}}chip::ByteSpan{{else}}{{asUnderlyingZclType type}}{{/if}} {{asSymbol label}}{{/unless}}{{/zcl_command_arguments}}) { ChipLogProgress(chipTool, "{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}"); @@ -130,8 +124,7 @@ static void On{{asCamelCased parent.name false}}Cluster{{asCamelCased name false {{/if}} {{/all_user_cluster_commands}} {{/if}} -{{/if}} -{{/all_user_clusters}} +{{/chip_client_clusters}} {{#chip_client_clusters}} {{#chip_server_cluster_attributes}} @@ -145,11 +138,24 @@ static void On{{asCamelCased parent.name false}}{{asCamelCased name false}}ListA {{#if isStruct}} ChipLogProgress(chipTool, "{{type}}[%lu]:", i); {{#chip_attribute_list_entryTypes}} + {{#if (isOctetString type)}} + ChipLogProgress(Zcl, " {{asSymbol label}}: %zu", entries[i].{{name}}.size()); + {{else if (isCharString type)}} + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " {{asSymbol label}}: %.*s", entries[i].{{name}}.size(), entries[i].{{name}}.data()); + {{else}} ChipLogProgress(chipTool, " {{name}}: {{asPrintFormat type}}", entries[i].{{name}}); + {{/if}} {{/chip_attribute_list_entryTypes}} {{else}} + {{#if (isOctetString type)}} + ChipLogProgress(Zcl, " {{asSymbol label}}: %zu", entries[i].size()); + {{else if (isCharString type)}} + ChipLogProgress(Zcl, " {{asSymbol label}}: %.*s", entries[i].size(), entries[i].data()); + {{else}} ChipLogProgress(chipTool, "{{type}}[%lu]: {{asPrintFormat type}}", i, entries[i]); {{/if}} + {{/if}} } ModelCommand * command = reinterpret_cast(context); @@ -203,8 +209,8 @@ public: } private: - {{#if (hasSpecificResponse name)}} - chip::Callback::Callback<{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}ResponseCallback> * onSuccessCallback = new chip::Callback::Callback<{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}ResponseCallback>(On{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}Response, this); + {{#if hasSpecificResponse}} + chip::Callback::Callback<{{asCamelCased parent.name false}}Cluster{{asCamelCased responseName false}}Callback> * onSuccessCallback = new chip::Callback::Callback<{{asCamelCased parent.name false}}Cluster{{asCamelCased responseName false}}Callback>(On{{asCamelCased parent.name false}}Cluster{{asCamelCased responseName false}}, this); {{else}} chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); {{/if}} diff --git a/src/app/zap-templates/common/ClustersHelper.js b/src/app/zap-templates/common/ClustersHelper.js index 4c684b037b4d4f..ca702396ba7087 100644 --- a/src/app/zap-templates/common/ClustersHelper.js +++ b/src/app/zap-templates/common/ClustersHelper.js @@ -324,6 +324,33 @@ function enhancedCommands(commands, types) }); }); + // This filter uses the assumption that a response to a command has a well defined name, such as + // (response name) == (command name + 'Response') or s/Request/Response. This is very often the case, + // but this is not always true since some clusters use the same response to answer different commands, such as the + // operational cluster. + commands.forEach(command => { + const automaticFilter = response => (response.name == (command.name + 'Response') + || (command.name.includes('Request') && response.name == (command.name.replace('Request', 'Response')))); + const manualFilter = response => { + switch (command.name) { + case 'AddOpCert': + case 'UpdateOpCert': + case 'UpdateFabricLabel': + case 'RemoveFabric': + return response.name == 'OpCertResponse'; + default: + return false; + } + }; + const filter = response => automaticFilter(response) || manualFilter(response); + + const response = commands.find(filter); + if (response) { + command.hasSpecificResponse = true; + command.responseName = response.name; + } + }); + // At this stage, 'command.arguments' may contains 'struct'. But controllers does not know (yet) how // to handle them. So those needs to be inlined. commands.forEach(command => { diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt index 770b3803b690d7..067ca6b4579262 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt @@ -803,6 +803,11 @@ bool emberAf{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}} {{#zcl_command_arguments}} {{#if (isStrEqual label "status")}} LogStatus(status); + {{else if (isOctetString type)}} + ChipLogProgress(Zcl, " {{asSymbol label}}: %zu", {{asSymbol label}}.size()); + {{else if (isCharString type)}} + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " {{asSymbol label}}: %.*s", {{asSymbol label}}.size(), {{asSymbol label}}.data()); {{else}} ChipLogProgress(Zcl, " {{asSymbol label}}: {{asPrintFormat type}}", {{asSymbol label}}); {{/if}} diff --git a/src/app/zap-templates/templates/chip/helper.js b/src/app/zap-templates/templates/chip/helper.js index 109e4b04f902f6..ddffc234420f70 100644 --- a/src/app/zap-templates/templates/chip/helper.js +++ b/src/app/zap-templates/templates/chip/helper.js @@ -319,13 +319,6 @@ function isManufacturerSpecificCommand() return !!this.mfgCode; } -function hasSpecificResponse(commandName) -{ - const { clusterName, clusterSide } = checkIsInsideClusterBlock(this.parent, 'has_specific_response'); - const filter = response => response.name == (commandName + 'Response'); - return asPromise.call(this, Clusters.getServerResponses(clusterName).then(responses => responses.find(filter))); -} - function asCallbackAttributeType(attributeType) { switch (parseInt(attributeType)) { @@ -432,4 +425,3 @@ exports.isWritableAttribute = isWritableAttribute; exports.isReportableAttribute = isReportableAttribute; exports.isManufacturerSpecificCommand = isManufacturerSpecificCommand; exports.asCallbackAttributeType = asCallbackAttributeType; -exports.hasSpecificResponse = hasSpecificResponse; diff --git a/src/controller/python/gen/CHIPClientCallbacks.cpp b/src/controller/python/gen/CHIPClientCallbacks.cpp index cc5bd5b5184f17..e27275b3589809 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.cpp +++ b/src/controller/python/gen/CHIPClientCallbacks.cpp @@ -1194,7 +1194,8 @@ bool emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16 bool emberAfAccountLoginClusterGetSetupPINResponseCallback(chip::app::Command * commandObj, uint8_t * setupPIN) { ChipLogProgress(Zcl, "GetSetupPINResponse:"); - ChipLogProgress(Zcl, " setupPIN: %s", setupPIN); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " setupPIN: %.*s", setupPIN.size(), setupPIN.data()); GET_CLUSTER_RESPONSE_CALLBACKS("AccountLoginClusterGetSetupPINResponseCallback"); @@ -1208,7 +1209,8 @@ bool emberAfApplicationLauncherClusterLaunchAppResponseCallback(chip::app::Comma { ChipLogProgress(Zcl, "LaunchAppResponse:"); LogStatus(status); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); GET_CLUSTER_RESPONSE_CALLBACKS("ApplicationLauncherClusterLaunchAppResponseCallback"); @@ -1230,7 +1232,8 @@ bool emberAfContentLaunchClusterLaunchContentResponseCallback(chip::app::Command uint8_t contentLaunchStatus) { ChipLogProgress(Zcl, "LaunchContentResponse:"); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); ChipLogProgress(Zcl, " contentLaunchStatus: %" PRIu8 "", contentLaunchStatus); GET_CLUSTER_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchContentResponseCallback"); @@ -1245,7 +1248,8 @@ bool emberAfContentLaunchClusterLaunchURLResponseCallback(chip::app::Command * c uint8_t contentLaunchStatus) { ChipLogProgress(Zcl, "LaunchURLResponse:"); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); ChipLogProgress(Zcl, " contentLaunchStatus: %" PRIu8 "", contentLaunchStatus); GET_CLUSTER_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchURLResponseCallback"); @@ -1441,7 +1445,8 @@ bool emberAfDoorLockClusterGetLogRecordResponseCallback(chip::app::Command * com ChipLogProgress(Zcl, " source: %" PRIu8 "", source); ChipLogProgress(Zcl, " eventIdOrAlarmCode: %" PRIu8 "", eventIdOrAlarmCode); ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); - ChipLogProgress(Zcl, " pin: %s", pin); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " pin: %.*s", pin.size(), pin.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetLogRecordResponseCallback"); @@ -1458,7 +1463,8 @@ bool emberAfDoorLockClusterGetPinResponseCallback(chip::app::Command * commandOb ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); ChipLogProgress(Zcl, " userStatus: %" PRIu8 "", userStatus); ChipLogProgress(Zcl, " userType: %" PRIu8 "", userType); - ChipLogProgress(Zcl, " pin: %s", pin); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " pin: %.*s", pin.size(), pin.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetPinResponseCallback"); @@ -1475,7 +1481,8 @@ bool emberAfDoorLockClusterGetRfidResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); ChipLogProgress(Zcl, " userStatus: %" PRIu8 "", userStatus); ChipLogProgress(Zcl, " userType: %" PRIu8 "", userType); - ChipLogProgress(Zcl, " rfid: %s", rfid); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " rfid: %.*s", rfid.size(), rfid.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetRfidResponseCallback"); @@ -1749,7 +1756,8 @@ bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Co { ChipLogProgress(Zcl, "ArmFailSafeResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterArmFailSafeResponseCallback"); @@ -1764,7 +1772,8 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chi { ChipLogProgress(Zcl, "CommissioningCompleteResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterCommissioningCompleteResponseCallback"); @@ -1779,7 +1788,8 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(chip: { ChipLogProgress(Zcl, "SetRegulatoryConfigResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterSetRegulatoryConfigResponseCallback"); @@ -1855,7 +1865,8 @@ bool emberAfGroupsClusterViewGroupResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, "ViewGroupResponse:"); LogStatus(status); ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " groupName: %s", groupName); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " groupName: %.*s", groupName.size(), groupName.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GroupsClusterViewGroupResponseCallback"); @@ -2055,7 +2066,8 @@ bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(chip::ap { ChipLogProgress(Zcl, "AddThreadNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddThreadNetworkResponseCallback"); @@ -2070,7 +2082,8 @@ bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(chip::app: { ChipLogProgress(Zcl, "AddWiFiNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddWiFiNetworkResponseCallback"); @@ -2085,7 +2098,8 @@ bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(chip::app: { ChipLogProgress(Zcl, "DisableNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterDisableNetworkResponseCallback"); @@ -2100,7 +2114,8 @@ bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(chip::app:: { ChipLogProgress(Zcl, "EnableNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterEnableNetworkResponseCallback"); @@ -2115,7 +2130,8 @@ bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(chip::app:: { ChipLogProgress(Zcl, "RemoveNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterRemoveNetworkResponseCallback"); @@ -2132,7 +2148,8 @@ bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( { ChipLogProgress(Zcl, "ScanNetworksResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); ChipLogProgress(Zcl, " wifiScanResults: %p", wifiScanResults); ChipLogProgress(Zcl, " threadScanResults: %p", threadScanResults); @@ -2149,7 +2166,8 @@ bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(chip: { ChipLogProgress(Zcl, "UpdateThreadNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateThreadNetworkResponseCallback"); @@ -2164,7 +2182,8 @@ bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::a { ChipLogProgress(Zcl, "UpdateWiFiNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback"); @@ -2180,12 +2199,12 @@ bool emberAfOperationalCredentialsClusterOpCSRResponseCallback(chip::app::Comman chip::ByteSpan Signature) { ChipLogProgress(Zcl, "OpCSRResponse:"); - ChipLogProgress(Zcl, " CSR: %s", CSR); - ChipLogProgress(Zcl, " CSRNonce: %s", CSRNonce); - ChipLogProgress(Zcl, " VendorReserved1: %s", VendorReserved1); - ChipLogProgress(Zcl, " VendorReserved2: %s", VendorReserved2); - ChipLogProgress(Zcl, " VendorReserved3: %s", VendorReserved3); - ChipLogProgress(Zcl, " Signature: %s", Signature); + ChipLogProgress(Zcl, " CSR: %zu", CSR.size()); + ChipLogProgress(Zcl, " CSRNonce: %zu", CSRNonce.size()); + ChipLogProgress(Zcl, " VendorReserved1: %zu", VendorReserved1.size()); + ChipLogProgress(Zcl, " VendorReserved2: %zu", VendorReserved2.size()); + ChipLogProgress(Zcl, " VendorReserved3: %zu", VendorReserved3.size()); + ChipLogProgress(Zcl, " Signature: %zu", Signature.size()); GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterOpCSRResponseCallback"); @@ -2201,7 +2220,8 @@ bool emberAfOperationalCredentialsClusterOpCertResponseCallback(chip::app::Comma ChipLogProgress(Zcl, "OpCertResponse:"); ChipLogProgress(Zcl, " StatusCode: %" PRIu8 "", StatusCode); ChipLogProgress(Zcl, " FabricIndex: %" PRIu64 "", FabricIndex); - ChipLogProgress(Zcl, " DebugText: %s", DebugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " DebugText: %.*s", DebugText.size(), DebugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterOpCertResponseCallback"); @@ -2354,7 +2374,8 @@ bool emberAfScenesClusterViewSceneResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); ChipLogProgress(Zcl, " transitionTime: %" PRIu16 "", transitionTime); - ChipLogProgress(Zcl, " sceneName: %s", sceneName); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " sceneName: %.*s", sceneName.size(), sceneName.data()); ChipLogProgress(Zcl, " extensionFieldSets: %p", extensionFieldSets); GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterViewSceneResponseCallback"); @@ -2393,7 +2414,8 @@ bool emberAfTargetNavigatorClusterNavigateTargetResponseCallback(chip::app::Comm { ChipLogProgress(Zcl, "NavigateTargetResponse:"); LogStatus(status); - ChipLogProgress(Zcl, " data: %s", data); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " data: %.*s", data.size(), data.data()); GET_CLUSTER_RESPONSE_CALLBACKS("TargetNavigatorClusterNavigateTargetResponseCallback"); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 5ea970e77232da..99d3ba71ac84c8 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp @@ -1206,7 +1206,8 @@ bool emberAfDoorLockClusterGetLogRecordResponseCallback(chip::app::Command * com ChipLogProgress(Zcl, " source: %" PRIu8 "", source); ChipLogProgress(Zcl, " eventIdOrAlarmCode: %" PRIu8 "", eventIdOrAlarmCode); ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); - ChipLogProgress(Zcl, " pin: %s", pin); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " pin: %.*s", pin.size(), pin.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetLogRecordResponseCallback"); @@ -1223,7 +1224,8 @@ bool emberAfDoorLockClusterGetPinResponseCallback(chip::app::Command * commandOb ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); ChipLogProgress(Zcl, " userStatus: %" PRIu8 "", userStatus); ChipLogProgress(Zcl, " userType: %" PRIu8 "", userType); - ChipLogProgress(Zcl, " pin: %s", pin); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " pin: %.*s", pin.size(), pin.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetPinResponseCallback"); @@ -1240,7 +1242,8 @@ bool emberAfDoorLockClusterGetRfidResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, " userId: %" PRIu16 "", userId); ChipLogProgress(Zcl, " userStatus: %" PRIu8 "", userStatus); ChipLogProgress(Zcl, " userType: %" PRIu8 "", userType); - ChipLogProgress(Zcl, " rfid: %s", rfid); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " rfid: %.*s", rfid.size(), rfid.data()); GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetRfidResponseCallback"); @@ -1514,7 +1517,8 @@ bool emberAfGeneralCommissioningClusterArmFailSafeResponseCallback(chip::app::Co { ChipLogProgress(Zcl, "ArmFailSafeResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterArmFailSafeResponseCallback"); @@ -1529,7 +1533,8 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteResponseCallback(chi { ChipLogProgress(Zcl, "CommissioningCompleteResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterCommissioningCompleteResponseCallback"); @@ -1544,7 +1549,8 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(chip: { ChipLogProgress(Zcl, "SetRegulatoryConfigResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GeneralCommissioningClusterSetRegulatoryConfigResponseCallback"); @@ -1620,7 +1626,8 @@ bool emberAfGroupsClusterViewGroupResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, "ViewGroupResponse:"); LogStatus(status); ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " groupName: %s", groupName); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " groupName: %.*s", groupName.size(), groupName.data()); GET_CLUSTER_RESPONSE_CALLBACKS("GroupsClusterViewGroupResponseCallback"); @@ -1656,7 +1663,8 @@ bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(chip::ap { ChipLogProgress(Zcl, "AddThreadNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddThreadNetworkResponseCallback"); @@ -1671,7 +1679,8 @@ bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(chip::app: { ChipLogProgress(Zcl, "AddWiFiNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddWiFiNetworkResponseCallback"); @@ -1686,7 +1695,8 @@ bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(chip::app: { ChipLogProgress(Zcl, "DisableNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterDisableNetworkResponseCallback"); @@ -1701,7 +1711,8 @@ bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(chip::app:: { ChipLogProgress(Zcl, "EnableNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterEnableNetworkResponseCallback"); @@ -1716,7 +1727,8 @@ bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(chip::app:: { ChipLogProgress(Zcl, "RemoveNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterRemoveNetworkResponseCallback"); @@ -1733,7 +1745,8 @@ bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( { ChipLogProgress(Zcl, "ScanNetworksResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); ChipLogProgress(Zcl, " wifiScanResults: %p", wifiScanResults); ChipLogProgress(Zcl, " threadScanResults: %p", threadScanResults); @@ -1750,7 +1763,8 @@ bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(chip: { ChipLogProgress(Zcl, "UpdateThreadNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateThreadNetworkResponseCallback"); @@ -1765,7 +1779,8 @@ bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::a { ChipLogProgress(Zcl, "UpdateWiFiNetworkResponse:"); ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); - ChipLogProgress(Zcl, " debugText: %s", debugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " debugText: %.*s", debugText.size(), debugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback"); @@ -1781,12 +1796,12 @@ bool emberAfOperationalCredentialsClusterOpCSRResponseCallback(chip::app::Comman chip::ByteSpan Signature) { ChipLogProgress(Zcl, "OpCSRResponse:"); - ChipLogProgress(Zcl, " CSR: %s", CSR); - ChipLogProgress(Zcl, " CSRNonce: %s", CSRNonce); - ChipLogProgress(Zcl, " VendorReserved1: %s", VendorReserved1); - ChipLogProgress(Zcl, " VendorReserved2: %s", VendorReserved2); - ChipLogProgress(Zcl, " VendorReserved3: %s", VendorReserved3); - ChipLogProgress(Zcl, " Signature: %s", Signature); + ChipLogProgress(Zcl, " CSR: %zu", CSR.size()); + ChipLogProgress(Zcl, " CSRNonce: %zu", CSRNonce.size()); + ChipLogProgress(Zcl, " VendorReserved1: %zu", VendorReserved1.size()); + ChipLogProgress(Zcl, " VendorReserved2: %zu", VendorReserved2.size()); + ChipLogProgress(Zcl, " VendorReserved3: %zu", VendorReserved3.size()); + ChipLogProgress(Zcl, " Signature: %zu", Signature.size()); GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterOpCSRResponseCallback"); @@ -1802,7 +1817,8 @@ bool emberAfOperationalCredentialsClusterOpCertResponseCallback(chip::app::Comma ChipLogProgress(Zcl, "OpCertResponse:"); ChipLogProgress(Zcl, " StatusCode: %" PRIu8 "", StatusCode); ChipLogProgress(Zcl, " FabricIndex: %" PRIu64 "", FabricIndex); - ChipLogProgress(Zcl, " DebugText: %s", DebugText); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " DebugText: %.*s", DebugText.size(), DebugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterOpCertResponseCallback"); @@ -1955,7 +1971,8 @@ bool emberAfScenesClusterViewSceneResponseCallback(chip::app::Command * commandO ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); ChipLogProgress(Zcl, " transitionTime: %" PRIu16 "", transitionTime); - ChipLogProgress(Zcl, " sceneName: %s", sceneName); + // Currently the generated code emits `uint8_t *` for CHAR_STRING, it needs to emits chip::ByteSpan + // ChipLogProgress(Zcl, " sceneName: %.*s", sceneName.size(), sceneName.data()); ChipLogProgress(Zcl, " extensionFieldSets: %p", extensionFieldSets); GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterViewSceneResponseCallback"); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 8a80b51603a211..27d561eddd3824 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -8756,7 +8756,8 @@ - (void)addOpCert:(NSData *)noc adminVendorId:(uint16_t)adminVendorId responseHandler:(ResponseHandler)responseHandler { - CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + CHIPOperationalCredentialsClusterOpCertResponseCallbackBridge * onSuccess + = new CHIPOperationalCredentialsClusterOpCertResponseCallbackBridge(responseHandler, [self callbackQueue]); if (!onSuccess) { responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -8785,7 +8786,8 @@ - (void)addOpCert:(NSData *)noc } - (void)opCSRRequest:(NSData *)cSRNonce responseHandler:(ResponseHandler)responseHandler { - CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + CHIPOperationalCredentialsClusterOpCSRResponseCallbackBridge * onSuccess + = new CHIPOperationalCredentialsClusterOpCSRResponseCallbackBridge(responseHandler, [self callbackQueue]); if (!onSuccess) { responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -8841,7 +8843,8 @@ - (void)removeFabric:(uint64_t)fabricId vendorId:(uint16_t)vendorId responseHandler:(ResponseHandler)responseHandler { - CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + CHIPOperationalCredentialsClusterOpCertResponseCallbackBridge * onSuccess + = new CHIPOperationalCredentialsClusterOpCertResponseCallbackBridge(responseHandler, [self callbackQueue]); if (!onSuccess) { responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; @@ -8894,7 +8897,8 @@ - (void)setFabric:(uint16_t)vendorId responseHandler:(ResponseHandler)responseHa } - (void)updateFabricLabel:(NSString *)label responseHandler:(ResponseHandler)responseHandler { - CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); + CHIPOperationalCredentialsClusterOpCertResponseCallbackBridge * onSuccess + = new CHIPOperationalCredentialsClusterOpCertResponseCallbackBridge(responseHandler, [self callbackQueue]); if (!onSuccess) { responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); return; diff --git a/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt index 81637764f6568b..a846e280ca95e3 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt @@ -597,8 +597,8 @@ private: - (void){{asCamelCased name}}:(ResponseHandler)responseHandler {{/if}} { -{{#if (hasSpecificResponse name)}} - CHIP{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}ResponseCallbackBridge * onSuccess = new CHIP{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}ResponseCallbackBridge(responseHandler, [self callbackQueue]); +{{#if hasSpecificResponse}} + CHIP{{asCamelCased parent.name false}}Cluster{{asCamelCased responseName false}}CallbackBridge * onSuccess = new CHIP{{asCamelCased parent.name false}}Cluster{{asCamelCased responseName false}}CallbackBridge(responseHandler, [self callbackQueue]); {{else}} CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]); {{/if}}