From 9e50a6e8aafbc5f3d9f677d87b8a38770883c59b Mon Sep 17 00:00:00 2001
From: Paul Zander
Date: Fri, 22 Oct 2021 11:59:54 +0200
Subject: [PATCH] Replace OCTET_STRING with now supported CHAR_STRING
---
.../data-model/chip/bridged-actions-cluster.xml | 6 ++----
.../java/zap-generated/CHIPClusters-JNI.cpp | 16 ++++++++--------
.../chip/devicecontroller/ChipClusters.java | 8 ++++----
.../python/chip/clusters/CHIPClusters.cpp | 4 ++--
src/controller/python/chip/clusters/Objects.py | 8 ++++----
.../CHIP/zap-generated/CHIPCallbackBridge.mm | 4 ++--
.../zap-generated/attribute-size.cpp | 10 ++++++----
.../app-common/zap-generated/af-structs.h | 4 ++--
.../app-common/zap-generated/cluster-objects.h | 4 ++--
.../chip-tool/zap-generated/cluster/Commands.h | 4 ++--
10 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml
index f7c43309e2b408..e1f13d4bc8a8ad 100644
--- a/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/bridged-actions-cluster.xml
@@ -68,8 +68,7 @@ limitations under the License.
-
-
+
@@ -79,8 +78,7 @@ limitations under the License.
-
-
+
diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp
index 9f121228e013ef..9bfe5c129c5240 100644
--- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp
+++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp
@@ -6266,16 +6266,16 @@ class CHIPBridgedActionsActionListAttributeCallback : public Callback::Callback<
err == CHIP_NO_ERROR,
ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$BridgedActionsCluster$ActionListAttribute"));
JniClass attributeJniClass(attributeClass);
- jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(I[BIIII)V");
+ jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(ILjava/lang/String;IIII)V");
VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find ActionListAttribute constructor"));
auto iter = list.begin();
while (iter.Next())
{
- auto & entry = iter.GetValue();
- jint actionID = entry.actionID;
- jbyteArray name = env->NewByteArray(entry.name.size());
- env->SetByteArrayRegion(name, 0, entry.name.size(), reinterpret_cast(entry.name.data()));
+ auto & entry = iter.GetValue();
+ jint actionID = entry.actionID;
+ UtfString nameStr(env, entry.name);
+ jstring name(nameStr.jniValue());
jint type = entry.type;
jint endpointListID = entry.endpointListID;
jint supportedCommands = entry.supportedCommands;
@@ -6362,7 +6362,7 @@ class CHIPBridgedActionsEndpointListAttributeCallback : public Callback::Callbac
ChipLogError(Zcl,
"Could not find class chip/devicecontroller/ChipClusters$BridgedActionsCluster$EndpointListAttribute"));
JniClass attributeJniClass(attributeClass);
- jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(I[BI[B)V");
+ jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(ILjava/lang/String;I[B)V");
VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find EndpointListAttribute constructor"));
auto iter = list.begin();
@@ -6370,8 +6370,8 @@ class CHIPBridgedActionsEndpointListAttributeCallback : public Callback::Callbac
{
auto & entry = iter.GetValue();
jint endpointListID = entry.endpointListID;
- 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());
jint type = entry.type;
jbyteArray endpoints = env->NewByteArray(entry.endpoints.size());
env->SetByteArrayRegion(endpoints, 0, entry.endpoints.size(), reinterpret_cast(entry.endpoints.data()));
diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java
index d0c819d4bfd936..f3b3c78180fff6 100644
--- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java
@@ -931,7 +931,7 @@ private native void stopAction(
public static class ActionListAttribute {
public int actionID;
- public byte[] name;
+ public String name;
public int type;
public int endpointListID;
public int supportedCommands;
@@ -939,7 +939,7 @@ public static class ActionListAttribute {
public ActionListAttribute(
int actionID,
- byte[] name,
+ String name,
int type,
int endpointListID,
int supportedCommands,
@@ -961,11 +961,11 @@ public interface ActionListAttributeCallback {
public static class EndpointListAttribute {
public int endpointListID;
- public byte[] name;
+ public String name;
public int type;
public byte[] endpoints;
- public EndpointListAttribute(int endpointListID, byte[] name, int type, byte[] endpoints) {
+ public EndpointListAttribute(int endpointListID, String name, int type, byte[] endpoints) {
this.endpointListID = endpointListID;
this.name = name;
this.type = type;
diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp
index 9449a54fef380e..e7048df97b560c 100644
--- a/src/controller/python/chip/clusters/CHIPClusters.cpp
+++ b/src/controller/python/chip/clusters/CHIPClusters.cpp
@@ -222,7 +222,7 @@ static void OnBridgedActionsActionListListAttributeResponse(
#endif // CHIP_PROGRESS_LOGGING
ChipLogProgress(Zcl, " {");
ChipLogProgress(Zcl, " ActionID: %" PRIu16 ",", entry.actionID);
- ChipLogProgress(Zcl, " Name: %s,", ByteSpanToString(entry.name).c_str());
+ ChipLogProgress(Zcl, " Name: %.*s,", static_cast(entry.name.size()), entry.name.data());
ChipLogProgress(Zcl, " Type: %" PRIu8 ",", entry.type);
ChipLogProgress(Zcl, " EndpointListID: %" PRIu16 ",", entry.endpointListID);
ChipLogProgress(Zcl, " SupportedCommands: %" PRIu16 ",", entry.supportedCommands);
@@ -272,7 +272,7 @@ static void OnBridgedActionsEndpointListListAttributeResponse(
#endif // CHIP_PROGRESS_LOGGING
ChipLogProgress(Zcl, " {");
ChipLogProgress(Zcl, " EndpointListID: %" PRIu16 ",", entry.endpointListID);
- ChipLogProgress(Zcl, " Name: %s,", ByteSpanToString(entry.name).c_str());
+ ChipLogProgress(Zcl, " Name: %.*s,", static_cast(entry.name.size()), entry.name.data());
ChipLogProgress(Zcl, " Type: %" PRIu8 ",", entry.type);
ChipLogProgress(Zcl, " Endpoints: %s,", ByteSpanToString(entry.endpoints).c_str());
ChipLogProgress(Zcl, " },");
diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py
index d9843eee04999e..3dbd652af37e92 100644
--- a/src/controller/python/chip/clusters/Objects.py
+++ b/src/controller/python/chip/clusters/Objects.py
@@ -4177,7 +4177,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
ClusterObjectFieldDescriptor(
Label="ActionID", Tag=0, Type=uint),
ClusterObjectFieldDescriptor(
- Label="Name", Tag=1, Type=bytes),
+ Label="Name", Tag=1, Type=str),
ClusterObjectFieldDescriptor(
Label="Type", Tag=2, Type=BridgedActions.Enums.ActionTypeEnum),
ClusterObjectFieldDescriptor(
@@ -4189,7 +4189,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
])
ActionID: 'uint' = None
- Name: 'bytes' = None
+ Name: 'str' = None
Type: 'BridgedActions.Enums.ActionTypeEnum' = None
EndpointListID: 'uint' = None
SupportedCommands: 'uint' = None
@@ -4204,7 +4204,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
ClusterObjectFieldDescriptor(
Label="EndpointListID", Tag=0, Type=uint),
ClusterObjectFieldDescriptor(
- Label="Name", Tag=1, Type=bytes),
+ Label="Name", Tag=1, Type=str),
ClusterObjectFieldDescriptor(
Label="Type", Tag=2, Type=BridgedActions.Enums.EndpointListTypeEnum),
ClusterObjectFieldDescriptor(
@@ -4212,7 +4212,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
])
EndpointListID: 'uint' = None
- Name: 'bytes' = None
+ Name: 'str' = None
Type: 'BridgedActions.Enums.EndpointListTypeEnum' = None
Endpoints: 'bytes' = None
diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm
index 117dcfb4360c69..9861bbcf7f603f 100644
--- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm
@@ -124,7 +124,7 @@
auto & entry = iter.GetValue();
[array addObject:@ {
@"ActionID" : [NSNumber numberWithUnsignedShort:entry.actionID],
- @"Name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()],
+ @"Name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding],
@"Type" : [NSNumber numberWithUnsignedChar:entry.type],
@"EndpointListID" : [NSNumber numberWithUnsignedShort:entry.endpointListID],
@"SupportedCommands" : [NSNumber numberWithUnsignedShort:entry.supportedCommands],
@@ -149,7 +149,7 @@
auto & entry = iter.GetValue();
[array addObject:@ {
@"EndpointListID" : [NSNumber numberWithUnsignedShort:entry.endpointListID],
- @"Name" : [NSData dataWithBytes:entry.name.data() length:entry.name.size()],
+ @"Name" : [[NSString alloc] initWithBytes:entry.name.data() length:entry.name.size() encoding:NSUTF8StringEncoding],
@"Type" : [NSNumber numberWithUnsignedChar:entry.type],
@"Endpoints" : [NSData dataWithBytes:entry.endpoints.data() length:entry.endpoints.size()],
}];
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 646dcb4a9def6a..6b2f90fd3ac906 100644
--- a/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp
+++ b/zzz_generated/all-clusters-app/zap-generated/attribute-size.cpp
@@ -150,8 +150,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
// Struct _ActionStruct
_ActionStruct * entry = reinterpret_cast<_ActionStruct *>(write ? src : dest);
copyListMember(write ? dest : (uint8_t *) &entry->ActionID, write ? (uint8_t *) &entry->ActionID : src, write,
- &entryOffset, sizeof(entry->ActionID)); // INT16U
- ByteSpan * NameSpan = &entry->Name; // OCTET_STRING
+ &entryOffset, sizeof(entry->ActionID)); // 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)))
{
@@ -182,8 +183,9 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
// Struct _EndpointListStruct
_EndpointListStruct * entry = reinterpret_cast<_EndpointListStruct *>(write ? src : dest);
copyListMember(write ? dest : (uint8_t *) &entry->EndpointListID, write ? (uint8_t *) &entry->EndpointListID : src,
- write, &entryOffset, sizeof(entry->EndpointListID)); // INT16U
- ByteSpan * NameSpan = &entry->Name; // OCTET_STRING
+ write, &entryOffset, sizeof(entry->EndpointListID)); // 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)))
{
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 3c76082688e96b..5fc0c80a77d98f 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
@@ -84,7 +84,7 @@ typedef struct _ContentLaunchParamater
typedef struct _ActionStruct
{
uint16_t ActionID;
- chip::ByteSpan Name;
+ chip::CharSpan Name;
uint8_t Type;
uint16_t EndpointListID;
uint16_t SupportedCommands;
@@ -164,7 +164,7 @@ typedef struct _DeviceType
typedef struct _EndpointListStruct
{
uint16_t EndpointListID;
- chip::ByteSpan Name;
+ chip::CharSpan Name;
uint8_t Type;
chip::ByteSpan Endpoints;
} EndpointListStruct;
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 bd484d5a02b953..84ebadb9ba5a79 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
@@ -4752,7 +4752,7 @@ struct Type
{
public:
uint16_t actionID;
- chip::ByteSpan name;
+ chip::CharSpan name;
ActionTypeEnum type;
uint16_t endpointListID;
uint16_t supportedCommands;
@@ -4778,7 +4778,7 @@ struct Type
{
public:
uint16_t endpointListID;
- chip::ByteSpan name;
+ chip::CharSpan name;
EndpointListTypeEnum type;
chip::ByteSpan endpoints;
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
index 0055ff40c5dae8..1d33a1cc72f98d 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
@@ -256,7 +256,7 @@ static void OnBridgedActionsActionListListAttributeResponse(
++i;
ChipLogProgress(chipTool, "ActionStruct[%" PRIu16 "]:", i);
ChipLogProgress(chipTool, " actionID: %" PRIu16 "", entry.actionID);
- ChipLogProgress(Zcl, " Name: %zu", entry.name.size());
+ ChipLogProgress(Zcl, " Name: %.*s", static_cast(entry.name.size()), entry.name.data());
ChipLogProgress(chipTool, " type: %" PRIu8 "", entry.type);
ChipLogProgress(chipTool, " endpointListID: %" PRIu16 "", entry.endpointListID);
ChipLogProgress(chipTool, " supportedCommands: %" PRIu16 "", entry.supportedCommands);
@@ -298,7 +298,7 @@ static void OnBridgedActionsEndpointListListAttributeResponse(
++i;
ChipLogProgress(chipTool, "EndpointListStruct[%" PRIu16 "]:", i);
ChipLogProgress(chipTool, " endpointListID: %" PRIu16 "", entry.endpointListID);
- ChipLogProgress(Zcl, " Name: %zu", entry.name.size());
+ ChipLogProgress(Zcl, " Name: %.*s", static_cast(entry.name.size()), entry.name.data());
ChipLogProgress(chipTool, " type: %" PRIu8 "", entry.type);
ChipLogProgress(Zcl, " Endpoints: %zu", entry.endpoints.size());
}