diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 579b382441cd23..2d6c1fae676922 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -179,8 +179,8 @@ void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer, uint16_t listCount = 1; _LabelStruct labelStruct; - labelStruct.label = chip::ByteSpan(Uint8::from_const_char(label), strlen(label)); - labelStruct.value = chip::ByteSpan(Uint8::from_const_char(value), strlen(value)); + labelStruct.label = chip::CharSpan(label, strlen(label)); + labelStruct.value = chip::CharSpan(value, strlen(value)); emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast(&labelStruct), 1); emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast(&listCount), 0); diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 3d4d34c0d4c6a9..53288b703dfdbf 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -200,10 +200,14 @@ void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer, uint16_t listCount = 1; _LabelStruct labelStruct; - labelStruct.label = chip::ByteSpan(reinterpret_cast(label), kFixedLabelElementsOctetStringSize); + // TODO: This size is obviously wrong. See + // https://github.com/project-chip/connectedhomeip/issues/10743 + labelStruct.label = CharSpan(label, kFixedLabelElementsOctetStringSize); strncpy(zclOctetStrBuf, value, sizeof(zclOctetStrBuf)); - labelStruct.value = chip::ByteSpan(reinterpret_cast(&zclOctetStrBuf[0]), sizeof(zclOctetStrBuf)); + // TODO: This size is obviously wrong. See + // https://github.com/project-chip/connectedhomeip/issues/10743 + labelStruct.value = CharSpan(&zclOctetStrBuf[0], sizeof(zclOctetStrBuf)); emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast(&labelStruct), 1); emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast(&listCount), 0); diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index cdd78aebd469c8..01295d615cee35 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -119,7 +119,6 @@ class {{filename}}: public TestCommand {{/chip_tests_item_parameters}} auto success = [](void * context, const responseType & data) { - {{! TODO Update CHAR_STRING to be of type chip::CharSpan instead of chip::ByteSpan }} (static_cast<{{filename}} *>(context))->OnSuccessResponse_{{index}}({{#chip_tests_item_response_parameters}}{{#not_first}}, {{/not_first}}data.{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); }; diff --git a/examples/tv-app/linux/include/audio-output/AudioOutputManager.cpp b/examples/tv-app/linux/include/audio-output/AudioOutputManager.cpp index 6cf30fc2b4bd1e..61018e7417424d 100644 --- a/examples/tv-app/linux/include/audio-output/AudioOutputManager.cpp +++ b/examples/tv-app/linux/include/audio-output/AudioOutputManager.cpp @@ -51,7 +51,7 @@ CHIP_ERROR AudioOutputManager::proxyGetListOfAudioOutputInfo(chip::app::Attribut { chip::app::Clusters::AudioOutput::Structs::AudioOutputInfo::Type audioOutputInfo; audioOutputInfo.outputType = EMBER_ZCL_AUDIO_OUTPUT_TYPE_HDMI; - audioOutputInfo.name = chip::ByteSpan(chip::Uint8::from_char(name), sizeof(name) - 1); + audioOutputInfo.name = chip::CharSpan(name, sizeof(name) - 1); audioOutputInfo.index = static_cast(1 + i); ReturnErrorOnFailure(encoder.Encode(audioOutputInfo)); } diff --git a/examples/tv-app/linux/include/media-input/MediaInputManager.cpp b/examples/tv-app/linux/include/media-input/MediaInputManager.cpp index 21abbdcc9e78bf..bb8dbf2f255a31 100644 --- a/examples/tv-app/linux/include/media-input/MediaInputManager.cpp +++ b/examples/tv-app/linux/include/media-input/MediaInputManager.cpp @@ -47,8 +47,8 @@ CHIP_ERROR MediaInputManager::proxyGetInputList(chip::app::AttributeValueEncoder for (int i = 0; i < maximumVectorSize; ++i) { chip::app::Clusters::MediaInput::Structs::MediaInputInfo::Type mediaInput; - mediaInput.description = chip::ByteSpan(chip::Uint8::from_char(description), sizeof(description) - 1); - mediaInput.name = chip::ByteSpan(chip::Uint8::from_char(name), sizeof(name) - 1); + mediaInput.description = chip::CharSpan(description, sizeof(description) - 1); + mediaInput.name = chip::CharSpan(name, sizeof(name) - 1); mediaInput.inputType = EMBER_ZCL_MEDIA_INPUT_TYPE_HDMI; mediaInput.index = static_cast(1 + i); ReturnErrorOnFailure(encoder.Encode(mediaInput)); diff --git a/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp b/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp index a2f50a11059a50..bb15476209d9b6 100644 --- a/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp +++ b/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp @@ -47,7 +47,7 @@ CHIP_ERROR TargetNavigatorManager::proxyGetTargetInfoList(chip::app::AttributeVa for (int i = 0; i < maximumVectorSize; ++i) { chip::app::Clusters::TargetNavigator::Structs::NavigateTargetTargetInfo::Type targetInfo; - targetInfo.name = chip::ByteSpan(chip::Uint8::from_char(name), sizeof(name) - 1); + targetInfo.name = chip::CharSpan(name, sizeof(name) - 1); targetInfo.identifier = static_cast(1 + i); ReturnErrorOnFailure(encoder.Encode(targetInfo)); } diff --git a/examples/tv-app/linux/include/tv-channel/TvChannelManager.cpp b/examples/tv-app/linux/include/tv-channel/TvChannelManager.cpp index 3af338aadc8cc0..5d5a1ead456e6d 100644 --- a/examples/tv-app/linux/include/tv-channel/TvChannelManager.cpp +++ b/examples/tv-app/linux/include/tv-channel/TvChannelManager.cpp @@ -55,9 +55,9 @@ CHIP_ERROR TvChannelManager::proxyGetTvChannelList(chip::app::AttributeValueEnco for (int i = 0; i < maximumVectorSize; ++i) { chip::app::Clusters::TvChannel::Structs::TvChannelInfo::Type channelInfo; - channelInfo.affiliateCallSign = ByteSpan(Uint8::from_char(affiliateCallSign), sizeof(affiliateCallSign) - 1); - channelInfo.callSign = ByteSpan(Uint8::from_char(callSign), sizeof(callSign) - 1); - channelInfo.name = ByteSpan(Uint8::from_char(name), sizeof(name) - 1); + channelInfo.affiliateCallSign = CharSpan(affiliateCallSign, sizeof(affiliateCallSign) - 1); + channelInfo.callSign = CharSpan(callSign, sizeof(callSign) - 1); + channelInfo.name = CharSpan(name, sizeof(name) - 1); channelInfo.majorNumber = static_cast(1 + i); channelInfo.minorNumber = static_cast(2 + i); ReturnErrorOnFailure(encoder.Encode(channelInfo)); diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index cce24fc1fe4568..a6eb8bbf60beaf 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -89,9 +89,7 @@ CHIP_ERROR OperationalCredentialsAttrAccess::ReadFabricsList(EndpointId endpoint fabricDescriptor.vendorId = fabricInfo.GetVendorId(); fabricDescriptor.fabricId = fabricInfo.GetFabricId(); - // TODO: The type of 'label' should be 'CharSpan', need to fix the XML definition for broken member type. - fabricDescriptor.label = - ByteSpan(Uint8::from_const_char(fabricInfo.GetFabricLabel().data()), fabricInfo.GetFabricLabel().size()); + fabricDescriptor.label = fabricInfo.GetFabricLabel(); fabricDescriptor.rootPublicKey = fabricInfo.GetRootPubkey(); ReturnErrorOnFailure(encoder.Encode(fabricDescriptor)); @@ -176,7 +174,7 @@ EmberAfStatus writeFabric(FabricIndex fabricIndex, FabricId fabricId, NodeId nod fabricDescriptor->NodeId = nodeId; if (!fabricLabel.empty()) { - fabricDescriptor->Label = ByteSpan(Uint8::from_const_char(fabricLabel.data()), fabricLabel.size()); + fabricDescriptor->Label = fabricLabel; } emberAfPrintln(EMBER_AF_PRINT_DEBUG, @@ -407,7 +405,7 @@ namespace { FabricInfo gFabricBeingCommissioned; -CHIP_ERROR SendNOCResponse(app::Command * commandObj, EmberAfNodeOperationalCertStatus status, uint8_t index, ByteSpan debug_text) +CHIP_ERROR SendNOCResponse(app::Command * commandObj, EmberAfNodeOperationalCertStatus status, uint8_t index, CharSpan debug_text) { app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, ZCL_NOC_RESPONSE_COMMAND_ID, (app::CommandPathFlags::kEndpointIdValid) }; @@ -422,8 +420,7 @@ CHIP_ERROR SendNOCResponse(app::Command * commandObj, EmberAfNodeOperationalCert { ReturnErrorOnFailure(writer->Put(TLV::ContextTag(1), index)); } - // TODO: Change DebugText to CHAR_STRING once strings are supported in command/response fields - ReturnErrorOnFailure(writer->Put(TLV::ContextTag(2), debug_text)); + ReturnErrorOnFailure(writer->PutString(TLV::ContextTag(2), debug_text)); return commandObj->FinishCommand(); } @@ -494,7 +491,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co exit: gFabricBeingCommissioned.Reset(); - SendNOCResponse(commandObj, nocResponse, fabricIndex, ByteSpan()); + SendNOCResponse(commandObj, nocResponse, fabricIndex, CharSpan()); if (nocResponse != EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS) { @@ -538,7 +535,7 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler * exit: - SendNOCResponse(commandObj, nocResponse, fabricIndex, ByteSpan()); + SendNOCResponse(commandObj, nocResponse, fabricIndex, CharSpan()); if (nocResponse != EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS) { diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp index 7317343ef57c13..724090aabd2807 100644 --- a/src/app/clusters/ota-provider/ota-provider.cpp +++ b/src/app/clusters/ota-provider/ota-provider.cpp @@ -189,11 +189,6 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(app::CommandHandl ChipLogDetail(Zcl, "OTA Provider received QueryImage"); - // TODO: (#7112) support location param and verify length once CHAR_STRING is supported - // Using location parameter is blocked by #5542 (use Span for string arguments). For now, there is no way to safely get the - // length of the location string because it is not guaranteed to be null-terminated. - Span locationSpan; - if (metadataForProvider.size() > kMaxMetadataLen) { ChipLogError(Zcl, "metadata size %zu exceeds max %zu", metadataForProvider.size(), kMaxMetadataLen); @@ -201,7 +196,7 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(app::CommandHandl } status = delegate->HandleQueryImage(commandObj, vendorId, productId, hardwareVersion, softwareVersion, protocolsSupported, - locationSpan, requestorCanConsent, metadataForProvider); + commandData.location, requestorCanConsent, metadataForProvider); if (status != EMBER_ZCL_STATUS_SUCCESS) { emberAfSendImmediateDefaultResponse(status); diff --git a/src/app/zap-templates/templates/app/attribute-size-src.zapt b/src/app/zap-templates/templates/app/attribute-size-src.zapt index a842398ef41cb7..d72e66d18e022d 100644 --- a/src/app/zap-templates/templates/app/attribute-size-src.zapt +++ b/src/app/zap-templates/templates/app/attribute-size-src.zapt @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -85,7 +86,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo {{chipType}} * entry = reinterpret_cast<{{chipType}} *>(write ? src : dest); {{#chip_attribute_list_entryTypes}} {{#if (isString type)}} + {{#if (isOctetString type)}} ByteSpan * {{name}}Span = &entry->{{name}}; // {{type}} + {{else}} + ByteSpan {{name}}SpanStorage(Uint8::from_const_char(entry->{{name}}.data()), entry->{{name}}.size()); // {{type}} + ByteSpan * {{name}}Span = &{{name}}SpanStorage; + {{/if}} if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, {{size}}, {{name}}Span) : ReadByteSpan(src + entryOffset, {{size}}, {{name}}Span))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); diff --git a/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml index d1cae9fa4aebf0..c6a87f87fed805 100644 --- a/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml @@ -45,7 +45,7 @@ limitations under the License. - + @@ -58,4 +58,4 @@ limitations under the License. - \ No newline at end of file + diff --git a/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml index 76f4920c7e5eb7..62497c43e0231e 100644 --- a/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml @@ -19,8 +19,8 @@ limitations under the License. - - + + diff --git a/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml index 2d43c339c6385c..8d9edde2dc1bc7 100644 --- a/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml @@ -67,8 +67,7 @@ limitations under the License. - - + diff --git a/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml index a7dd293f03a032..b75e94bca0b0c0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml @@ -53,8 +53,8 @@ limitations under the License. - - + + @@ -73,4 +73,4 @@ limitations under the License. - \ No newline at end of file + diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml index 47f7b7f5f484ee..7f5aca0a6087ff 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml @@ -24,7 +24,7 @@ limitations under the License. - + @@ -108,12 +108,11 @@ limitations under the License. - Response to AddNOC or UpdateNOC commands. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml index 3bbe5761679676..d24e20ce163cb5 100644 --- a/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml @@ -19,8 +19,7 @@ limitations under the License. - - + @@ -39,4 +38,4 @@ limitations under the License. Reception of this command SHALL reset the values: The StackFreeMinimum field of the ThreadMetrics attribute, CurrentHeapHighWaterMark attribute - \ No newline at end of file + diff --git a/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml index ea6e39e239ae60..1fb16d28ab5740 100644 --- a/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml @@ -51,6 +51,6 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/tv-channel-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/tv-channel-cluster.xml index f6eb0eff80f95d..a149f35746ba31 100644 --- a/src/app/zap-templates/zcl/data-model/chip/tv-channel-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/tv-channel-cluster.xml @@ -59,9 +59,9 @@ limitations under the License. - - - + + + @@ -83,4 +83,4 @@ limitations under the License. - \ No newline at end of file + diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index cd484653feca2b..7a4d04ae233ed9 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1447,7 +1447,7 @@ void DeviceCommissioner::OnAddNOCFailureResponse(void * context, uint8_t status) } void DeviceCommissioner::OnOperationalCertificateAddResponse(void * context, uint8_t StatusCode, uint8_t FabricIndex, - ByteSpan DebugText) + CharSpan DebugText) { ChipLogProgress(Controller, "Device returned status %d on receiving the NOC", StatusCode); DeviceCommissioner * commissioner = static_cast(context); diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index fad27a7a9bef02..d2e406c536e264 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -645,7 +645,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, /* Callback when adding operational certs to device results in failure */ static void OnAddNOCFailureResponse(void * context, uint8_t status); /* Callback when the device confirms that it has added the operational certificates */ - static void OnOperationalCertificateAddResponse(void * context, uint8_t StatusCode, uint8_t FabricIndex, ByteSpan DebugText); + static void OnOperationalCertificateAddResponse(void * context, uint8_t StatusCode, uint8_t FabricIndex, CharSpan DebugText); /* Callback when the device confirms that it has added the root certificate */ static void OnRootCertSuccessResponse(void * context); diff --git a/src/controller/java/templates/CHIPClusters-JNI.zapt b/src/controller/java/templates/CHIPClusters-JNI.zapt index 127dc2c271e00e..eb481608cafd1f 100644 --- a/src/controller/java/templates/CHIPClusters-JNI.zapt +++ b/src/controller/java/templates/CHIPClusters-JNI.zapt @@ -462,7 +462,8 @@ class CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCall jbyteArray {{asLowerCamelCase name}} = env->NewByteArray(entry.{{asLowerCamelCase name}}.size()); env->SetByteArrayRegion({{asLowerCamelCase name}}, 0, entry.{{asLowerCamelCase name}}.size(), reinterpret_cast(entry.{{asLowerCamelCase name}}.data())); {{else if (isCharString type)}} - // Implement after ByteSpan is emitted instead of uint8_t *. + UtfString {{asLowerCamelCase name}}Str(env, entry.{{asLowerCamelCase name}}); + jstring {{asLowerCamelCase name}}({{asLowerCamelCase name}}Str.jniValue()); {{else}} {{asJniBasicType type}} {{asLowerCamelCase name}} = entry.{{asLowerCamelCase name}}; {{/if}} @@ -481,7 +482,8 @@ class CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCall jbyteArray {{asLowerCamelCase name}} = env->NewByteArray(entry.size()); env->SetByteArrayRegion({{asLowerCamelCase name}}, 0, entry.size(), reinterpret_cast(entry.data())); {{else if (isCharString type)}} - // Implement after ByteSpan is emitted instead of uint8_t * + UtfString {{asLowerCamelCase name}}Str(env, entry); + jstring {{asLowerCamelCase name}}({{asLowerCamelCase name}}Str.jniValue()); {{else}} jclass entryTypeCls; JniReferences::GetInstance().GetClassRef(env, "java/lang/{{asJavaBasicTypeForZclType type true}}", entryTypeCls); diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 3d88ecfd2e22ea..674cafbc91d698 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -5059,7 +5059,7 @@ class CHIPOperationalCredentialsClusterNOCResponseCallback env->DeleteGlobalRef(javaCallbackRef); }; - static void CallbackFn(void * context, uint8_t StatusCode, uint8_t FabricIndex, chip::ByteSpan DebugText) + static void CallbackFn(void * context, uint8_t StatusCode, uint8_t FabricIndex, chip::CharSpan DebugText) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -5067,7 +5067,7 @@ class CHIPOperationalCredentialsClusterNOCResponseCallback jobject javaCallbackRef; jmethodID javaMethod; CHIPOperationalCredentialsClusterNOCResponseCallback * cppCallback = nullptr; - jbyteArray DebugTextArr; + UtfString DebugTextStr(env, DebugText); VerifyOrExit(env != nullptr, err = CHIP_JNI_ERROR_NO_ENV); @@ -5077,19 +5077,11 @@ class CHIPOperationalCredentialsClusterNOCResponseCallback javaCallbackRef = cppCallback->javaCallbackRef; VerifyOrExit(javaCallbackRef != nullptr, err = CHIP_NO_ERROR); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(II[B)V", &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(IILjava/lang/String;)V", &javaMethod); SuccessOrExit(err); - DebugTextArr = env->NewByteArray(DebugText.size()); - VerifyOrExit(DebugTextArr != nullptr, err = CHIP_ERROR_NO_MEMORY); - env->ExceptionClear(); - env->SetByteArrayRegion(DebugTextArr, 0, DebugText.size(), reinterpret_cast(DebugText.data())); - VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(StatusCode), static_cast(FabricIndex), - DebugTextArr); - - env->DeleteLocalRef(DebugTextArr); + DebugTextStr.jniValue()); exit: if (err != CHIP_NO_ERROR) @@ -6105,7 +6097,7 @@ class CHIPAudioOutputAudioOutputListAttributeCallback : public Callback::Callbac ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$AudioOutputCluster$AudioOutputListAttribute")); JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(II[B)V"); + jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(IILjava/lang/String;)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find AudioOutputListAttribute constructor")); auto iter = list.begin(); @@ -6114,8 +6106,8 @@ class CHIPAudioOutputAudioOutputListAttributeCallback : public Callback::Callbac auto & entry = iter.GetValue(); jint index = entry.index; jint outputType = entry.outputType; - jbyteArray name = env->NewByteArray(entry.name.size()); - env->SetByteArrayRegion(name, 0, entry.name.size(), reinterpret_cast(entry.name.data())); + UtfString nameStr(env, entry.name); + jstring name(nameStr.jniValue()); jobject attributeObj = env->NewObject(attributeClass, attributeCtor, index, outputType, name); VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create AudioOutputListAttribute object")); @@ -6655,17 +6647,17 @@ class CHIPFixedLabelLabelListAttributeCallback : public Callback::CallbackGetMethodID(attributeClass, "", "([B[B)V"); + jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/String;Ljava/lang/String;)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find LabelListAttribute constructor")); auto iter = list.begin(); while (iter.Next()) { - auto & entry = iter.GetValue(); - jbyteArray label = env->NewByteArray(entry.label.size()); - env->SetByteArrayRegion(label, 0, entry.label.size(), reinterpret_cast(entry.label.data())); - jbyteArray value = env->NewByteArray(entry.value.size()); - env->SetByteArrayRegion(value, 0, entry.value.size(), reinterpret_cast(entry.value.data())); + auto & entry = iter.GetValue(); + UtfString labelStr(env, entry.label); + jstring label(labelStr.jniValue()); + UtfString valueStr(env, entry.value); + jstring value(valueStr.jniValue()); jobject attributeObj = env->NewObject(attributeClass, attributeCtor, label, value); VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create LabelListAttribute object")); @@ -6843,15 +6835,15 @@ class CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback Zcl, "Could not find class chip/devicecontroller/ChipClusters$GeneralDiagnosticsCluster$NetworkInterfacesAttribute")); JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "([BZZZ[BI)V"); + jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/String;ZZZ[BI)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find NetworkInterfacesAttribute constructor")); auto iter = list.begin(); while (iter.Next()) { - auto & entry = iter.GetValue(); - jbyteArray name = env->NewByteArray(entry.name.size()); - env->SetByteArrayRegion(name, 0, entry.name.size(), reinterpret_cast(entry.name.data())); + auto & entry = iter.GetValue(); + UtfString nameStr(env, entry.name); + jstring name(nameStr.jniValue()); jboolean fabricConnected = entry.fabricConnected; jboolean offPremiseServicesReachableIPv4 = entry.offPremiseServicesReachableIPv4; jboolean offPremiseServicesReachableIPv6 = entry.offPremiseServicesReachableIPv6; @@ -7123,20 +7115,19 @@ class CHIPMediaInputMediaInputListAttributeCallback : public Callback::Callback< err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$MediaInputCluster$MediaInputListAttribute")); JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(II[B[B)V"); + jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(IILjava/lang/String;Ljava/lang/String;)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find MediaInputListAttribute constructor")); auto iter = list.begin(); while (iter.Next()) { - auto & entry = iter.GetValue(); - jint index = entry.index; - jint inputType = entry.inputType; - jbyteArray name = env->NewByteArray(entry.name.size()); - env->SetByteArrayRegion(name, 0, entry.name.size(), reinterpret_cast(entry.name.data())); - jbyteArray description = env->NewByteArray(entry.description.size()); - env->SetByteArrayRegion(description, 0, entry.description.size(), - reinterpret_cast(entry.description.data())); + auto & entry = iter.GetValue(); + jint index = entry.index; + jint inputType = entry.inputType; + UtfString nameStr(env, entry.name); + jstring name(nameStr.jniValue()); + UtfString descriptionStr(env, entry.description); + jstring description(descriptionStr.jniValue()); jobject attributeObj = env->NewObject(attributeClass, attributeCtor, index, inputType, name, description); VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create MediaInputListAttribute object")); @@ -7219,7 +7210,7 @@ class CHIPOperationalCredentialsFabricsListAttributeCallback ChipLogError( Zcl, "Could not find class chip/devicecontroller/ChipClusters$OperationalCredentialsCluster$FabricsListAttribute")); JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(I[BIJJ[B)V"); + jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(I[BIJJLjava/lang/String;)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find FabricsListAttribute constructor")); auto iter = list.begin(); @@ -7230,11 +7221,11 @@ class CHIPOperationalCredentialsFabricsListAttributeCallback jbyteArray rootPublicKey = env->NewByteArray(entry.rootPublicKey.size()); env->SetByteArrayRegion(rootPublicKey, 0, entry.rootPublicKey.size(), reinterpret_cast(entry.rootPublicKey.data())); - jint vendorId = entry.vendorId; - jlong fabricId = entry.fabricId; - jlong nodeId = entry.nodeId; - jbyteArray label = env->NewByteArray(entry.label.size()); - env->SetByteArrayRegion(label, 0, entry.label.size(), reinterpret_cast(entry.label.data())); + jint vendorId = entry.vendorId; + jlong fabricId = entry.fabricId; + jlong nodeId = entry.nodeId; + UtfString labelStr(env, entry.label); + jstring label(labelStr.jniValue()); jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, rootPublicKey, vendorId, fabricId, nodeId, label); @@ -7390,7 +7381,8 @@ class CHIPTvChannelTvChannelListAttributeCallback : public Callback::CallbackGetMethodID(attributeClass, "", "(II[B[B[B)V"); + jmethodID attributeCtor = + env->GetMethodID(attributeClass, "", "(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find TvChannelListAttribute constructor")); auto iter = list.begin(); @@ -7399,13 +7391,12 @@ class CHIPTvChannelTvChannelListAttributeCallback : public Callback::CallbackNewByteArray(entry.name.size()); - env->SetByteArrayRegion(name, 0, entry.name.size(), reinterpret_cast(entry.name.data())); - jbyteArray callSign = env->NewByteArray(entry.callSign.size()); - env->SetByteArrayRegion(callSign, 0, entry.callSign.size(), reinterpret_cast(entry.callSign.data())); - jbyteArray affiliateCallSign = env->NewByteArray(entry.affiliateCallSign.size()); - env->SetByteArrayRegion(affiliateCallSign, 0, entry.affiliateCallSign.size(), - reinterpret_cast(entry.affiliateCallSign.data())); + UtfString nameStr(env, entry.name); + jstring name(nameStr.jniValue()); + UtfString callSignStr(env, entry.callSign); + jstring callSign(callSignStr.jniValue()); + UtfString affiliateCallSignStr(env, entry.affiliateCallSign); + jstring affiliateCallSign(affiliateCallSignStr.jniValue()); jobject attributeObj = env->NewObject(attributeClass, attributeCtor, majorNumber, minorNumber, name, callSign, affiliateCallSign); @@ -7489,7 +7480,7 @@ class CHIPTargetNavigatorTargetNavigatorListAttributeCallback Zcl, "Could not find class chip/devicecontroller/ChipClusters$TargetNavigatorCluster$TargetNavigatorListAttribute")); JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(I[B)V"); + jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(ILjava/lang/String;)V"); VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find TargetNavigatorListAttribute constructor")); auto iter = list.begin(); @@ -7497,8 +7488,8 @@ class CHIPTargetNavigatorTargetNavigatorListAttributeCallback { auto & entry = iter.GetValue(); jint identifier = entry.identifier; - jbyteArray name = env->NewByteArray(entry.name.size()); - env->SetByteArrayRegion(name, 0, entry.name.size(), reinterpret_cast(entry.name.data())); + UtfString nameStr(env, entry.name); + jstring name(nameStr.jniValue()); jobject attributeObj = env->NewObject(attributeClass, attributeCtor, identifier, name); VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create TargetNavigatorListAttribute object")); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 76d2594b9e9a34..94480f91598fee 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -364,9 +364,9 @@ private native void selectOutput( public static class AudioOutputListAttribute { public int index; public int outputType; - public byte[] name; + public String name; - public AudioOutputListAttribute(int index, int outputType, byte[] name) { + public AudioOutputListAttribute(int index, int outputType, String name) { this.index = index; this.outputType = outputType; this.name = name; @@ -2702,10 +2702,10 @@ public static long clusterId() { public native long initWithDevice(long devicePtr, int endpointId); public static class LabelListAttribute { - public byte[] label; - public byte[] value; + public String label; + public String value; - public LabelListAttribute(byte[] label, byte[] value) { + public LabelListAttribute(String label, String value) { this.label = label; this.value = value; } @@ -2899,7 +2899,7 @@ public static long clusterId() { public native long initWithDevice(long devicePtr, int endpointId); public static class NetworkInterfacesAttribute { - public byte[] name; + public String name; public boolean fabricConnected; public boolean offPremiseServicesReachableIPv4; public boolean offPremiseServicesReachableIPv6; @@ -2907,7 +2907,7 @@ public static class NetworkInterfacesAttribute { public int type; public NetworkInterfacesAttribute( - byte[] name, + String name, boolean fabricConnected, boolean offPremiseServicesReachableIPv4, boolean offPremiseServicesReachableIPv6, @@ -3594,10 +3594,10 @@ private native void selectInput( public static class MediaInputListAttribute { public int index; public int inputType; - public byte[] name; - public byte[] description; + public String name; + public String description; - public MediaInputListAttribute(int index, int inputType, byte[] name, byte[] description) { + public MediaInputListAttribute(int index, int inputType, String name, String description) { this.index = index; this.inputType = inputType; this.name = name; @@ -4551,7 +4551,7 @@ public interface CertificateChainResponseCallback { } public interface NOCResponseCallback { - void onSuccess(int StatusCode, int FabricIndex, byte[] DebugText); + void onSuccess(int StatusCode, int FabricIndex, String DebugText); void onError(Exception error); } @@ -4568,7 +4568,7 @@ public static class FabricsListAttribute { public int vendorId; public long fabricId; public long nodeId; - public byte[] label; + public String label; public FabricsListAttribute( int fabricIndex, @@ -4576,7 +4576,7 @@ public FabricsListAttribute( int vendorId, long fabricId, long nodeId, - byte[] label) { + String label) { this.fabricIndex = fabricIndex; this.rootPublicKey = rootPublicKey; this.vendorId = vendorId; @@ -5236,16 +5236,16 @@ void onSuccess( public static class TvChannelListAttribute { public int majorNumber; public int minorNumber; - public byte[] name; - public byte[] callSign; - public byte[] affiliateCallSign; + public String name; + public String callSign; + public String affiliateCallSign; public TvChannelListAttribute( int majorNumber, int minorNumber, - byte[] name, - byte[] callSign, - byte[] affiliateCallSign) { + String name, + String callSign, + String affiliateCallSign) { this.majorNumber = majorNumber; this.minorNumber = minorNumber; this.name = name; @@ -5316,9 +5316,9 @@ public interface NavigateTargetResponseCallback { public static class TargetNavigatorListAttribute { public int identifier; - public byte[] name; + public String name; - public TargetNavigatorListAttribute(int identifier, byte[] name) { + public TargetNavigatorListAttribute(int identifier, String name) { this.identifier = identifier; this.name = name; } diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 7902588ab853a6..98e229051819b7 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -176,7 +176,7 @@ static void OnAudioOutputAudioOutputListListAttributeResponse( ChipLogProgress(Zcl, " {"); ChipLogProgress(Zcl, " index: %" PRIu8 ",", entry.index); ChipLogProgress(Zcl, " outputType: %" PRIu8 ",", entry.outputType); - ChipLogProgress(Zcl, " name: %s,", ByteSpanToString(entry.name).c_str()); + ChipLogProgress(Zcl, " name: %.*s,", static_cast(entry.name.size()), entry.name.data()); ChipLogProgress(Zcl, " },"); } @@ -464,8 +464,8 @@ static void OnFixedLabelLabelListListAttributeResponse( auto & entry = iter.GetValue(); #endif // CHIP_PROGRESS_LOGGING ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " label: %s,", ByteSpanToString(entry.label).c_str()); - ChipLogProgress(Zcl, " value: %s,", ByteSpanToString(entry.value).c_str()); + ChipLogProgress(Zcl, " label: %.*s,", static_cast(entry.label.size()), entry.label.data()); + ChipLogProgress(Zcl, " value: %.*s,", static_cast(entry.value.size()), entry.value.data()); ChipLogProgress(Zcl, " },"); } @@ -555,7 +555,7 @@ static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse( auto & entry = iter.GetValue(); #endif // CHIP_PROGRESS_LOGGING ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " Name: %s,", ByteSpanToString(entry.name).c_str()); + ChipLogProgress(Zcl, " Name: %.*s,", static_cast(entry.name.size()), entry.name.data()); ChipLogProgress(Zcl, " FabricConnected: %d,", entry.fabricConnected); ChipLogProgress(Zcl, " OffPremiseServicesReachableIPv4: %d,", entry.offPremiseServicesReachableIPv4); ChipLogProgress(Zcl, " OffPremiseServicesReachableIPv6: %d,", entry.offPremiseServicesReachableIPv6); @@ -699,8 +699,8 @@ static void OnMediaInputMediaInputListListAttributeResponse( ChipLogProgress(Zcl, " {"); ChipLogProgress(Zcl, " index: %" PRIu8 ",", entry.index); ChipLogProgress(Zcl, " inputType: %" PRIu8 ",", entry.inputType); - ChipLogProgress(Zcl, " name: %s,", ByteSpanToString(entry.name).c_str()); - ChipLogProgress(Zcl, " description: %s,", ByteSpanToString(entry.description).c_str()); + ChipLogProgress(Zcl, " name: %.*s,", static_cast(entry.name.size()), entry.name.data()); + ChipLogProgress(Zcl, " description: %.*s,", static_cast(entry.description.size()), entry.description.data()); ChipLogProgress(Zcl, " },"); } @@ -749,7 +749,7 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse( ChipLogProgress(Zcl, " VendorId: %" PRIu16 ",", entry.vendorId); ChipLogProgress(Zcl, " FabricId: %" PRIu64 ",", entry.fabricId); ChipLogProgress(Zcl, " NodeId: %" PRIu64 ",", entry.nodeId); - ChipLogProgress(Zcl, " Label: %s,", ByteSpanToString(entry.label).c_str()); + ChipLogProgress(Zcl, " Label: %.*s,", static_cast(entry.label.size()), entry.label.data()); ChipLogProgress(Zcl, " },"); } @@ -833,9 +833,10 @@ static void OnTvChannelTvChannelListListAttributeResponse( ChipLogProgress(Zcl, " {"); ChipLogProgress(Zcl, " majorNumber: %" PRIu16 ",", entry.majorNumber); ChipLogProgress(Zcl, " minorNumber: %" PRIu16 ",", entry.minorNumber); - ChipLogProgress(Zcl, " name: %s,", ByteSpanToString(entry.name).c_str()); - ChipLogProgress(Zcl, " callSign: %s,", ByteSpanToString(entry.callSign).c_str()); - ChipLogProgress(Zcl, " affiliateCallSign: %s,", ByteSpanToString(entry.affiliateCallSign).c_str()); + ChipLogProgress(Zcl, " name: %.*s,", static_cast(entry.name.size()), entry.name.data()); + ChipLogProgress(Zcl, " callSign: %.*s,", static_cast(entry.callSign.size()), entry.callSign.data()); + ChipLogProgress(Zcl, " affiliateCallSign: %.*s,", static_cast(entry.affiliateCallSign.size()), + entry.affiliateCallSign.data()); ChipLogProgress(Zcl, " },"); } @@ -880,7 +881,7 @@ static void OnTargetNavigatorTargetNavigatorListListAttributeResponse( #endif // CHIP_PROGRESS_LOGGING ChipLogProgress(Zcl, " {"); ChipLogProgress(Zcl, " identifier: %" PRIu8 ",", entry.identifier); - ChipLogProgress(Zcl, " name: %s,", ByteSpanToString(entry.name).c_str()); + ChipLogProgress(Zcl, " name: %.*s,", static_cast(entry.name.size()), entry.name.data()); ChipLogProgress(Zcl, " },"); } diff --git a/src/controller/python/templates/python-CHIPClusters-cpp.zapt b/src/controller/python/templates/python-CHIPClusters-cpp.zapt index 9d2b7b00f32520..f75cb2feea4717 100644 --- a/src/controller/python/templates/python-CHIPClusters-cpp.zapt +++ b/src/controller/python/templates/python-CHIPClusters-cpp.zapt @@ -122,7 +122,7 @@ static void On{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}ListAttri {{#if (isOctetString type)}} ChipLogProgress(Zcl, " {{asSymbol label}}: %s,", ByteSpanToString(entry.{{asLowerCamelCase name}}).c_str()); {{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,", static_cast(entry.{{asLowerCamelCase name}}.size()), entry.{{asLowerCamelCase name}}.data()); {{else}} ChipLogProgress(Zcl, " {{asSymbol label}}: {{asPrintFormat type}},", entry.{{asLowerCamelCase name}}); {{/if}} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index 5be34e1c073063..92f7279b3f13bb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -104,7 +104,7 @@ [array addObject:@ { @"index" : [NSNumber numberWithUnsignedChar:entry.index], @"outputType" : [NSNumber numberWithUnsignedChar:entry.outputType], - @"name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()], + @"name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding], }]; } if (iter.GetStatus() != CHIP_NO_ERROR) { @@ -228,8 +228,8 @@ while (iter.Next()) { auto & entry = iter.GetValue(); [array addObject:@ { - @"label" : [NSData dataWithBytes:entry.label.data() length:entry.label.size()], - @"value" : [NSData dataWithBytes:entry.value.data() length:entry.value.size()], + @"label" : [[NSString alloc] initWithBytes:entry.label.data() length:entry.label.size() encoding:NSUTF8StringEncoding], + @"value" : [[NSString alloc] initWithBytes:entry.value.data() length:entry.value.size() encoding:NSUTF8StringEncoding], }]; } if (iter.GetStatus() != CHIP_NO_ERROR) { @@ -269,7 +269,7 @@ while (iter.Next()) { auto & entry = iter.GetValue(); [array addObject:@ { - @"Name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()], + @"Name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding], @"FabricConnected" : [NSNumber numberWithBool:entry.fabricConnected], @"OffPremiseServicesReachableIPv4" : [NSNumber numberWithBool:entry.offPremiseServicesReachableIPv4], @"OffPremiseServicesReachableIPv6" : [NSNumber numberWithBool:entry.offPremiseServicesReachableIPv6], @@ -339,8 +339,10 @@ [array addObject:@ { @"index" : [NSNumber numberWithUnsignedChar:entry.index], @"inputType" : [NSNumber numberWithUnsignedChar:entry.inputType], - @"name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()], - @"description" : [NSData dataWithBytes:entry.description.data() length:entry.description.size()], + @"name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding], + @"description" : [[NSString alloc] initWithBytes:entry.description.data() + length:entry.description.size() + encoding:NSUTF8StringEncoding], }]; } if (iter.GetStatus() != CHIP_NO_ERROR) { @@ -365,7 +367,7 @@ @"VendorId" : [NSNumber numberWithUnsignedShort:entry.vendorId], @"FabricId" : [NSNumber numberWithUnsignedLongLong:entry.fabricId], @"NodeId" : [NSNumber numberWithUnsignedLongLong:entry.nodeId], - @"Label" : [NSData dataWithBytes:entry.label.data() length:entry.label.size()], + @"Label" : [[NSString alloc] initWithBytes:entry.label.data() length:entry.label.size() encoding:NSUTF8StringEncoding], }]; } if (iter.GetStatus() != CHIP_NO_ERROR) { @@ -403,9 +405,13 @@ [array addObject:@ { @"majorNumber" : [NSNumber numberWithUnsignedShort:entry.majorNumber], @"minorNumber" : [NSNumber numberWithUnsignedShort:entry.minorNumber], - @"name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()], - @"callSign" : [NSData dataWithBytes:entry.callSign.data() length:entry.callSign.size()], - @"affiliateCallSign" : [NSData dataWithBytes:entry.affiliateCallSign.data() length:entry.affiliateCallSign.size()], + @"name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding], + @"callSign" : [[NSString alloc] initWithBytes:entry.callSign.data() + length:entry.callSign.size() + encoding:NSUTF8StringEncoding], + @"affiliateCallSign" : [[NSString alloc] initWithBytes:entry.affiliateCallSign.data() + length:entry.affiliateCallSign.size() + encoding:NSUTF8StringEncoding], }]; } if (iter.GetStatus() != CHIP_NO_ERROR) { @@ -426,7 +432,7 @@ auto & entry = iter.GetValue(); [array addObject:@ { @"identifier" : [NSNumber numberWithUnsignedChar:entry.identifier], - @"name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()], + @"name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding], }]; } if (iter.GetStatus() != CHIP_NO_ERROR) { @@ -1127,12 +1133,12 @@ }; void CHIPOperationalCredentialsClusterNOCResponseCallbackBridge::OnSuccessFn( - void * context, uint8_t StatusCode, uint8_t FabricIndex, chip::ByteSpan DebugText) + void * context, uint8_t StatusCode, uint8_t FabricIndex, chip::CharSpan DebugText) { DispatchSuccess(context, @ { @"StatusCode" : [NSNumber numberWithUnsignedChar:StatusCode], @"FabricIndex" : [NSNumber numberWithUnsignedChar:FabricIndex], - @"DebugText" : [NSData dataWithBytes:DebugText.data() length:DebugText.size()], + @"DebugText" : [[NSString alloc] initWithBytes:DebugText.data() length:DebugText.size() encoding:NSUTF8StringEncoding], }); }; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 81f622b7e98749..9a0209d1a840cd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -1142,7 +1142,7 @@ class CHIPOperationalCredentialsClusterNOCResponseCallbackBridge CHIPActionBlock action, bool keepAlive = false) : CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; - static void OnSuccessFn(void * context, uint8_t StatusCode, uint8_t FabricIndex, chip::ByteSpan DebugText); + static void OnSuccessFn(void * context, uint8_t StatusCode, uint8_t FabricIndex, chip::CharSpan DebugText); }; class CHIPOperationalCredentialsClusterOpCSRResponseCallbackBridge diff --git a/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp b/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp index 99869a59f8c7f7..c317be238e49ec 100644 --- a/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -117,8 +118,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->outputType)); // AudioOutputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { @@ -255,15 +257,17 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING + ByteSpan labelSpanStorage(Uint8::from_const_char(entry->label.data()), entry->label.size()); // CHAR_STRING + ByteSpan * labelSpan = &labelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING + entryOffset = static_cast(entryOffset + 18); + ByteSpan valueSpanStorage(Uint8::from_const_char(entry->value.data()), entry->value.size()); // CHAR_STRING + ByteSpan * valueSpan = &valueSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) { @@ -316,7 +320,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -426,16 +431,19 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->inputType)); // MediaInputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan descriptionSpanStorage(Uint8::from_const_char(entry->description.data()), + entry->description.size()); // CHAR_STRING + ByteSpan * descriptionSpan = &descriptionSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) @@ -481,8 +489,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { @@ -561,24 +570,28 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, &entryOffset, sizeof(entry->majorNumber)); // INT16U copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->minorNumber)); // INT16U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan callSignSpanStorage(Uint8::from_const_char(entry->callSign.data()), entry->callSign.size()); // CHAR_STRING + ByteSpan * callSignSpan = &callSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan affiliateCallSignSpanStorage(Uint8::from_const_char(entry->affiliateCallSign.data()), + entry->affiliateCallSign.size()); // CHAR_STRING + ByteSpan * affiliateCallSignSpan = &affiliateCallSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) @@ -609,8 +622,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->identifier)); // INT8U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.h b/zzz_generated/app-common/app-common/zap-generated/af-structs.h index eb3f49d9b71f66..9edfddb7a0ddb2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/af-structs.h +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.h @@ -92,7 +92,7 @@ typedef struct _AudioOutputInfo { uint8_t index; uint8_t outputType; - chip::ByteSpan name; + chip::CharSpan name; } AudioOutputInfo; // Struct for BasicCommissioningInfoType @@ -172,7 +172,7 @@ typedef struct _FabricDescriptor uint16_t VendorId; chip::FabricId FabricId; chip::NodeId NodeId; - chip::ByteSpan Label; + chip::CharSpan Label; } FabricDescriptor; // Struct for GroupKey @@ -203,8 +203,8 @@ typedef struct _IasAceZoneStatusResult // Struct for LabelStruct typedef struct _LabelStruct { - chip::ByteSpan label; - chip::ByteSpan value; + chip::CharSpan label; + chip::CharSpan value; } LabelStruct; // Struct for MediaInputInfo @@ -212,8 +212,8 @@ typedef struct _MediaInputInfo { uint8_t index; uint8_t inputType; - chip::ByteSpan name; - chip::ByteSpan description; + chip::CharSpan name; + chip::CharSpan description; } MediaInputInfo; // Struct for MediaPlaybackPosition @@ -234,7 +234,7 @@ typedef struct _NOCStruct typedef struct _NavigateTargetTargetInfo { uint8_t identifier; - chip::ByteSpan name; + chip::CharSpan name; } NavigateTargetTargetInfo; // Struct for NeighborTable @@ -259,7 +259,7 @@ typedef struct _NeighborTable // Struct for NetworkInterfaceType typedef struct _NetworkInterfaceType { - chip::ByteSpan Name; + chip::CharSpan Name; bool FabricConnected; bool OffPremiseServicesReachableIPv4; bool OffPremiseServicesReachableIPv6; @@ -378,7 +378,7 @@ typedef struct _ThreadInterfaceScanResult typedef struct _ThreadMetrics { uint64_t Id; - chip::ByteSpan Name; + chip::CharSpan Name; uint32_t StackFreeCurrent; uint32_t StackFreeMinimum; uint32_t StackSize; @@ -400,9 +400,9 @@ typedef struct _TvChannelInfo { uint16_t majorNumber; uint16_t minorNumber; - chip::ByteSpan name; - chip::ByteSpan callSign; - chip::ByteSpan affiliateCallSign; + chip::CharSpan name; + chip::CharSpan callSign; + chip::CharSpan affiliateCallSign; } TvChannelInfo; // Struct for TvChannelLineupInfo 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 3da6c70990da7d..e91ffe86c0830a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -12867,7 +12867,7 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback( * @brief Operational Credentials Cluster NOCResponse Command callback (from server) */ bool emberAfOperationalCredentialsClusterNOCResponseCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj, - uint8_t StatusCode, uint8_t FabricIndex, chip::ByteSpan DebugText); + uint8_t StatusCode, uint8_t FabricIndex, chip::CharSpan DebugText); /** * @brief Operational Credentials Cluster UpdateFabricLabel Command callback (from client) */ 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 921238f10a3ff3..0cb77b889aaca4 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 @@ -6719,7 +6719,7 @@ enum class Fields struct Type { public: - chip::ByteSpan name; + chip::CharSpan name; bool fabricConnected; bool offPremiseServicesReachableIPv4; bool offPremiseServicesReachableIPv6; @@ -6835,7 +6835,7 @@ struct Type { public: uint64_t id; - chip::ByteSpan name; + chip::CharSpan name; uint32_t stackFreeCurrent; uint32_t stackFreeMinimum; uint32_t stackSize; @@ -8526,7 +8526,7 @@ struct Type uint16_t vendorId; chip::FabricId fabricId; chip::NodeId nodeId; - chip::ByteSpan label; + chip::CharSpan label; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -8820,7 +8820,7 @@ struct Type uint8_t statusCode; uint8_t fabricIndex; - chip::ByteSpan debugText; + chip::CharSpan debugText; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -8833,7 +8833,7 @@ struct DecodableType uint8_t statusCode; uint8_t fabricIndex; - chip::ByteSpan debugText; + chip::CharSpan debugText; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace NOCResponse @@ -9007,8 +9007,8 @@ enum class Fields struct Type { public: - chip::ByteSpan label; - chip::ByteSpan value; + chip::CharSpan label; + chip::CharSpan value; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -18301,9 +18301,9 @@ struct Type public: uint16_t majorNumber; uint16_t minorNumber; - chip::ByteSpan name; - chip::ByteSpan callSign; - chip::ByteSpan affiliateCallSign; + chip::CharSpan name; + chip::CharSpan callSign; + chip::CharSpan affiliateCallSign; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -18519,7 +18519,7 @@ struct Type { public: uint8_t identifier; - chip::ByteSpan name; + chip::CharSpan name; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -19382,8 +19382,8 @@ struct Type public: uint8_t index; MediaInputType inputType; - chip::ByteSpan name; - chip::ByteSpan description; + chip::CharSpan name; + chip::CharSpan description; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -20093,7 +20093,7 @@ struct Type public: uint8_t index; AudioOutputType outputType; - chip::ByteSpan name; + chip::CharSpan name; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/bridge-app/zap-generated/attribute-size.cpp b/zzz_generated/bridge-app/zap-generated/attribute-size.cpp index cb8da08a1c8ce8..07b040a2406610 100644 --- a/zzz_generated/bridge-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/bridge-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -155,15 +156,17 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING + ByteSpan labelSpanStorage(Uint8::from_const_char(entry->label.data()), entry->label.size()); // CHAR_STRING + ByteSpan * labelSpan = &labelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING + entryOffset = static_cast(entryOffset + 18); + ByteSpan valueSpanStorage(Uint8::from_const_char(entry->value.data()), entry->value.size()); // CHAR_STRING + ByteSpan * valueSpan = &valueSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) { @@ -216,7 +219,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -280,8 +284,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 8383a3d67a3b80..bddf989461c5b8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -219,7 +219,7 @@ static void OnAudioOutputAudioOutputListListAttributeResponse( ChipLogProgress(chipTool, "AudioOutputInfo[%" PRIu16 "]:", i); ChipLogProgress(chipTool, " index: %" PRIu8 "", entry.index); ChipLogProgress(chipTool, " outputType: %" PRIu8 "", entry.outputType); - ChipLogProgress(Zcl, " name: %zu", entry.name.size()); + ChipLogProgress(Zcl, " name: %.*s", static_cast(entry.name.size()), entry.name.data()); } command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -464,8 +464,8 @@ static void OnFixedLabelLabelListListAttributeResponse( #endif // CHIP_PROGRESS_LOGGING ++i; ChipLogProgress(chipTool, "LabelStruct[%" PRIu16 "]:", i); - ChipLogProgress(Zcl, " label: %zu", entry.label.size()); - ChipLogProgress(Zcl, " value: %zu", entry.value.size()); + ChipLogProgress(Zcl, " label: %.*s", static_cast(entry.label.size()), entry.label.data()); + ChipLogProgress(Zcl, " value: %.*s", static_cast(entry.value.size()), entry.value.data()); } command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -539,7 +539,7 @@ static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse( #endif // CHIP_PROGRESS_LOGGING ++i; ChipLogProgress(chipTool, "NetworkInterfaceType[%" PRIu16 "]:", i); - ChipLogProgress(Zcl, " Name: %zu", entry.name.size()); + ChipLogProgress(Zcl, " Name: %.*s", static_cast(entry.name.size()), entry.name.data()); ChipLogProgress(chipTool, " fabricConnected: %d", entry.fabricConnected); ChipLogProgress(chipTool, " offPremiseServicesReachableIPv4: %d", entry.offPremiseServicesReachableIPv4); ChipLogProgress(chipTool, " offPremiseServicesReachableIPv6: %d", entry.offPremiseServicesReachableIPv6); @@ -660,8 +660,8 @@ static void OnMediaInputMediaInputListListAttributeResponse( ChipLogProgress(chipTool, "MediaInputInfo[%" PRIu16 "]:", i); ChipLogProgress(chipTool, " index: %" PRIu8 "", entry.index); ChipLogProgress(chipTool, " inputType: %" PRIu8 "", entry.inputType); - ChipLogProgress(Zcl, " name: %zu", entry.name.size()); - ChipLogProgress(Zcl, " description: %zu", entry.description.size()); + ChipLogProgress(Zcl, " name: %.*s", static_cast(entry.name.size()), entry.name.data()); + ChipLogProgress(Zcl, " description: %.*s", static_cast(entry.description.size()), entry.description.data()); } command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -703,7 +703,7 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse( ChipLogProgress(chipTool, " vendorId: %" PRIu16 "", entry.vendorId); ChipLogProgress(chipTool, " fabricId: %" PRIu64 "", entry.fabricId); ChipLogProgress(chipTool, " nodeId: %" PRIu64 "", entry.nodeId); - ChipLogProgress(Zcl, " Label: %zu", entry.label.size()); + ChipLogProgress(Zcl, " Label: %.*s", static_cast(entry.label.size()), entry.label.data()); } command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -775,9 +775,10 @@ static void OnTvChannelTvChannelListListAttributeResponse( ChipLogProgress(chipTool, "TvChannelInfo[%" PRIu16 "]:", i); ChipLogProgress(chipTool, " majorNumber: %" PRIu16 "", entry.majorNumber); ChipLogProgress(chipTool, " minorNumber: %" PRIu16 "", entry.minorNumber); - ChipLogProgress(Zcl, " name: %zu", entry.name.size()); - ChipLogProgress(Zcl, " callSign: %zu", entry.callSign.size()); - ChipLogProgress(Zcl, " affiliateCallSign: %zu", entry.affiliateCallSign.size()); + ChipLogProgress(Zcl, " name: %.*s", static_cast(entry.name.size()), entry.name.data()); + ChipLogProgress(Zcl, " callSign: %.*s", static_cast(entry.callSign.size()), entry.callSign.data()); + ChipLogProgress(Zcl, " affiliateCallSign: %.*s", static_cast(entry.affiliateCallSign.size()), + entry.affiliateCallSign.data()); } command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -815,7 +816,7 @@ static void OnTargetNavigatorTargetNavigatorListListAttributeResponse( ++i; ChipLogProgress(chipTool, "NavigateTargetTargetInfo[%" PRIu16 "]:", i); ChipLogProgress(chipTool, " identifier: %" PRIu8 "", entry.identifier); - ChipLogProgress(Zcl, " name: %zu", entry.name.size()); + ChipLogProgress(Zcl, " name: %.*s", static_cast(entry.name.size()), entry.name.data()); } command->SetCommandExitStatus(CHIP_NO_ERROR); @@ -1812,7 +1813,7 @@ static void OnOperationalCredentialsNOCResponseSuccess( ChipLogProgress(Zcl, "Received NOCResponse:"); ChipLogProgress(Zcl, " StatusCode: %" PRIu8 "", data.statusCode); ChipLogProgress(Zcl, " FabricIndex: %" PRIu8 "", data.fabricIndex); - ChipLogProgress(Zcl, " DebugText: %zu", data.debugText.size()); + ChipLogProgress(Zcl, " DebugText: %.*s", static_cast(data.debugText.size()), data.debugText.data()); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_NO_ERROR); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index e5fdaae0d8817e..cdafc888c4df5c 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -1734,12 +1734,12 @@ bool emberAfOperationalCredentialsClusterCertificateChainResponseCallback(Endpoi } bool emberAfOperationalCredentialsClusterNOCResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, - uint8_t StatusCode, uint8_t FabricIndex, chip::ByteSpan DebugText) + uint8_t StatusCode, uint8_t FabricIndex, chip::CharSpan DebugText) { ChipLogProgress(Zcl, "NOCResponse:"); ChipLogProgress(Zcl, " StatusCode: %" PRIu8 "", StatusCode); ChipLogProgress(Zcl, " FabricIndex: %" PRIu8 "", FabricIndex); - ChipLogProgress(Zcl, " DebugText: %zu", DebugText.size()); + ChipLogProgress(Zcl, " DebugText: %.*s", static_cast(DebugText.size()), DebugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterNOCResponseCallback"); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index dcee30dc309c7c..c9536f6e8cadc4 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -123,7 +123,7 @@ typedef void (*OperationalCredentialsClusterAttestationResponseCallback)(void * chip::ByteSpan Signature); typedef void (*OperationalCredentialsClusterCertificateChainResponseCallback)(void * context, chip::ByteSpan Certificate); typedef void (*OperationalCredentialsClusterNOCResponseCallback)(void * context, uint8_t StatusCode, uint8_t FabricIndex, - chip::ByteSpan DebugText); + chip::CharSpan DebugText); typedef void (*OperationalCredentialsClusterOpCSRResponseCallback)(void * context, chip::ByteSpan NOCSRElements, chip::ByteSpan AttestationSignature); typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint8_t status, uint16_t groupId, uint8_t sceneId); diff --git a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp index 11068bf28fe14c..0ef28c73c599c3 100644 --- a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp @@ -4233,7 +4233,7 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa expectArgumentCount = 3; uint8_t StatusCode; uint8_t FabricIndex; - chip::ByteSpan DebugText; + chip::CharSpan DebugText; bool argExists[3]; memset(argExists, 0, sizeof argExists); diff --git a/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp b/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp index d06e4b2c339a7e..6d177c34b97ac7 100644 --- a/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp +++ b/zzz_generated/controller-clusters/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/zzz_generated/lighting-app/zap-generated/attribute-size.cpp b/zzz_generated/lighting-app/zap-generated/attribute-size.cpp index 70dededa2c9285..ff942e42785082 100644 --- a/zzz_generated/lighting-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/lighting-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,7 +180,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -243,8 +245,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/lock-app/zap-generated/attribute-size.cpp b/zzz_generated/lock-app/zap-generated/attribute-size.cpp index 70dededa2c9285..ff942e42785082 100644 --- a/zzz_generated/lock-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/lock-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,7 +180,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -243,8 +245,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp b/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp index 5ca8d86188ccd9..11bb303cbdd145 100644 --- a/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/ota-provider-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -134,8 +135,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/ota-requestor-app/zap-generated/attribute-size.cpp b/zzz_generated/ota-requestor-app/zap-generated/attribute-size.cpp index 3e9a1b1e722595..0f634bf1cb446f 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -134,8 +135,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/pump-app/zap-generated/attribute-size.cpp b/zzz_generated/pump-app/zap-generated/attribute-size.cpp index 70dededa2c9285..ff942e42785082 100644 --- a/zzz_generated/pump-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/pump-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,7 +180,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -243,8 +245,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp b/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp index 70dededa2c9285..ff942e42785082 100644 --- a/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/pump-controller-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,7 +180,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -243,8 +245,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp b/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp index d8608d708e20bf..1e6d7ead69a2e9 100644 --- a/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/temperature-measurement-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,7 +180,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -243,8 +245,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { diff --git a/zzz_generated/thermostat/zap-generated/attribute-size.cpp b/zzz_generated/thermostat/zap-generated/attribute-size.cpp index a9d4d0654a2fe9..49f67d49b1a79f 100644 --- a/zzz_generated/thermostat/zap-generated/attribute-size.cpp +++ b/zzz_generated/thermostat/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -117,8 +118,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->outputType)); // AudioOutputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { @@ -255,15 +257,17 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING + ByteSpan labelSpanStorage(Uint8::from_const_char(entry->label.data()), entry->label.size()); // CHAR_STRING + ByteSpan * labelSpan = &labelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING + entryOffset = static_cast(entryOffset + 18); + ByteSpan valueSpanStorage(Uint8::from_const_char(entry->value.data()), entry->value.size()); // CHAR_STRING + ByteSpan * valueSpan = &valueSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) { @@ -316,7 +320,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -426,16 +431,19 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->inputType)); // MediaInputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan descriptionSpanStorage(Uint8::from_const_char(entry->description.data()), + entry->description.size()); // CHAR_STRING + ByteSpan * descriptionSpan = &descriptionSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) @@ -481,8 +489,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { @@ -541,24 +550,28 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, &entryOffset, sizeof(entry->majorNumber)); // INT16U copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->minorNumber)); // INT16U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan callSignSpanStorage(Uint8::from_const_char(entry->callSign.data()), entry->callSign.size()); // CHAR_STRING + ByteSpan * callSignSpan = &callSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan affiliateCallSignSpanStorage(Uint8::from_const_char(entry->affiliateCallSign.data()), + entry->affiliateCallSign.size()); // CHAR_STRING + ByteSpan * affiliateCallSignSpan = &affiliateCallSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) @@ -589,8 +602,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->identifier)); // INT8U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { diff --git a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp index d8654681be8cba..796e46bf39177e 100644 --- a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp @@ -487,12 +487,12 @@ bool emberAfOperationalCredentialsClusterCertificateChainResponseCallback(Endpoi } bool emberAfOperationalCredentialsClusterNOCResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, - uint8_t StatusCode, uint8_t FabricIndex, chip::ByteSpan DebugText) + uint8_t StatusCode, uint8_t FabricIndex, chip::CharSpan DebugText) { ChipLogProgress(Zcl, "NOCResponse:"); ChipLogProgress(Zcl, " StatusCode: %" PRIu8 "", StatusCode); ChipLogProgress(Zcl, " FabricIndex: %" PRIu8 "", FabricIndex); - ChipLogProgress(Zcl, " DebugText: %zu", DebugText.size()); + ChipLogProgress(Zcl, " DebugText: %.*s", static_cast(DebugText.size()), DebugText.data()); GET_CLUSTER_RESPONSE_CALLBACKS("OperationalCredentialsClusterNOCResponseCallback"); diff --git a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h index 01dc638f83d08e..8f342fd8e7c87f 100644 --- a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h @@ -63,7 +63,7 @@ typedef void (*OperationalCredentialsClusterAttestationResponseCallback)(void * chip::ByteSpan Signature); typedef void (*OperationalCredentialsClusterCertificateChainResponseCallback)(void * context, chip::ByteSpan Certificate); typedef void (*OperationalCredentialsClusterNOCResponseCallback)(void * context, uint8_t StatusCode, uint8_t FabricIndex, - chip::ByteSpan DebugText); + chip::CharSpan DebugText); typedef void (*OperationalCredentialsClusterOpCSRResponseCallback)(void * context, chip::ByteSpan NOCSRElements, chip::ByteSpan AttestationSignature); diff --git a/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp index f07552a2c16ad2..a680bf54539f2f 100644 --- a/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp @@ -2016,7 +2016,7 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa expectArgumentCount = 3; uint8_t StatusCode; uint8_t FabricIndex; - chip::ByteSpan DebugText; + chip::CharSpan DebugText; bool argExists[3]; memset(argExists, 0, sizeof argExists); diff --git a/zzz_generated/tv-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-app/zap-generated/attribute-size.cpp index 1182463e1b7670..8e034db9cc9d33 100644 --- a/zzz_generated/tv-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -117,8 +118,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->outputType)); // AudioOutputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { @@ -279,7 +281,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -389,16 +392,19 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->inputType)); // MediaInputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan descriptionSpanStorage(Uint8::from_const_char(entry->description.data()), + entry->description.size()); // CHAR_STRING + ByteSpan * descriptionSpan = &descriptionSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) @@ -444,8 +450,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { @@ -504,24 +511,28 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, &entryOffset, sizeof(entry->majorNumber)); // INT16U copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->minorNumber)); // INT16U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan callSignSpanStorage(Uint8::from_const_char(entry->callSign.data()), entry->callSign.size()); // CHAR_STRING + ByteSpan * callSignSpan = &callSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan affiliateCallSignSpanStorage(Uint8::from_const_char(entry->affiliateCallSign.data()), + entry->affiliateCallSign.size()); // CHAR_STRING + ByteSpan * affiliateCallSignSpan = &affiliateCallSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) @@ -552,8 +563,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->identifier)); // INT8U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { diff --git a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp index fa60da7b9bd8ca..c2db6bd5582973 100644 --- a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -117,8 +118,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->outputType, write ? (uint8_t *) &entry->outputType : src, write, - &entryOffset, sizeof(entry->outputType)); // AudioOutputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->outputType)); // AudioOutputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { @@ -255,15 +257,17 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _LabelStruct _LabelStruct * entry = reinterpret_cast<_LabelStruct *>(write ? src : dest); - ByteSpan * labelSpan = &entry->label; // OCTET_STRING + ByteSpan labelSpanStorage(Uint8::from_const_char(entry->label.data()), entry->label.size()); // CHAR_STRING + ByteSpan * labelSpan = &labelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, labelSpan) : ReadByteSpan(src + entryOffset, 18, labelSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 18); - ByteSpan * valueSpan = &entry->value; // OCTET_STRING + entryOffset = static_cast(entryOffset + 18); + ByteSpan valueSpanStorage(Uint8::from_const_char(entry->value.data()), entry->value.size()); // CHAR_STRING + ByteSpan * valueSpan = &valueSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 18, valueSpan) : ReadByteSpan(src + entryOffset, 18, valueSpan))) { @@ -316,7 +320,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -426,16 +431,19 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->index, write ? (uint8_t *) &entry->index : src, write, &entryOffset, sizeof(entry->index)); // INT8U copyListMember(write ? dest : (uint8_t *) &entry->inputType, write ? (uint8_t *) &entry->inputType : src, write, - &entryOffset, sizeof(entry->inputType)); // MediaInputType - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->inputType)); // MediaInputType + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * descriptionSpan = &entry->description; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan descriptionSpanStorage(Uint8::from_const_char(entry->description.data()), + entry->description.size()); // CHAR_STRING + ByteSpan * descriptionSpan = &descriptionSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, descriptionSpan) : ReadByteSpan(src + entryOffset, 34, descriptionSpan))) @@ -481,8 +489,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) { @@ -514,24 +523,28 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->majorNumber, write ? (uint8_t *) &entry->majorNumber : src, write, &entryOffset, sizeof(entry->majorNumber)); // INT16U copyListMember(write ? dest : (uint8_t *) &entry->minorNumber, write ? (uint8_t *) &entry->minorNumber : src, write, - &entryOffset, sizeof(entry->minorNumber)); // INT16U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->minorNumber)); // INT16U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * callSignSpan = &entry->callSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan callSignSpanStorage(Uint8::from_const_char(entry->callSign.data()), entry->callSign.size()); // CHAR_STRING + ByteSpan * callSignSpan = &callSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, callSignSpan) : ReadByteSpan(src + entryOffset, 34, callSignSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - entryOffset = static_cast(entryOffset + 34); - ByteSpan * affiliateCallSignSpan = &entry->affiliateCallSign; // OCTET_STRING + entryOffset = static_cast(entryOffset + 34); + ByteSpan affiliateCallSignSpanStorage(Uint8::from_const_char(entry->affiliateCallSign.data()), + entry->affiliateCallSign.size()); // CHAR_STRING + ByteSpan * affiliateCallSignSpan = &affiliateCallSignSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, affiliateCallSignSpan) : ReadByteSpan(src + entryOffset, 34, affiliateCallSignSpan))) @@ -562,8 +575,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo // Struct _NavigateTargetTargetInfo _NavigateTargetTargetInfo * entry = reinterpret_cast<_NavigateTargetTargetInfo *>(write ? src : dest); copyListMember(write ? dest : (uint8_t *) &entry->identifier, write ? (uint8_t *) &entry->identifier : src, write, - &entryOffset, sizeof(entry->identifier)); // INT8U - ByteSpan * nameSpan = &entry->name; // OCTET_STRING + &entryOffset, sizeof(entry->identifier)); // INT8U + ByteSpan nameSpanStorage(Uint8::from_const_char(entry->name.data()), entry->name.size()); // CHAR_STRING + ByteSpan * nameSpan = &nameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, nameSpan) : ReadByteSpan(src + entryOffset, 34, nameSpan))) { diff --git a/zzz_generated/window-app/zap-generated/attribute-size.cpp b/zzz_generated/window-app/zap-generated/attribute-size.cpp index 70dededa2c9285..ff942e42785082 100644 --- a/zzz_generated/window-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/window-app/zap-generated/attribute-size.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,7 +180,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); // Struct _NetworkInterfaceType _NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest); - ByteSpan * NameSpan = &entry->Name; // OCTET_STRING + ByteSpan NameSpanStorage(Uint8::from_const_char(entry->Name.data()), entry->Name.size()); // CHAR_STRING + ByteSpan * NameSpan = &NameSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan))) { @@ -243,8 +245,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write, &entryOffset, sizeof(entry->FabricId)); // FABRIC_ID copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset, - sizeof(entry->NodeId)); // NODE_ID - ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING + sizeof(entry->NodeId)); // NODE_ID + ByteSpan LabelSpanStorage(Uint8::from_const_char(entry->Label.data()), entry->Label.size()); // CHAR_STRING + ByteSpan * LabelSpan = &LabelSpanStorage; if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan))) {